niceeval 0.17.1 → 0.19.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 (692) hide show
  1. package/INDEX.md +5 -2
  2. package/dist/adapter-usage.cjs.map +1 -1
  3. package/dist/adapter-usage.d.cts +1 -1
  4. package/dist/adapter-usage.d.mts +1 -1
  5. package/dist/adapter-usage.d.ts +1 -1
  6. package/dist/adapter.cjs +8 -3
  7. package/dist/adapter.cjs.map +1 -1
  8. package/dist/adapter.d.cts +26 -15
  9. package/dist/adapter.d.mts +26 -15
  10. package/dist/adapter.d.ts +26 -15
  11. package/dist/agents/{effect-runtime.cjs → agent-effects.cjs} +12 -18
  12. package/dist/agents/agent-effects.cjs.map +1 -0
  13. package/dist/agents/agent-effects.d.cts +23 -0
  14. package/dist/agents/agent-effects.d.mts +23 -0
  15. package/dist/agents/agent-effects.d.ts +23 -0
  16. package/dist/agents/agent-effects.js +16 -0
  17. package/dist/agents/agent-effects.js.map +1 -0
  18. package/dist/agents/ai-sdk.cjs +1 -1
  19. package/dist/agents/ai-sdk.cjs.map +1 -1
  20. package/dist/agents/bub.cjs +31 -18
  21. package/dist/agents/bub.cjs.map +1 -1
  22. package/dist/agents/bub.d.cts +9 -12
  23. package/dist/agents/bub.d.mts +9 -12
  24. package/dist/agents/bub.d.ts +9 -12
  25. package/dist/agents/claude-code-native.cjs +2 -2
  26. package/dist/agents/claude-code-native.cjs.map +1 -1
  27. package/dist/agents/claude-code.cjs +17 -11
  28. package/dist/agents/claude-code.cjs.map +1 -1
  29. package/dist/agents/claude-code.d.cts +11 -11
  30. package/dist/agents/claude-code.d.mts +11 -11
  31. package/dist/agents/claude-code.d.ts +11 -11
  32. package/dist/agents/codex-app-server.cjs +2 -2
  33. package/dist/agents/codex-app-server.cjs.map +1 -1
  34. package/dist/agents/codex.cjs +18 -12
  35. package/dist/agents/codex.cjs.map +1 -1
  36. package/dist/agents/codex.d.cts +12 -12
  37. package/dist/agents/codex.d.mts +12 -12
  38. package/dist/agents/codex.d.ts +12 -12
  39. package/dist/agents/deepseek-harness.cjs +2 -2
  40. package/dist/agents/deepseek-harness.cjs.map +1 -1
  41. package/dist/agents/hermes.cjs +3 -3
  42. package/dist/agents/hermes.cjs.map +1 -1
  43. package/dist/agents/index.cjs +3 -3
  44. package/dist/agents/index.cjs.map +1 -1
  45. package/dist/agents/index.d.cts +3 -3
  46. package/dist/agents/index.d.mts +3 -3
  47. package/dist/agents/index.d.ts +3 -3
  48. package/dist/agents/index.js +2 -2
  49. package/dist/agents/index.mjs +2 -2
  50. package/dist/agents/mcp.cjs.map +1 -1
  51. package/dist/agents/mcp.d.cts +2 -2
  52. package/dist/agents/mcp.d.mts +2 -2
  53. package/dist/agents/mcp.d.ts +2 -2
  54. package/dist/agents/omp.cjs +2 -2
  55. package/dist/agents/omp.cjs.map +1 -1
  56. package/dist/agents/openai-compat.cjs +2 -2
  57. package/dist/agents/openai-compat.cjs.map +1 -1
  58. package/dist/agents/openclaw.cjs +3 -3
  59. package/dist/agents/openclaw.cjs.map +1 -1
  60. package/dist/agents/opencode.cjs +16 -4
  61. package/dist/agents/opencode.cjs.map +1 -1
  62. package/dist/agents/plugin-extensions.cjs +71 -0
  63. package/dist/agents/plugin-extensions.cjs.map +1 -0
  64. package/dist/agents/plugin-extensions.d.cts +26 -0
  65. package/dist/agents/plugin-extensions.d.mts +26 -0
  66. package/dist/agents/plugin-extensions.d.ts +26 -0
  67. package/dist/agents/plugin-extensions.js +8 -0
  68. package/dist/agents/plugin-extensions.js.map +1 -0
  69. package/dist/agents/post-setup.cjs +14 -3
  70. package/dist/agents/post-setup.cjs.map +1 -1
  71. package/dist/agents/post-setup.d.cts +4 -2
  72. package/dist/agents/post-setup.d.mts +4 -2
  73. package/dist/agents/post-setup.d.ts +4 -2
  74. package/dist/agents/post-setup.js +8 -6
  75. package/dist/agents/sdk-streams.cjs +3 -3
  76. package/dist/agents/sdk-streams.cjs.map +1 -1
  77. package/dist/agents/{session-slot.cjs → session-key.cjs} +4 -4
  78. package/dist/agents/session-key.cjs.map +1 -0
  79. package/dist/agents/session-key.d.cts +12 -0
  80. package/dist/agents/session-key.d.mts +12 -0
  81. package/dist/agents/session-key.d.ts +12 -0
  82. package/dist/agents/session-key.js +6 -0
  83. package/dist/agents/session-key.js.map +1 -0
  84. package/dist/agents/shared.cjs +2 -2
  85. package/dist/agents/shared.cjs.map +1 -1
  86. package/dist/agents/shared.d.cts +4 -4
  87. package/dist/agents/shared.d.mts +4 -4
  88. package/dist/agents/shared.d.ts +4 -4
  89. package/dist/agents/skills.cjs.map +1 -1
  90. package/dist/agents/skills.d.cts +3 -3
  91. package/dist/agents/skills.d.mts +3 -3
  92. package/dist/agents/skills.d.ts +3 -3
  93. package/dist/agents/types.cjs.map +1 -1
  94. package/dist/agents/types.d.cts +55 -54
  95. package/dist/agents/types.d.mts +55 -54
  96. package/dist/agents/types.d.ts +55 -54
  97. package/dist/agents/ui-message-stream.cjs +4 -4
  98. package/dist/agents/ui-message-stream.cjs.map +1 -1
  99. package/dist/agents/unrecognized-events.cjs +32 -0
  100. package/dist/agents/unrecognized-events.cjs.map +1 -0
  101. package/dist/agents/unrecognized-events.d.cts +8 -0
  102. package/dist/agents/unrecognized-events.d.mts +8 -0
  103. package/dist/agents/unrecognized-events.d.ts +8 -0
  104. package/dist/agents/unrecognized-events.js +6 -0
  105. package/dist/agents/unrecognized-events.js.map +1 -0
  106. package/dist/assertions/api.cjs.map +1 -1
  107. package/dist/assertions/api.d.cts +3 -0
  108. package/dist/assertions/api.d.mts +3 -0
  109. package/dist/assertions/api.d.ts +3 -0
  110. package/dist/assertions/collection.cjs +1 -1
  111. package/dist/assertions/collection.cjs.map +1 -1
  112. package/dist/assertions/judge.cjs +1 -1
  113. package/dist/assertions/judge.cjs.map +1 -1
  114. package/dist/assertions/match.cjs +52 -21
  115. package/dist/assertions/match.cjs.map +1 -1
  116. package/dist/assertions/match.d.cts +16 -5
  117. package/dist/assertions/match.d.mts +16 -5
  118. package/dist/assertions/match.d.ts +16 -5
  119. package/dist/assertions/match.js +96 -94
  120. package/dist/assertions/measurements.cjs +61 -0
  121. package/dist/assertions/measurements.cjs.map +1 -0
  122. package/dist/assertions/measurements.d.cts +24 -0
  123. package/dist/assertions/measurements.d.mts +24 -0
  124. package/dist/assertions/measurements.d.ts +24 -0
  125. package/dist/assertions/measurements.js +8 -0
  126. package/dist/assertions/measurements.js.map +1 -0
  127. package/dist/assertions/numeric.cjs +2 -0
  128. package/dist/assertions/numeric.cjs.map +1 -1
  129. package/dist/assertions/numeric.d.cts +1 -1
  130. package/dist/assertions/numeric.d.mts +1 -1
  131. package/dist/assertions/numeric.d.ts +1 -1
  132. package/dist/assertions/quantity.cjs +42 -0
  133. package/dist/assertions/quantity.cjs.map +1 -0
  134. package/dist/assertions/quantity.d.cts +18 -0
  135. package/dist/assertions/quantity.d.mts +18 -0
  136. package/dist/assertions/quantity.d.ts +18 -0
  137. package/dist/assertions/quantity.js +22 -0
  138. package/dist/assertions/quantity.js.map +1 -0
  139. package/dist/assertions/record/attachment.cjs +2 -0
  140. package/dist/assertions/record/attachment.cjs.map +1 -1
  141. package/dist/assertions/record/codec.cjs +5 -1
  142. package/dist/assertions/record/codec.cjs.map +1 -1
  143. package/dist/assertions/record/model.cjs.map +1 -1
  144. package/dist/assertions/record/model.d.cts +3 -1
  145. package/dist/assertions/record/model.d.mts +3 -1
  146. package/dist/assertions/record/model.d.ts +3 -1
  147. package/dist/assertions/runtime.cjs +11 -6
  148. package/dist/assertions/runtime.cjs.map +1 -1
  149. package/dist/cli/program.cjs +3 -0
  150. package/dist/cli/program.cjs.map +1 -1
  151. package/dist/context/assert-first.cjs +6 -4
  152. package/dist/context/assert-first.cjs.map +1 -1
  153. package/dist/context/assert-first.d.cts +9 -3
  154. package/dist/context/assert-first.d.mts +9 -3
  155. package/dist/context/assert-first.d.ts +9 -3
  156. package/dist/context/notes.cjs +47 -0
  157. package/dist/context/notes.cjs.map +1 -0
  158. package/dist/context/notes.d.cts +10 -0
  159. package/dist/context/notes.d.mts +10 -0
  160. package/dist/context/notes.d.ts +10 -0
  161. package/dist/context/notes.js +6 -0
  162. package/dist/context/notes.js.map +1 -0
  163. package/dist/context/send-failures.cjs +1 -7
  164. package/dist/context/send-failures.cjs.map +1 -1
  165. package/dist/context/send-failures.d.cts +2 -3
  166. package/dist/context/send-failures.d.mts +2 -3
  167. package/dist/context/send-failures.d.ts +2 -3
  168. package/dist/context/send-retry.cjs +0 -1
  169. package/dist/context/send-retry.cjs.map +1 -1
  170. package/dist/context/send-retry.d.cts +1 -2
  171. package/dist/context/send-retry.d.mts +1 -2
  172. package/dist/context/send-retry.d.ts +1 -2
  173. package/dist/context/session.cjs +10 -17
  174. package/dist/context/session.cjs.map +1 -1
  175. package/dist/context/session.d.cts +4 -10
  176. package/dist/context/session.d.mts +4 -10
  177. package/dist/context/session.d.ts +4 -10
  178. package/dist/define.cjs +89 -64
  179. package/dist/define.cjs.map +1 -1
  180. package/dist/define.d.cts +3 -3
  181. package/dist/define.d.mts +3 -3
  182. package/dist/define.d.ts +3 -3
  183. package/dist/eval/cli/contribution.cjs +1 -1
  184. package/dist/eval/cli/contribution.cjs.map +1 -1
  185. package/dist/eval/host/index.cjs +1 -1
  186. package/dist/eval/host/index.cjs.map +1 -1
  187. package/dist/eval/record/evaluation.cjs +1 -1
  188. package/dist/eval/record/evaluation.cjs.map +1 -1
  189. package/dist/eval/record/membership-provenance.d.cts +3 -3
  190. package/dist/eval/record/membership-provenance.d.mts +3 -3
  191. package/dist/eval/record/membership-provenance.d.ts +3 -3
  192. package/dist/eval/record/score.cjs +2 -2
  193. package/dist/eval/record/score.cjs.map +1 -1
  194. package/dist/eval/record/sealed-assertion.cjs +1 -1
  195. package/dist/eval/record/sealed-assertion.cjs.map +1 -1
  196. package/dist/eval/record/verdict.cjs +2 -2
  197. package/dist/eval/record/verdict.cjs.map +1 -1
  198. package/dist/expect/index.cjs +13 -1
  199. package/dist/expect/index.cjs.map +1 -1
  200. package/dist/expect/index.d.cts +5 -1
  201. package/dist/expect/index.d.mts +5 -1
  202. package/dist/expect/index.d.ts +5 -1
  203. package/dist/expect/index.js +92 -72
  204. package/dist/expect/index.mjs +92 -72
  205. package/dist/experiment/host/cli/contribution.cjs +52 -39
  206. package/dist/experiment/host/cli/contribution.cjs.map +1 -1
  207. package/dist/experiment/host/cli/contribution.d.cts +18 -4
  208. package/dist/experiment/host/cli/contribution.d.mts +18 -4
  209. package/dist/experiment/host/cli/contribution.d.ts +18 -4
  210. package/dist/experiment/host/cli/contribution.js +2 -2
  211. package/dist/experiment/host/cli/debug-protocol.cjs +2 -2
  212. package/dist/experiment/host/cli/debug-protocol.cjs.map +1 -1
  213. package/dist/experiment/host/cli/debug-protocol.d.cts +2 -2
  214. package/dist/experiment/host/cli/debug-protocol.d.mts +2 -2
  215. package/dist/experiment/host/cli/debug-protocol.d.ts +2 -2
  216. package/dist/experiment/host/cli/output-protocol.cjs +1 -1
  217. package/dist/experiment/host/cli/output-protocol.cjs.map +1 -1
  218. package/dist/experiment/host/cli/output-protocol.d.cts +2 -2
  219. package/dist/experiment/host/cli/output-protocol.d.mts +2 -2
  220. package/dist/experiment/host/cli/output-protocol.d.ts +2 -2
  221. package/dist/experiment/host/current.cjs +2 -2
  222. package/dist/experiment/host/current.cjs.map +1 -1
  223. package/dist/experiment/host/index.cjs +1 -1
  224. package/dist/experiment/host/index.cjs.map +1 -1
  225. package/dist/experiment/host/operations.cjs +24 -23
  226. package/dist/experiment/host/operations.cjs.map +1 -1
  227. package/dist/experiment/host/runtime.cjs +11 -10
  228. package/dist/experiment/host/runtime.cjs.map +1 -1
  229. package/dist/experiment/host/runtime.d.cts +3 -3
  230. package/dist/experiment/host/runtime.d.mts +3 -3
  231. package/dist/experiment/host/runtime.d.ts +3 -3
  232. package/dist/experiment/host/teardown.cjs +4 -3
  233. package/dist/experiment/host/teardown.cjs.map +1 -1
  234. package/dist/experiment/host/teardown.d.cts +3 -3
  235. package/dist/experiment/host/teardown.d.mts +3 -3
  236. package/dist/experiment/host/teardown.d.ts +3 -3
  237. package/dist/experiment/host/types.cjs.map +1 -1
  238. package/dist/experiment/host/types.d.cts +19 -19
  239. package/dist/experiment/host/types.d.mts +19 -19
  240. package/dist/experiment/host/types.d.ts +19 -19
  241. package/dist/index.cjs +3 -19
  242. package/dist/index.cjs.map +1 -1
  243. package/dist/index.d.cts +4 -8
  244. package/dist/index.d.mts +4 -8
  245. package/dist/index.d.ts +4 -8
  246. package/dist/index.js +12 -34
  247. package/dist/index.mjs +12 -34
  248. package/dist/inspection/assertions.cjs +1 -1
  249. package/dist/inspection/assertions.cjs.map +1 -1
  250. package/dist/inspection/cli/contribution.cjs +8 -7
  251. package/dist/inspection/cli/contribution.cjs.map +1 -1
  252. package/dist/inspection/facts.cjs +4 -4
  253. package/dist/inspection/facts.cjs.map +1 -1
  254. package/dist/inspection/index.cjs +1 -5
  255. package/dist/inspection/index.cjs.map +1 -1
  256. package/dist/inspection/index.d.cts +1 -2
  257. package/dist/inspection/index.d.mts +1 -2
  258. package/dist/inspection/index.d.ts +1 -2
  259. package/dist/inspection/index.js +20 -26
  260. package/dist/inspection/lifecycle.cjs +7 -0
  261. package/dist/inspection/lifecycle.cjs.map +1 -0
  262. package/dist/inspection/lifecycle.d.cts +4 -0
  263. package/dist/inspection/lifecycle.d.mts +4 -0
  264. package/dist/inspection/lifecycle.d.ts +4 -0
  265. package/dist/inspection/lifecycle.js +6 -0
  266. package/dist/inspection/lifecycle.js.map +1 -0
  267. package/dist/inspection/notes.cjs +40 -0
  268. package/dist/inspection/notes.cjs.map +1 -0
  269. package/dist/inspection/notes.d.cts +12 -0
  270. package/dist/inspection/notes.d.mts +12 -0
  271. package/dist/inspection/notes.d.ts +12 -0
  272. package/dist/inspection/notes.js +8 -0
  273. package/dist/inspection/notes.js.map +1 -0
  274. package/dist/inspection/overview.cjs +12 -15
  275. package/dist/inspection/overview.cjs.map +1 -1
  276. package/dist/inspection/overview.d.cts +8 -6
  277. package/dist/inspection/overview.d.mts +8 -6
  278. package/dist/inspection/overview.d.ts +8 -6
  279. package/dist/inspection/planned-attempt.cjs +45 -0
  280. package/dist/inspection/planned-attempt.cjs.map +1 -0
  281. package/dist/inspection/planned-attempt.d.cts +109 -0
  282. package/dist/inspection/planned-attempt.d.mts +109 -0
  283. package/dist/inspection/planned-attempt.d.ts +109 -0
  284. package/dist/inspection/planned-attempt.js +24 -0
  285. package/dist/inspection/planned-attempt.js.map +1 -0
  286. package/dist/inspection/project-result.cjs +5 -5
  287. package/dist/inspection/project-result.cjs.map +1 -1
  288. package/dist/inspection/project-result.d.cts +58 -57
  289. package/dist/inspection/project-result.d.mts +58 -57
  290. package/dist/inspection/project-result.d.ts +58 -57
  291. package/dist/inspection/project-result.js +4 -4
  292. package/dist/inspection/project.cjs +3 -3
  293. package/dist/inspection/project.cjs.map +1 -1
  294. package/dist/inspection/protocol-values.cjs +1 -1
  295. package/dist/inspection/protocol-values.cjs.map +1 -1
  296. package/dist/inspection/protocol-values.d.cts +1 -1
  297. package/dist/inspection/protocol-values.d.mts +1 -1
  298. package/dist/inspection/protocol-values.d.ts +1 -1
  299. package/dist/inspection/protocol.cjs +8 -8
  300. package/dist/inspection/protocol.cjs.map +1 -1
  301. package/dist/inspection/protocol.d.cts +237 -219
  302. package/dist/inspection/protocol.d.mts +237 -219
  303. package/dist/inspection/protocol.d.ts +237 -219
  304. package/dist/inspection/public.cjs +1 -5
  305. package/dist/inspection/public.cjs.map +1 -1
  306. package/dist/inspection/public.d.cts +1 -2
  307. package/dist/inspection/public.d.mts +1 -2
  308. package/dist/inspection/public.d.ts +1 -2
  309. package/dist/inspection/public.js +14 -20
  310. package/dist/inspection/public.mjs +166 -129
  311. package/dist/inspection/query.cjs +1 -1
  312. package/dist/inspection/query.cjs.map +1 -1
  313. package/dist/inspection/results.cjs +61 -52
  314. package/dist/inspection/results.cjs.map +1 -1
  315. package/dist/inspection/results.d.cts +157 -140
  316. package/dist/inspection/results.d.mts +157 -140
  317. package/dist/inspection/results.d.ts +157 -140
  318. package/dist/inspection/select.cjs +33 -28
  319. package/dist/inspection/select.cjs.map +1 -1
  320. package/dist/inspection/source.cjs +1 -1
  321. package/dist/inspection/source.cjs.map +1 -1
  322. package/dist/inspection/sources.cjs +2 -2
  323. package/dist/inspection/sources.cjs.map +1 -1
  324. package/dist/inspection/trace.cjs +9 -8
  325. package/dist/inspection/trace.cjs.map +1 -1
  326. package/dist/inspection/trace.d.cts +4 -4
  327. package/dist/inspection/trace.d.mts +4 -4
  328. package/dist/inspection/trace.d.ts +4 -4
  329. package/dist/loaders/index.cjs +7 -279
  330. package/dist/loaders/index.cjs.map +1 -1
  331. package/dist/loaders/index.d.cts +2 -95
  332. package/dist/loaders/index.d.mts +2 -95
  333. package/dist/loaders/index.d.ts +2 -95
  334. package/dist/loaders/index.js +10 -12
  335. package/dist/loaders/index.mjs +10 -12
  336. package/dist/loaders/runtime.cjs +283 -0
  337. package/dist/loaders/runtime.cjs.map +1 -0
  338. package/dist/loaders/runtime.d.cts +95 -0
  339. package/dist/loaders/runtime.d.mts +95 -0
  340. package/dist/loaders/runtime.d.ts +95 -0
  341. package/dist/loaders/runtime.js +16 -0
  342. package/dist/loaders/runtime.js.map +1 -0
  343. package/dist/migrations/judge-provider.md +6 -6
  344. package/dist/{model-slots.cjs → model-roles.cjs} +26 -7
  345. package/dist/model-roles.cjs.map +1 -0
  346. package/dist/model-roles.d.cts +26 -0
  347. package/dist/model-roles.d.mts +26 -0
  348. package/dist/model-roles.d.ts +26 -0
  349. package/dist/model-roles.js +14 -0
  350. package/dist/model-roles.js.map +1 -0
  351. package/dist/o11y/adapter-usage-projection.cjs +9 -8
  352. package/dist/o11y/adapter-usage-projection.cjs.map +1 -1
  353. package/dist/o11y/adapter-usage-projection.d.cts +23 -15
  354. package/dist/o11y/adapter-usage-projection.d.mts +23 -15
  355. package/dist/o11y/adapter-usage-projection.d.ts +23 -15
  356. package/dist/o11y/cache-read.cjs +14 -14
  357. package/dist/o11y/cache-read.cjs.map +1 -1
  358. package/dist/o11y/cache-read.d.cts +5 -5
  359. package/dist/o11y/cache-read.d.mts +5 -5
  360. package/dist/o11y/cache-read.d.ts +5 -5
  361. package/dist/o11y/derive.cjs.map +1 -1
  362. package/dist/o11y/derive.d.cts +2 -2
  363. package/dist/o11y/derive.d.mts +2 -2
  364. package/dist/o11y/derive.d.ts +2 -2
  365. package/dist/o11y/eval-usage.cjs +9 -9
  366. package/dist/o11y/eval-usage.cjs.map +1 -1
  367. package/dist/o11y/eval-usage.d.cts +7 -7
  368. package/dist/o11y/eval-usage.d.mts +7 -7
  369. package/dist/o11y/eval-usage.d.ts +7 -7
  370. package/dist/o11y/parsers/bub.cjs +57 -81
  371. package/dist/o11y/parsers/bub.cjs.map +1 -1
  372. package/dist/o11y/parsers/index.cjs.map +1 -1
  373. package/dist/o11y/parsers/index.d.cts +2 -0
  374. package/dist/o11y/parsers/index.d.mts +2 -0
  375. package/dist/o11y/parsers/index.d.ts +2 -0
  376. package/dist/o11y/parsers/opencode.cjs +129 -217
  377. package/dist/o11y/parsers/opencode.cjs.map +1 -1
  378. package/dist/o11y/parsers/opencode.d.cts +2 -5
  379. package/dist/o11y/parsers/opencode.d.mts +2 -5
  380. package/dist/o11y/parsers/opencode.d.ts +2 -5
  381. package/dist/o11y/types.cjs.map +1 -1
  382. package/dist/o11y/types.d.cts +1 -1
  383. package/dist/o11y/types.d.mts +1 -1
  384. package/dist/o11y/types.d.ts +1 -1
  385. package/dist/plugin/contracts.cjs +170 -120
  386. package/dist/plugin/contracts.cjs.map +1 -1
  387. package/dist/plugin/contracts.d.cts +102 -90
  388. package/dist/plugin/contracts.d.mts +102 -90
  389. package/dist/plugin/contracts.d.ts +102 -90
  390. package/dist/plugin/contracts.js +16 -12
  391. package/dist/plugin/index.cjs.map +1 -1
  392. package/dist/plugin/index.d.cts +1 -1
  393. package/dist/plugin/index.d.mts +1 -1
  394. package/dist/plugin/index.d.ts +1 -1
  395. package/dist/plugin/link.cjs +69 -64
  396. package/dist/plugin/link.cjs.map +1 -1
  397. package/dist/plugin/link.d.cts +5 -3
  398. package/dist/plugin/link.d.mts +5 -3
  399. package/dist/plugin/link.d.ts +5 -3
  400. package/dist/plugin/link.js +12 -8
  401. package/dist/record/codec/seal-manifest.d.cts +3 -3
  402. package/dist/record/codec/seal-manifest.d.mts +3 -3
  403. package/dist/record/codec/seal-manifest.d.ts +3 -3
  404. package/dist/record/family/attempt-note/definition.cjs +12 -0
  405. package/dist/record/family/attempt-note/definition.cjs.map +1 -0
  406. package/dist/record/family/attempt-note/definition.d.cts +6 -0
  407. package/dist/record/family/attempt-note/definition.d.mts +6 -0
  408. package/dist/record/family/attempt-note/definition.d.ts +6 -0
  409. package/dist/record/family/attempt-note/definition.js +6 -0
  410. package/dist/record/family/attempt-note/definition.js.map +1 -0
  411. package/dist/record/family/attempt-note/persistence.cjs +10 -0
  412. package/dist/record/family/attempt-note/persistence.cjs.map +1 -0
  413. package/dist/record/family/attempt-note/persistence.d.cts +6 -0
  414. package/dist/record/family/attempt-note/persistence.d.mts +6 -0
  415. package/dist/record/family/attempt-note/persistence.d.ts +6 -0
  416. package/dist/record/family/attempt-note/persistence.js +6 -0
  417. package/dist/record/family/attempt-note/persistence.js.map +1 -0
  418. package/dist/record/family/attempt-note/schema.cjs +20 -0
  419. package/dist/record/family/attempt-note/schema.cjs.map +1 -0
  420. package/dist/record/family/attempt-note/schema.d.cts +21 -0
  421. package/dist/record/family/attempt-note/schema.d.mts +21 -0
  422. package/dist/record/family/attempt-note/schema.d.ts +21 -0
  423. package/dist/record/family/attempt-note/schema.js +10 -0
  424. package/dist/record/family/attempt-note/schema.js.map +1 -0
  425. package/dist/record/family/catalog.cjs +32 -29
  426. package/dist/record/family/catalog.cjs.map +1 -1
  427. package/dist/record/family/catalog.d.cts +7 -2
  428. package/dist/record/family/catalog.d.mts +7 -2
  429. package/dist/record/family/catalog.d.ts +7 -2
  430. package/dist/record/family/current.cjs +48 -45
  431. package/dist/record/family/current.cjs.map +1 -1
  432. package/dist/record/family/current.d.cts +15 -0
  433. package/dist/record/family/current.d.mts +15 -0
  434. package/dist/record/family/current.d.ts +15 -0
  435. package/dist/record/model/index.js +66 -64
  436. package/dist/record/model/run-context.cjs +9 -3
  437. package/dist/record/model/run-context.cjs.map +1 -1
  438. package/dist/record/model/run-context.d.cts +9 -2
  439. package/dist/record/model/run-context.d.mts +9 -2
  440. package/dist/record/model/run-context.d.ts +9 -2
  441. package/dist/record/model/run-context.js +8 -6
  442. package/dist/record/model/seal-manifest.d.cts +1 -1
  443. package/dist/record/model/seal-manifest.d.mts +1 -1
  444. package/dist/record/model/seal-manifest.d.ts +1 -1
  445. package/dist/run/cli/contribution.cjs +6 -32
  446. package/dist/run/cli/contribution.cjs.map +1 -1
  447. package/dist/run/host/runtime.cjs +1 -1
  448. package/dist/run/host/runtime.cjs.map +1 -1
  449. package/dist/run/storage/sqlite.cjs +7 -7
  450. package/dist/run/storage/sqlite.cjs.map +1 -1
  451. package/dist/runner/adapter-usage.cjs +5 -3
  452. package/dist/runner/adapter-usage.cjs.map +1 -1
  453. package/dist/runner/adapter-usage.d.cts +2 -2
  454. package/dist/runner/adapter-usage.d.mts +2 -2
  455. package/dist/runner/adapter-usage.d.ts +2 -2
  456. package/dist/runner/adoption.cjs +10 -12
  457. package/dist/runner/adoption.cjs.map +1 -1
  458. package/dist/runner/attempt-notes.cjs +8 -0
  459. package/dist/runner/attempt-notes.cjs.map +1 -0
  460. package/dist/runner/attempt-notes.d.cts +4 -0
  461. package/dist/runner/attempt-notes.d.mts +4 -0
  462. package/dist/runner/attempt-notes.d.ts +4 -0
  463. package/dist/runner/attempt-notes.js +8 -0
  464. package/dist/runner/attempt-notes.js.map +1 -0
  465. package/dist/runner/attempt.cjs +61 -73
  466. package/dist/runner/attempt.cjs.map +1 -1
  467. package/dist/runner/attempt.d.cts +3 -3
  468. package/dist/runner/attempt.d.mts +3 -3
  469. package/dist/runner/attempt.d.ts +3 -3
  470. package/dist/runner/command-plan.cjs +21 -26
  471. package/dist/runner/command-plan.cjs.map +1 -1
  472. package/dist/runner/command-plan.d.cts +4 -4
  473. package/dist/runner/command-plan.d.mts +4 -4
  474. package/dist/runner/command-plan.d.ts +4 -4
  475. package/dist/runner/command-plan.js +4 -4
  476. package/dist/runner/config-identity.cjs.map +1 -1
  477. package/dist/runner/config-identity.d.cts +2 -2
  478. package/dist/runner/config-identity.d.mts +2 -2
  479. package/dist/runner/config-identity.d.ts +2 -2
  480. package/dist/runner/discover.cjs +6 -6
  481. package/dist/runner/discover.cjs.map +1 -1
  482. package/dist/runner/eval-selection.cjs +15 -1
  483. package/dist/runner/eval-selection.cjs.map +1 -1
  484. package/dist/runner/eval-selection.d.cts +4 -0
  485. package/dist/runner/eval-selection.d.mts +4 -0
  486. package/dist/runner/eval-selection.d.ts +4 -0
  487. package/dist/runner/feedback/human.cjs +1 -1
  488. package/dist/runner/feedback/human.cjs.map +1 -1
  489. package/dist/runner/feedback/json.cjs +4 -2
  490. package/dist/runner/feedback/json.cjs.map +1 -1
  491. package/dist/runner/feedback/json.d.cts +1 -1
  492. package/dist/runner/feedback/json.d.mts +1 -1
  493. package/dist/runner/feedback/json.d.ts +1 -1
  494. package/dist/runner/feedback/sink.cjs +1 -1
  495. package/dist/runner/feedback/sink.cjs.map +1 -1
  496. package/dist/runner/feedback/sink.d.cts +1 -1
  497. package/dist/runner/feedback/sink.d.mts +1 -1
  498. package/dist/runner/feedback/sink.d.ts +1 -1
  499. package/dist/runner/fingerprint.cjs +1 -1
  500. package/dist/runner/fingerprint.cjs.map +1 -1
  501. package/dist/runner/lock.cjs +1 -3
  502. package/dist/runner/lock.cjs.map +1 -1
  503. package/dist/runner/lock.d.cts +0 -2
  504. package/dist/runner/lock.d.mts +0 -2
  505. package/dist/runner/lock.d.ts +0 -2
  506. package/dist/runner/lock.js +14 -16
  507. package/dist/runner/project-target.cjs.map +1 -1
  508. package/dist/runner/project-target.d.cts +2 -2
  509. package/dist/runner/project-target.d.mts +2 -2
  510. package/dist/runner/project-target.d.ts +2 -2
  511. package/dist/runner/record/attachments.cjs +2 -2
  512. package/dist/runner/record/attachments.cjs.map +1 -1
  513. package/dist/runner/record/planning.cjs +8 -2
  514. package/dist/runner/record/planning.cjs.map +1 -1
  515. package/dist/runner/record.cjs +2 -0
  516. package/dist/runner/record.cjs.map +1 -1
  517. package/dist/runner/report.cjs +3 -3
  518. package/dist/runner/report.cjs.map +1 -1
  519. package/dist/runner/report.d.cts +1 -1
  520. package/dist/runner/report.d.mts +1 -1
  521. package/dist/runner/report.d.ts +1 -1
  522. package/dist/runner/reuse-plan.cjs +2 -2
  523. package/dist/runner/reuse-plan.cjs.map +1 -1
  524. package/dist/runner/run.cjs +10 -45
  525. package/dist/runner/run.cjs.map +1 -1
  526. package/dist/runner/sandbox-pool.cjs +1 -2
  527. package/dist/runner/sandbox-pool.cjs.map +1 -1
  528. package/dist/runner/setup-prefix-preparation.cjs +1 -1
  529. package/dist/runner/setup-prefix-preparation.cjs.map +1 -1
  530. package/dist/runner/teardown-registry.cjs +2 -2
  531. package/dist/runner/teardown-registry.cjs.map +1 -1
  532. package/dist/runner/teardown-registry.d.cts +1 -1
  533. package/dist/runner/teardown-registry.d.mts +1 -1
  534. package/dist/runner/teardown-registry.d.ts +1 -1
  535. package/dist/runner/types.cjs +4 -4
  536. package/dist/runner/types.cjs.map +1 -1
  537. package/dist/runner/types.d.cts +64 -92
  538. package/dist/runner/types.d.mts +64 -92
  539. package/dist/runner/types.d.ts +64 -92
  540. package/dist/runner/types.js +2 -2
  541. package/dist/sandbox/action.cjs +1 -1
  542. package/dist/sandbox/action.cjs.map +1 -1
  543. package/dist/sandbox/cli/contribution.cjs +17 -14
  544. package/dist/sandbox/cli/contribution.cjs.map +1 -1
  545. package/dist/sandbox/cli/contribution.d.cts +1 -1
  546. package/dist/sandbox/cli/contribution.d.mts +1 -1
  547. package/dist/sandbox/cli/contribution.d.ts +1 -1
  548. package/dist/sandbox/commands.cjs +1 -1
  549. package/dist/sandbox/commands.cjs.map +1 -1
  550. package/dist/sandbox/commands.d.cts +1 -1
  551. package/dist/sandbox/commands.d.mts +1 -1
  552. package/dist/sandbox/commands.d.ts +1 -1
  553. package/dist/sandbox/compose.cjs +2 -2
  554. package/dist/sandbox/compose.cjs.map +1 -1
  555. package/dist/sandbox/docker-profile/registry.cjs +5 -10
  556. package/dist/sandbox/docker-profile/registry.cjs.map +1 -1
  557. package/dist/sandbox/docker-profile/registry.d.cts +0 -4
  558. package/dist/sandbox/docker-profile/registry.d.mts +0 -4
  559. package/dist/sandbox/docker-profile/registry.d.ts +0 -4
  560. package/dist/sandbox/docker-profile/registry.js +6 -14
  561. package/dist/sandbox/docker-profile/runtime.cjs +1 -1
  562. package/dist/sandbox/docker-profile/runtime.cjs.map +1 -1
  563. package/dist/sandbox/docker-profile/schema.cjs +12 -16
  564. package/dist/sandbox/docker-profile/schema.cjs.map +1 -1
  565. package/dist/sandbox/docker-profile/schema.d.cts +2 -6
  566. package/dist/sandbox/docker-profile/schema.d.mts +2 -6
  567. package/dist/sandbox/docker-profile/schema.d.ts +2 -6
  568. package/dist/sandbox/docker-profile/schema.js +24 -32
  569. package/dist/sandbox/incus.cjs +2 -2
  570. package/dist/sandbox/incus.cjs.map +1 -1
  571. package/dist/sandbox/index.cjs +4 -36
  572. package/dist/sandbox/index.cjs.map +1 -1
  573. package/dist/sandbox/index.d.cts +4 -8
  574. package/dist/sandbox/index.d.mts +4 -8
  575. package/dist/sandbox/index.d.ts +4 -8
  576. package/dist/sandbox/index.js +116 -174
  577. package/dist/sandbox/index.mjs +116 -174
  578. package/dist/sandbox/layer.cjs +3 -3
  579. package/dist/sandbox/layer.cjs.map +1 -1
  580. package/dist/sandbox/link.cjs +5 -0
  581. package/dist/sandbox/link.cjs.map +1 -1
  582. package/dist/sandbox/link.d.cts +3 -0
  583. package/dist/sandbox/link.d.mts +3 -0
  584. package/dist/sandbox/link.d.ts +3 -0
  585. package/dist/sandbox/runtime.cjs +9 -4
  586. package/dist/sandbox/runtime.cjs.map +1 -1
  587. package/dist/shared/failure-class.cjs +5 -5
  588. package/dist/shared/failure-class.cjs.map +1 -1
  589. package/dist/shared/failure-class.d.cts +4 -10
  590. package/dist/shared/failure-class.d.mts +4 -10
  591. package/dist/shared/failure-class.d.ts +4 -10
  592. package/dist/shared/types.cjs.map +1 -1
  593. package/dist/shared/types.d.cts +1 -1
  594. package/dist/shared/types.d.mts +1 -1
  595. package/dist/shared/types.d.ts +1 -1
  596. package/dist/show/contribution.cjs +17 -2
  597. package/dist/show/contribution.cjs.map +1 -1
  598. package/dist/show/contribution.d.cts +14 -0
  599. package/dist/show/contribution.d.mts +14 -0
  600. package/dist/show/contribution.d.ts +14 -0
  601. package/dist/show/model.cjs +8 -5
  602. package/dist/show/model.cjs.map +1 -1
  603. package/dist/show/model.d.cts +11 -8
  604. package/dist/show/model.d.mts +11 -8
  605. package/dist/show/model.d.ts +11 -8
  606. package/dist/show/render.cjs +34 -22
  607. package/dist/show/render.cjs.map +1 -1
  608. package/dist/sources/projector.cjs +1 -1
  609. package/dist/sources/projector.cjs.map +1 -1
  610. package/dist/types.cjs +1 -1
  611. package/dist/types.cjs.map +1 -1
  612. package/dist/types.d.cts +1 -1
  613. package/dist/types.d.mts +1 -1
  614. package/dist/types.d.ts +1 -1
  615. package/dist/types.js +2 -2
  616. package/dist/view/app-dist/.vite/manifest.json +2 -2
  617. package/dist/view/app-dist/assets/{index-B3ijZRph.js → index-CxrOUvHC.js} +17 -17
  618. package/dist/view/app-dist/assets/{quality-cost-scatter-B--DfJ9s.js → quality-cost-scatter-B6Aiss7x.js} +1 -1
  619. package/dist/view/app-dist/index.html +1 -1
  620. package/dist/view/cli/contribution.cjs +1 -1
  621. package/dist/view/cli/contribution.cjs.map +1 -1
  622. package/dist/view/function-runtime.mjs +318 -121
  623. package/dist/view/http-protocol.d.cts +1 -1
  624. package/dist/view/http-protocol.d.mts +1 -1
  625. package/dist/view/http-protocol.d.ts +1 -1
  626. package/dist/view/inspection-host.cjs +2 -2
  627. package/dist/view/inspection-host.cjs.map +1 -1
  628. package/dist/view/inspection-host.d.cts +349 -331
  629. package/dist/view/inspection-host.d.mts +349 -331
  630. package/dist/view/inspection-host.d.ts +349 -331
  631. package/docs-site/zh/examples/integrations/ai-sdk-v7.mdx +9 -9
  632. package/docs-site/zh/examples/integrations/claude-sdk.mdx +8 -8
  633. package/docs-site/zh/examples/integrations/codex-sdk.mdx +4 -4
  634. package/docs-site/zh/examples/integrations/langgraph.mdx +6 -6
  635. package/docs-site/zh/examples/integrations/pi-sdk.mdx +8 -8
  636. package/docs-site/zh/explanation/adapter.mdx +6 -6
  637. package/docs-site/zh/explanation/assert.mdx +7 -7
  638. package/docs-site/zh/explanation/drive.mdx +4 -4
  639. package/docs-site/zh/explanation/hitl.mdx +2 -2
  640. package/docs-site/zh/explanation/judge.mdx +3 -3
  641. package/docs-site/zh/index.mdx +18 -0
  642. package/docs-site/zh/introduction.mdx +4 -3
  643. package/docs-site/zh/reference/builtin-agents.mdx +46 -49
  644. package/docs-site/zh/reference/cli.mdx +16 -14
  645. package/docs-site/zh/reference/define-agent.mdx +19 -19
  646. package/docs-site/zh/reference/define-config.mdx +7 -15
  647. package/docs-site/zh/reference/define-eval.mdx +20 -14
  648. package/docs-site/zh/reference/define-experiment.mdx +18 -39
  649. package/docs-site/zh/reference/events.mdx +1 -1
  650. package/docs-site/zh/reference/expect.mdx +21 -0
  651. package/docs-site/zh/reference/official-adapters.mdx +12 -5
  652. package/docs-site/zh/troubleshooting/debugging.mdx +2 -2
  653. package/docs-site/zh/troubleshooting/recover-after-kill.mdx +1 -1
  654. package/docs-site/zh/tutorials/agent-onboarding.mdx +2 -2
  655. package/docs-site/zh/tutorials/authoring.mdx +4 -3
  656. package/docs-site/zh/tutorials/compare-runs.mdx +1 -1
  657. package/docs-site/zh/tutorials/concurrency.mdx +8 -8
  658. package/docs-site/zh/tutorials/configuration.mdx +5 -5
  659. package/docs-site/zh/tutorials/control-run-cost.mdx +49 -9
  660. package/docs-site/zh/tutorials/eval-groups.mdx +1 -1
  661. package/docs-site/zh/tutorials/evaluation-kinds.mdx +5 -5
  662. package/docs-site/zh/tutorials/experiment-services.mdx +32 -32
  663. package/docs-site/zh/tutorials/handle-execution-failures.mdx +2 -28
  664. package/docs-site/zh/tutorials/plugins.mdx +49 -143
  665. package/docs-site/zh/tutorials/sandbox-agent.mdx +1 -1
  666. package/docs-site/zh/tutorials/sandbox-reuse.mdx +7 -7
  667. package/docs-site/zh/tutorials/upgrade-0-18.mdx +64 -0
  668. package/docs-site/zh/tutorials/upgrade-0-19.mdx +121 -0
  669. package/docs-site/zh/tutorials/upgrade-0-20.mdx +12 -0
  670. package/docs-site/zh/tutorials/verify-judge.mdx +4 -3
  671. package/docs-site/zh/tutorials/viewing-results.mdx +2 -2
  672. package/docs-site/zh/tutorials/write-experiment.mdx +1 -1
  673. package/docs-site/zh/tutorials/write-send.mdx +13 -13
  674. package/package.json +1 -1
  675. package/dist/agents/effect-runtime.cjs.map +0 -1
  676. package/dist/agents/effect-runtime.d.cts +0 -29
  677. package/dist/agents/effect-runtime.d.mts +0 -29
  678. package/dist/agents/effect-runtime.d.ts +0 -29
  679. package/dist/agents/effect-runtime.js +0 -16
  680. package/dist/agents/effect-runtime.js.map +0 -1
  681. package/dist/agents/session-slot.cjs.map +0 -1
  682. package/dist/agents/session-slot.d.cts +0 -12
  683. package/dist/agents/session-slot.d.mts +0 -12
  684. package/dist/agents/session-slot.d.ts +0 -12
  685. package/dist/agents/session-slot.js +0 -6
  686. package/dist/agents/session-slot.js.map +0 -1
  687. package/dist/model-slots.cjs.map +0 -1
  688. package/dist/model-slots.d.cts +0 -19
  689. package/dist/model-slots.d.mts +0 -19
  690. package/dist/model-slots.d.ts +0 -19
  691. package/dist/model-slots.js +0 -8
  692. package/dist/model-slots.js.map +0 -1
@@ -9,18 +9,18 @@ Error generating stack: `+e.message+`
9
9
  `).replace(hp,``)}function _p(e,t){return t=gp(t),gp(e)===t}function vp(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||bn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&bn(e,``+r);else return;break;case`className`:an(e,`class`,r);break;case`tabIndex`:an(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:an(e,n,r);break;case`style`:Cn(e,r,o);return;case`data`:if(t!==`object`){an(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Dn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&vp(e,t,`name`,a.name,a,null),vp(e,t,`formEncType`,a.formEncType,a,null),vp(e,t,`formMethod`,a.formMethod,a,null),vp(e,t,`formTarget`,a.formTarget,a,null)):(vp(e,t,`encType`,a.encType,a,null),vp(e,t,`method`,a.method,a,null),vp(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Dn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=On);return;case`onScroll`:r!=null&&ip(`scroll`,e);return;case`onScrollEnd`:r!=null&&ip(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Dn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:ip(`beforetoggle`,e),ip(`toggle`,e),rn(e,`popover`,r);break;case`xlinkActuate`:on(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:on(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:on(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:on(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:on(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:on(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:on(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:on(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:on(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:rn(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=Tn.get(n)||n,rn(e,n,r);else return}tn=!0}function yp(e,t,n,r,a,o){switch(n){case`style`:Cn(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)bn(e,r);else if(typeof r==`number`||typeof r==`bigint`)bn(e,``+r);else return;break;case`onScroll`:r!=null&&ip(`scroll`,e);return;case`onScrollEnd`:r!=null&&ip(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=On);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Jt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[Mt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}tn=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):rn(e,n,r)}return}tn=!0}function bp(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:ip(`error`,e),ip(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:vp(e,t,o,s,n,null)}}a&&vp(e,t,`srcSet`,n.srcSet,n,null),r&&vp(e,t,`src`,n.src,n,null);return;case`input`:ip(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:vp(e,t,r,d,n,null)}}hn(e,o,c,l,u,s,a,!1);return;case`select`:for(a in ip(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:vp(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&_n(e,!!r,n,!0):_n(e,!!r,t,!1);return;case`textarea`:for(s in ip(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:vp(e,t,s,c,n,null)}yn(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:vp(e,t,l,r,n,null)}return;case`dialog`:ip(`beforetoggle`,e),ip(`toggle`,e),ip(`cancel`,e),ip(`close`,e);break;case`iframe`:case`object`:ip(`load`,e);break;case`video`:case`audio`:for(r=0;r<tp.length;r++)ip(tp[r],e);break;case`image`:ip(`error`,e),ip(`load`,e);break;case`details`:ip(`toggle`,e);break;case`embed`:case`source`:case`link`:ip(`error`,e),ip(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:vp(e,t,u,r,n,null)}return;default:if(wn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&yp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&vp(e,t,c,r,n,null))}var xp={};function Sp(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||vp(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(tn=!0),o=m;break;case`name`:m!==f&&(tn=!0),a=m;break;case`checked`:m!==f&&(tn=!0),u=m;break;case`defaultChecked`:m!==f&&(tn=!0),d=m;break;case`value`:m!==f&&(tn=!0),s=m;break;case`defaultValue`:m!==f&&(tn=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&vp(e,t,p,m,r,f)}}mn(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||vp(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(tn=!0),p=o;break;case`defaultValue`:o!==l&&(tn=!0),c=o;break;case`multiple`:o!==l&&(tn=!0),s=o;default:o!==l&&vp(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?_n(e,!!n,n?[]:``,!1):_n(e,!!n,t,!0)):_n(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:vp(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(tn=!0),p=a;break;case`defaultValue`:a!==o&&(tn=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&vp(e,t,s,a,r,o)}vn(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:vp(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(tn=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:vp(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&vp(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:vp(e,t,u,p,r,m)}return;default:if(wn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&yp(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||yp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&vp(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||vp(e,t,f,p,r,m)}function Cp(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function wp(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Cp(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Cp(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Tp=null,Ep=null;function Dp(e){return e.nodeType===9?e:e.ownerDocument}function Op(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function kp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ap(e,t,n,r){return n=Dp(n).createElement(e),n[jt]=r,n[Mt]=t,bp(n,e,t),Gt(n),n}function jp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Mp=null;function Np(){var e=window.event;return e&&e.type===`popstate`?e!==Mp&&(Mp=e,!0):(Mp=null,!1)}var Pp=typeof setTimeout==`function`?setTimeout:void 0,Fp=typeof clearTimeout==`function`?clearTimeout:void 0,Ip=typeof Promise==`function`?Promise:void 0,Lp=typeof requestAnimationFrame==`function`?requestAnimationFrame:Pp,Rp=typeof queueMicrotask==`function`?queueMicrotask:Ip===void 0?Pp:function(e){return Ip.resolve(null).then(e).catch(zp)};function zp(e){setTimeout(function(){throw e})}function Bp(e){return e===`head`}function Vp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),og(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Fm(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Fm(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[Rt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Fm(e.ownerDocument.body)}n=i}while(n);og(t)}function Hp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Up(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Wp(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Gp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Kp(e){return Gp(e.getBoundingClientRect(),getComputedStyle(e),e)}function qp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Gp(t,n,e)}function Jp(e){return e.documentElement.clientHeight}function Yp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Xp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Jp(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=mh(f),u>_h){s.length=o;break}f=new Promise(Yp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Zp(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Zp.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:D({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Zp.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Zp.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Qp(e){return{name:e,group:new Zp(`group`,e),imagePair:new Zp(`image-pair`,e),old:new Zp(`old`,e),new:new Zp(`new`,e)}}function $p(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}$p.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(im(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=nm(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),m(this._fragmentFiber.child,!1,em,e,s,r)}this._eventListeners=a}};function em(e,t,n,r){return b(e).addEventListener(t,n,r),!1}$p.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=im(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=nm(i.optionsOrUseCapture),m(this._fragmentFiber.child,!1,tm,e,n,i),r.splice(t,1),a!==null&&a()}};function tm(e,t,n,r){return b(e).removeEventListener(t,n,r),!1}function nm(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function rm(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function im(e,t,n,r){if(e.length===0)return-1;r=rm(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&rm(a.optionsOrUseCapture)===r)return i}return-1}$p.prototype.dispatchEvent=function(e){var t=g(this._fragmentFiber);if(t===null)return!0;t=b(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,nm(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,nm(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},$p.prototype.focus=function(e){m(this._fragmentFiber.child,!0,am,e,void 0,void 0)};function am(e,t){return e.tag!==6&&(e=b(e),jm(e,t))}$p.prototype.focusLast=function(e){var t=[];m(this._fragmentFiber.child,!0,om,t,void 0,void 0);for(var n=t.length-1;0<=n&&!am(t[n],e);n--);};function om(e,t){return t.push(e),!1}$p.prototype.blur=function(){var e=g(this._fragmentFiber);e!==null&&(e=b(e),e=Dp(e).activeElement,e!==null&&m(this._fragmentFiber.child,!1,sm,e,void 0,void 0))};function sm(e,t){return e.tag!==6&&(e=b(e),e===t||e.contains(t)?(t.blur(),!0):!1)}$p.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),m(this._fragmentFiber.child,!1,cm,e,void 0,void 0)};function cm(e,t){return e.tag!==6&&(e=b(e),t.observe(e),!1)}$p.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),m(this._fragmentFiber.child,!1,lm,e,void 0,void 0);for(var n=t=0;n<um.length;n++){var r=um[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):um[t++]=r}um.length=t}};function lm(e,t){return e.tag!==6&&(e=b(e),t.unobserve(e),!1)}var um=[],dm=!1;function fm(e,t,n){um.push({fragmentInstance:e,observer:t,instance:n}),dm||(dm=!0,Mm(function(){dm=!1;var e=um;um=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}$p.prototype.getClientRects=function(){var e=[];return m(this._fragmentFiber.child,!1,pm,e,void 0,void 0),e};function pm(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=b(e),t.push.apply(t,e.getClientRects());return!1}$p.prototype.getRootNode=function(e){var t=g(this._fragmentFiber);return t===null?this:b(t).getRootNode(e)},$p.prototype.compareDocumentPosition=function(e){var t=g(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];m(this._fragmentFiber.child,!1,om,n,void 0,void 0);var r=b(t);if(n.length===0){if(n=r,_(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=v(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=b(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=b(n[0]),i=b(n[n.length-1]);var a=_(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||mm(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function mm(e,t,n,r,i){var a=Vt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=g(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=E(n,a,T),t===null?t=!1:(m(t,!0,C,a,n),a=x,x=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=E(r,a,T),t===null?t=!1:(m(t,!0,w,a,r),a=x,S=x=null,t=a!==null)),t):!1}function hm(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}$p.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];m(this._fragmentFiber.child,!1,om,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=v(this._fragmentFiber);if(r=n?r[1]||r[0]||g(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=b(r),hm(e,n);return}if(r=b(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=b(a),hm(a,n)):b(a).scrollIntoView(e),r+=n?-1:1}};function gm(e,t){return e=b(e),_m(e,t),!1}function _m(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function vm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,nm(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<um.length;i++){var a=um[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(um[r++]=a)}um.length=r,n.observe(e)}),_m(e,t))}function ym(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,nm(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?fm(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function bm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:bm(n),Bt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function xm(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[Rt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=Dm(e.nextSibling),e===null)break}return null}function Sm(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=Dm(e.nextSibling),e===null))return null;return e}function Cm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=Dm(e.nextSibling),e===null))return null;return e}function wm(e){return e.data===`$?`||e.data===`$~`}function Tm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function Em(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function Dm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var Om=null;function km(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return Dm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function Am(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function jm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function Mm(e){Lp(function(){Lp(function(t){return e(t)})})}function Nm(e,t,n){switch(t=Dp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Pm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&vp(e,t,r,null,xp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===On&&(e.onclick=null),Bt(e)}function Fm(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Bt(e)}var Im=new Map,Lm=new Set;function Rm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var zm=Se.d;Se.d={f:Bm,r:Vm,D:Wm,C:Gm,L:Km,m:qm,X:Ym,S:Jm,M:Xm};function Bm(){var e=zm.f(),t=ef();return e||t}function Vm(e){var t=Ht(e);t!==null&&t.tag===5&&t.type===`form`?dc(t):zm.r(e)}var Hm=typeof document>`u`?null:document;function Um(e,t,n){var r=Hm;if(r&&typeof t==`string`&&t){var i=pn(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Lm.has(i)||(Lm.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),bp(t,`link`,e),Gt(t),r.head.appendChild(t)))}}function Wm(e){zm.D(e),Um(`dns-prefetch`,e,null)}function Gm(e,t){zm.C(e,t),Um(`preconnect`,e,t)}function Km(e,t,n){zm.L(e,t,n);var r=Hm;if(r&&e&&t){var i=`link[rel="preload"][as="`+pn(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+pn(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+pn(n.imageSizes)+`"]`)):i+=`[href="`+pn(e)+`"]`;var a=i;switch(t){case`style`:a=Qm(e);break;case`script`:a=nh(e)}if(!(Im.has(a)||(e=D({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Im.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector($m(a))||t===`script`&&r.querySelector(rh(a))))){var o=r.createElement(`link`);bp(o,`link`,e),t===`style`&&(o[zt]=!0,o.onload=o.onerror=function(){Kt(o)}),Gt(o),r.head.appendChild(o)}}}function qm(e,t){zm.m(e,t);var n=Hm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+pn(r)+`"][href="`+pn(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=nh(e)}if(!Im.has(a)&&(e=D({rel:`modulepreload`,href:e},t),Im.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(rh(a)))return}r=n.createElement(`link`),bp(r,`link`,e),Gt(r),n.head.appendChild(r)}}}function Jm(e,t,n){zm.S(e,t,n);var r=Hm;if(r&&e){var i=Wt(r).hoistableStyles,a=Qm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector($m(a)))s.loading=5;else{e=D({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Im.get(a))&&oh(e,n);var c=o=r.createElement(`link`);Gt(c),bp(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,ah(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Ym(e,t){zm.X(e,t);var n=Hm;if(n&&e){var r=Wt(n).hoistableScripts,i=nh(e),a=r.get(i);a||(a=n.querySelector(rh(i)),a||(e=D({src:e,async:!0},t),(t=Im.get(i))&&sh(e,t),a=n.createElement(`script`),Gt(a),bp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Xm(e,t){zm.M(e,t);var n=Hm;if(n&&e){var r=Wt(n).hoistableScripts,i=nh(e),a=r.get(i);a||(a=n.querySelector(rh(i)),a||(e=D({src:e,async:!0,type:`module`},t),(t=Im.get(i))&&sh(e,t),a=n.createElement(`script`),Gt(a),bp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Zm(e,t,n,r){var a=(a=je.current)?Rm(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Qm(n.href),t=Wt(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Qm(n.href);var o=Wt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector($m(e)))?o._p||(s.instance=o,s.state.loading=5):(o=Im.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Im.set(e,o)),th(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=nh(n),t=Wt(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Qm(e){return`href="`+pn(e)+`"`}function $m(e){return`link[rel="stylesheet"][`+e+`]`}function eh(e){return D({},e,{"data-precedence":e.precedence,precedence:null})}function th(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[zt]){r.loading=1;return}}else t=e.createElement(`link`),t[zt]=!0,t.onload=t.onerror=Kt.bind(null,t),bp(t,`link`,n),Gt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function nh(e){return`[src="`+pn(e)+`"]`}function rh(e){return`script[async]`+e}function ih(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+pn(n.href)+`"]`);if(r)return t.instance=r,Gt(r),r;var a=D({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Gt(r),bp(r,`style`,a),ah(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Qm(n.href);var o=e.querySelector($m(a));if(o)return t.state.loading|=4,t.instance=o,Gt(o),o;r=eh(n),(a=Im.get(a))&&oh(r,a),o=(e.ownerDocument||e).createElement(`link`),Gt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),bp(o,`link`,r),t.state.loading|=4,ah(o,n.precedence,e),t.instance=o;case`script`:return o=nh(n.src),(a=e.querySelector(rh(o)))?(t.instance=a,Gt(a),a):(r=n,(a=Im.get(o))&&(r=D({},n),sh(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Gt(a),bp(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,ah(r,n.precedence,e));return t.instance}function ah(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function oh(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function sh(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var ch=null;function lh(e,t,n){if(ch===null){var r=new Map,i=ch=new Map;i.set(n,r)}else i=ch,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[Rt]||a[jt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function uh(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function dh(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function fh(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function ph(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function mh(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function hh(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=mh(t),e.suspenseyImages.push(t)),e=xh.bind(e),t.decode().then(e,e))}function gh(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Qm(r.href),a=t.querySelector($m(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=bh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Gt(a);return}a=t.ownerDocument||t,r=eh(r),(i=Im.get(i))&&oh(r,i),a=a.createElement(`link`),Gt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),bp(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=bh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var _h=0;function vh(e,t){return e.stylesheets&&e.count===0&&Ch(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Ch(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&_h===0&&(_h=62500*wp());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ch(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>_h?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function yh(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)Ch(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function bh(){this.count--,yh(this)}function xh(){this.imgCount--,yh(this)}var Sh=null;function Ch(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Sh=new Map,t.forEach(wh,e),Sh=null,bh.call(e))}function wh(e,t){if(!(t.state.loading&4)){var n=Sh.get(e);if(n)var r=n.get(null);else{n=new Map,Sh.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=bh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Th={$$typeof:se,Provider:null,Consumer:null,_currentValue:Ce,_currentValue2:Ce,_threadCount:0};function Eh(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=bt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bt(0),this.hiddenUpdates=bt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function Dh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new Eh(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Hi(3,null,null,t),e.current=a,a.stateNode=e,t=Va(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},wo(a),e}function Oh(e){return e?(e=Bi,e):Bi}function kh(e,t,n,r,i,a){i=Oh(i),r.context===null?r.context=i:r.pendingContext=i,r=Eo(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Do(e,r,t),n!==null&&(Yd(n,e,t),Oo(n,e,t))}function Ah(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function jh(e,t){Ah(e,t),(e=e.alternate)&&Ah(e,t)}function Mh(e){if(e.tag===13||e.tag===31){var t=Li(e,67108864);t!==null&&Yd(t,e,67108864),jh(e,67108864)}}function Nh(e){if(e.tag===13||e.tag===31){var t=Kd();t=Et(t);var n=Li(e,t);n!==null&&Yd(n,e,t),jh(e,t)}}var Ph=!0;function Fh(e,t,n,r){var i=k.T;k.T=null;var a=Se.p;try{Se.p=2,Lh(e,t,n,r)}finally{Se.p=a,k.T=i}}function Ih(e,t,n,r){var i=k.T;k.T=null;var a=Se.p;try{Se.p=8,Lh(e,t,n,r)}finally{Se.p=a,k.T=i}}function Lh(e,t,n,r){if(Ph){var i=Rh(r);if(i===null)lp(e,t,r,zh,n),Xh(e,r);else if(Qh(i,e,t,n,r))r.stopPropagation();else if(Xh(e,r),t&4&&-1<Yh.indexOf(e)){for(;i!==null;){var a=Ht(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=mt(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-st(o);s.entanglements[1]|=c,o&=~c}Hf(a),!(ud&6)&&(jd=Ye()+500,Uf(0,!1))}}break;case 31:case 13:s=Li(a,2),s!==null&&Yd(s,a,2),ef(),jh(a,2)}if(a=Rh(r),a===null&&lp(e,t,r,zh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else lp(e,t,r,null,n)}}function Rh(e){return e=An(e),Bh(e)}var zh=null;function Bh(e){if(zh=null,e=Vt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return zh=e,null}function Vh(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Xe()){case Ze:return 2;case Qe:return 8;case $e:case et:return 32;case tt:return 268435456;default:return 32}default:return 32}}var Hh=!1,Uh=null,Wh=null,Gh=null,Kh=new Map,qh=new Map,Jh=[],Yh=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Xh(e,t){switch(e){case`focusin`:case`focusout`:Uh=null;break;case`dragenter`:case`dragleave`:Wh=null;break;case`mouseover`:case`mouseout`:Gh=null;break;case`pointerover`:case`pointerout`:Kh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:qh.delete(t.pointerId)}}function Zh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Ht(t),t!==null&&Mh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Qh(e,t,n,r,i){switch(t){case`focusin`:return Uh=Zh(Uh,e,t,n,r,i),!0;case`dragenter`:return Wh=Zh(Wh,e,t,n,r,i),!0;case`mouseover`:return Gh=Zh(Gh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Kh.set(a,Zh(Kh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,qh.set(a,Zh(qh.get(a)||null,e,t,n,r,i)),!0}return!1}function $h(e){var t=Vt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,kt(e.priority,function(){Nh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,kt(e.priority,function(){Nh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function eg(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Rh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);kn=r,n.target.dispatchEvent(r),kn=null}else return t=Ht(n),t!==null&&Mh(t),e.blockedOn=n,!1;t.shift()}return!0}function tg(e,t,n){eg(e)&&n.delete(t)}function ng(){Hh=!1,Uh!==null&&eg(Uh)&&(Uh=null),Wh!==null&&eg(Wh)&&(Wh=null),Gh!==null&&eg(Gh)&&(Gh=null),Kh.forEach(tg),qh.forEach(tg)}function rg(e,n){e.blockedOn===n&&(e.blockedOn=null,Hh||(Hh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,ng)))}var ig=null;function ag(e){ig!==e&&(ig=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){ig===e&&(ig=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Bh(r||n)===null)continue;break}var a=Ht(n);a!==null&&(e.splice(t,3),t-=3,lc(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function og(e){function t(t){return rg(t,e)}Uh!==null&&rg(Uh,e),Wh!==null&&rg(Wh,e),Gh!==null&&rg(Gh,e),Kh.forEach(t),qh.forEach(t);for(var n=0;n<Jh.length;n++){var r=Jh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Jh.length&&(n=Jh[0],n.blockedOn===null);)$h(n),n.blockedOn===null&&Jh.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[Mt]||null;if(typeof a==`function`)o||ag(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[Mt]||null)s=o.formAction;else if(Bh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),ag(n)}}}function sg(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function cg(e){this._internalRoot=e}lg.prototype.render=cg.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;kh(n,Kd(),e,t,null,null)},lg.prototype.unmount=cg.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;kh(e.current,2,null,e,null,null),ef(),t[Nt]=null}};function lg(e){this._internalRoot=e}lg.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ot();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Jh.length&&t!==0&&t<Jh[n].priority;n++);Jh.splice(n,0,e),n===0&&$h(e)}};var ug=n.version;if(ug!==`19.3.0`)throw Error(i(527,ug,`19.3.0`));Se.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var dg={bundleType:0,version:`19.3.0`,rendererPackageName:`react-dom`,currentDispatcherRef:k,reconcilerVersion:`19.3.0`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var fg=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fg.isDisabled&&fg.supportsFiber)try{it=fg.inject(dg),at=fg}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Mc,s=Nc,c=Pc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=Dh(e,1,!1,null,null,n,r,null,o,s,c,sg),e[Nt]=t.current,sp(e),new cg(t)}})),_=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=l(d(),1),y=l(h(),1),b=_(),x=`modulepreload`,S=function(e){return`/`+e},C={},w=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=S(t,n),t=s(t),t in C)return;C[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:x,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},T=e=>{throw TypeError(e)},E=(e,t,n)=>t.has(e)||T(`Cannot `+n),D=(e,t,n)=>(E(e,t,`read from private field`),n?n.call(e):t.get(e)),ee=(e,t,n)=>t.has(e)?T(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),te=(e,t,n,r)=>(E(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),ne=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,re=/^[\\/]{2}/;function ie(e,t){return t+e.replace(/\\/g,`/`)}var ae=`popstate`;function oe(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function se(e={}){function t(e,t){let{pathname:n=`/`,search:r=``,hash:i=``}=pe(e.location.hash.substring(1));return!n.startsWith(`/`)&&!n.startsWith(`.`)&&(n=`/`+n),de(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){let n=e.document.querySelector(`base`),r=``;if(n&&n.getAttribute(`href`)){let t=e.location.href,n=t.indexOf(`#`);r=n===-1?t:t.slice(0,n)}return r+`#`+(typeof t==`string`?t:fe(t))}function r(e,t){ce(e.pathname.charAt(0)===`/`,`relative pathnames are not supported in hash history.push(${JSON.stringify(t)})`)}return me(t,n,r,e)}function O(e,t){if(e===!1||e==null)throw Error(t)}function ce(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function le(){return Math.random().toString(36).substring(2,10)}function ue(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function de(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?pe(t):t,state:n,key:t&&t.key||r||le(),mask:i}}function fe({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function pe(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function me(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=oe(e)?e:de(h.location,e,t);n&&n(r,e),l=u()+1;let d=ue(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=oe(e)?e:de(h.location,e,t);n&&n(r,e),l=u();let i=ue(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return he(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(ae,d),c=e,()=>{i.removeEventListener(ae,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function he(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),O(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:fe(t);return i=i.replace(/ $/,`%20`),!n&&re.test(i)&&(i=r+i),new URL(i,r)}var ge,_e=class{constructor(e){if(ee(this,ge,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(D(this,ge).has(e))return D(this,ge).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){D(this,ge).set(e,t)}};ge=new WeakMap;var ve=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function ye(e){return ve.has(e)}var be=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function xe(e){return be.has(e)}function k(e){return e.index===!0}function Se(e,t,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(O(e.index!==!0||!e.children,`Cannot specify children on an index route`),O(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),k(e)){let n={...e,id:s};return r[s]=Ce(n,t(n)),n}{let n={...e,id:s,children:void 0};return r[s]=Ce(n,t(n)),e.children&&(n.children=Se(e.children,t,o,r,i)),n}})}function Ce(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function we(e,t,n=`/`){return Te(e,t,n,!1)}function Te(e,t,n,r,i){let a=Ge((typeof t==`string`?pe(t):t).pathname||`/`,n);if(a==null)return null;let o=i??De(e),s=null,c=We(a);for(let e=0;s==null&&e<o.length;++e)s=Be(o[e],c,r);return s}function Ee(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function De(e){let t=Oe(e);return Ae(t),t}function Oe(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;O(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=tt([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(O(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Oe(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:Re(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=Ue(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of ke(e.path))a(e,t,!0,n)}),t}function ke(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=ke(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function Ae(e){e.sort((e,t)=>e.score===t.score?ze(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var je=/^:[\w-]+$/,Me=3,Ne=2,Pe=1,Fe=10,Ie=-2,Le=e=>e===`*`;function Re(e,t){let n=e.split(`/`),r=n.length;return n.some(Le)&&(r+=Ie),t&&(r+=Ne),n.filter(e=>!Le(e)).reduce((e,t)=>e+(je.test(t)?Me:t===``?Pe:Fe),r)}function ze(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Be(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?He(u,l,s.matcher,s.compiledParams):Ve(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=Ve({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:tt([a,d.pathname]),pathnameBase:rt(tt([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=tt([a,d.pathnameBase]))}return o}function Ve(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Ue(e.path,e.caseSensitive,e.end);return He(e,t,n,r)}function He(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=nt(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=nt(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Ue(e,t=!1,n=!0){ce(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function We(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return ce(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ge(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function Ke({basename:e,pathname:t}){return t===`/`?e:tt([e,t])}var qe=e=>ne.test(e);function Je(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?pe(e):e,a;return n?(n=et(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?Ye(n.substring(1),`/`):Ye(n,t)):a=t,{pathname:a,search:it(r),hash:at(i)}}function Ye(e,t){let n=nt(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Xe(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Ze(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Qe(e){let t=Ze(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function $e(e,t,n,r=!1){let i;typeof e==`string`?i=pe(e):(i={...e},O(!i.pathname||!i.pathname.includes(`?`),Xe(`?`,`pathname`,`search`,i)),O(!i.pathname||!i.pathname.includes(`#`),Xe(`#`,`pathname`,`hash`,i)),O(!i.search||!i.search.includes(`#`),Xe(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=Je(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var et=e=>e.replace(/[\\/]{2,}/g,`/`),tt=e=>et(e.join(`/`));function nt(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var rt=e=>nt(e).replace(/^\/*/,`/`),it=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,at=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,ot=(e,t=302)=>{let n=t;typeof n==`number`?n={status:n}:n.status===void 0&&(n.status=302);let r=new Headers(n.headers);return r.set(`Location`,e),new Response(null,{...n,headers:r})},st=(e,t)=>{let n=ot(e,t);return n.headers.set(`X-Remix-Replace`,`true`),n},ct=[`EvalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],lt=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function ut(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function dt(e){return tt(e.map(e=>e.route.path).filter(Boolean))||`/`}var ft=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function pt(e,t){let n=e;if(typeof n!=`string`||!ne.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(ft)try{let e=new URL(window.location.href),r=re.test(n)?new URL(ie(n,e.protocol)):new URL(n),a=Ge(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{ce(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var mt=Symbol(`Uninstrumented`);function ht(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){let t=Object.keys(n);for(let r of t)e[r]&&n[r].push(e[r])}}));let r={};if(typeof t.lazy==`function`&&n.lazy.length>0){let e=_t(n.lazy,t.lazy,()=>void 0);e&&(r.lazy=e)}if(typeof t.lazy==`object`){let e=t.lazy;[`middleware`,`loader`,`action`].forEach(t=>{let i=e[t],a=n[`lazy.${t}`];if(typeof i==`function`&&a.length>0){let e=_t(a,i,()=>void 0);e&&(r.lazy=Object.assign(r.lazy||{},{[t]:e}))}})}return[`loader`,`action`].forEach(e=>{let i=t[e];if(typeof i==`function`&&n[e].length>0){let t=i[mt]??i,a=_t(n[e],t,(...e)=>yt(e[0]));a&&(e===`loader`&&t.hydrate===!0&&(a.hydrate=!0),a[mt]=t,r[e]=a)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=e[mt]??e,r=_t(n.middleware,t,(...e)=>yt(e[0]));return r?(r[mt]=t,r):e})),r}function gt(e,t){let n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){let t=Object.keys(e);for(let r of t)e[r]&&n[r].push(e[r])}})),n.navigate.length>0){let t=e.navigate[mt]??e.navigate,r=_t(n.navigate,t,(...t)=>{let[n,r]=t;return{to:typeof n==`number`||typeof n==`string`?n:n?fe(n):`.`,...bt(e,r??{})}});r&&(r[mt]=t,e.navigate=r)}if(n.fetch.length>0){let t=e.fetch[mt]??e.fetch,r=_t(n.fetch,t,(...t)=>{let[n,,r,i]=t;return{href:r??`.`,fetcherKey:n,...bt(e,i??{})}});r&&(r[mt]=t,e.fetch=r)}return e}function _t(e,t,n){return e.length===0?null:async(...r)=>{let i=await vt(e,n(...r),()=>t(...r),e.length-1);if(i.type===`error`)throw i.value;return i.value}}async function vt(e,t,n,r){let i=e[r],a;if(i){let o,s=async()=>(o?console.error(`You cannot call instrumented handlers more than once`):o=vt(e,t,n,r-1),a=await o,O(a,`Expected a result`),a.type===`error`&&a.value instanceof Error?{status:`error`,error:a.value}:{status:`success`,error:void 0});try{await i(s,t)}catch(e){console.error(`An instrumentation function threw an error:`,e)}o||await s(),await o}else try{a={type:`success`,value:await n()}}catch(e){a={type:`error`,value:e}}return a||{type:`error`,value:Error(`No result assigned in instrumentation chain.`)}}function yt(e){let{request:t,context:n,params:r,pattern:i}=e;return{request:xt(t),params:{...r},pattern:i,context:St(n)}}function bt(e,t){return{currentUrl:fe(e.state.location),...`formMethod`in t?{formMethod:t.formMethod}:{},...`formEncType`in t?{formEncType:t.formEncType}:{},...`formData`in t?{formData:t.formData}:{},...`body`in t?{body:t.body}:{}}}function xt(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function St(e){if(wt(e)){let t={...e};return Object.freeze(t),t}return{get:t=>e.get(t)}}var Ct=Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function wt(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join(`\0`)===Ct}var Tt=new URL(`http://localhost`);function Et(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),Tt)}catch{return Tt}}function Dt(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function Ot(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function kt(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!Dt(i,n),s=!Dt(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!Ot(e,i)||!Dt(i,a)))throw Error(`External navigation is not allowed`)}var At=[`POST`,`PUT`,`PATCH`,`DELETE`],jt=new Set(At),Mt=[`GET`,...At],Nt=new Set(Mt),Pt=new Set([301,302,303,307,308]),Ft=new Set([307,308]),It={state:`idle`,location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Lt={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Rt={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},zt=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Bt=`remix-router-transitions`,Vt=Symbol(`ResetLoaderData`),Ht,Ut,Wt,Gt,Kt=class{constructor(e){ee(this,Ht),ee(this,Ut),ee(this,Wt),ee(this,Gt),te(this,Ht,e),te(this,Ut,De(e))}get stableRoutes(){return D(this,Ht)}get activeRoutes(){return D(this,Wt)??D(this,Ht)}get branches(){return D(this,Gt)??D(this,Ut)}get hasHMRRoutes(){return D(this,Wt)!=null}setRoutes(e){te(this,Ht,e),te(this,Ut,De(e))}setHmrRoutes(e){te(this,Wt,e),te(this,Gt,De(e))}commitHmrRoutes(){D(this,Wt)&&(te(this,Ht,D(this,Wt)),te(this,Ut,D(this,Gt)),te(this,Wt,void 0),te(this,Gt,void 0))}};Ht=new WeakMap,Ut=new WeakMap,Wt=new WeakMap,Gt=new WeakMap;function qt(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0;O(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties||zt,a=i;if(e.instrumentations){let t=e.instrumentations;a=e=>({...i(e),...ht(t.map(e=>e.route).filter(Boolean),e)})}let o={},s=new Kt(Se(e.routes,a,void 0,o)),c=e.basename||`/`;c.startsWith(`/`)||(c=`/${c}`);let l=e.dataStrategy||dn,u={...e.future},d=null,f=new Set,p=null,m=null,h=null,g=null,_=e.hydrationData!=null,v=Te(s.activeRoutes,e.history.location,c,!1,s.branches),y=!1,b=null,x,S;if(v==null&&!e.patchRoutesOnNavigation){let t=In(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=Fn(s.activeRoutes);x=!0,S=!x,v=n,b={[r.id]:t}}else if(v&&!e.hydrationData&&mt(v,s.activeRoutes,e.history.location.pathname).active&&(v=null),!v){x=!1,S=!x,v=[];let t=mt(null,s.activeRoutes,e.history.location.pathname);t.active&&t.matches&&(y=!0,v=t.matches)}else if(v.some(e=>e.route.lazy))x=!1,S=!x;else if(!v.some(e=>Qt(e.route)))x=!0,S=!x;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=v;if(n){let e=v.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}S=!1,x=!0,r.forEach(e=>{let r=$t(e.route,t,n);S||=r.renderFallback,x&&=!r.shouldLoad})}let C,w={historyAction:e.history.action,location:e.history.location,matches:v,initialized:x,renderFallback:S,navigation:It,restoreScrollPosition:e.hydrationData==null&&null,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||b,fetchers:new Map,blockers:new Map},T=`POP`,E=null,D=!1,ee,te=!1,ne=new Map,ie=null,ae=!1,oe=!1,se=new Set,le=new Map,ue=0,me=-1,ge=new Map,ve=new Set,ye=new Map,be=new Map,xe=new Set,k=new Map,Ce,we=null;function De(){if(d=e.history.listen(({action:t,location:n,delta:r})=>{if(Ce){Ce(),Ce=void 0;return}ce(k.size===0||r!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=st({currentLocation:w.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{Ce=e});e.history.go(r*-1),ot(i,{state:`blocked`,location:n,proceed(){ot(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(w.blockers);e.set(i,Rt),Ae({blockers:e})}}),E?.resolve(),E=null;return}return Pe(t,n)}),n){or(t,ne);let e=()=>sr(t,ne);t.addEventListener(`pagehide`,e),ie=()=>t.removeEventListener(`pagehide`,e)}return w.initialized||Pe(`POP`,w.location,{initialHydration:!0}),C}function Oe(){d&&d(),ie&&ie(),f.clear(),ee&&ee.abort(),w.fetchers.forEach((e,t)=>Qe(w.fetchers,t)),w.blockers.forEach((e,t)=>at(t))}function ke(e){if(f.add(e),p){let{newErrors:t}=p;p=null,e(w,{deletedFetchers:[],newErrors:t,viewTransitionOpts:void 0,flushSync:!1})}return()=>f.delete(e)}function Ae(e,t={}){e.matches&&=e.matches.map(e=>{let t=o[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),w={...w,...e};let n=[],r=[];w.fetchers.forEach((e,t)=>{e.state===`idle`&&(xe.has(t)?n.push(t):r.push(t))}),xe.forEach(e=>{!w.fetchers.has(e)&&!le.has(e)&&n.push(e)}),f.size===0&&(p={newErrors:e.errors??null}),[...f].forEach(r=>r(w,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>Qe(w.fetchers,e)),r.forEach(e=>w.fetchers.delete(e))}function je(t,n,{flushSync:r}={}){let i=w.actionData!=null&&w.navigation.formMethod!=null&&Zn(w.navigation.formMethod)&&w.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?w.actionData:null;let o=n.loaderData?Mn(w.loaderData,n.loaderData,n.matches||[],n.errors):w.loaderData,c=w.blockers;c.size>0&&(c=new Map(c),c.forEach((e,t)=>c.set(t,Rt)));let l=!ae&&pt(t,n.matches||w.matches),u=D===!0||w.navigation.formMethod!=null&&Zn(w.navigation.formMethod)&&t.state?._isRedirect!==!0;s.commitHmrRoutes(),ae||T===`POP`||(T===`PUSH`?e.history.push(t,t.state):T===`REPLACE`&&e.history.replace(t,t.state));let d;if(T===`POP`&&!ae&&t!==w.location){let e=ne.get(w.location.pathname);e&&e.has(t.pathname)?d={currentLocation:w.location,nextLocation:t}:ne.has(t.pathname)&&(d={currentLocation:t,nextLocation:w.location})}else if(te){let e=ne.get(w.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),ne.set(w.location.pathname,e)),d={currentLocation:w.location,nextLocation:t}}Ae({...n,actionData:a,loaderData:o,historyAction:T,location:t,initialized:!0,renderFallback:!1,navigation:It,revalidation:`idle`,restoreScrollPosition:l,preventScrollReset:u,blockers:c},{viewTransitionOpts:d,flushSync:r===!0}),T=`POP`,D=!1,te=!1,ae=!1,oe=!1,E?.resolve(),E=null,we?.resolve(),we=null}async function Me(t,n){if(E?.resolve(),E=null,typeof t==`number`){E||=cr();let n=E.promise;return e.history.go(t),n}let{path:r,submission:i,error:a}=Xt(!1,Yt(w.location,w.matches,c,t,n?.fromRouteId,n?.relative),n),o;if(n?.mask){let t=typeof n.mask==`string`?pe(n.mask):{...w.location.mask,...n.mask};if(o={pathname:t.pathname??``,search:t.search??``,hash:t.hash??``},re.test(o.pathname))throw Error(`External navigation is not allowed`);o.pathname.startsWith(`\\`)&&(o.pathname=o.pathname.replace(/^\\+/,`/`)),kt(typeof n.mask==`string`?n.mask:fe(n.mask),fe(o),e.history.createURL(`/`),`reject`)}let s=w.location,l=de(s,r,n&&n.state,void 0,o);l={...l,...e.history.encodeLocation(l)},kt(t==null?e.history.createHref(w.location):typeof t==`string`?t:fe(t),e.history.createHref(l.mask||l),e.history.createURL(`/`),`reject`);let u=n&&n.replace!=null?n.replace:void 0,d=`PUSH`;u===!0?d=`REPLACE`:u===!1||i!=null&&Zn(i.formMethod)&&i.formAction===w.location.pathname+w.location.search&&(d=`REPLACE`);let f=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,p=(n&&n.flushSync)===!0,m=st({currentLocation:s,nextLocation:l,historyAction:d});if(m){ot(m,{state:`blocked`,location:l,proceed(){ot(m,{state:`proceeding`,proceed:void 0,reset:void 0,location:l}),Me(t,n)},reset(){let e=new Map(w.blockers);e.set(m,Rt),Ae({blockers:e})}});return}await Pe(d,l,{submission:i,pendingError:a,preventScrollReset:f,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:p,callSiteDefaultShouldRevalidate:n&&n.defaultShouldRevalidate})}function Ne(){we||=cr(),Ke(),Ae({revalidation:`loading`});let e=we.promise;return w.navigation.state===`submitting`?e:w.navigation.state===`idle`?(Pe(w.historyAction,w.location,{startUninterruptedRevalidation:!0}),e):(Pe(T||w.historyAction,w.navigation.location,{overrideNavigation:w.navigation,enableViewTransition:te===!0}),e)}async function Pe(t,n,r){ee&&ee.abort(),ee=null,T=t,ae=(r&&r.startUninterruptedRevalidation)===!0,ft(w.location,w.matches),D=(r&&r.preventScrollReset)===!0,te=(r&&r.enableViewTransition)===!0;let i=s.activeRoutes,a=r?.initialHydration&&w.matches&&w.matches.length>0&&!y?w.matches:Te(i,n,c,!1,s.branches),o=(r&&r.flushSync)===!0;if(a&&w.initialized&&!oe&&zn(w.location,n)&&!(r&&r.submission&&Zn(r.submission.formMethod))){je(n,{matches:a},{flushSync:o});return}let l=mt(a,i,n.pathname);if(l.active&&l.matches&&(a=l.matches),!a){let{error:e,notFoundMatches:t,route:r}=ct(n.pathname);je(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:o});return}let u=r&&r.overrideNavigation?{...r.overrideNavigation,matches:a,historyAction:t}:void 0;ee=new AbortController;let d=En(e.history,n,ee.signal,r&&r.submission),f=e.getContext?await e.getContext():new _e,p;if(r&&r.pendingError)p=[Pn(a).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&Zn(r.submission.formMethod)){let i=await Fe(d,n,r.submission,a,t,f,l.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:o});if(i.shortCircuited)return;if(i.pendingActionResult){let[e,t]=i.pendingActionResult;if(Wn(t)&&ut(t.error)&&t.error.status===404){ee=null,je(n,{matches:i.matches,loaderData:{},errors:{[e]:t.error}});return}}a=i.matches||a,p=i.pendingActionResult,u=tr(n,a,t,r.submission),o=!1,l.active=!1,d=En(e.history,d.url,d.signal)}let{shortCircuited:m,matches:h,loaderData:g,errors:_,workingFetchers:v}=await Ie(d,n,a,t,f,l.active,u,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,o,p,r&&r.callSiteDefaultShouldRevalidate);m||(ee=null,je(n,{matches:h||a,...Nn(p),loaderData:g,errors:_,...v?{fetchers:v}:{}}))}async function Fe(t,n,i,l,u,d,f,p,m={}){if(Ke(),Ae({navigation:nr(n,l,u,i)},{flushSync:m.flushSync===!0}),f){let e=await _t(l,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=Fn(s.activeRoutes);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=Pn(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:`error`,error:e.error}]}}if(e.matches)l=e.matches;else{let{notFoundMatches:e,error:t,route:r}=ct(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:t}]}}}let h,g=$n(l,n);if(!g.route.action&&!g.route.lazy)h={type:`error`,error:In(405,{method:t.method,pathname:n.pathname,routeId:g.route.id})};else{let e=await Ue(t,n,_n(a,o,t,n,l,g,p?[]:r,d),d,null);if(h=e[g.route.id],!h){for(let t of l)if(e[t.route.id]){h=e[t.route.id];break}}if(t.signal.aborted)return{shortCircuited:!0}}if(Gn(h)){let n;return n=m&&m.replace!=null?m.replace:Tn(h.response.headers.get(`Location`),new URL(t.url),c,e.history)===w.location.pathname+w.location.search,await He(t,h,!0,{submission:i,replace:n}),{shortCircuited:!0}}if(Wn(h)){let e=Pn(l,g.route.id);return(m&&m.replace)!==!0&&(T=`PUSH`),{matches:l,pendingActionResult:[e.route.id,h,g.route.id]}}return{matches:l,pendingActionResult:[g.route.id,h]}}async function Ie(t,n,i,l,u,d,f,p,m,h,g,_,v,y){let b=f||tr(n,i,l,p),x=p||m||er(b),S=!ae&&!g;if(d){if(S){let e=Le(v);Ae({navigation:b,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await _t(i,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=Fn(s.activeRoutes);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=Pn(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}if(e.matches)i=e.matches;else{let{error:e,notFoundMatches:t,route:r}=ct(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=s.activeRoutes,{dsMatches:T,revalidatingFetchers:E}=Zt(t,u,a,o,e.history,w,i,x,n,g?[]:r,g===!0,oe,se,xe,ye,ve,C,c,e.patchRoutesOnNavigation!=null,s.branches,v,y);if(me=++ue,!e.dataStrategy&&!T.some(e=>e.shouldLoad)&&!T.some(e=>e.route.middleware&&e.route.middleware.length>0)&&E.length===0){let e=new Map(w.fetchers),t=nt(e);return je(n,{matches:i,loaderData:{},errors:v&&Wn(v[1])?{[v[0]]:v[1].error}:null,...Nn(v),...t?{fetchers:e}:{}},{flushSync:_}),{shortCircuited:!0}}if(S){let e={};if(!d){e.navigation=b;let t=Le(v);t!==void 0&&(e.actionData=t)}E.length>0&&(e.fetchers=Re(E)),Ae(e,{flushSync:_})}E.forEach(e=>{et(e.key),e.controller&&le.set(e.key,e.controller)});let D=()=>E.forEach(e=>et(e.key));ee&&ee.signal.addEventListener(`abort`,D);let{loaderResults:te,fetcherResults:ne}=await We(T,E,t,n,u);if(t.signal.aborted)return{shortCircuited:!0};ee&&ee.signal.removeEventListener(`abort`,D),E.forEach(e=>le.delete(e.key));let re=Ln(te);if(re)return await He(t,re.result,!0,{replace:h}),{shortCircuited:!0};if(re=Ln(ne),re)return ve.add(re.key),await He(t,re.result,!0,{replace:h}),{shortCircuited:!0};let ie=new Map(w.fetchers),{loaderData:O,errors:ce}=jn(w,i,te,v,E,ne,ie);g&&w.errors&&(ce={...w.errors,...ce});let de=nt(ie),fe=rt(me,ie),pe=de||fe||E.length>0;return{matches:i,loaderData:O,errors:ce,...pe?{workingFetchers:ie}:{}}}function Le(e){if(e&&!Wn(e[1]))return{[e[0]]:e[1].data};if(w.actionData)return Object.keys(w.actionData).length===0?null:w.actionData}function Re(e){let t=new Map(w.fetchers);return e.forEach(e=>{let n=t.get(e.key),r=rr(void 0,n?n.data:void 0);t.set(e.key,r)}),t}async function ze(t,n,r,i){et(t);let a=(i&&i.flushSync)===!0,o=s.activeRoutes,l=Yt(w.location,w.matches,c,r,n,i?.relative),u=Te(o,l,c,!1,s.branches),d=mt(u,o,l);if(d.active&&d.matches&&(u=d.matches),!u){Ye(t,n,In(404,{pathname:l}),{flushSync:a});return}let{path:f,submission:p,error:m}=Xt(!0,l,i);if(m){Ye(t,n,m,{flushSync:a});return}let h=e.getContext?await e.getContext():new _e,g=(i&&i.preventScrollReset)===!0;if(p&&Zn(p.formMethod)){await Be(t,n,f,u,h,d.active,a,g,p,i&&i.defaultShouldRevalidate);return}ye.set(t,{routeId:n,path:f}),await Ve(t,n,f,u,h,d.active,a,g,p)}async function Be(t,n,i,l,u,d,f,p,m,h){Ke(),ye.delete(t),Je(t,ir(m,w.fetchers.get(t)),{flushSync:f});let g=new AbortController,_=En(e.history,i,g.signal,m);if(d){let e=await _t(l,new URL(_.url).pathname,_.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Ye(t,n,e.error,{flushSync:f});return}if(e.matches)l=e.matches;else{Ye(t,n,In(404,{pathname:i}),{flushSync:f});return}}let v=$n(l,i);if(!v.route.action&&!v.route.lazy){Ye(t,n,In(405,{method:m.formMethod,pathname:i,routeId:n}),{flushSync:f});return}le.set(t,g);let y=ue,b=_n(a,o,_,i,l,v,r,u),x=await Ue(_,i,b,u,t),S=x[v.route.id];if(!S){for(let e of b)if(x[e.route.id]){S=x[e.route.id];break}}if(_.signal.aborted){le.get(t)===g&&le.delete(t);return}if(xe.has(t)){if(Gn(S)||Wn(S)){Je(t,ar(void 0));return}}else{if(Gn(S)){if(le.delete(t),me>y){Je(t,ar(void 0));return}return ve.add(t),Je(t,rr(m)),He(_,S,!1,{fetcherSubmission:m,preventScrollReset:p})}if(Wn(S)){Ye(t,n,S.error);return}}let C=w.navigation.location||w.location,E=En(e.history,C,g.signal),D=s.activeRoutes,te=w.navigation.state===`idle`?w.matches:Te(D,w.navigation.location,c,!1,s.branches);O(te,`Didn't find any matches after fetcher action`);let ne=++ue;ge.set(t,ne);let{dsMatches:re,revalidatingFetchers:ie}=Zt(E,u,a,o,e.history,w,te,m,C,r,!1,oe,se,xe,ye,ve,D,c,e.patchRoutesOnNavigation!=null,s.branches,[v.route.id,S],h),ae=rr(m,S.data),ce=new Map(w.fetchers);ce.set(t,ae),ie.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=ce.get(t),r=rr(void 0,n?n.data:void 0);ce.set(t,r),et(t),e.controller&&le.set(t,e.controller)}),Ae({fetchers:ce});let de=()=>ie.forEach(e=>et(e.key));g.signal.addEventListener(`abort`,de);let{loaderResults:fe,fetcherResults:pe}=await We(re,ie,E,C,u);if(g.signal.aborted)return;g.signal.removeEventListener(`abort`,de),ge.delete(t),le.delete(t),ie.forEach(e=>le.delete(e.key));let he=w.fetchers.has(t),_e=e=>{if(!he)return e;let n=new Map(e.fetchers);return n.set(t,ar(S.data)),{...e,fetchers:n}},be=Ln(fe);if(be)return w=_e(w),He(E,be.result,!1,{preventScrollReset:p});if(be=Ln(pe),be)return ve.add(be.key),w=_e(w),He(E,be.result,!1,{preventScrollReset:p});let k=new Map(w.fetchers);he&&k.set(t,ar(S.data));let{loaderData:Se,errors:Ce}=jn(w,te,fe,void 0,ie,pe,k);rt(ne,k),w.navigation.state===`loading`&&ne>me?(O(T,`Expected pending action`),ee&&ee.abort(),je(w.navigation.location,{matches:te,loaderData:Se,errors:Ce,fetchers:k})):(Ae({errors:Ce,loaderData:Mn(w.loaderData,Se,te,Ce),fetchers:k}),oe=!1)}async function Ve(t,n,i,s,c,l,u,d,f){let p=w.fetchers.get(t);Je(t,rr(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=En(e.history,i,m.signal);if(l){let e=await _t(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Ye(t,n,e.error,{flushSync:u});return}if(e.matches)s=e.matches;else{Ye(t,n,In(404,{pathname:i}),{flushSync:u});return}}let g=$n(s,i);le.set(t,m);let _=ue,v=await Ue(h,i,_n(a,o,h,i,s,g,r,c),c,t),y=v[g.route.id];if(!y){for(let e of s)if(v[e.route.id]){y=v[e.route.id];break}}if(le.get(t)===m&&le.delete(t),!h.signal.aborted){if(xe.has(t)){Je(t,ar(void 0));return}if(Gn(y)){if(me>_){Je(t,ar(void 0));return}ve.add(t),await He(h,y,!1,{preventScrollReset:d});return}if(Wn(y)){Ye(t,n,y.error);return}Je(t,ar(y.data))}}async function He(r,i,a,{submission:o,fetcherSubmission:s,preventScrollReset:l,replace:u}={}){a||(E?.resolve(),E=null),i.response.headers.has(`X-Remix-Revalidate`)&&(oe=!0);let d=i.response.headers.get(`Location`);O(d,`Expected a Location header on the redirect Response`);let f=d,p=new URL(r.url);d=Tn(d,p,c,e.history),kt(f,d,p,`allow-explicit`);let m=de(w.location,d,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(qe(d)){let n=he(t,d,!0);e=n.origin!==t.location.origin||Ge(n.pathname,c)==null}if(e){u?t.location.replace(d):t.location.assign(d);return}}ee=null;let h=u===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:g,formAction:_,formEncType:v}=w.navigation;!o&&!s&&g&&_&&v&&(o=er(w.navigation));let y=o||s;Ft.has(i.response.status)&&y&&Zn(y.formMethod)?await Pe(h,m,{submission:{...y,formAction:d},preventScrollReset:l||D,enableViewTransition:a?te:void 0}):await Pe(h,m,{overrideNavigation:tr(m,[],h,o),fetcherSubmission:s,preventScrollReset:l||D,enableViewTransition:a?te:void 0})}async function Ue(e,t,n,r,i){let a,o={};try{a=await vn(l,e,t,n,i,r,!1)}catch(e){return n.filter(e=>e.shouldLoad).forEach(t=>{o[t.route.id]={type:`error`,error:e}}),o}if(e.signal.aborted)return o;if(!Zn(e.method))for(let e of n){if(a[e.route.id]?.type===`error`)break;!a.hasOwnProperty(e.route.id)&&!w.loaderData.hasOwnProperty(e.route.id)&&(!w.errors||!w.errors.hasOwnProperty(e.route.id))&&e.shouldCallHandler()&&(a[e.route.id]={type:`error`,result:Error(`No result returned from dataStrategy for route ${e.route.id}`)})}for(let[t,r]of Object.entries(a))if(Un(r)){let i=r.result;o[t]={type:`redirect`,response:Sn(i,e,t,n,c)}}else o[t]=await xn(r);return o}async function We(e,t,n,r,i){let a=Ue(n,r,e,i,null),o=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await Ue(e.request,e.path,e.matches,i,e.key))[e.match.route.id];return{[e.key]:t}}return Promise.resolve({[e.key]:{type:`error`,error:In(404,{pathname:e.path})}})}));return{loaderResults:await a,fetcherResults:(await o).reduce((e,t)=>Object.assign(e,t),{})}}function Ke(){oe=!0,ye.forEach((e,t)=>{le.has(t)&&se.add(t),et(t)})}function Je(e,t,n={}){let r=new Map(w.fetchers);r.set(e,t),Ae({fetchers:r},{flushSync:(n&&n.flushSync)===!0})}function Ye(e,t,n,r={}){let i=Pn(w.matches,t),a=new Map(w.fetchers);Qe(a,e),Ae({errors:{[i.route.id]:n},fetchers:a},{flushSync:(r&&r.flushSync)===!0})}function Xe(e){return be.set(e,(be.get(e)||0)+1),xe.has(e)&&xe.delete(e),w.fetchers.get(e)||Lt}function Ze(e,t){et(e,t?.reason),Je(e,ar(null))}function Qe(e,t){let n=w.fetchers.get(t);le.has(t)&&!(n&&n.state===`loading`&&ge.has(t))&&et(t),ye.delete(t),ge.delete(t),ve.delete(t),xe.delete(t),se.delete(t),e.delete(t)}function $e(e){let t=(be.get(e)||0)-1;t<=0?(be.delete(e),xe.add(e)):be.set(e,t),Ae({fetchers:new Map(w.fetchers)})}function et(e,t){let n=le.get(e);n&&(n.abort(t),le.delete(e))}function tt(e,t){for(let n of e){let e=t.get(n);O(e,`Expected fetcher: ${n}`);let r=ar(e.data);t.set(n,r)}}function nt(e){let t=[],n=!1;for(let r of ve){let i=e.get(r);O(i,`Expected fetcher: ${r}`),i.state===`loading`&&(ve.delete(r),t.push(r),n=!0)}return tt(t,e),n}function rt(e,t){let n=[];for(let[r,i]of ge)if(i<e){let e=t.get(r);O(e,`Expected fetcher: ${r}`),e.state===`loading`&&(et(r),ge.delete(r),n.push(r))}return tt(n,t),n.length>0}function it(e,t){let n=w.blockers.get(e)||Rt;return k.get(e)!==t&&k.set(e,t),n}function at(e){w.blockers.delete(e),k.delete(e)}function ot(e,t){let n=w.blockers.get(e)||Rt;O(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: ${n.state} -> ${t.state}`);let r=new Map(w.blockers);r.set(e,t),Ae({blockers:r})}function st({currentLocation:e,nextLocation:t,historyAction:n}){if(k.size===0)return;k.size>1&&ce(!1,`A router only supports one blocker at a time`);let r=Array.from(k.entries()),[i,a]=r[r.length-1],o=w.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function ct(e){let t=In(404,{pathname:e}),n=s.activeRoutes,{matches:r,route:i}=Fn(n);return{notFoundMatches:r,route:i,error:t}}function lt(e,t,n){if(m=e,g=t,h=n||null,!_&&w.navigation===It){_=!0;let e=pt(w.location,w.matches);e!=null&&Ae({restoreScrollPosition:e})}return()=>{m=null,g=null,h=null}}function dt(e,t){return h&&h(e,t.map(e=>Ee(e,w.loaderData)))||e.key}function ft(e,t){if(m&&g){let n=dt(e,t);m[n]=g()}}function pt(e,t){if(m){let n=dt(e,t),r=m[n];if(typeof r==`number`)return r}return null}function mt(t,n,r){if(e.patchRoutesOnNavigation){let e=s.branches;if(!t)return{active:!0,matches:Te(n,r,c,!0,e)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:Te(n,r,c,!0,e)}}return{active:!1,matches:null}}async function _t(t,n,r,i){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let l=t;for(;;){let t=o;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:l,fetcherKey:i,patch:(e,n)=>{r.aborted||rn(e,n,s,t,a,!1)}})}catch(e){return{type:`error`,error:e,partialMatches:l}}if(r.aborted)return{type:`aborted`};let u=s.branches,d=Te(s.activeRoutes,n,c,!1,u),f=null;if(d&&(Object.keys(d[0].params).length===0||(f=Te(s.activeRoutes,n,c,!0,u),!(f&&l.length<f.length&&vt(l,f.slice(0,l.length))))))return{type:`success`,matches:d};if(f||=Te(s.activeRoutes,n,c,!0,u),!f||vt(l,f))return{type:`success`,matches:null};l=f}}function vt(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function yt(e){o={},s.setHmrRoutes(Se(e,a,void 0,o))}function bt(e,t,n=!1){rn(e,t,s,o,a,n),s.hasHMRRoutes||Ae({})}return C={get basename(){return c},get future(){return u},get state(){return w},get routes(){return s.stableRoutes},get branches(){return s.branches},get manifest(){return o},get window(){return t},initialize:De,subscribe:ke,enableScrollRestoration:lt,navigate:Me,fetch:ze,revalidate:Ne,createHref:t=>e.history.createHref(t),createURL:t=>e.history.createURL(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Xe,resetFetcher:Ze,deleteFetcher:$e,dispose:Oe,getBlocker:it,deleteBlocker:at,patchRoutes:bt,_internalFetchControllers:le,_internalSetRoutes:yt,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){Ae(e)}},e.instrumentations&&(C=gt(C,e.instrumentations.map(e=>e.router).filter(Boolean))),C}function Jt(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function Yt(e,t,n,r,i,a){let o,s;if(i){o=[];for(let e of t)if(o.push(e),e.route.id===i){s=e;break}}else o=t,s=t[t.length-1];let c=$e(r||`.`,Qe(o),Ge(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=Qn(c.search);if(s.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,`?index&`):`?index`;else if(!s.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();c.search=n?`?${n}`:``}}return n!==`/`&&(c.pathname=Ke({basename:n,pathname:c.pathname})),fe(c)}function Xt(e,t,n){if(!n||!Jt(n))return{path:t};if(n.formMethod&&!Xn(n.formMethod))return{path:t,error:In(405,{method:n.formMethod})};let r=()=>({path:t,error:In(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=Rn(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!Zn(i))return r();let e=typeof n.body==`string`?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}
10
10
  `,``):String(n.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}if(n.formEncType===`application/json`){if(!Zn(i))return r();try{let e=typeof n.body==`string`?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch{return r()}}}O(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=On(n.formData),s=n.formData;else if(n.body instanceof FormData)o=On(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=kn(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=kn(o)}catch{return r()}let c={formMethod:i,formAction:a,formEncType:n&&n.formEncType||`application/x-www-form-urlencoded`,formData:s,json:void 0,text:void 0};if(Zn(c.formMethod))return{path:t,submission:c};let l=pe(t);return e&&l.search&&Qn(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:fe(l),submission:c}}function Zt(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x){let S=b?Wn(b[1])?b[1].error:b[1].data:void 0,C=i.createURL(a.location),w=i.createURL(c),T;if(u&&a.errors){let e=Object.keys(a.errors)[0];T=o.findIndex(t=>t.route.id===e)}else if(b&&Wn(b[1])){let e=b[0];T=o.findIndex(t=>t.route.id===e)-1}let E=b?b[1].statusCode:void 0,D=E&&E>=400,ee={currentUrl:C,currentParams:a.matches[0]?.params||{},nextUrl:w,nextParams:o[0].params,...s,actionResult:S,actionStatus:E},te=dt(o),ne=o.map((i,o)=>{let{route:s}=i,f=null;if(T!=null&&o>T)f=!1;else if(s.lazy)f=!0;else if(!Qt(s))f=!1;else if(u){let{shouldLoad:e}=$t(s,a.loaderData,a.errors);f=e}else en(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return gn(n,r,e,c,te,i,l,t,f);let p=!1;typeof x==`boolean`?p=x:D?p=!1:d||C.pathname+C.search===w.pathname+w.search?p=!0:C.search===w.search?tn(a.matches[o],i)&&(p=!0):p=!0;let m={...ee,defaultShouldRevalidate:p},h=nn(i,m);return gn(n,r,e,c,te,i,l,t,h,m,x)}),re=[];return m.forEach((e,s)=>{if(u||!o.some(t=>t.route.id===e.routeId)||p.has(s))return;let c=a.fetchers.get(s),m=c&&c.state!==`idle`&&c.data===void 0,b=Te(g,e.path,_??`/`,!1,y);if(!b){if(v&&m)return;re.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let S=$n(b,e.path),C=new AbortController,w=En(i,e.path,C.signal),T=null;if(f.has(s))f.delete(s),T=_n(n,r,w,e.path,b,S,l,t);else if(m)d&&(T=_n(n,r,w,e.path,b,S,l,t));else{let i;i=typeof x==`boolean`?x:!D&&d;let a={...ee,defaultShouldRevalidate:i};nn(S,a)&&(T=_n(n,r,w,e.path,b,S,l,t,a))}T&&re.push({key:s,routeId:e.routeId,path:e.path,matches:T,match:S,request:w,controller:C})}),{dsMatches:ne,revalidatingFetchers:re}}function Qt(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function $t(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!Qt(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;if(!r&&i)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader==`function`&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!i;return{shouldLoad:a,renderFallback:a}}function en(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function tn(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function nn(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function rn(e,t,n,r,i,a){let o;if(e){let t=r[e];O(t,`No route found to patch children into: routeId = ${e}`),t.children||=[],o=t.children}else o=n.activeRoutes;let s=[],c=[];if(t.forEach(e=>{let t=o.find(t=>an(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=Se(s,i,[e||`_`,`patch`,String(o?.length||`0`)],r);o.push(...t)}if(a&&c.length>0)for(let e=0;e<c.length;e++){let{existingRoute:t,newRoute:n}=c[e],r=t,[a]=Se([n],i,[],{},!0);Object.assign(r,{element:a.element?a.element:r.element,errorElement:a.errorElement?a.errorElement:r.errorElement,hydrateFallbackElement:a.hydrateFallbackElement?a.hydrateFallbackElement:r.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function an(e,t){return`id`in e&&`id`in t&&e.id===t.id?!0:e.index!==t.index||e.path!==t.path||e.caseSensitive!==t.caseSensitive?!1:(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((e,n)=>t.children?.some(t=>an(e,t)))??!1}var on=new WeakMap,sn=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(O(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=on.get(i);o||(o={},on.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=ye(e),n=i[e]!==void 0&&e!==`hasErrorBoundary`;if(t)ce(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)ce(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let t=await a();t!=null&&(Object.assign(i,{[e]:t}),Object.assign(i,r(i)))}typeof i.lazy==`object`&&(i.lazy[e]=void 0,Object.values(i.lazy).every(e=>e===void 0)&&(i.lazy=void 0))})();return o[e]=c,c},cn=new WeakMap;function ln(e,t,n,r,i){let a=n[e.id];if(O(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=cn.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{O(typeof e.lazy==`function`,`No lazy route function found`);let t=await e.lazy(),n={};for(let e in t){let r=t[e];if(r===void 0)continue;let i=xe(e),o=a[e]!==void 0&&e!==`hasErrorBoundary`;i?ce(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?ce(!o,`Route "${a.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(a,n),Object.assign(a,{...r(a),lazy:void 0})})();return cn.set(a,n),n.catch(()=>{}),{lazyRoutePromise:n,lazyHandlerPromise:n}}let o=Object.keys(e.lazy),s=[],c;for(let a of o){if(i&&i.includes(a))continue;let o=sn({key:a,route:e,manifest:n,mapRouteProperties:r});o&&(s.push(o),a===t&&(c=o))}let l=s.length>0?Promise.all(s).then(()=>{}):void 0;return l?.catch(()=>{}),c?.catch(()=>{}),{lazyRoutePromise:l,lazyHandlerPromise:c}}async function un(e){let t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function dn(e){return e.matches.some(e=>e.route.middleware)?fn(e,()=>un(e)):un(e)}function fn(e,t){return pn(e,t,e=>{if(Yn(e))throw e;return e},Vn,n);function n(t,n,r){if(r)return Promise.resolve(Object.assign(r.value,{[n]:{type:`error`,result:t}}));{let{matches:r}=e,i=Pn(r,r[Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0))].route.id).route.id;return Promise.resolve({[i]:{type:`error`,result:t}})}}}async function pn(e,t,n,r,i){let{matches:a,...o}=e;return await mn(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function mn(e,t,n,r,i,a,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??Error(`Request aborted: ${s.method} ${s.url}`);let c=t[o];if(!c)return await n();let[l,u]=c,d,f=async()=>{if(d)throw Error("You may only call `next()` once per middleware");try{return d={value:await mn(e,t,n,r,i,a,o+1)},d.value}catch(e){return d={value:await a(e,l,d)},d.value}};try{let t=await u(e,f),n=t==null?void 0:r(t);return i(n)?n:d?n??d.value:(d={value:await f()},d.value)}catch(e){return await a(e,l,d)}}function hn(e,t,n,r,i){let a=sn({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=ln(r.route,Zn(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function gn(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=hn(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?nn(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?nn(a,{...l,defaultShouldRevalidate:e}):nn(a,l):c},resolve(e){let{lazy:t,loader:o,middleware:l}=a.route,u=d||c||e&&!Zn(n.method)&&(t||o),p=l&&l.length>0&&!o&&!t;return u&&(Zn(n.method)||!p)?yn({request:n,path:r,pattern:i,match:a,lazyHandlerPromise:f?.handler,lazyRoutePromise:f?.route,handlerOverride:e,scopedContext:s}):Promise.resolve({type:`data`,result:void 0})}}}function _n(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?gn(e,t,n,r,dt(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:hn(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function vn(e,t,n,r,i,a,o){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));let s={request:t,url:Dn(t,n),pattern:dt(r),params:r[0].params,context:a,matches:r},c=o?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:e=>{let t=s;return fn(t,()=>e({...t,fetcherKey:i,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},l=await e({...s,fetcherKey:i,runClientMiddleware:c});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return l}async function yn({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let c,l,u=Zn(e.method),d=u?`action`:`loader`,f=i=>{let a,c=new Promise((e,t)=>a=t);l=()=>a(),e.signal.addEventListener(`abort`,l);let u=a=>typeof i==`function`?i({request:e,url:Dn(e,t),pattern:n,params:r.params,context:s},...a===void 0?[]:[a]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${d}" [routeId: ${r.route.id}]`)),f=(async()=>{try{return{type:`data`,result:await(o?o(e=>u(e)):u())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([f,c])};try{let t=u?r.route.action:r.route.loader;if(i||a){if(t){let e,[n]=await Promise.all([f(t).catch(t=>{e=t}),i,a]);if(e!==void 0)throw e;c=n}else{await i;let t=u?r.route.action:r.route.loader;if(t)[c]=await Promise.all([f(t),a]);else if(d===`action`){let t=new URL(e.url),n=t.pathname+t.search;throw In(405,{method:e.method,pathname:n,routeId:r.route.id})}else return{type:`data`,result:void 0}}}else if(t)c=await f(t);else{let t=new URL(e.url);throw In(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{l&&e.signal.removeEventListener(`abort`,l)}return c}async function bn(e){let t=e.headers.get(`Content-Type`);return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function xn(e){let{result:t,type:n}=e;if(qn(t)){let e;try{e=await bn(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new lt(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?Kn(t)?t.data instanceof Error?{type:`error`,error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:Bn(t),statusCode:ut(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:ut(t)?t.status:void 0}:Kn(t)?{type:`data`,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`data`,data:t}}function Sn(e,t,n,r,i){let a=e.headers.get(`Location`);if(O(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!qe(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=Yt(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var Cn=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function wn(e){try{return Cn.includes(new URL(e).protocol)}catch{return!1}}function Tn(e,t,n,r){if(qe(e)){let r=e,i=re.test(r)?new URL(ie(r,t.protocol)):new URL(r);if(wn(i.toString()))throw Error(`Invalid redirect location`);let a=Ge(i.pathname,n)!=null;if(i.origin===t.origin&&a)return et(i.pathname)+i.search+i.hash}try{if(wn(r.createURL(e).toString()))throw Error(`Invalid redirect location`)}catch{}return e}function En(e,t,n,r){let i=e.createURL(Rn(t)).toString(),a={signal:n};if(r&&Zn(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),t===`application/json`?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):a.body=t===`text/plain`?r.text:t===`application/x-www-form-urlencoded`&&r.formData?On(r.formData):r.formData}return new Request(i,a)}function Dn(e,t){let n=new URL(e.url),r=typeof t==`string`?pe(t):t;if(n.pathname=r.pathname||`/`,r.search){let e=new URLSearchParams(r.search),t=e.getAll(`index`);e.delete(`index`);for(let n of t.filter(Boolean))e.append(`index`,n);n.search=e.size?`?${e.toString()}`:``}else n.search=``;return n.hash=r.hash||``,n}function On(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function kn(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function An(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,l={},u=n&&Wn(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let d=n.route.id,f=t[d];if(O(!Gn(f),`Cannot handle redirect results in processLoaderData`),Wn(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o||={},i)o[d]=t;else{let n=Pn(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=Vt),c||(c=!0,s=ut(f.error)?f.error.status:500),f.headers&&(l[d]=f.headers)}else a[d]=f.data,f.statusCode&&f.statusCode!==200&&!c&&(s=f.statusCode),f.headers&&(l[d]=f.headers)}),u!==void 0&&n&&(o={[n[0]]:u},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:l}}function jn(e,t,n,r,i,a,o){let{loaderData:s,errors:c}=An(t,n,r);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:n,match:r,controller:i}=t;if(i&&i.signal.aborted)return;let s=a[n];if(O(s,`Did not find corresponding fetcher result`),Wn(s)){let t=Pn(e.matches,r?.route.id);c&&c[t.route.id]||(c={...c,[t.route.id]:s.error}),o.delete(n)}else if(Gn(s))O(!1,`Unhandled fetcher revalidation redirect`);else{let e=ar(s.data);o.set(n,e)}}),{loaderData:s,errors:c}}function Mn(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==Vt).reduce((e,[t,n])=>(e[t]=n,e),{});for(let a of n){let n=a.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&a.route.loader&&(i[n]=e[n]),r&&r.hasOwnProperty(n))break}return i}function Nn(e){return e?Wn(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Pn(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.hasErrorBoundary===!0)||e[0]}function Fn(e){let t=e.length===1?e[0]:e.find(e=>e.index||!e.path||e.path===`/`)||{id:`__shim-error-route__`};return{matches:[{params:{},pathname:``,pathnameBase:``,route:t}],route:t}}function In(e,{pathname:t,routeId:n,method:r,type:i,message:a}={}){let o=`Unknown Server Error`,s=`Unknown @remix-run/router error`;return e===400?(o=`Bad Request`,r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i===`invalid-body`&&(s=`Unable to encode submission body`)):e===403?(o=`Forbidden`,s=`Route "${n}" does not match URL "${t}"`):e===404?(o=`Not Found`,s=`No route matches URL "${t}"`):e===405&&(o=`Method Not Allowed`,r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new lt(e||500,o,Error(s),!0)}function Ln(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(Gn(r))return{key:n,result:r}}}function Rn(e){return fe({...typeof e==`string`?pe(e):e,hash:``})}function zn(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash||t.hash!==``}function Bn(e){return new lt(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function Vn(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&Hn(t))}function Hn(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function Un(e){return qn(e.result)&&Pt.has(e.result.status)}function Wn(e){return e.type===`error`}function Gn(e){return(e&&e.type)===`redirect`}function Kn(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function qn(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function Jn(e){return Pt.has(e)}function Yn(e){return qn(e)&&Jn(e.status)&&e.headers.has(`Location`)}function Xn(e){return Nt.has(e.toUpperCase())}function Zn(e){return jt.has(e.toUpperCase())}function Qn(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function $n(e,t){let n=typeof t==`string`?pe(t).search:t.search;if(e[e.length-1].route.index&&Qn(n||``))return e[e.length-1];let r=Ze(e);return r[r.length-1]}function er(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(t&&n&&r){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function tr(e,t,n,r){return r?{state:`loading`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:`loading`,location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function nr(e,t,n,r){return{state:`submitting`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function rr(e,t){return e?{state:`loading`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:`loading`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function ir(e,t){return{state:`submitting`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function ar(e){return{state:`idle`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function or(e,t){try{let n=e.sessionStorage.getItem(Bt);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch{}}function sr(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(Bt,JSON.stringify(n))}catch(e){ce(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function cr(){let e,t,n=new Promise((r,i)=>{e=async e=>{r(e);try{await n}catch{}},t=async e=>{i(e);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var lr=v.createContext(null);lr.displayName=`DataRouter`;var ur=v.createContext(null);ur.displayName=`DataRouterState`;var dr=v.createContext(!1);function fr(){return v.useContext(dr)}var pr=v.createContext({isTransitioning:!1});pr.displayName=`ViewTransition`;var mr=v.createContext(new Map);mr.displayName=`Fetchers`;var hr=v.createContext(null);hr.displayName=`Await`;var gr=v.createContext(null);gr.displayName=`Navigation`;var _r=v.createContext(null);_r.displayName=`Location`;var vr=v.createContext({outlet:null,matches:[],isDataRoute:!1});vr.displayName=`Route`;var yr=v.createContext(null);yr.displayName=`RouteError`;var br=`REACT_ROUTER_ERROR`,xr=`REDIRECT`,Sr=`ROUTE_ERROR_RESPONSE`;function Cr(e){if(e.startsWith(`${br}:${xr}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function wr(e){if(e.startsWith(`${br}:${Sr}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new lt(t.status,t.statusText,t.data)}catch{}}function Tr(e,{relative:t}={}){O(Er(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=v.useContext(gr),{hash:i,pathname:a,search:o}=Mr(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:tt([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Er(){return v.useContext(_r)!=null}function Dr(){return O(Er(),`useLocation() may be used only in the context of a <Router> component.`),v.useContext(_r).location}var Or=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function kr(e){v.useContext(gr).static||v.useLayoutEffect(e)}function Ar(){let{isDataRoute:e}=v.useContext(vr);return e?Xr():jr()}function jr(){O(Er(),`useNavigate() may be used only in the context of a <Router> component.`);let e=v.useContext(lr),{basename:t,navigator:n}=v.useContext(gr),{matches:r}=v.useContext(vr),{pathname:i}=Dr(),a=JSON.stringify(Qe(r)),o=v.useRef(!1);return kr(()=>{o.current=!0}),v.useCallback((r,s={})=>{if(ce(o.current,Or),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=$e(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:tt([t,c.pathname])),kt(typeof r==`string`?r:fe(r),n.createHref(c),Et(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}v.createContext(null);function Mr(e,{relative:t}={}){let{matches:n}=v.useContext(vr),{pathname:r}=Dr(),i=JSON.stringify(Qe(n));return v.useMemo(()=>$e(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Nr(e,t,n){O(Er(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=v.useContext(gr),{matches:i}=v.useContext(vr),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;Qr(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
11
11
 
12
- Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=Dr(),d;if(t){let e=typeof t==`string`?pe(t):t;O(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):we(e,{pathname:p});ce(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),ce(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=Br(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:tt([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:tt([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?v.createElement(_r.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function Pr(){let e=qr(),t=ut(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=v.createElement(v.Fragment,null,v.createElement(`p`,null,`💿 Hey developer 👋`),v.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,v.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,v.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),v.createElement(v.Fragment,null,v.createElement(`h2`,null,`Unexpected Application Error!`),v.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?v.createElement(`pre`,{style:i},n):null,o)}var Fr=v.createElement(Pr,null),Ir=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=wr(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:v.createElement(vr.Provider,{value:this.props.routeContext},v.createElement(yr.Provider,{value:e,children:this.props.component}));return this.context?v.createElement(Rr,{error:e},t):t}};Ir.contextType=dr;var Lr=new WeakMap;function Rr({children:e,error:t}){let{basename:n,navigator:r}=v.useContext(gr);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Cr(t.digest);if(e){let i=Lr.get(t);if(i)throw i;let a=pt(e.location,n),o=a.absoluteURL||a.to;if(kt(e.location,o,Et(r),`allow-explicit`),wn(o))throw Error(`Invalid redirect location`);if(ft&&!Lr.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw Lr.set(t,n),n}}return v.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function zr({routeContext:e,match:t,children:n}){let r=v.useContext(lr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(vr.Provider,{value:e},n)}function Br(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);O(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:dt(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||Fr,o&&(s<0&&c===0?(Qr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?v.createElement(n.route.Component,null):n.route.element?n.route.element:e,v.createElement(zr,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?v.createElement(Ir,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function Vr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Hr(e){let t=v.useContext(lr);return O(t,Vr(e)),t}function Ur(e){let t=v.useContext(ur);return O(t,Vr(e)),t}function Wr(e){let t=v.useContext(vr);return O(t,Vr(e)),t}function Gr(e){let t=Wr(e),n=t.matches[t.matches.length-1];return O(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Kr(){return Gr(`useRouteId`)}function qr(){let e=v.useContext(yr),t=Ur(`useRouteError`),n=Gr(`useRouteError`);return e===void 0?t.errors?.[n]:e}var Jr=0;function Yr(e){let{router:t,basename:n}=Hr(`useBlocker`),r=Ur(`useBlocker`),[i,a]=v.useState(``),o=v.useCallback(t=>{if(typeof e!=`function`)return!!e;if(n===`/`)return e(t);let{currentLocation:r,nextLocation:i,historyAction:a}=t;return e({currentLocation:{...r,pathname:Ge(r.pathname,n)||r.pathname},nextLocation:{...i,pathname:Ge(i.pathname,n)||i.pathname},historyAction:a})},[n,e]);return v.useEffect(()=>{let e=String(++Jr);return a(e),()=>t.deleteBlocker(e)},[t]),v.useEffect(()=>{i!==``&&t.getBlocker(i,o)},[t,i,o]),i&&r.blockers.has(i)?r.blockers.get(i):Rt}function Xr(){let{router:e}=Hr(`useNavigate`),t=Gr(`useNavigate`),n=v.useRef(!1);return kr(()=>{n.current=!0}),v.useCallback(async(r,i={})=>{ce(n.current,Or),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Zr={};function Qr(e,t,n){!t&&!Zr[e]&&(Zr[e]=!0,ce(!1,n))}var $r={};function ei(e,t){!e&&!$r[t]&&($r[t]=!0,console.warn(t))}var ti=v.useOptimistic,ni=()=>void 0;function ri(e){return ti?ti(e):[e,ni]}function ii(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&ce(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:v.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&ce(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:v.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&ce(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:v.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var ai=[`HydrateFallback`,`hydrateFallbackElement`],oi=class{constructor(){this.status=`pending`,this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function si({router:e,flushSync:t,onError:n,useTransitions:r}){r=fr()||r;let[i,a]=v.useState(e.state),[o,s]=ri(i),[c,l]=v.useState(),[u,d]=v.useState({isTransitioning:!1}),[f,p]=v.useState(),[m,h]=v.useState(),[g,_]=v.useState(),y=v.useRef(new Map),b=v.useCallback((i,{deletedFetchers:o,newErrors:c,flushSync:u,viewTransitionOpts:g})=>{c&&n&&Object.values(c).forEach(e=>n(e,{location:i.location,params:i.matches[0]?.params??{},pattern:dt(i.matches)})),i.fetchers.forEach((e,t)=>{e.data!==void 0&&y.current.set(t,e.data)}),o.forEach(e=>y.current.delete(e)),ei(u===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let b=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(ei(g==null||b,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!g||!b){t&&u?t(()=>a(i)):r===!1?a(i):v.startTransition(()=>{r===!0&&s(e=>ci(e,i)),a(i)});return}if(t&&u){t(()=>{m&&(f?.resolve(),m.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:g.currentLocation,nextLocation:g.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>a(i))});n.finished.finally(()=>{t(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})})}),t(()=>h(n));return}m?(f?.resolve(),m.skipTransition(),_({state:i,currentLocation:g.currentLocation,nextLocation:g.nextLocation})):(l(i),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}))},[e.window,t,m,f,r,s,n]);v.useLayoutEffect(()=>e.subscribe(b),[e,b]),v.useEffect(()=>{u.isTransitioning&&!u.flushSync&&p(new oi)},[u]),v.useEffect(()=>{if(f&&c&&e.window){let t=c,n=f.promise,i=e.window.document.startViewTransition(async()=>{r===!1?a(t):v.startTransition(()=>{r===!0&&s(e=>ci(e,t)),a(t)}),await n});i.finished.finally(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})}),h(i)}},[c,f,e.window,r,s]),v.useEffect(()=>{f&&c&&o.location.key===c.location.key&&f.resolve()},[f,m,o.location,c]),v.useEffect(()=>{!u.isTransitioning&&g&&(l(g.state),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),_(void 0))},[u.isTransitioning,g]);let x=v.useMemo(()=>({createHref:e.createHref,createURL:e.createURL,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),S=e.basename||`/`,C=v.useMemo(()=>({router:e,navigator:x,static:!1,basename:S,onError:n}),[e,x,S,n]);return v.createElement(v.Fragment,null,v.createElement(lr.Provider,{value:C},v.createElement(ur.Provider,{value:o},v.createElement(mr.Provider,{value:y.current},v.createElement(pr.Provider,{value:u},v.createElement(di,{basename:S,location:o.location,navigationType:o.historyAction,navigator:x,useTransitions:r},v.createElement(li,{routes:e.routes,manifest:e.manifest,future:e.future,state:o,isStatic:!1,onError:n})))))),null)}function ci(e,t){return{...e,navigation:t.navigation.state===`idle`?e.navigation:t.navigation,revalidation:t.revalidation===`idle`?e.revalidation:t.revalidation,actionData:t.navigation.state===`submitting`?e.actionData:t.actionData,fetchers:t.fetchers}}var li=v.memo(ui);function ui({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Nr(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function di({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){O(!Er(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=v.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=pe(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=v.useMemo(()=>{let e=Ge(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return ce(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:v.createElement(gr.Provider,{value:c},v.createElement(_r.Provider,{children:t,value:h}))}v.Component;var fi=`get`,pi=`application/x-www-form-urlencoded`;function mi(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function hi(e){return mi(e)&&e.tagName.toLowerCase()===`button`}function gi(e){return mi(e)&&e.tagName.toLowerCase()===`form`}function _i(e){return mi(e)&&e.tagName.toLowerCase()===`input`}function vi(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function yi(e,t){return e.button===0&&(!t||t===`_self`)&&!vi(e)}var bi=null;function xi(){if(bi===null)try{new FormData(document.createElement(`form`),0),bi=!1}catch{bi=!0}return bi}var Si=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Ci(e){return e!=null&&!Si.has(e)?(ce(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${pi}"`),null):e}function wi(e,t){let n,r,i,a,o;if(gi(e)){let o=e.getAttribute(`action`);r=o?Ge(o,t):null,n=e.getAttribute(`method`)||fi,i=Ci(e.getAttribute(`enctype`))||pi,a=new FormData(e)}else if(hi(e)||_i(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?Ge(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||fi,i=Ci(e.getAttribute(`formenctype`))||Ci(o.getAttribute(`enctype`))||pi,a=new FormData(o,e),!xi()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(mi(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=fi,r=null,i=pi,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function Ti(e,t){if(e===!1||e==null)throw Error(t)}function Ei(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&Ge(i.pathname,t)===`/`?`${nt(t)}/_root.${r}`:`${nt(i.pathname)}.${r}`,i}async function Di(e,t){if(e.id in t)return t[e.id];try{let n=await w(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Oi(e){return e!=null&&typeof e.page==`string`}function ki(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Ai(e,t,n){return Fi((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Di(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(ki).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function ji(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Mi(e,t,{includeHydrateFallback:n}={}){return Ni(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Ni(e){return[...new Set(e)]}function Pi(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Fi(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Oi(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Pi(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Ii(){let e=v.useContext(lr);return Ti(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Li(){let e=v.useContext(ur);return Ti(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Ri=v.createContext(void 0);Ri.displayName=`FrameworkContext`;function zi(){let e=v.useContext(Ri);return Ti(e,`You must render this element inside a <HydratedRouter> element`),e}function Bi(e,t){let n=v.useContext(Ri),[r,i]=v.useState(!1),[a,o]=v.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=v.useRef(null);v.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),v.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:Vi(s,p),onBlur:Vi(c,m),onMouseEnter:Vi(l,p),onMouseLeave:Vi(u,m),onTouchStart:Vi(d,p)}]:[a,f,{}]:[!1,f,{}]}function Vi(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Hi({page:e,...t}){let n=fr(),{nonce:r}=zi(),{router:i}=Ii(),a=v.useMemo(()=>we(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?v.createElement(Wi,{page:e,matches:a,...t}):v.createElement(Gi,{page:e,matches:a,...t})):null}function Ui(e){let{manifest:t,routeModules:n}=zi(),[r,i]=v.useState([]);return v.useEffect(()=>{let r=!1;return Ai(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Wi({page:e,matches:t,...n}){let r=Dr(),{future:i}=zi(),{basename:a}=Ii(),o=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Ei(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return v.createElement(v.Fragment,null,o.map(e=>v.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Gi({page:e,matches:t,...n}){let r=Dr(),{future:i,manifest:a,routeModules:o}=zi(),{basename:s}=Ii(),{loaderData:c,matches:l}=Li(),u=v.useMemo(()=>ji(e,t,l,a,r,`data`),[e,t,l,a,r]),d=v.useMemo(()=>ji(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];t&&t.hasLoader&&(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Ei(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=v.useMemo(()=>Mi(d,a),[d,a]),m=Ui(d);return v.createElement(v.Fragment,null,f.map(e=>v.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>v.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>v.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Ki(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}v.Component;var qi=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{qi&&(window.__reactRouterVersion=`7.18.4`)}catch{}function Ji(e,t){return qt({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:se({window:t?.window}),hydrationData:t?.hydrationData||Yi(),routes:e,mapRouteProperties:ii,hydrationRouteProperties:ai,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function Yi(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:Xi(e.errors)}),e}function Xi(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new lt(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(typeof r.__subType==`string`&&ct.includes(r.__subType)){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}var Zi=v.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=v.useContext(gr),y=typeof l==`string`&&ne.test(l),b=pt(l,h);l=b.to;let x=Tr(l,{relative:r}),S=Dr(),C=null;if(o){let e=$e(o,[],S.mask?S.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:tt([h,e.pathname])),C=g.createHref(e)}let[w,T,E]=Bi(n,p),D=na(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function ee(t){e&&e(t),t.defaultPrevented||D(t)}let te=!(b.isExternal||i),re=v.createElement(`a`,{...p,...E,href:(te?C:void 0)||b.absoluteURL||x,onClick:te?ee:e,ref:Ki(m,T),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return w&&!y?v.createElement(v.Fragment,null,re,v.createElement(Hi,{page:x})):re});Zi.displayName=`Link`;var Qi=v.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Mr(a,{relative:c.relative}),d=Dr(),f=v.useContext(ur),{navigator:p,basename:m}=v.useContext(gr),h=f!=null&&sa(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,y=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),y=y?y.toLowerCase():null,g=g.toLowerCase()),y&&m&&(y=Ge(y,m)||y);let b=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,x=_===g||!r&&_.startsWith(g)&&_.charAt(b)===`/`,S=y!=null&&(y===g||!r&&y.startsWith(g)&&y.charAt(g.length)===`/`),C={isActive:x,isPending:S,isTransitioning:h},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return v.createElement(Zi,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});Qi.displayName=`NavLink`;var $i=v.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=fi,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=v.useContext(gr),g=aa(),_=oa(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&ne.test(s);return v.createElement(`form`,{ref:m,method:y,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?v.startTransition(()=>p()):p()},...p,"data-discover":!b&&e===`render`?`true`:void 0})});$i.displayName=`Form`;function ea(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ta(e){let t=v.useContext(lr);return O(t,ea(e)),t}function na(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=Ar(),d=Dr(),f=Mr(e,{relative:o});return v.useCallback(p=>{if(yi(p,t)){p.preventDefault();let t=n===void 0?fe(d)===fe(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?v.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var ra=0,ia=()=>`__${String(++ra)}__`;function aa(){let{router:e}=ta(`useSubmit`),{basename:t}=v.useContext(gr),n=Kr(),r=e.fetch,i=e.navigate;return v.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=wi(e,t);if(a.navigate===!1){let e=a.fetcherKey||ia();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function oa(e,{relative:t}={}){let{basename:n}=v.useContext(gr),r=v.useContext(vr);O(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Mr(e||`.`,{relative:t})},o=Dr();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:tt([n,a.pathname])),fe(a)}function sa(e,{relative:t}={}){let n=v.useContext(pr);O(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=ta(`useViewTransitionState`),i=Mr(e,{relative:t});if(!n.isTransitioning)return!1;let a=Ge(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Ge(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ve(i.pathname,o)!=null||Ve(i.pathname,a)!=null}function ca(e){return v.createElement(si,{flushSync:y.flushSync,...e})}var A=e=>typeof e==`string`,la=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},ua=e=>e==null?``:``+e,da=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},fa=/###/g,pa=e=>e&&e.indexOf(`###`)>-1?e.replace(fa,`.`):e,j=e=>!e||A(e),ma=(e,t,n)=>{let r=A(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(j(e))return{};let t=pa(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return j(e)?{}:{obj:e,k:pa(r[i])}},ha=(e,t,n)=>{let{obj:r,k:i}=ma(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=ma(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=ma(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},ga=(e,t,n,r)=>{let{obj:i,k:a}=ma(e,t,Object);i[a]=i[a]||[],i[a].push(n)},_a=(e,t)=>{let{obj:n,k:r}=ma(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},va=(e,t,n)=>{let r=_a(e,n);return r===void 0?_a(t,n):r},ya=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(r in e?A(e[r])||e[r]instanceof String||A(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):ya(e[r],t[r],n):e[r]=t[r]);return e},ba=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),xa={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`,"/":`&#x2F;`},Sa=e=>A(e)?e.replace(/[&<>"'\/]/g,e=>xa[e]):e,Ca=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},wa=[` `,`,`,`?`,`!`,`;`],Ta=new Ca(20),Ea=(e,t,n)=>{t||=``,n||=``;let r=wa.filter(e=>t.indexOf(e)<0&&n.indexOf(e)<0);if(r.length===0)return!0;let i=Ta.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},Da=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].indexOf(typeof t)>-1&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},Oa=e=>e?.replace(/_/g,`-`),ka={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}},Aa=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||ka,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,t,n,r){return r&&!this.debug?null:(A(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t||=this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},ja=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n.apply(n,[e,...t])})}},Ma=class extends ja{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let i=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,a=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,o;e.indexOf(`.`)>-1?o=e.split(`.`):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):A(n)&&i?o.push(...n.split(i)):o.push(n)));let s=_a(this.data,o);return!s&&!t&&!n&&e.indexOf(`.`)>-1&&(e=o[0],t=o[1],n=o.slice(2).join(`.`)),s||!a||!A(n)?s:Da(this.data?.[e]?.[t],n,i)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.indexOf(`.`)>-1&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),ha(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(A(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.indexOf(`.`)>-1&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=_a(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?ya(s,n,i):s={...s,...n},ha(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||=this.options.defaultNS,this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},Na={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}},Pa=Symbol(`i18next/PATH_KEY`);function Fa(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===Pa?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function Ia(e,t){let{[Pa]:n}=e(Fa()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`;if(n.length>1&&i){let e=t?.ns,a=Array.isArray(e)?e:null;if(a&&a.length>1&&a.slice(1).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}var La={},Ra=e=>!A(e)&&typeof e!=`boolean`&&typeof e!=`number`,za=class e extends ja{constructor(e,t={}){super(),da([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=Aa.create(`translator`)}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=Ra(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,i=t.ns||this.options.defaultNS||[],a=n&&e.indexOf(n)>-1,o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!Ea(e,n,r);if(a&&!o){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:A(i)?[i]:i};let a=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(a[0])>-1)&&(i=a.shift()),e=a.join(r)}return{key:e,namespaces:A(i)?[i]:i}}translate(t,n,r){let i=typeof n==`object`?{...n}:n;if(typeof i!=`object`&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i==`object`&&(i={...i}),i||={},t==null)return``;typeof t==`function`&&(t=Ia(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?Ia(e,{...this.options,...i}):String(e));let a=i.returnDetails===void 0?this.options.returnDetails:i.returnDetails,o=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,{key:s,namespaces:c}=this.extractFromKey(t[t.length-1],i),l=c[c.length-1],u=i.nsSeparator===void 0?this.options.nsSeparator:i.nsSeparator;u===void 0&&(u=`:`);let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()===`cimode`)return f?a?{res:`${l}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:`${l}${u}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:s;let p=this.resolve(t,i),m=p?.res,h=p?.usedKey||s,g=p?.exactUsedKey||s,_=[`[object Number]`,`[object Function]`,`[object RegExp]`],v=i.joinArrays===void 0?this.options.joinArrays:i.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,b=i.count!==void 0&&!A(i.count),x=e.hasDefaultValue(i),S=b?this.pluralResolver.getSuffix(d,i.count,i):``,C=i.ordinal&&b?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):``,w=b&&!i.ordinal&&i.count===0,T=w&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${S}`]||i[`defaultValue${C}`]||i.defaultValue,E=m;y&&!m&&x&&(E=T);let D=Ra(E),ee=Object.prototype.toString.apply(E);if(y&&E&&D&&_.indexOf(ee)<0&&!(A(v)&&Array.isArray(E))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,E,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(p.res=e,p.usedParams=this.getUsedParamsDetails(i),p):e}if(o){let e=Array.isArray(E),t=e?[]:{},n=e?g:h;for(let e in E)if(Object.prototype.hasOwnProperty.call(E,e)){let r=`${n}${o}${e}`;t[e]=x&&!m?this.translate(r,{...i,defaultValue:Ra(T)?T[e]:void 0,joinArrays:!1,ns:c}):this.translate(r,{...i,joinArrays:!1,ns:c}),t[e]===r&&(t[e]=E[e])}m=t}}else if(y&&A(v)&&Array.isArray(m))m=m.join(v),m&&=this.extendTranslation(m,t,i,r);else{let e=!1,n=!1;!this.isValidLookup(m)&&x&&(e=!0,m=T),this.isValidLookup(m)||(n=!0,m=s);let a=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:m,c=x&&T!==m&&this.options.updateMissing;if(n||e||c){if(this.logger.log(c?`updateKey`:`missingKey`,d,l,s,c?T:m),o){let e=this.resolve(s,{...i,keySeparator:!1});e&&e.res&&this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`)}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(i.lng||this.language):e.push(i.lng||this.language);let n=(e,t,n)=>{let r=x&&n!==m?n:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,r,c,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,r,c,i),this.emit(`missingKey`,e,l,t,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,i);w&&i[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,i[`defaultValue${t}`]||T)})}):n(e,s,T))}m=this.extendTranslation(m,t,i,p,r),n&&m===s&&this.options.appendNamespaceToMissingKey&&(m=`${l}${u}${s}`),(n||e)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${s}`:s,e?m:void 0,i))}return a?(p.res=m,p.usedParams=this.getUsedParamsDetails(i),p):m}extendTranslation(e,t,n,r,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let a=A(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),o;if(a){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!A(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),a){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;o<r&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>i?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let a=n.postProcess||this.options.postProcess,o=A(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=Na.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,i,a,o;return A(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?Ia(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),c=s.key;r=c;let l=s.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));let u=t.count!==void 0&&!A(t.count),d=u&&!t.ordinal&&t.count===0,f=t.context!==void 0&&(A(t.context)||typeof t.context==`number`)&&t.context!==``,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);l.forEach(e=>{this.isValidLookup(n)||(o=e,!La[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(La[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(`, `)}" won't get resolved as namespace "${o}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)),p.forEach(r=>{if(this.isValidLookup(n))return;a=r;let o=[c];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(o,c,r,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&e.indexOf(i)===0&&o.push(c+e.replace(i,this.options.pluralSeparator)),o.push(c+e),d&&o.push(c+n)),f){let r=`${c}${this.options.contextSeparator||`_`}${t.context}`;o.push(r),u&&(t.ordinal&&e.indexOf(i)===0&&o.push(r+e.replace(i,this.options.pluralSeparator)),o.push(r+e),d&&o.push(r+n))}}let s;for(;s=o.pop();)this.isValidLookup(n)||(i=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!A(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.substring(0,12)===`defaultValue`&&e[t]!==void 0)return!0;return!1}},Ba=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Aa.create(`languageUtils`)}getScriptPartFromCode(e){if(e=Oa(e),!e||e.indexOf(`-`)<0)return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=Oa(e),!e||e.indexOf(`-`)<0)return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(A(e)&&e.indexOf(`-`)>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load===`languageOnly`||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>{if(e===r||!(e.indexOf(`-`)<0&&r.indexOf(`-`)<0)&&(e.indexOf(`-`)>0&&r.indexOf(`-`)<0&&e.substring(0,e.indexOf(`-`))===r||e.indexOf(r)===0&&r.length>1))return e})}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),A(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||=e[this.getScriptPartFromCode(t)],n||=e[this.formatLanguageCode(t)],n||=e[this.getLanguagePartFromCode(t)],n||=e.default,n||[]}toResolveHierarchy(e,t){let n=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),r=[],i=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return A(e)&&(e.indexOf(`-`)>-1||e.indexOf(`_`)>-1)?(this.options.load!==`languageOnly`&&i(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&i(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&i(this.getLanguagePartFromCode(e))):A(e)&&i(this.formatLanguageCode(e)),n.forEach(e=>{r.indexOf(e)<0&&i(this.formatLanguageCode(e))}),r}},Va={zero:0,one:1,two:2,few:3,many:4,other:5},Ha={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},Ua=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=Aa.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=Oa(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),Ha;if(!e.match(/-|_/))return Ha;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?n.resolvedOptions().pluralCategories.sort((e,t)=>Va[e]-Va[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}},Wa=(e,t,n,r=`.`,i=!0)=>{let a=va(e,t,n);return!a&&i&&A(n)&&(a=Da(e,n,r),a===void 0&&(a=Da(t,n,r))),a},Ga=e=>e.replace(/\$/g,`$$$$`),Ka=class{constructor(e={}){this.logger=Aa.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||={escapeValue:!0};let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:_}=e.interpolation;this.escape=t===void 0?Sa:t,this.escapeValue=n===void 0||n,this.useRawValueToEscape=r!==void 0&&r,this.prefix=i?ba(i):a||`{{`,this.suffix=o?ba(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u||`-`,this.unescapeSuffix=this.unescapePrefix?``:l||``,this.nestingPrefix=d?ba(d):f||ba(`$t(`),this.nestingSuffix=p?ba(p):m||ba(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=_!==void 0&&_,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`g`);this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let i,a,o,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(e.indexOf(this.formatSeparator)<0){let i=Wa(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(Wa(t,s,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp();let l=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>Ga(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?Ga(this.escape(e)):Ga(e)}].forEach(t=>{for(o=0;i=t.regex.exec(e);){let n=i[1].trim();if(a=c(n),a===void 0){if(typeof l==`function`){let t=l(e,i,r);a=A(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))a=``;else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),a=``}else!A(a)&&!this.useRawValueToEscape&&(a=ua(a));let s=t.safeValue(a);if(e=e.replace(i[0],s),u?(t.regex.lastIndex+=a.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,i,a,o=(e,t)=>{let n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;let r=e.split(RegExp(`${ba(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,a);let o=i.match(/'/g),s=i.match(/"/g);((o?.length??0)%2==0&&!s||(s?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{a=JSON.parse(i),t&&(a={...t,...a})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];a={...n},a=a.replace&&!A(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=/{.*}/.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(c!==-1&&(s=r[1].slice(c).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,c)),i=t(o.call(this,r[1].trim(),a),a),i&&r[0]===e&&!A(i))return i;A(i)||(i=ua(i)),i||=(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),``),s.length&&(i=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}},qa=e=>{let t=e.toLowerCase().trim(),n={};if(e.indexOf(`(`)>-1){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].substring(0,r[1].length-1);t===`currency`&&i.indexOf(`:`)<0?n.currency||=i.trim():t===`relativetime`&&i.indexOf(`:`)<0?n.range||=i.trim():i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},Ja=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(Oa(r),i),t[o]=s),s(n)}},Ya=e=>(t,n,r)=>e(Oa(n),r)(t),Xa=class{constructor(e={}){this.logger=Aa.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?Ja:Ya;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Ja(t)}format(e,t,n,r={}){let i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf(`(`)>1&&i[0].indexOf(`)`)<0&&i.find(e=>e.indexOf(`)`)>-1)){let e=i.findIndex(e=>e.indexOf(`)`)>-1);i[0]=[i[0],...i.splice(1,e)].join(this.formatSeparator)}return i.reduce((e,t)=>{let{formatName:i,formatOptions:a}=qa(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${i}`),e},e)}},Za=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},Qa=class extends ja{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=Aa.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{ga(n.loaded,[i],a),Za(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();A(e)&&(e=this.languageUtils.toResolveHierarchy(e)),A(t)&&(t=[t]);let i=this.queueLoad(e,t,n,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);return}if(n!=null&&n!==``){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}},$a=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,simplifyPluralSuffix:!0,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:`fallback`,saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]==`object`&&(t=e[1]),A(e[1])&&(t.defaultValue=e[1]),A(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),eo=e=>(A(e.ns)&&(e.ns=[e.ns]),A(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),A(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.(`cimode`)<0&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),typeof e.initImmediate==`boolean`&&(e.initAsync=e.initImmediate),e),to=()=>{},no=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},ro=`__i18next_supportNoticeShown`,io=()=>!!(typeof globalThis<`u`&&globalThis[ro]||typeof process<`u`&&{}.I18NEXT_NO_SUPPORT_NOTICE||typeof process<`u`),ao=()=>{typeof globalThis<`u`&&(globalThis[ro]=!0)},oo=e=>!!(e?.modules?.backend?.name?.indexOf(`Locize`)>0||e?.modules?.backend?.constructor?.name?.indexOf(`Locize`)>0||e?.options?.backend?.backends&&e.options.backend.backends.some(e=>e?.name?.indexOf(`Locize`)>0||e?.constructor?.name?.indexOf(`Locize`)>0)||e?.options?.backend?.projectId||e?.options?.backend?.backendOptions&&e.options.backend.backendOptions.some(e=>e?.projectId)),so=class e extends ja{constructor(e={},t){if(super(),this.options=eo(e),this.services={},this.logger=Aa,this.modules={external:[]},no(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&(A(e.ns)?e.defaultNS=e.ns:e.ns.indexOf(`translation`)<0&&(e.defaultNS=e.ns[0]));let n=$a();this.options={...n,...this.options,...eo(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!=`function`&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!oo(this)&&!io()&&(typeof console<`u`&&console.info!==void 0&&console.info(`🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙`),ao());let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?Aa.init(r(this.modules.logger),this.options):Aa.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:Xa;let t=new Ba(this.options);this.store=new Ma(this.options.resources,this.options);let i=this.services;i.logger=Aa,i.resourceStore=this.store,i.languageUtils=t,i.pluralResolver=new Ua(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`),e&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(i.formatter=r(e),i.formatter.init&&i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new Ka(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new Qa(r(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(i.languageDetector=r(this.modules.languageDetector),i.languageDetector.init&&i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=r(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new za(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||=to,this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn(`init: no languageDetector is used and no lng is defined`),[`getResource`,`hasResourceBundle`,`getResourceBundle`,`getDataByLanguage`].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let i=la(),a=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn(`init: i18next is already initialized. You should call init just once!`),this.isInitialized=!0,this.options.isClone||this.logger.log(`initialized`,this.options),this.emit(`initialized`,this.options),i.resolve(n),t(e,n)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),i}loadResources(e,t=to){let n=t,r=A(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&e.indexOf(t)<0&&e.push(t)})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=la();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||=this.languages,t||=this.options.ns,n||=to,this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);return e.type===`backend`&&(this.modules.backend=e),(e.type===`logger`||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type===`languageDetector`&&(this.modules.languageDetector=e),e.type===`i18nFormat`&&(this.modules.i18nFormat=e),e.type===`postProcessor`&&Na.addPostProcessor(e),e.type===`formatter`&&(this.modules.formatter=e),e.type===`3rdParty`&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!([`cimode`,`dev`].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(!([`cimode`,`dev`].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=la();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},a=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=A(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(A(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{i(e,a)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),n}getFixedT(e,t,n){let r=(e,t,...i)=>{let a;a=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(i)),a.lng=a.lng||r.lng,a.lngs=a.lngs||r.lngs,a.ns=a.ns||r.ns,a.keyPrefix!==``&&(a.keyPrefix=a.keyPrefix||n||r.keyPrefix);let o={...this.options,...a};typeof a.keyPrefix==`function`&&(a.keyPrefix=Ia(a.keyPrefix,o));let s=this.options.keySeparator||`.`,c;return a.keyPrefix&&Array.isArray(e)?c=e.map(e=>(typeof e==`function`&&(e=Ia(e,o)),`${a.keyPrefix}${s}${e}`)):(typeof e==`function`&&(e=Ia(e,o)),c=a.keyPrefix?`${a.keyPrefix}${s}${e}`:e),this.t(c,a)};return A(e)?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=n,r}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`,this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`,this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,t){let n=la();return this.options.ns?(A(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=la();A(e)&&(e=[e]);let r=this.options.preload||[],i=e.filter(e=>r.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=r.concat(i),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`),n=this.services?.languageUtils||new Ba($a());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=to){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new Ma(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...$a().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new Ka(n)}return a.translator=new za(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();so.createInstance,so.dir,so.init,so.loadResources,so.reloadResources,so.use,so.changeLanguage,so.getFixedT,so.t,so.exists,so.setDefaultNamespace,so.hasLoadedNamespace,so.loadNamespaces,so.loadLanguages;var co=(e,t,n,r)=>{let i=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,`warn`,`react-i18next::`,!0);go(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},lo={},uo=(e,t,n,r)=>{go(n)&&lo[n]||(go(n)&&(lo[n]=new Date),co(e,t,n,r))},fo=(e,t)=>()=>{if(e.isInitialized)t();else{let n=()=>{setTimeout(()=>{e.off(`initialized`,n)},0),t()};e.on(`initialized`,n)}},po=(e,t,n)=>{e.loadNamespaces(t,fo(e,n))},mo=(e,t,n,r)=>{if(go(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return po(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,fo(e,r))},ho=(e,t,n={})=>!t.languages||!t.languages.length?(uo(t,`NO_LANGUAGES`,`i18n.languages were undefined or empty`,{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,r)=>{if(n.bindI18n&&n.bindI18n.indexOf(`languageChanging`)>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}),go=e=>typeof e==`string`,_o=e=>typeof e==`object`&&!!e,vo=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,yo={"&amp;":`&`,"&#38;":`&`,"&lt;":`<`,"&#60;":`<`,"&gt;":`>`,"&#62;":`>`,"&apos;":`'`,"&#39;":`'`,"&quot;":`"`,"&#34;":`"`,"&nbsp;":` `,"&#160;":` `,"&copy;":`©`,"&#169;":`©`,"&reg;":`®`,"&#174;":`®`,"&hellip;":`…`,"&#8230;":`…`,"&#x2F;":`/`,"&#47;":`/`},bo=e=>yo[e],xo={bindI18n:`languageChanged`,bindI18nStore:``,transEmptyNodeValue:``,transSupportBasicHtmlNodes:!0,transWrapTextNodes:``,transKeepBasicHtmlNodesFor:[`br`,`strong`,`i`,`p`],useSuspense:!0,unescape:e=>e.replace(vo,bo),transDefaultProps:void 0},So=(e={})=>{xo={...xo,...e}},Co=()=>xo,wo,To=e=>{wo=e},Eo=()=>wo,Do={type:`3rdParty`,init(e){So(e.options.react),To(e)}},Oo=(0,v.createContext)(),ko=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}},Ao=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),jo=o(((e,t)=>{t.exports=Ao()})),Mo=jo(),No={t:(e,t)=>{if(go(t))return t;if(_o(t)&&go(t.defaultValue))return t.defaultValue;if(typeof e==`function`)return``;if(Array.isArray(e)){let t=e[e.length-1];return typeof t==`function`?``:t}return e},ready:!1},Po=()=>()=>{},Fo=(e,t={})=>{let{i18n:n}=t,{i18n:r,defaultNS:i}=(0,v.useContext)(Oo)||{},a=n||r||Eo();a&&!a.reportNamespaces&&(a.reportNamespaces=new ko),a||uo(a,`NO_I18NEXT_INSTANCE`,`useTranslation: You will need to pass in an i18next instance by using initReactI18next`);let o=(0,v.useMemo)(()=>({...Co(),...a?.options?.react,...t}),[a,t]),{useSuspense:s,keyPrefix:c}=o,l=e||i||a?.options?.defaultNS,u=go(l)?[l]:l||[`translation`],d=(0,v.useMemo)(()=>u,u);a?.reportNamespaces?.addUsedNamespaces?.(d);let f=(0,v.useRef)(0),p=(0,v.useCallback)(e=>{if(!a)return Po;let{bindI18n:t,bindI18nStore:n}=o,r=()=>{f.current+=1,e()};return t&&a.on(t,r),n&&a.store.on(n,r),()=>{t&&t.split(` `).forEach(e=>a.off(e,r)),n&&n.split(` `).forEach(e=>a.store.off(e,r))}},[a,o]),m=(0,v.useRef)(),h=(0,v.useCallback)(()=>{if(!a)return No;let e=!!(a.isInitialized||a.initializedStoreOnce)&&d.every(e=>ho(e,a,o)),n=t.lng||a.language,r=f.current,i=m.current;if(i&&i.ready===e&&i.lng===n&&i.keyPrefix===c&&i.revision===r)return i;let s={t:a.getFixedT(n,o.nsMode===`fallback`?d:d[0],c),ready:e,lng:n,keyPrefix:c,revision:r};return m.current=s,s},[a,d,c,o,t.lng]),[g,_]=(0,v.useState)(0),{t:y,ready:b}=(0,Mo.useSyncExternalStore)(p,h,h);(0,v.useEffect)(()=>{if(a&&!b&&!s){let e=()=>_(e=>e+1);t.lng?mo(a,t.lng,d,e):po(a,d,e)}},[a,t.lng,d,b,s,g]);let x=a||{},S=(0,v.useRef)(null),C=(0,v.useRef)(),w=e=>{let t=Object.getOwnPropertyDescriptors(e);t.__original&&delete t.__original;let n=Object.create(Object.getPrototypeOf(e),t);if(!Object.prototype.hasOwnProperty.call(n,`__original`))try{Object.defineProperty(n,"__original",{value:e,writable:!1,enumerable:!1,configurable:!1})}catch{}return n},T=(0,v.useMemo)(()=>{let e=x,t=e?.language,n=e;e&&(S.current&&S.current.__original===e&&C.current===t?n=S.current:(n=w(e),S.current=n,C.current=t));let r=!b&&!s?(...e)=>(uo(a,`USE_T_BEFORE_READY`,`useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.`),y(...e)):y,i=[r,n,b];return i.t=r,i.i18n=n,i.ready=b,i},[y,x,b,x.resolvedLanguage,x.language,x.languages]);if(a&&s&&!b)throw new Promise(e=>{let n=()=>e();t.lng?mo(a,t.lng,d,n):po(a,d,n)});return T},Io={en:{translation:{"app.failed":`NiceEval View failed to load`,"executionTrace.title":`Execution events`,"executionTrace.stableId":`Stable event or evidence ID`,"executionTrace.openEvent":`Open event`,"executionTrace.openEvidence":`Open evidence`,"executionTrace.nextPage":`Next event page`,"executionTrace.firstPage":`First event page`,"executionTrace.nextBytes":`Next evidence chunk`,"executionTrace.omitted":`{{count}} events remaining`,"executionTrace.byteRange":`UTF-8 preview from byte {{offset}} of {{total}}`,"executionTrace.moreBytes":`… ({{count}} more bytes; open event for full text)`,"executionTrace.imageDecodeFailed":`Image could not be decoded`,"executionTrace.imageTooLarge":`Images above 16 MiB are not displayed inline. Read this artifact with niceeval query run --request -.`,"nav.experiments":`Experiments`,"nav.language":`Language`,"nav.pages":`Report pages`,"insight.title":`NiceEval Insight`,"insight.navigation":`Insight`,"current.title":`Current results`,"current.summary":`Summary`,"current.covered":`Covered`,"current.gaps":`Gaps`,"current.verdicts":`Verdicts`,"current.partial":`partial`,"current.attempt":`Attempt`,"current.eval":`Eval`,"current.gapReason":`Gap: {{reason}}`,"current.reason.no-result":`no result`,"current.reason.pending":`pending`,"current.reason.not-published":`not published`,"current.reason.identity-mismatch":`identity-mismatch`,"current.reason.outcome-ineligible":`previous attempt did not complete`,"current.reason.score-incomplete":`score incomplete`,"current.reason.evidence-unavailable":`evidence unavailable`,"current.reason.timeout-exceeded":`timeout exceeded`,"current.reason.adoption-unproven":`adoption could not be verified`,"current.previousResult":`Previous result`,"current.next":`Next:`,"current.history":`History`,"current.historicalResults":`Historical results`,"current.unavailable":`Current results are unavailable`,"current.unavailableDetail":`The current project target could not be evaluated. Review recorded results or retry refresh.`,"current.unavailableReason":`Reason`,"current.historicalRun":`Open a historical Run`,"insight.chart.cost":`Application cost`,"insight.chart.passRate":`Pass rate`,"insight.chart.score":`Score`,"insight.chart.noData":`No chartable data`,"insight.chart.partial":`partial data`,"insight.chart.openExperiment":`open experiment`,"verdict.passed":`passed`,"verdict.scored":`scored`,"verdict.failed":`failed`,"verdict.errored":`errored`,"verdict.skipped":`skipped`,"cell.missing":`no data`,"cell.unscorable":`unscorable`,"cell.noCurrentResult":`no result for current config`,"cell.metricFailed":`failed`,"cell.metricUnavailable":`unavailable`,"cell.metricUnsupported":`unsupported`,"cell.metricMigrationRequired":`migration required`,"cell.measuredTitle":`{{samples}}/{{total}} attempts measured`,"cell.noneMeasurableTitle":`0/{{total}} attempts measurable`,"cell.coverageTitle":`coverage {{samples}}/{{total}}: this metric is null for the remaining attempts`,"cell.coverageDetail":`Result coverage {{samples}}/{{total}}`,"cell.partialTitle":`This value is a known subtotal because some underlying observations are unavailable`,"cell.partialDetail":`partial`,"cell.costReported":`reported`,"cell.costEstimated":`estimated`,"cell.costMixed":`reported + estimated`,"usage.configuredModels":`Configured model slots`,"usage.configuredSlotCount":`{{count}} configured slots`,"usage.configuredModel":`Configured model`,"usage.slot":`Slot`,"usage.effort":`Effort`,"usage.recordedCalls":`Recorded calls`,"usage.noRecordedCalls":`no recorded calls`,"usage.notRecorded":`not recorded`,"usage.actualModels":`Actual model usage`,"usage.actualModel":`Actual model`,"usage.servingProvider":`Serving provider`,"usage.tokens":`Tokens`,"usage.inputTotal":`Input including cache`,"usage.totalTokens":`Total tokens`,"usage.applicationCost":`Application cost`,"usage.judgeUsage":`Judge usage`,"usage.judgeNotRecorded":`Judge usage was not recorded`,"usage.knownSubtotal":`known subtotal`,"usage.totalKnownSubtotal":`Attempt known subtotal`,"usage.missingSources":`Missing sources`,"usage.groupPreview":`{{shown}} groups shown; {{total}} total; {{omitted}} omitted`,"usage.costOrigins":`{{reported}} reported; {{estimated}} estimated`,"usage.totalCosts":`Attempt total cost`,"usage.costComplete":`Complete`,"usage.costIncomplete":`Incomplete`,"usage.noRecordedCharges":`No recorded charges`,"usage.noJudgeCalls":`No Judge calls`,"usage.physicalCalls":`Physical calls`,"usage.cacheReadRate":`Cache read rate`,"usage.cacheTotal":`Total`,"usage.cacheScope":`Scope`,"usage.cacheCoverage":`Covered calls`,"usage.cacheCollection":`Collection`,"usage.cacheReasons":`Reasons`,"usage.cacheComplete":`Collection complete`,"usage.cacheIncomplete":`Collection incomplete`,"usage.external":`External call usage`,"usage.input":`Input tokens (excluding cache)`,"usage.output":`Output tokens`,"usage.requests":`Requests`,"usage.calls":`Recorded calls`,"usage.prices":`Sealed pricing evidence`,"usage.coverage":`{{covered}}/{{total}} calls fully costed`,"experimentCost.totalCosts":`Experiment total costs`,"experimentCost.knownSubtotal":`Experiment known subtotal`,"experimentCost.scope":`Scope: latest recorded slots. Each slot retains its latest recorded result across reruns; replaced executions are excluded.`,"experimentCost.selectedSlots":`Selected slots`,"experimentCost.resolvedSlots":`Resolved slots`,"experimentCost.originAttempts":`Unique origin Attempts`,"experimentCost.completeAttempts":`Attempts with complete costs`,"experimentCost.partialAttempts":`Attempts with partial costs`,"experimentCost.unavailableAttempts":`Attempts with unavailable costs`,"experimentCost.unresolvedSlots":`Unresolved slots`,"cell.evidence":`{{n}} attempts`,"table.model":`Model`,"cell.mixedExecution":`mixed`,"table.adapter":`Adapter`,"table.filterPlaceholder":`Filter rows…`,"experimentList.experiment":`Experiment`,"experimentList.avgDuration":`Avg. time`,"experimentList.passRate":`Pass rate`,"experimentList.totalScore":`Total score`,"experimentList.missedScoreItems":`{{n}} missed checks`,"experimentList.tokens":`Tokens`,"experimentList.cost":`Application cost`,"experimentList.result":`Result`,"experimentList.status":`Status`,"experimentList.filterPlaceholder":`Filter experiments…`,"report.close":`Close`,"report.details":`Details`,"report.loading":`Loading…`,"report.loadingDetails":`Loading details…`,"report.backToResults":`Back to results`,"report.retry":`Retry`,"report.unableToLoad":`Unable to load this page.`,"report.unableToLoadDetails":`Unable to load details.`,"attempt.title":`Attempt`,"attempt.experiment":`Experiment`,"attempt.adapter":`Adapter`,"attempt.adapterRevisionNotDeclared":`revision not declared`,"attempt.eval":`Eval`,"attempt.score":`Score`,"attempt.scoreCompleted":`Score completed`,"attempt.started":`Started`,"attempt.duration":`Duration`,"attempt.cost":`Cost`,"attempt.assertions":`Assertions`,"attempt.traceDetails":`Trace details`,"attempt.traceItem":`item {{id}}`,"attempt.traceTool":`tool {{id}}`,"attempt.traceCommand":`command {{id}}`,"attempt.executionTimeline":`Execution timeline`,"attempt.usage":`Usage`,"attempt.sources":`Sources`,"attempt.fileChanges":`File changes`,"attempt.artifacts":`Artifacts`,"attempt.loadOnDemand":`Expand or select to load.`,"attempt.artifactsNone":`No artifacts were recorded.`,"attempt.artifactsRetained_one":`{{count}} retained content item`,"attempt.artifactsRetained_other":`{{count}} retained content items`,"attempt.truncated":`(truncated)`,"attempt.verdict.passed":`passed`,"attempt.verdict.failed":`failed`,"attempt.verdict.errored":`errored`,"attempt.verdict.skipped":`skipped`,"attempt.verdict.unknown":`unknown`,"refresh.action":`Refresh`,"refresh.available":`An update with newer sealed results is available.`,"refresh.lastGoodStale":`These are previous current results. Refresh to evaluate the project again.`,"refresh.failed":`Refresh failed. The previous result remains visible but may be out of date.`,"refresh.reload":`Reload`,"refresh.reloadRequired":`Reload NiceEval View`,"refresh.reloadRequiredDetail":`The refresh result could not be confirmed. Reload before continuing to review results.`,"refresh.working":`Refreshing…`,"refresh.selectionChanged":`The previous selection is no longer available. Showing the nearest available result.`}},"zh-CN":{translation:{"app.failed":`NiceEval 视图载入失败`,"executionTrace.title":`执行事件`,"executionTrace.moreBytes":`…(还有 {{count}} 字节;打开事件查看全文)`,"executionTrace.imageDecodeFailed":`图片无法解码`,"executionTrace.imageTooLarge":`超过 16 MiB 的图片不内联显示。使用 niceeval query run --request - 读取此附件。`,"executionTrace.stableId":`稳定事件或证据 ID`,"executionTrace.openEvent":`打开事件`,"executionTrace.openEvidence":`打开证据`,"executionTrace.nextPage":`下一页事件`,"executionTrace.firstPage":`第一页事件`,"executionTrace.nextBytes":`下一段证据`,"executionTrace.omitted":`尚有 {{count}} 条事件`,"executionTrace.byteRange":`UTF-8 预览,从第 {{offset}} 字节开始,共 {{total}} 字节`,"nav.experiments":`实验`,"nav.language":`语言`,"nav.pages":`报告页面`,"insight.title":`NiceEval Insight`,"insight.navigation":`洞察`,"current.title":`当前结果`,"current.summary":`概览`,"current.covered":`已覆盖`,"current.gaps":`缺口`,"current.verdicts":`判定`,"current.partial":`部分结果`,"current.attempt":`尝试`,"current.eval":`评估用例`,"current.gapReason":`缺口:{{reason}}`,"current.reason.no-result":`暂无结果`,"current.reason.pending":`仍在运行`,"current.reason.not-published":`结果尚未发布`,"current.reason.identity-mismatch":`输入已变化(identity-mismatch)`,"current.reason.outcome-ineligible":`上次运行未完成`,"current.reason.score-incomplete":`得分不完整`,"current.reason.evidence-unavailable":`证据不可用`,"current.reason.timeout-exceeded":`超出时限`,"current.reason.adoption-unproven":`无法核实已采用结果`,"current.previousResult":`上次结果`,"current.next":`下一步:`,"current.history":`历史`,"current.historicalResults":`历史结果`,"current.unavailable":`当前结果不可用`,"current.unavailableDetail":`无法求值当前项目目标。可查看已有历史结果,或重新刷新。`,"current.unavailableReason":`原因`,"current.historicalRun":`查看历史运行`,"insight.chart.cost":`应用费用`,"insight.chart.passRate":`通过率`,"insight.chart.score":`得分`,"insight.chart.noData":`暂无可绘制的数据`,"insight.chart.partial":`部分数据`,"insight.chart.openExperiment":`打开实验`,"verdict.passed":`通过`,"verdict.scored":`评分完成`,"verdict.failed":`失败`,"verdict.errored":`错误`,"verdict.skipped":`跳过`,"cell.missing":`无数据`,"cell.unscorable":`测不出`,"cell.noCurrentResult":`当前配置下无结果`,"cell.metricFailed":`读取失败`,"cell.metricUnavailable":`不可用`,"cell.metricUnsupported":`不支持`,"cell.metricMigrationRequired":`需要迁移`,"cell.measuredTitle":`{{samples}}/{{total}} 次 attempt 测得`,"cell.noneMeasurableTitle":`0/{{total}} 次 attempt 可测`,"cell.coverageTitle":`覆盖率 {{samples}}/{{total}}:其余 attempt 测不了这个指标`,"cell.coverageDetail":`结果完整度 {{samples}}/{{total}}`,"cell.partialTitle":`部分底层观测不可用,此值是已知小计`,"cell.partialDetail":`部分`,"cell.costReported":`回执金额`,"cell.costEstimated":`估算金额`,"cell.costMixed":`回执金额 + 估算`,"usage.configuredModels":`配置模型用途`,"usage.configuredSlotCount":`{{count}} 个配置用途`,"usage.configuredModel":`配置模型`,"usage.slot":`用途`,"usage.effort":`推理强度`,"usage.recordedCalls":`已登记调用`,"usage.noRecordedCalls":`无已登记调用`,"usage.notRecorded":`未记录`,"usage.actualModels":`实际模型用量`,"usage.actualModel":`实际模型`,"usage.servingProvider":`服务提供方`,"usage.tokens":`Tokens`,"usage.inputTotal":`输入 token(含缓存)`,"usage.totalTokens":`总 token`,"usage.applicationCost":`应用费用`,"usage.judgeUsage":`裁判用量`,"usage.judgeNotRecorded":`未记录裁判用量`,"usage.knownSubtotal":`已知小计`,"usage.totalKnownSubtotal":`本局已知费用小计`,"usage.missingSources":`缺失来源`,"usage.groupPreview":`显示 {{shown}} 组,共 {{total}} 组,省略 {{omitted}} 组`,"usage.costOrigins":`{{reported}} 个回执金额;{{estimated}} 个估算金额`,"usage.totalCosts":`本局总费用`,"usage.costComplete":`费用完整`,"usage.costIncomplete":`费用不完整`,"usage.noRecordedCharges":`无已登记费用`,"usage.noJudgeCalls":`未调用 Judge`,"usage.physicalCalls":`物理调用`,"usage.cacheReadRate":`缓存读取率`,"usage.cacheTotal":`总计`,"usage.cacheScope":`范围`,"usage.cacheCoverage":`覆盖调用`,"usage.cacheCollection":`采集完整性`,"usage.cacheReasons":`原因`,"usage.cacheComplete":`完整`,"usage.cacheIncomplete":`不完整`,"usage.external":`外部调用用量`,"usage.input":`输入 token(不含缓存)`,"usage.output":`输出 token`,"usage.requests":`请求数`,"usage.calls":`已保存调用`,"usage.prices":`封存价格证据`,"usage.coverage":`{{covered}}/{{total}} 个调用成本完整`,"experimentCost.totalCosts":`实验总费用`,"experimentCost.knownSubtotal":`实验已知费用小计`,"experimentCost.scope":`范围:最新已记录槽位。每个槽位保留历次执行中的最新已记录结果,被替代的旧执行不累计。`,"experimentCost.selectedSlots":`所选槽位`,"experimentCost.resolvedSlots":`已解析槽位`,"experimentCost.originAttempts":`唯一 origin Attempt`,"experimentCost.completeAttempts":`费用完整的 Attempt`,"experimentCost.partialAttempts":`费用部分已知的 Attempt`,"experimentCost.unavailableAttempts":`费用不可用的 Attempt`,"experimentCost.unresolvedSlots":`未解析槽位`,"cell.evidence":`{{n}} 个 Attempt`,"table.model":`模型`,"cell.mixedExecution":`混合`,"table.adapter":`Adapter`,"table.filterPlaceholder":`筛选行…`,"experimentList.experiment":`实验`,"experimentList.avgDuration":`平均耗时`,"experimentList.passRate":`通过率`,"experimentList.totalScore":`总分`,"experimentList.missedScoreItems":`{{n}} 项未满足`,"experimentList.tokens":`Tokens`,"experimentList.cost":`应用费用`,"experimentList.result":`结果`,"experimentList.status":`状态`,"experimentList.filterPlaceholder":`筛选实验…`,"report.close":`关闭`,"report.details":`详情`,"report.loading":`正在加载…`,"report.loadingDetails":`正在加载详情…`,"report.backToResults":`返回结果`,"report.retry":`重试`,"report.unableToLoad":`无法加载此页面。`,"report.unableToLoadDetails":`无法加载详情。`,"attempt.title":`尝试`,"attempt.experiment":`实验`,"attempt.adapter":`Adapter`,"attempt.adapterRevisionNotDeclared":`未声明修订`,"attempt.eval":`评测`,"attempt.score":`得分`,"attempt.scoreCompleted":`评分完成`,"attempt.started":`开始时间`,"attempt.duration":`耗时`,"attempt.cost":`成本`,"attempt.assertions":`断言`,"attempt.traceDetails":`轨迹详情`,"attempt.traceItem":`项目 {{id}}`,"attempt.traceTool":`工具 {{id}}`,"attempt.traceCommand":`命令 {{id}}`,"attempt.executionTimeline":`执行时间轴`,"attempt.usage":`用量`,"attempt.sources":`来源`,"attempt.fileChanges":`文件变更`,"attempt.artifacts":`产物`,"attempt.loadOnDemand":`展开或选择后载入。`,"attempt.artifactsNone":`未记录产物。`,"attempt.artifactsRetained_one":`保留了 {{count}} 项内容`,"attempt.artifactsRetained_other":`保留了 {{count}} 项内容`,"attempt.truncated":`(已截断)`,"attempt.verdict.passed":`通过`,"attempt.verdict.failed":`失败`,"attempt.verdict.errored":`错误`,"attempt.verdict.skipped":`跳过`,"attempt.verdict.unknown":`未知`,"refresh.action":`刷新`,"refresh.available":`有更新的封存结果可用。`,"refresh.lastGoodStale":`这是上次的当前结果。刷新以重新检查项目。`,"refresh.failed":`刷新失败。上次结果仍可查看,但可能已过期。`,"refresh.reload":`重新加载`,"refresh.reloadRequired":`重新加载 NiceEval 视图`,"refresh.reloadRequiredDetail":`无法确认刷新结果。请先重新加载,再继续审阅结果。`,"refresh.working":`正在刷新…`,"refresh.selectionChanged":`之前的选择已不存在,现已显示最近的可用结果。`}}},Lo=`niceeval:report:locale`;so.use(Do).init({resources:Io,lng:(()=>{try{let e=localStorage.getItem(Lo);if(e===`en`||e===`zh-CN`)return e}catch{}return navigator.language.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`})(),fallbackLng:`en`,supportedLngs:[`en`,`zh-CN`],interpolation:{escapeValue:!1},returnNull:!1}),so.on(`languageChanged`,e=>{document.documentElement.lang=e;try{localStorage.setItem(Lo,e)}catch{}}),document.documentElement.lang=so.resolvedLanguage??`en`;var Ro=so,zo=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Bo=o(((e,t)=>{t.exports=zo()})),M=Bo(),Vo=v.createContext(void 0),Ho=e=>{let t=v.useContext(Vo);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Uo=({client:e,children:t})=>(v.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,M.jsx)(Vo.Provider,{value:e,children:t})),Wo={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Go=new class{#e=Wo;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Ko(e){setTimeout(e,0)}var qo=typeof window>`u`||`Deno`in globalThis;function Jo(){}function Yo(e,t){return typeof e==`function`?e(t):e}function Xo(e){return typeof e==`number`&&e>=0&&e!==1/0}function N(e,t){return Math.max(e+(t||0)-Date.now(),0)}function P(e,t){return typeof e==`function`?e(t):e}function Zo(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==$o(o,t.options))return!1}else if(!ts(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Qo(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(es(t.options.mutationKey)!==es(a))return!1}else if(!ts(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function $o(e,t){return(t?.queryKeyHashFn||es)(e)}function es(e){return JSON.stringify(e,(e,t)=>os(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function ts(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!ts(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!ts(e[r],t[r]))return!1;return!0}return!1}var ns=Object.prototype.hasOwnProperty;function rs(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=as(e)&&as(t);if(!r&&!(os(e)&&os(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:ns.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=rs(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function is(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function as(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function os(e){if(!ss(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!ss(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function ss(e){return Object.prototype.toString.call(e)===`[object Object]`}function cs(e){return new Promise(t=>{Go.setTimeout(t,e)})}function ls(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:rs(e,t)}function us(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ds(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var fs=Symbol();function ps(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===fs?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ms(e,t){return typeof e==`function`?e(...t):!!e}function hs(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var gs=()=>qo,_s=()=>gs(),vs=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ys=new class extends vs{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},bs=Ko;function xs(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=bs,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Ss=xs(),Cs=new class extends vs{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function ws(e){return Math.min(1e3*2**e,3e4)}function Ts(e){return(e??`online`)!==`online`||Cs.isOnline()}var Es=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Ds(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(Jo);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Es(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>ys.isFocused()&&(e.networkMode===`always`||Cs.isOnline())&&e.canRun(),p=()=>Ts(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(_s()?0:3),a=e.retryDelay??ws,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),cs(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var Os=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Xo(this.gcTime)&&(this.#e=Go.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(_s()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Go.clearTimeout(this.#e),this.#e=void 0)}};function ks(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{hs(e,()=>t.signal,()=>n=!0)},u=ps(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?ds:us;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?js:As,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:As(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function As(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function js(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Ms=class extends Os{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Fs(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Fs(this.options);e.data!==void 0&&(this.setState(Ps(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=ls(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(Jo).catch(Jo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>P(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===fs||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>P(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!N(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ps(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?ks(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Ds({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Es&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Es){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ns(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Ps(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Ss.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ns(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ts(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Ps(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Fs(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Is=class extends vs{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Rs(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return zs(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return zs(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof P(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!is(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Bs(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||P(this.options.enabled,this.#t)!==P(t.enabled,this.#t)||P(this.options.staleTime,this.#t)!==P(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||P(this.options.enabled,this.#t)!==P(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return is(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Jo)),t}#h(e){return!_s()&&P(this.options.enabled,this.#t)!==!1&&Xo(e)}#g(){this.#b();let e=P(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=N(this.#r.dataUpdatedAt,e)+1;this.#u=Go.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return P(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=Go.setInterval(()=>{(this.options.refetchIntervalInBackground||ys.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(Go.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(Go.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Rs(e,t),o=i&&Bs(e,n,t,r);(a||o)&&(l={...l,...Ns(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=ls(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=ls(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Vs(e,t),refetch:this.refetch,isEnabled:P(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),is(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();Ss.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Ls(e,t){return P(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||P(t.retryOnMount,e)!==!1)}function Rs(e,t){return Ls(e,t)||e.state.data!==void 0&&zs(e,t,t.refetchOnMount)}function zs(e,t,n){if(P(t.enabled,e)!==!1&&P(t.staleTime,e)!==`static`){let r=P(n,e);return r===`always`||r!==!1&&Vs(e,t)}return!1}function Bs(e,t,n,r){return(e!==t||P(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Vs(e,n)}function Vs(e,t){return P(t.enabled,e)!==!1&&e.isStaleByTime(P(t.staleTime,e))}var Hs=class extends Os{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Us(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=Ds({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Ss.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Us(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ws=class extends vs{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Hs({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Gs(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Gs(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Gs(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Gs(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Ss.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Qo(t,e))}findAll(e={}){return this.getAll().filter(t=>Qo(e,t))}notify(e){Ss.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Ss.batch(()=>Promise.all(e.map(e=>e.continue().catch(Jo))))}};function Gs(e){return e.options.scope?.id}function Ks(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var qs=class extends vs{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,Ss.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!is(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Ks(e,n).forEach(e=>{e.destroy()}),Ks(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=rs(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Is(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&Ss.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},Js=class extends vs{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??$o(r,t),a=this.get(i);return a||(a=new Ms({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Ss.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Zo(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Zo(e,t)):t}notify(e){Ss.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Ss.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Ss.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ys=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Js,this.#t=e.mutationCache||new Ws,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ys.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Cs.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(P(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Yo(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Ss.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Ss.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Ss.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=Ss.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Jo).catch(Jo)}invalidateQueries(e,t={}){return Ss.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Ss.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Jo)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Jo)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(P(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(P(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Jo).catch(Jo)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Jo).catch(Jo)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Cs.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(es(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{ts(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(es(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{ts(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=$o(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===fs&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Xs=v.createContext(!1),Zs=()=>v.useContext(Xs);Xs.Provider;function Qs(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var $s=v.createContext(Qs()),ec=()=>v.useContext($s),tc=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ms(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},nc=e=>{v.useEffect(()=>{e.clearReset()},[e])},rc=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ms(n,[e.error,r])),ic=(e,t)=>t.state.data===void 0,ac=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},oc=(e,t)=>e?.suspense&&t.isPending,sc=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function cc({queries:e,...t},n){let r=Ho(n),i=Zs(),a=ec(),o=t.subscribed!==!1,s=v.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{ac(e);let t=r.getQueryCache().get(e.queryHash);tc(e,a,t)}),nc(a);let[c]=v.useState(()=>new qs(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;v.useSyncExternalStore(v.useCallback(e=>f?c.subscribe(Ss.batchCalls(e)):Jo,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),v.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>oc(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&oc(n,e)?sc(n,new Is(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&rc({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m)throw m.error;return u(d())}function lc(e,t,n){let r=Zs(),i=ec(),a=Ho(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,ac(o),tc(o,i,s),nc(i);let[l]=v.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(v.useSyncExternalStore(v.useCallback(e=>{let t=d?l.subscribe(Ss.batchCalls(e)):Jo;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),v.useEffect(()=>{l.setOptions(o)},[o,l]),oc(o,u))throw sc(o,l,i);if(rc({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function uc(e,t){return lc(e,Is,t)}function dc(e,t){return lc({...e,enabled:!0,suspense:!0,throwOnError:ic,placeholderData:void 0},Is,t)}function fc(e){return e}var pc=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let e=0,r=t.length;e<r;e++)n=t[e](n);return n}}},mc={pipe(){return pc(this,arguments)}},hc=function(){function e(){}return e.prototype=mc,e}(),gc=function(e,t){if(typeof e==`function`)return function(){return e(arguments)?t.apply(this,arguments):e=>t(e,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(e,n){return arguments.length>=2?t(e,n):function(n){return t(n,e)}};case 3:return function(e,n,r){return arguments.length>=3?t(e,n,r):function(r){return t(r,e,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(e){return t(e,...n)}}}},_c=e=>e,vc=(e=>()=>e)(void 0),yc=vc;function bc(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i}}function xc(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),t.set(i,i),i}}var Sc=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete(`stack`);let n=Object.getPrototypeOf(e),r=n;for(;r!==null&&r!==Object.prototype;){let e=Reflect.ownKeys(r);for(let n=0;n<e.length;n++)t.add(e[n]);r=Object.getPrototypeOf(r)}return t.has(`constructor`)&&typeof e.constructor==`function`&&n===e.constructor.prototype&&t.delete(`constructor`),t},Cc=new WeakSet;function wc(e){return typeof e==`string`}function Tc(e){return typeof e==`number`}function Ec(e){return typeof e==`boolean`}function Dc(e){return typeof e==`symbol`}function Oc(e){return wc(e)||Tc(e)||Dc(e)}function kc(e){return typeof e==`function`}function Ac(e){return e!==void 0}function jc(e){return e!=null}function Mc(e){return!1}function Nc(e){return!0}function Pc(e){return typeof e==`object`&&!!e||kc(e)}var Fc=gc(2,(e,t)=>Pc(e)&&t in e),Ic=`~effect/interfaces/Hash`,Lc=e=>{switch(typeof e){case`number`:return Hc(e);case`bigint`:return Uc(e.toString(10));case`boolean`:return Uc(String(e));case`symbol`:return Uc(String(e));case`string`:return Uc(e);case`undefined`:return Uc(`undefined`);case`function`:case`object`:if(e===null)return Uc(`null`);if(e instanceof Date)return Number.isNaN(e.getTime())?Uc(`Invalid Date`):Uc(e.toISOString());if(e instanceof RegExp)return Uc(e.toString());{if(Cc.has(e))return Rc(e);if(Zc.has(e))return Zc.get(e);let t=$c(e,()=>Vc(e)?e[Ic]():typeof e==`function`?Rc(e):e instanceof DataView?qc(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):Array.isArray(e)||ArrayBuffer.isView(e)?qc(e):e instanceof Map?Jc(e):e instanceof Set?Yc(e):Gc(e));return Zc.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},Rc=e=>(Xc.has(e)||Xc.set(e,Hc(Math.floor(Math.random()*(2**53-1)))),Xc.get(e)),zc=gc(2,(e,t)=>e*53^t),Bc=e=>e&3221225471|e>>>1&1073741824,Vc=e=>Fc(e,Ic),Hc=e=>{if(e!==e)return Uc(`NaN`);if(e===1/0)return Uc(`Infinity`);if(e===-1/0)return Uc(`-Infinity`);let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return Bc(t)},Uc=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return Bc(t)},Wc=(e,t)=>{let n=12289;for(let r of t)n^=zc(Lc(r),Lc(e[r]));return Bc(n)},Gc=e=>Wc(e,Sc(e)),Kc=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return Bc(r)},qc=Kc(6151,Lc),Jc=Kc(Uc(`Map`),([e,t])=>zc(Lc(e),Lc(t))),Yc=Kc(Uc(`Set`),Lc),Xc=new WeakMap,Zc=new WeakMap,Qc=new WeakSet;function $c(e,t){if(Qc.has(e))return Uc(`[Circular]`);Qc.add(e);let n=t();return Qc.delete(e),n}var el=`~effect/interfaces/Equal`;function tl(){return arguments.length===1?e=>nl(e,arguments[0]):nl(arguments[0],arguments[1])}function nl(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;return n===typeof t?n===`number`&&e!==e&&t!==t?!0:n!==`object`&&n!==`function`||Cc.has(e)||Cc.has(t)?!1:sl(e,t,ol):!1}function rl(e,t,n){let r=il.has(e),i=al.has(t);if(r&&i)return!0;if(r||i)return!1;il.add(e),al.add(t);let a=n();return il.delete(e),al.delete(t),a}var il=new WeakSet,al=new WeakSet;function ol(e,t){if(Lc(e)!==Lc(t))return!1;if(e instanceof Date){if(!(t instanceof Date))return!1;let n=e.getTime(),r=t.getTime();return n===r||Number.isNaN(n)&&Number.isNaN(r)}if(e instanceof RegExp)return t instanceof RegExp&&e.toString()===t.toString();let n=gl(e),r=gl(t);if(n!==r)return!1;let i=n&&r;return typeof e==`function`&&!i?!1:rl(e,t,()=>{if(i)return e[el](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:ll(e,t);if(ArrayBuffer.isView(e)){let n=e instanceof DataView;if(!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||n!==t instanceof DataView)return!1;if(n){let n=t;return ul(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(n.buffer,n.byteOffset,n.byteLength))}return ul(e,t)}return e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:pl(e,t):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:hl(e,t):dl(e,t)})}function sl(e,t,n){let r=cl.get(e);if(!r)r=new WeakMap,cl.set(e,r);else if(r.has(t))return r.get(t);let i=n(e,t);r.set(t,i);let a=cl.get(t);return a||(a=new WeakMap,cl.set(t,a)),a.set(e,i),i}var cl=new WeakMap;function ll(e,t){for(let n=0;n<e.length;n++)if(!nl(e[n],t[n]))return!1;return!0}function ul(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function dl(e,t){let n=Sc(e),r=Sc(t);if(n.size!==r.size)return!1;for(let i of n)if(!r.has(i)||!nl(e[i],t[i]))return!1;return!0}function fl(e,t){return function(n,r){let i=Array.from(r);for(let[r,a]of n){let n=!1;for(let o=0;o<i.length;o++){let[s,c]=i[o];if(e(r,s)&&t(a,c)){i[o]=i[i.length-1],i.pop(),n=!0;break}}if(!n)return!1}return!0}}var pl=fl(nl,nl);function ml(e){return function(t,n){let r=Array.from(n);for(let n of t){let t=!1;for(let i=0;i<r.length;i++){let a=r[i];if(e(n,a)){r[i]=r[r.length-1],r.pop(),t=!0;break}}if(!t)return!1}return!0}}var hl=ml(nl),gl=e=>Fc(e,el),_l=e=>(t,n)=>t===n||e(t,n),vl=e=>e.length>0;function yl(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function bl(e,t){for(let n of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,n)&&yl(e,n,t[n])}var xl=Symbol.for(`~effect/Redactable`),Sl=e=>Fc(e,xl);function Cl(e){return Sl(e)?wl(e):e}function wl(e){return e[xl](globalThis[`~effect/Fiber/currentFiber`]?.context??Dl)}var Tl=`~effect/Fiber/currentFiber`,El=new Map,Dl={"~effect/Context":{},base:El,depth:0,mapUnsafe:El,pipe(){return pc(this,arguments)}};function Ol(e,t){let n=t?.space??0,r=new WeakSet,i=n?typeof n==`number`?` `.repeat(n):n:``,a=e=>i.repeat(e),o=(e,t)=>{let n=e?.constructor;return n&&n!==Object.prototype.constructor&&n.name?`${n.name}(${t})`:t},s=e=>{try{return Reflect.ownKeys(e)}catch{return[`[ownKeys threw]`]}};function c(e,n=0){if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`||e==null||typeof e==`boolean`||typeof e==`symbol`)return String(e);if(typeof e==`bigint`)return String(e)+`n`;if(typeof e==`object`||typeof e==`function`){if(r.has(e))return kl;r.add(e);let l;if(xl in e)l=c(wl(e),n);else if(Array.isArray(e))l=!i||e.length<=1?`[${e.map(e=>c(e,n)).join(`,`)}]`:`[\n${a(n+1)}${e.map(e=>c(e,n+1)).join(`,
12
+ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=Dr(),d;if(t){let e=typeof t==`string`?pe(t):t;O(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):we(e,{pathname:p});ce(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),ce(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=Br(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:tt([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:tt([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?v.createElement(_r.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function Pr(){let e=qr(),t=ut(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=v.createElement(v.Fragment,null,v.createElement(`p`,null,`💿 Hey developer 👋`),v.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,v.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,v.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),v.createElement(v.Fragment,null,v.createElement(`h2`,null,`Unexpected Application Error!`),v.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?v.createElement(`pre`,{style:i},n):null,o)}var Fr=v.createElement(Pr,null),Ir=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=wr(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:v.createElement(vr.Provider,{value:this.props.routeContext},v.createElement(yr.Provider,{value:e,children:this.props.component}));return this.context?v.createElement(Rr,{error:e},t):t}};Ir.contextType=dr;var Lr=new WeakMap;function Rr({children:e,error:t}){let{basename:n,navigator:r}=v.useContext(gr);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Cr(t.digest);if(e){let i=Lr.get(t);if(i)throw i;let a=pt(e.location,n),o=a.absoluteURL||a.to;if(kt(e.location,o,Et(r),`allow-explicit`),wn(o))throw Error(`Invalid redirect location`);if(ft&&!Lr.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw Lr.set(t,n),n}}return v.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function zr({routeContext:e,match:t,children:n}){let r=v.useContext(lr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(vr.Provider,{value:e},n)}function Br(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);O(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:dt(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||Fr,o&&(s<0&&c===0?(Qr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?v.createElement(n.route.Component,null):n.route.element?n.route.element:e,v.createElement(zr,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?v.createElement(Ir,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function Vr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Hr(e){let t=v.useContext(lr);return O(t,Vr(e)),t}function Ur(e){let t=v.useContext(ur);return O(t,Vr(e)),t}function Wr(e){let t=v.useContext(vr);return O(t,Vr(e)),t}function Gr(e){let t=Wr(e),n=t.matches[t.matches.length-1];return O(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Kr(){return Gr(`useRouteId`)}function qr(){let e=v.useContext(yr),t=Ur(`useRouteError`),n=Gr(`useRouteError`);return e===void 0?t.errors?.[n]:e}var Jr=0;function Yr(e){let{router:t,basename:n}=Hr(`useBlocker`),r=Ur(`useBlocker`),[i,a]=v.useState(``),o=v.useCallback(t=>{if(typeof e!=`function`)return!!e;if(n===`/`)return e(t);let{currentLocation:r,nextLocation:i,historyAction:a}=t;return e({currentLocation:{...r,pathname:Ge(r.pathname,n)||r.pathname},nextLocation:{...i,pathname:Ge(i.pathname,n)||i.pathname},historyAction:a})},[n,e]);return v.useEffect(()=>{let e=String(++Jr);return a(e),()=>t.deleteBlocker(e)},[t]),v.useEffect(()=>{i!==``&&t.getBlocker(i,o)},[t,i,o]),i&&r.blockers.has(i)?r.blockers.get(i):Rt}function Xr(){let{router:e}=Hr(`useNavigate`),t=Gr(`useNavigate`),n=v.useRef(!1);return kr(()=>{n.current=!0}),v.useCallback(async(r,i={})=>{ce(n.current,Or),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Zr={};function Qr(e,t,n){!t&&!Zr[e]&&(Zr[e]=!0,ce(!1,n))}var $r={};function ei(e,t){!e&&!$r[t]&&($r[t]=!0,console.warn(t))}var ti=v.useOptimistic,ni=()=>void 0;function ri(e){return ti?ti(e):[e,ni]}function ii(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&ce(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:v.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&ce(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:v.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&ce(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:v.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var ai=[`HydrateFallback`,`hydrateFallbackElement`],oi=class{constructor(){this.status=`pending`,this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function si({router:e,flushSync:t,onError:n,useTransitions:r}){r=fr()||r;let[i,a]=v.useState(e.state),[o,s]=ri(i),[c,l]=v.useState(),[u,d]=v.useState({isTransitioning:!1}),[f,p]=v.useState(),[m,h]=v.useState(),[g,_]=v.useState(),y=v.useRef(new Map),b=v.useCallback((i,{deletedFetchers:o,newErrors:c,flushSync:u,viewTransitionOpts:g})=>{c&&n&&Object.values(c).forEach(e=>n(e,{location:i.location,params:i.matches[0]?.params??{},pattern:dt(i.matches)})),i.fetchers.forEach((e,t)=>{e.data!==void 0&&y.current.set(t,e.data)}),o.forEach(e=>y.current.delete(e)),ei(u===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let b=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(ei(g==null||b,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!g||!b){t&&u?t(()=>a(i)):r===!1?a(i):v.startTransition(()=>{r===!0&&s(e=>ci(e,i)),a(i)});return}if(t&&u){t(()=>{m&&(f?.resolve(),m.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:g.currentLocation,nextLocation:g.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>a(i))});n.finished.finally(()=>{t(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})})}),t(()=>h(n));return}m?(f?.resolve(),m.skipTransition(),_({state:i,currentLocation:g.currentLocation,nextLocation:g.nextLocation})):(l(i),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}))},[e.window,t,m,f,r,s,n]);v.useLayoutEffect(()=>e.subscribe(b),[e,b]),v.useEffect(()=>{u.isTransitioning&&!u.flushSync&&p(new oi)},[u]),v.useEffect(()=>{if(f&&c&&e.window){let t=c,n=f.promise,i=e.window.document.startViewTransition(async()=>{r===!1?a(t):v.startTransition(()=>{r===!0&&s(e=>ci(e,t)),a(t)}),await n});i.finished.finally(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})}),h(i)}},[c,f,e.window,r,s]),v.useEffect(()=>{f&&c&&o.location.key===c.location.key&&f.resolve()},[f,m,o.location,c]),v.useEffect(()=>{!u.isTransitioning&&g&&(l(g.state),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),_(void 0))},[u.isTransitioning,g]);let x=v.useMemo(()=>({createHref:e.createHref,createURL:e.createURL,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),S=e.basename||`/`,C=v.useMemo(()=>({router:e,navigator:x,static:!1,basename:S,onError:n}),[e,x,S,n]);return v.createElement(v.Fragment,null,v.createElement(lr.Provider,{value:C},v.createElement(ur.Provider,{value:o},v.createElement(mr.Provider,{value:y.current},v.createElement(pr.Provider,{value:u},v.createElement(di,{basename:S,location:o.location,navigationType:o.historyAction,navigator:x,useTransitions:r},v.createElement(li,{routes:e.routes,manifest:e.manifest,future:e.future,state:o,isStatic:!1,onError:n})))))),null)}function ci(e,t){return{...e,navigation:t.navigation.state===`idle`?e.navigation:t.navigation,revalidation:t.revalidation===`idle`?e.revalidation:t.revalidation,actionData:t.navigation.state===`submitting`?e.actionData:t.actionData,fetchers:t.fetchers}}var li=v.memo(ui);function ui({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Nr(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function di({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){O(!Er(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=v.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=pe(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=v.useMemo(()=>{let e=Ge(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return ce(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:v.createElement(gr.Provider,{value:c},v.createElement(_r.Provider,{children:t,value:h}))}v.Component;var fi=`get`,pi=`application/x-www-form-urlencoded`;function mi(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function hi(e){return mi(e)&&e.tagName.toLowerCase()===`button`}function gi(e){return mi(e)&&e.tagName.toLowerCase()===`form`}function _i(e){return mi(e)&&e.tagName.toLowerCase()===`input`}function vi(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function yi(e,t){return e.button===0&&(!t||t===`_self`)&&!vi(e)}var bi=null;function xi(){if(bi===null)try{new FormData(document.createElement(`form`),0),bi=!1}catch{bi=!0}return bi}var Si=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Ci(e){return e!=null&&!Si.has(e)?(ce(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${pi}"`),null):e}function wi(e,t){let n,r,i,a,o;if(gi(e)){let o=e.getAttribute(`action`);r=o?Ge(o,t):null,n=e.getAttribute(`method`)||fi,i=Ci(e.getAttribute(`enctype`))||pi,a=new FormData(e)}else if(hi(e)||_i(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?Ge(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||fi,i=Ci(e.getAttribute(`formenctype`))||Ci(o.getAttribute(`enctype`))||pi,a=new FormData(o,e),!xi()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(mi(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=fi,r=null,i=pi,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function Ti(e,t){if(e===!1||e==null)throw Error(t)}function Ei(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&Ge(i.pathname,t)===`/`?`${nt(t)}/_root.${r}`:`${nt(i.pathname)}.${r}`,i}async function Di(e,t){if(e.id in t)return t[e.id];try{let n=await w(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Oi(e){return e!=null&&typeof e.page==`string`}function ki(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Ai(e,t,n){return Fi((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Di(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(ki).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function ji(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Mi(e,t,{includeHydrateFallback:n}={}){return Ni(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Ni(e){return[...new Set(e)]}function Pi(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Fi(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Oi(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Pi(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Ii(){let e=v.useContext(lr);return Ti(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Li(){let e=v.useContext(ur);return Ti(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Ri=v.createContext(void 0);Ri.displayName=`FrameworkContext`;function zi(){let e=v.useContext(Ri);return Ti(e,`You must render this element inside a <HydratedRouter> element`),e}function Bi(e,t){let n=v.useContext(Ri),[r,i]=v.useState(!1),[a,o]=v.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=v.useRef(null);v.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),v.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:Vi(s,p),onBlur:Vi(c,m),onMouseEnter:Vi(l,p),onMouseLeave:Vi(u,m),onTouchStart:Vi(d,p)}]:[a,f,{}]:[!1,f,{}]}function Vi(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Hi({page:e,...t}){let n=fr(),{nonce:r}=zi(),{router:i}=Ii(),a=v.useMemo(()=>we(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?v.createElement(Wi,{page:e,matches:a,...t}):v.createElement(Gi,{page:e,matches:a,...t})):null}function Ui(e){let{manifest:t,routeModules:n}=zi(),[r,i]=v.useState([]);return v.useEffect(()=>{let r=!1;return Ai(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Wi({page:e,matches:t,...n}){let r=Dr(),{future:i}=zi(),{basename:a}=Ii(),o=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Ei(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return v.createElement(v.Fragment,null,o.map(e=>v.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Gi({page:e,matches:t,...n}){let r=Dr(),{future:i,manifest:a,routeModules:o}=zi(),{basename:s}=Ii(),{loaderData:c,matches:l}=Li(),u=v.useMemo(()=>ji(e,t,l,a,r,`data`),[e,t,l,a,r]),d=v.useMemo(()=>ji(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];t&&t.hasLoader&&(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Ei(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=v.useMemo(()=>Mi(d,a),[d,a]),m=Ui(d);return v.createElement(v.Fragment,null,f.map(e=>v.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>v.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>v.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Ki(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}v.Component;var qi=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{qi&&(window.__reactRouterVersion=`7.18.4`)}catch{}function Ji(e,t){return qt({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:se({window:t?.window}),hydrationData:t?.hydrationData||Yi(),routes:e,mapRouteProperties:ii,hydrationRouteProperties:ai,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function Yi(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:Xi(e.errors)}),e}function Xi(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new lt(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(typeof r.__subType==`string`&&ct.includes(r.__subType)){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}var Zi=v.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=v.useContext(gr),y=typeof l==`string`&&ne.test(l),b=pt(l,h);l=b.to;let x=Tr(l,{relative:r}),S=Dr(),C=null;if(o){let e=$e(o,[],S.mask?S.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:tt([h,e.pathname])),C=g.createHref(e)}let[w,T,E]=Bi(n,p),D=na(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function ee(t){e&&e(t),t.defaultPrevented||D(t)}let te=!(b.isExternal||i),re=v.createElement(`a`,{...p,...E,href:(te?C:void 0)||b.absoluteURL||x,onClick:te?ee:e,ref:Ki(m,T),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return w&&!y?v.createElement(v.Fragment,null,re,v.createElement(Hi,{page:x})):re});Zi.displayName=`Link`;var Qi=v.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Mr(a,{relative:c.relative}),d=Dr(),f=v.useContext(ur),{navigator:p,basename:m}=v.useContext(gr),h=f!=null&&sa(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,y=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),y=y?y.toLowerCase():null,g=g.toLowerCase()),y&&m&&(y=Ge(y,m)||y);let b=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,x=_===g||!r&&_.startsWith(g)&&_.charAt(b)===`/`,S=y!=null&&(y===g||!r&&y.startsWith(g)&&y.charAt(g.length)===`/`),C={isActive:x,isPending:S,isTransitioning:h},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return v.createElement(Zi,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});Qi.displayName=`NavLink`;var $i=v.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=fi,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=v.useContext(gr),g=aa(),_=oa(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&ne.test(s);return v.createElement(`form`,{ref:m,method:y,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?v.startTransition(()=>p()):p()},...p,"data-discover":!b&&e===`render`?`true`:void 0})});$i.displayName=`Form`;function ea(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ta(e){let t=v.useContext(lr);return O(t,ea(e)),t}function na(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=Ar(),d=Dr(),f=Mr(e,{relative:o});return v.useCallback(p=>{if(yi(p,t)){p.preventDefault();let t=n===void 0?fe(d)===fe(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?v.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var ra=0,ia=()=>`__${String(++ra)}__`;function aa(){let{router:e}=ta(`useSubmit`),{basename:t}=v.useContext(gr),n=Kr(),r=e.fetch,i=e.navigate;return v.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=wi(e,t);if(a.navigate===!1){let e=a.fetcherKey||ia();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function oa(e,{relative:t}={}){let{basename:n}=v.useContext(gr),r=v.useContext(vr);O(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Mr(e||`.`,{relative:t})},o=Dr();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:tt([n,a.pathname])),fe(a)}function sa(e,{relative:t}={}){let n=v.useContext(pr);O(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=ta(`useViewTransitionState`),i=Mr(e,{relative:t});if(!n.isTransitioning)return!1;let a=Ge(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Ge(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ve(i.pathname,o)!=null||Ve(i.pathname,a)!=null}function ca(e){return v.createElement(si,{flushSync:y.flushSync,...e})}var A=e=>typeof e==`string`,la=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},ua=e=>e==null?``:``+e,da=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},fa=/###/g,pa=e=>e&&e.indexOf(`###`)>-1?e.replace(fa,`.`):e,j=e=>!e||A(e),ma=(e,t,n)=>{let r=A(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(j(e))return{};let t=pa(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return j(e)?{}:{obj:e,k:pa(r[i])}},ha=(e,t,n)=>{let{obj:r,k:i}=ma(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=ma(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=ma(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},ga=(e,t,n,r)=>{let{obj:i,k:a}=ma(e,t,Object);i[a]=i[a]||[],i[a].push(n)},_a=(e,t)=>{let{obj:n,k:r}=ma(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},va=(e,t,n)=>{let r=_a(e,n);return r===void 0?_a(t,n):r},ya=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(r in e?A(e[r])||e[r]instanceof String||A(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):ya(e[r],t[r],n):e[r]=t[r]);return e},ba=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),xa={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`,"/":`&#x2F;`},Sa=e=>A(e)?e.replace(/[&<>"'\/]/g,e=>xa[e]):e,Ca=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},wa=[` `,`,`,`?`,`!`,`;`],Ta=new Ca(20),Ea=(e,t,n)=>{t||=``,n||=``;let r=wa.filter(e=>t.indexOf(e)<0&&n.indexOf(e)<0);if(r.length===0)return!0;let i=Ta.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},Da=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].indexOf(typeof t)>-1&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},Oa=e=>e?.replace(/_/g,`-`),ka={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}},Aa=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||ka,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,t,n,r){return r&&!this.debug?null:(A(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t||=this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},ja=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n.apply(n,[e,...t])})}},Ma=class extends ja{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let i=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,a=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,o;e.indexOf(`.`)>-1?o=e.split(`.`):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):A(n)&&i?o.push(...n.split(i)):o.push(n)));let s=_a(this.data,o);return!s&&!t&&!n&&e.indexOf(`.`)>-1&&(e=o[0],t=o[1],n=o.slice(2).join(`.`)),s||!a||!A(n)?s:Da(this.data?.[e]?.[t],n,i)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.indexOf(`.`)>-1&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),ha(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(A(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.indexOf(`.`)>-1&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=_a(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?ya(s,n,i):s={...s,...n},ha(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||=this.options.defaultNS,this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},Na={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}},Pa=Symbol(`i18next/PATH_KEY`);function Fa(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===Pa?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function Ia(e,t){let{[Pa]:n}=e(Fa()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`;if(n.length>1&&i){let e=t?.ns,a=Array.isArray(e)?e:null;if(a&&a.length>1&&a.slice(1).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}var La={},Ra=e=>!A(e)&&typeof e!=`boolean`&&typeof e!=`number`,za=class e extends ja{constructor(e,t={}){super(),da([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=Aa.create(`translator`)}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=Ra(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,i=t.ns||this.options.defaultNS||[],a=n&&e.indexOf(n)>-1,o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!Ea(e,n,r);if(a&&!o){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:A(i)?[i]:i};let a=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(a[0])>-1)&&(i=a.shift()),e=a.join(r)}return{key:e,namespaces:A(i)?[i]:i}}translate(t,n,r){let i=typeof n==`object`?{...n}:n;if(typeof i!=`object`&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i==`object`&&(i={...i}),i||={},t==null)return``;typeof t==`function`&&(t=Ia(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?Ia(e,{...this.options,...i}):String(e));let a=i.returnDetails===void 0?this.options.returnDetails:i.returnDetails,o=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,{key:s,namespaces:c}=this.extractFromKey(t[t.length-1],i),l=c[c.length-1],u=i.nsSeparator===void 0?this.options.nsSeparator:i.nsSeparator;u===void 0&&(u=`:`);let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()===`cimode`)return f?a?{res:`${l}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:`${l}${u}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:s;let p=this.resolve(t,i),m=p?.res,h=p?.usedKey||s,g=p?.exactUsedKey||s,_=[`[object Number]`,`[object Function]`,`[object RegExp]`],v=i.joinArrays===void 0?this.options.joinArrays:i.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,b=i.count!==void 0&&!A(i.count),x=e.hasDefaultValue(i),S=b?this.pluralResolver.getSuffix(d,i.count,i):``,C=i.ordinal&&b?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):``,w=b&&!i.ordinal&&i.count===0,T=w&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${S}`]||i[`defaultValue${C}`]||i.defaultValue,E=m;y&&!m&&x&&(E=T);let D=Ra(E),ee=Object.prototype.toString.apply(E);if(y&&E&&D&&_.indexOf(ee)<0&&!(A(v)&&Array.isArray(E))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,E,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(p.res=e,p.usedParams=this.getUsedParamsDetails(i),p):e}if(o){let e=Array.isArray(E),t=e?[]:{},n=e?g:h;for(let e in E)if(Object.prototype.hasOwnProperty.call(E,e)){let r=`${n}${o}${e}`;t[e]=x&&!m?this.translate(r,{...i,defaultValue:Ra(T)?T[e]:void 0,joinArrays:!1,ns:c}):this.translate(r,{...i,joinArrays:!1,ns:c}),t[e]===r&&(t[e]=E[e])}m=t}}else if(y&&A(v)&&Array.isArray(m))m=m.join(v),m&&=this.extendTranslation(m,t,i,r);else{let e=!1,n=!1;!this.isValidLookup(m)&&x&&(e=!0,m=T),this.isValidLookup(m)||(n=!0,m=s);let a=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:m,c=x&&T!==m&&this.options.updateMissing;if(n||e||c){if(this.logger.log(c?`updateKey`:`missingKey`,d,l,s,c?T:m),o){let e=this.resolve(s,{...i,keySeparator:!1});e&&e.res&&this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`)}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(i.lng||this.language):e.push(i.lng||this.language);let n=(e,t,n)=>{let r=x&&n!==m?n:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,r,c,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,r,c,i),this.emit(`missingKey`,e,l,t,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,i);w&&i[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,i[`defaultValue${t}`]||T)})}):n(e,s,T))}m=this.extendTranslation(m,t,i,p,r),n&&m===s&&this.options.appendNamespaceToMissingKey&&(m=`${l}${u}${s}`),(n||e)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${s}`:s,e?m:void 0,i))}return a?(p.res=m,p.usedParams=this.getUsedParamsDetails(i),p):m}extendTranslation(e,t,n,r,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let a=A(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),o;if(a){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!A(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),a){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;o<r&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>i?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let a=n.postProcess||this.options.postProcess,o=A(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=Na.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,i,a,o;return A(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?Ia(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),c=s.key;r=c;let l=s.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));let u=t.count!==void 0&&!A(t.count),d=u&&!t.ordinal&&t.count===0,f=t.context!==void 0&&(A(t.context)||typeof t.context==`number`)&&t.context!==``,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);l.forEach(e=>{this.isValidLookup(n)||(o=e,!La[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(La[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(`, `)}" won't get resolved as namespace "${o}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)),p.forEach(r=>{if(this.isValidLookup(n))return;a=r;let o=[c];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(o,c,r,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&e.indexOf(i)===0&&o.push(c+e.replace(i,this.options.pluralSeparator)),o.push(c+e),d&&o.push(c+n)),f){let r=`${c}${this.options.contextSeparator||`_`}${t.context}`;o.push(r),u&&(t.ordinal&&e.indexOf(i)===0&&o.push(r+e.replace(i,this.options.pluralSeparator)),o.push(r+e),d&&o.push(r+n))}}let s;for(;s=o.pop();)this.isValidLookup(n)||(i=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!A(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.substring(0,12)===`defaultValue`&&e[t]!==void 0)return!0;return!1}},Ba=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Aa.create(`languageUtils`)}getScriptPartFromCode(e){if(e=Oa(e),!e||e.indexOf(`-`)<0)return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=Oa(e),!e||e.indexOf(`-`)<0)return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(A(e)&&e.indexOf(`-`)>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load===`languageOnly`||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>{if(e===r||!(e.indexOf(`-`)<0&&r.indexOf(`-`)<0)&&(e.indexOf(`-`)>0&&r.indexOf(`-`)<0&&e.substring(0,e.indexOf(`-`))===r||e.indexOf(r)===0&&r.length>1))return e})}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),A(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||=e[this.getScriptPartFromCode(t)],n||=e[this.formatLanguageCode(t)],n||=e[this.getLanguagePartFromCode(t)],n||=e.default,n||[]}toResolveHierarchy(e,t){let n=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),r=[],i=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return A(e)&&(e.indexOf(`-`)>-1||e.indexOf(`_`)>-1)?(this.options.load!==`languageOnly`&&i(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&i(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&i(this.getLanguagePartFromCode(e))):A(e)&&i(this.formatLanguageCode(e)),n.forEach(e=>{r.indexOf(e)<0&&i(this.formatLanguageCode(e))}),r}},Va={zero:0,one:1,two:2,few:3,many:4,other:5},Ha={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},Ua=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=Aa.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=Oa(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),Ha;if(!e.match(/-|_/))return Ha;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?n.resolvedOptions().pluralCategories.sort((e,t)=>Va[e]-Va[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}},Wa=(e,t,n,r=`.`,i=!0)=>{let a=va(e,t,n);return!a&&i&&A(n)&&(a=Da(e,n,r),a===void 0&&(a=Da(t,n,r))),a},Ga=e=>e.replace(/\$/g,`$$$$`),Ka=class{constructor(e={}){this.logger=Aa.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||={escapeValue:!0};let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:_}=e.interpolation;this.escape=t===void 0?Sa:t,this.escapeValue=n===void 0||n,this.useRawValueToEscape=r!==void 0&&r,this.prefix=i?ba(i):a||`{{`,this.suffix=o?ba(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u||`-`,this.unescapeSuffix=this.unescapePrefix?``:l||``,this.nestingPrefix=d?ba(d):f||ba(`$t(`),this.nestingSuffix=p?ba(p):m||ba(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=_!==void 0&&_,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`g`);this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let i,a,o,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(e.indexOf(this.formatSeparator)<0){let i=Wa(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(Wa(t,s,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp();let l=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>Ga(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?Ga(this.escape(e)):Ga(e)}].forEach(t=>{for(o=0;i=t.regex.exec(e);){let n=i[1].trim();if(a=c(n),a===void 0){if(typeof l==`function`){let t=l(e,i,r);a=A(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))a=``;else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),a=``}else!A(a)&&!this.useRawValueToEscape&&(a=ua(a));let s=t.safeValue(a);if(e=e.replace(i[0],s),u?(t.regex.lastIndex+=a.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,i,a,o=(e,t)=>{let n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;let r=e.split(RegExp(`${ba(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,a);let o=i.match(/'/g),s=i.match(/"/g);((o?.length??0)%2==0&&!s||(s?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{a=JSON.parse(i),t&&(a={...t,...a})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];a={...n},a=a.replace&&!A(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=/{.*}/.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(c!==-1&&(s=r[1].slice(c).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,c)),i=t(o.call(this,r[1].trim(),a),a),i&&r[0]===e&&!A(i))return i;A(i)||(i=ua(i)),i||=(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),``),s.length&&(i=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}},qa=e=>{let t=e.toLowerCase().trim(),n={};if(e.indexOf(`(`)>-1){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].substring(0,r[1].length-1);t===`currency`&&i.indexOf(`:`)<0?n.currency||=i.trim():t===`relativetime`&&i.indexOf(`:`)<0?n.range||=i.trim():i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},Ja=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(Oa(r),i),t[o]=s),s(n)}},Ya=e=>(t,n,r)=>e(Oa(n),r)(t),Xa=class{constructor(e={}){this.logger=Aa.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?Ja:Ya;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Ja(t)}format(e,t,n,r={}){let i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf(`(`)>1&&i[0].indexOf(`)`)<0&&i.find(e=>e.indexOf(`)`)>-1)){let e=i.findIndex(e=>e.indexOf(`)`)>-1);i[0]=[i[0],...i.splice(1,e)].join(this.formatSeparator)}return i.reduce((e,t)=>{let{formatName:i,formatOptions:a}=qa(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${i}`),e},e)}},Za=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},Qa=class extends ja{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=Aa.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{ga(n.loaded,[i],a),Za(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();A(e)&&(e=this.languageUtils.toResolveHierarchy(e)),A(t)&&(t=[t]);let i=this.queueLoad(e,t,n,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);return}if(n!=null&&n!==``){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}},$a=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,simplifyPluralSuffix:!0,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:`fallback`,saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]==`object`&&(t=e[1]),A(e[1])&&(t.defaultValue=e[1]),A(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),eo=e=>(A(e.ns)&&(e.ns=[e.ns]),A(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),A(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.(`cimode`)<0&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),typeof e.initImmediate==`boolean`&&(e.initAsync=e.initImmediate),e),to=()=>{},no=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},ro=`__i18next_supportNoticeShown`,io=()=>!!(typeof globalThis<`u`&&globalThis[ro]||typeof process<`u`&&{}.I18NEXT_NO_SUPPORT_NOTICE||typeof process<`u`),ao=()=>{typeof globalThis<`u`&&(globalThis[ro]=!0)},oo=e=>!!(e?.modules?.backend?.name?.indexOf(`Locize`)>0||e?.modules?.backend?.constructor?.name?.indexOf(`Locize`)>0||e?.options?.backend?.backends&&e.options.backend.backends.some(e=>e?.name?.indexOf(`Locize`)>0||e?.constructor?.name?.indexOf(`Locize`)>0)||e?.options?.backend?.projectId||e?.options?.backend?.backendOptions&&e.options.backend.backendOptions.some(e=>e?.projectId)),so=class e extends ja{constructor(e={},t){if(super(),this.options=eo(e),this.services={},this.logger=Aa,this.modules={external:[]},no(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&(A(e.ns)?e.defaultNS=e.ns:e.ns.indexOf(`translation`)<0&&(e.defaultNS=e.ns[0]));let n=$a();this.options={...n,...this.options,...eo(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!=`function`&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!oo(this)&&!io()&&(typeof console<`u`&&console.info!==void 0&&console.info(`🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙`),ao());let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?Aa.init(r(this.modules.logger),this.options):Aa.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:Xa;let t=new Ba(this.options);this.store=new Ma(this.options.resources,this.options);let i=this.services;i.logger=Aa,i.resourceStore=this.store,i.languageUtils=t,i.pluralResolver=new Ua(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`),e&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(i.formatter=r(e),i.formatter.init&&i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new Ka(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new Qa(r(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(i.languageDetector=r(this.modules.languageDetector),i.languageDetector.init&&i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=r(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new za(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||=to,this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn(`init: no languageDetector is used and no lng is defined`),[`getResource`,`hasResourceBundle`,`getResourceBundle`,`getDataByLanguage`].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let i=la(),a=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn(`init: i18next is already initialized. You should call init just once!`),this.isInitialized=!0,this.options.isClone||this.logger.log(`initialized`,this.options),this.emit(`initialized`,this.options),i.resolve(n),t(e,n)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),i}loadResources(e,t=to){let n=t,r=A(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&e.indexOf(t)<0&&e.push(t)})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=la();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||=this.languages,t||=this.options.ns,n||=to,this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);return e.type===`backend`&&(this.modules.backend=e),(e.type===`logger`||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type===`languageDetector`&&(this.modules.languageDetector=e),e.type===`i18nFormat`&&(this.modules.i18nFormat=e),e.type===`postProcessor`&&Na.addPostProcessor(e),e.type===`formatter`&&(this.modules.formatter=e),e.type===`3rdParty`&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!([`cimode`,`dev`].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(!([`cimode`,`dev`].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=la();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},a=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=A(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(A(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{i(e,a)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),n}getFixedT(e,t,n){let r=(e,t,...i)=>{let a;a=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(i)),a.lng=a.lng||r.lng,a.lngs=a.lngs||r.lngs,a.ns=a.ns||r.ns,a.keyPrefix!==``&&(a.keyPrefix=a.keyPrefix||n||r.keyPrefix);let o={...this.options,...a};typeof a.keyPrefix==`function`&&(a.keyPrefix=Ia(a.keyPrefix,o));let s=this.options.keySeparator||`.`,c;return a.keyPrefix&&Array.isArray(e)?c=e.map(e=>(typeof e==`function`&&(e=Ia(e,o)),`${a.keyPrefix}${s}${e}`)):(typeof e==`function`&&(e=Ia(e,o)),c=a.keyPrefix?`${a.keyPrefix}${s}${e}`:e),this.t(c,a)};return A(e)?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=n,r}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`,this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`,this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,t){let n=la();return this.options.ns?(A(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=la();A(e)&&(e=[e]);let r=this.options.preload||[],i=e.filter(e=>r.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=r.concat(i),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`),n=this.services?.languageUtils||new Ba($a());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=to){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new Ma(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...$a().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new Ka(n)}return a.translator=new za(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();so.createInstance,so.dir,so.init,so.loadResources,so.reloadResources,so.use,so.changeLanguage,so.getFixedT,so.t,so.exists,so.setDefaultNamespace,so.hasLoadedNamespace,so.loadNamespaces,so.loadLanguages;var co=(e,t,n,r)=>{let i=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,`warn`,`react-i18next::`,!0);go(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},lo={},uo=(e,t,n,r)=>{go(n)&&lo[n]||(go(n)&&(lo[n]=new Date),co(e,t,n,r))},fo=(e,t)=>()=>{if(e.isInitialized)t();else{let n=()=>{setTimeout(()=>{e.off(`initialized`,n)},0),t()};e.on(`initialized`,n)}},po=(e,t,n)=>{e.loadNamespaces(t,fo(e,n))},mo=(e,t,n,r)=>{if(go(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return po(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,fo(e,r))},ho=(e,t,n={})=>!t.languages||!t.languages.length?(uo(t,`NO_LANGUAGES`,`i18n.languages were undefined or empty`,{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,r)=>{if(n.bindI18n&&n.bindI18n.indexOf(`languageChanging`)>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}),go=e=>typeof e==`string`,_o=e=>typeof e==`object`&&!!e,vo=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,yo={"&amp;":`&`,"&#38;":`&`,"&lt;":`<`,"&#60;":`<`,"&gt;":`>`,"&#62;":`>`,"&apos;":`'`,"&#39;":`'`,"&quot;":`"`,"&#34;":`"`,"&nbsp;":` `,"&#160;":` `,"&copy;":`©`,"&#169;":`©`,"&reg;":`®`,"&#174;":`®`,"&hellip;":`…`,"&#8230;":`…`,"&#x2F;":`/`,"&#47;":`/`},bo=e=>yo[e],xo={bindI18n:`languageChanged`,bindI18nStore:``,transEmptyNodeValue:``,transSupportBasicHtmlNodes:!0,transWrapTextNodes:``,transKeepBasicHtmlNodesFor:[`br`,`strong`,`i`,`p`],useSuspense:!0,unescape:e=>e.replace(vo,bo),transDefaultProps:void 0},So=(e={})=>{xo={...xo,...e}},Co=()=>xo,wo,To=e=>{wo=e},Eo=()=>wo,Do={type:`3rdParty`,init(e){So(e.options.react),To(e)}},Oo=(0,v.createContext)(),ko=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}},Ao=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),jo=o(((e,t)=>{t.exports=Ao()})),Mo=jo(),No={t:(e,t)=>{if(go(t))return t;if(_o(t)&&go(t.defaultValue))return t.defaultValue;if(typeof e==`function`)return``;if(Array.isArray(e)){let t=e[e.length-1];return typeof t==`function`?``:t}return e},ready:!1},Po=()=>()=>{},Fo=(e,t={})=>{let{i18n:n}=t,{i18n:r,defaultNS:i}=(0,v.useContext)(Oo)||{},a=n||r||Eo();a&&!a.reportNamespaces&&(a.reportNamespaces=new ko),a||uo(a,`NO_I18NEXT_INSTANCE`,`useTranslation: You will need to pass in an i18next instance by using initReactI18next`);let o=(0,v.useMemo)(()=>({...Co(),...a?.options?.react,...t}),[a,t]),{useSuspense:s,keyPrefix:c}=o,l=e||i||a?.options?.defaultNS,u=go(l)?[l]:l||[`translation`],d=(0,v.useMemo)(()=>u,u);a?.reportNamespaces?.addUsedNamespaces?.(d);let f=(0,v.useRef)(0),p=(0,v.useCallback)(e=>{if(!a)return Po;let{bindI18n:t,bindI18nStore:n}=o,r=()=>{f.current+=1,e()};return t&&a.on(t,r),n&&a.store.on(n,r),()=>{t&&t.split(` `).forEach(e=>a.off(e,r)),n&&n.split(` `).forEach(e=>a.store.off(e,r))}},[a,o]),m=(0,v.useRef)(),h=(0,v.useCallback)(()=>{if(!a)return No;let e=!!(a.isInitialized||a.initializedStoreOnce)&&d.every(e=>ho(e,a,o)),n=t.lng||a.language,r=f.current,i=m.current;if(i&&i.ready===e&&i.lng===n&&i.keyPrefix===c&&i.revision===r)return i;let s={t:a.getFixedT(n,o.nsMode===`fallback`?d:d[0],c),ready:e,lng:n,keyPrefix:c,revision:r};return m.current=s,s},[a,d,c,o,t.lng]),[g,_]=(0,v.useState)(0),{t:y,ready:b}=(0,Mo.useSyncExternalStore)(p,h,h);(0,v.useEffect)(()=>{if(a&&!b&&!s){let e=()=>_(e=>e+1);t.lng?mo(a,t.lng,d,e):po(a,d,e)}},[a,t.lng,d,b,s,g]);let x=a||{},S=(0,v.useRef)(null),C=(0,v.useRef)(),w=e=>{let t=Object.getOwnPropertyDescriptors(e);t.__original&&delete t.__original;let n=Object.create(Object.getPrototypeOf(e),t);if(!Object.prototype.hasOwnProperty.call(n,`__original`))try{Object.defineProperty(n,"__original",{value:e,writable:!1,enumerable:!1,configurable:!1})}catch{}return n},T=(0,v.useMemo)(()=>{let e=x,t=e?.language,n=e;e&&(S.current&&S.current.__original===e&&C.current===t?n=S.current:(n=w(e),S.current=n,C.current=t));let r=!b&&!s?(...e)=>(uo(a,`USE_T_BEFORE_READY`,`useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.`),y(...e)):y,i=[r,n,b];return i.t=r,i.i18n=n,i.ready=b,i},[y,x,b,x.resolvedLanguage,x.language,x.languages]);if(a&&s&&!b)throw new Promise(e=>{let n=()=>e();t.lng?mo(a,t.lng,d,n):po(a,d,n)});return T},Io={en:{translation:{"attempt.notes":`Notes`,"app.failed":`NiceEval View failed to load`,"executionTrace.title":`Execution events`,"executionTrace.stableId":`Stable event or evidence ID`,"executionTrace.openEvent":`Open event`,"executionTrace.openEvidence":`Open evidence`,"executionTrace.nextPage":`Next event page`,"executionTrace.firstPage":`First event page`,"executionTrace.nextBytes":`Next evidence chunk`,"executionTrace.omitted":`{{count}} events remaining`,"executionTrace.byteRange":`UTF-8 preview from byte {{offset}} of {{total}}`,"executionTrace.moreBytes":`… ({{count}} more bytes; open event for full text)`,"executionTrace.imageDecodeFailed":`Image could not be decoded`,"executionTrace.imageTooLarge":`Images above 16 MiB are not displayed inline. Read this artifact with niceeval query run --request -.`,"nav.experiments":`Experiments`,"nav.language":`Language`,"nav.pages":`Report pages`,"insight.title":`NiceEval Insight`,"insight.navigation":`Insight`,"current.title":`Current results`,"current.summary":`Summary`,"current.covered":`Covered`,"current.gaps":`Gaps`,"current.verdicts":`Verdicts`,"current.partial":`partial`,"current.attempt":`Attempt`,"current.eval":`Eval`,"current.gapReason":`Gap: {{reason}}`,"current.reason.no-result":`no result`,"current.reason.pending":`pending`,"current.reason.not-published":`not published`,"current.reason.identity-mismatch":`identity-mismatch`,"current.reason.outcome-ineligible":`previous attempt did not complete`,"current.reason.score-incomplete":`score incomplete`,"current.reason.evidence-unavailable":`evidence unavailable`,"current.reason.timeout-exceeded":`timeout exceeded`,"current.reason.adoption-unproven":`adoption could not be verified`,"current.previousResult":`Previous result`,"current.next":`Next:`,"current.history":`History`,"current.historicalResults":`Historical results`,"current.unavailable":`Current results are unavailable`,"current.unavailableDetail":`The current project target could not be evaluated. Review recorded results or retry refresh.`,"current.unavailableReason":`Reason`,"current.historicalRun":`Open a historical Run`,"insight.chart.cost":`Application cost`,"insight.chart.passRate":`Pass rate`,"insight.chart.score":`Score`,"insight.chart.noData":`No chartable data`,"insight.chart.partial":`partial data`,"insight.chart.openExperiment":`open experiment`,"verdict.passed":`passed`,"verdict.scored":`scored`,"verdict.failed":`failed`,"verdict.errored":`errored`,"verdict.skipped":`skipped`,"cell.missing":`no data`,"cell.unscorable":`unscorable`,"cell.noCurrentResult":`no result for current config`,"cell.metricFailed":`failed`,"cell.metricUnavailable":`unavailable`,"cell.metricUnsupported":`unsupported`,"cell.metricMigrationRequired":`migration required`,"cell.measuredTitle":`{{samples}}/{{total}} attempts measured`,"cell.noneMeasurableTitle":`0/{{total}} attempts measurable`,"cell.coverageTitle":`coverage {{samples}}/{{total}}: this metric is null for the remaining attempts`,"cell.coverageDetail":`Result coverage {{samples}}/{{total}}`,"cell.partialTitle":`This value is a known subtotal because some underlying observations are unavailable`,"cell.partialDetail":`partial`,"cell.costReported":`reported`,"cell.costEstimated":`estimated`,"cell.costMixed":`reported + estimated`,"usage.configuredModels":`Configured model roles`,"usage.configuredRoleCount":`{{count}} configured roles`,"usage.configuredModel":`Configured model`,"usage.role":`Role`,"usage.effort":`Effort`,"usage.recordedCalls":`Recorded calls`,"usage.noRecordedCalls":`no recorded calls`,"usage.notRecorded":`not recorded`,"usage.actualModels":`Actual model usage`,"usage.actualModel":`Actual model`,"usage.servingProvider":`Serving provider`,"usage.tokens":`Tokens`,"usage.inputTotal":`Input including cache`,"usage.totalTokens":`Total tokens`,"usage.applicationCost":`Application cost`,"usage.judgeUsage":`Judge usage`,"usage.judgeNotRecorded":`Judge usage was not recorded`,"usage.knownSubtotal":`known subtotal`,"usage.totalKnownSubtotal":`Attempt known subtotal`,"usage.missingSources":`Missing sources`,"usage.groupPreview":`{{shown}} groups shown; {{total}} total; {{omitted}} omitted`,"usage.costOrigins":`{{reported}} reported; {{estimated}} estimated`,"usage.totalCosts":`Attempt total cost`,"usage.costComplete":`Complete`,"usage.costIncomplete":`Incomplete`,"usage.noRecordedCharges":`No recorded charges`,"usage.noJudgeCalls":`No Judge calls`,"usage.physicalCalls":`Physical calls`,"usage.cacheReadRate":`Cache read rate`,"usage.cacheTotal":`Total`,"usage.cacheScope":`Scope`,"usage.cacheCoverage":`Covered calls`,"usage.cacheCollection":`Collection`,"usage.cacheReasons":`Reasons`,"usage.cacheComplete":`Collection complete`,"usage.cacheIncomplete":`Collection incomplete`,"usage.external":`External call usage`,"usage.input":`Input tokens (excluding cache)`,"usage.output":`Output tokens`,"usage.requests":`Requests`,"usage.calls":`Recorded calls`,"usage.prices":`Sealed pricing evidence`,"usage.coverage":`{{covered}}/{{total}} calls fully costed`,"experimentCost.totalCosts":`Experiment total costs`,"experimentCost.knownSubtotal":`Experiment known subtotal`,"experimentCost.scope":`Scope: latest recorded attempts. Each planned attempt retains its latest recorded result across reruns; replaced executions are excluded.`,"experimentCost.selectedSlots":`Planned attempts`,"experimentCost.resolvedSlots":`Recorded attempts`,"experimentCost.originAttempts":`Unique origin Attempts`,"experimentCost.completeAttempts":`Attempts with complete costs`,"experimentCost.partialAttempts":`Attempts with partial costs`,"experimentCost.unavailableAttempts":`Attempts with unavailable costs`,"experimentCost.unresolvedSlots":`Missing attempts`,"cell.evidence":`{{n}} attempts`,"table.model":`Model`,"cell.mixedExecution":`mixed`,"table.adapter":`Adapter`,"table.filterPlaceholder":`Filter rows…`,"experimentList.experiment":`Experiment`,"experimentList.avgDuration":`Avg. time`,"experimentList.passRate":`Pass rate`,"experimentList.totalScore":`Total score`,"experimentList.missedScoreItems":`{{n}} missed checks`,"experimentList.tokens":`Tokens`,"experimentList.cost":`Application cost`,"experimentList.result":`Result`,"experimentList.status":`Status`,"experimentList.filterPlaceholder":`Filter experiments…`,"report.close":`Close`,"report.details":`Details`,"report.loading":`Loading…`,"report.loadingDetails":`Loading details…`,"report.backToResults":`Back to results`,"report.retry":`Retry`,"report.unableToLoad":`Unable to load this page.`,"report.unableToLoadDetails":`Unable to load details.`,"attempt.title":`Attempt`,"attempt.experiment":`Experiment`,"attempt.adapter":`Adapter`,"attempt.adapterRevisionNotDeclared":`revision not declared`,"attempt.eval":`Eval`,"attempt.score":`Score`,"attempt.scoreCompleted":`Score completed`,"attempt.started":`Started`,"attempt.duration":`Duration`,"attempt.cost":`Cost`,"attempt.assertions":`Assertions`,"attempt.traceDetails":`Trace details`,"attempt.traceItem":`item {{id}}`,"attempt.traceTool":`tool {{id}}`,"attempt.traceCommand":`command {{id}}`,"attempt.executionTimeline":`Execution timeline`,"attempt.usage":`Usage`,"attempt.sources":`Sources`,"attempt.fileChanges":`File changes`,"attempt.artifacts":`Artifacts`,"attempt.loadOnDemand":`Expand or select to load.`,"attempt.artifactsNone":`No artifacts were recorded.`,"attempt.artifactsRetained_one":`{{count}} retained content item`,"attempt.artifactsRetained_other":`{{count}} retained content items`,"attempt.truncated":`(truncated)`,"attempt.verdict.passed":`passed`,"attempt.verdict.failed":`failed`,"attempt.verdict.errored":`errored`,"attempt.verdict.skipped":`skipped`,"attempt.verdict.unknown":`unknown`,"refresh.action":`Refresh`,"refresh.available":`An update with newer sealed results is available.`,"refresh.lastGoodStale":`These are previous current results. Refresh to evaluate the project again.`,"refresh.failed":`Refresh failed. The previous result remains visible but may be out of date.`,"refresh.reload":`Reload`,"refresh.reloadRequired":`Reload NiceEval View`,"refresh.reloadRequiredDetail":`The refresh result could not be confirmed. Reload before continuing to review results.`,"refresh.working":`Refreshing…`,"refresh.selectionChanged":`The previous selection is no longer available. Showing the nearest available result.`}},"zh-CN":{translation:{"attempt.notes":`记录项`,"app.failed":`NiceEval 视图载入失败`,"executionTrace.title":`执行事件`,"executionTrace.moreBytes":`…(还有 {{count}} 字节;打开事件查看全文)`,"executionTrace.imageDecodeFailed":`图片无法解码`,"executionTrace.imageTooLarge":`超过 16 MiB 的图片不内联显示。使用 niceeval query run --request - 读取此附件。`,"executionTrace.stableId":`稳定事件或证据 ID`,"executionTrace.openEvent":`打开事件`,"executionTrace.openEvidence":`打开证据`,"executionTrace.nextPage":`下一页事件`,"executionTrace.firstPage":`第一页事件`,"executionTrace.nextBytes":`下一段证据`,"executionTrace.omitted":`尚有 {{count}} 条事件`,"executionTrace.byteRange":`UTF-8 预览,从第 {{offset}} 字节开始,共 {{total}} 字节`,"nav.experiments":`实验`,"nav.language":`语言`,"nav.pages":`报告页面`,"insight.title":`NiceEval Insight`,"insight.navigation":`洞察`,"current.title":`当前结果`,"current.summary":`概览`,"current.covered":`已覆盖`,"current.gaps":`缺口`,"current.verdicts":`判定`,"current.partial":`部分结果`,"current.attempt":`尝试`,"current.eval":`评估用例`,"current.gapReason":`缺口:{{reason}}`,"current.reason.no-result":`暂无结果`,"current.reason.pending":`仍在运行`,"current.reason.not-published":`结果尚未发布`,"current.reason.identity-mismatch":`输入已变化(identity-mismatch)`,"current.reason.outcome-ineligible":`上次运行未完成`,"current.reason.score-incomplete":`得分不完整`,"current.reason.evidence-unavailable":`证据不可用`,"current.reason.timeout-exceeded":`超出时限`,"current.reason.adoption-unproven":`无法核实已采用结果`,"current.previousResult":`上次结果`,"current.next":`下一步:`,"current.history":`历史`,"current.historicalResults":`历史结果`,"current.unavailable":`当前结果不可用`,"current.unavailableDetail":`无法求值当前项目目标。可查看已有历史结果,或重新刷新。`,"current.unavailableReason":`原因`,"current.historicalRun":`查看历史运行`,"insight.chart.cost":`应用费用`,"insight.chart.passRate":`通过率`,"insight.chart.score":`得分`,"insight.chart.noData":`暂无可绘制的数据`,"insight.chart.partial":`部分数据`,"insight.chart.openExperiment":`打开实验`,"verdict.passed":`通过`,"verdict.scored":`评分完成`,"verdict.failed":`失败`,"verdict.errored":`错误`,"verdict.skipped":`跳过`,"cell.missing":`无数据`,"cell.unscorable":`测不出`,"cell.noCurrentResult":`当前配置下无结果`,"cell.metricFailed":`读取失败`,"cell.metricUnavailable":`不可用`,"cell.metricUnsupported":`不支持`,"cell.metricMigrationRequired":`需要迁移`,"cell.measuredTitle":`{{samples}}/{{total}} 次 attempt 测得`,"cell.noneMeasurableTitle":`0/{{total}} 次 attempt 可测`,"cell.coverageTitle":`覆盖率 {{samples}}/{{total}}:其余 attempt 测不了这个指标`,"cell.coverageDetail":`结果完整度 {{samples}}/{{total}}`,"cell.partialTitle":`部分底层观测不可用,此值是已知小计`,"cell.partialDetail":`部分`,"cell.costReported":`回执金额`,"cell.costEstimated":`估算金额`,"cell.costMixed":`回执金额 + 估算`,"usage.configuredModels":`配置模型用途`,"usage.configuredRoleCount":`{{count}} 个配置用途`,"usage.configuredModel":`配置模型`,"usage.role":`用途`,"usage.effort":`推理强度`,"usage.recordedCalls":`已登记调用`,"usage.noRecordedCalls":`无已登记调用`,"usage.notRecorded":`未记录`,"usage.actualModels":`实际模型用量`,"usage.actualModel":`实际模型`,"usage.servingProvider":`服务提供方`,"usage.tokens":`Tokens`,"usage.inputTotal":`输入 token(含缓存)`,"usage.totalTokens":`总 token`,"usage.applicationCost":`应用费用`,"usage.judgeUsage":`裁判用量`,"usage.judgeNotRecorded":`未记录裁判用量`,"usage.knownSubtotal":`已知小计`,"usage.totalKnownSubtotal":`本局已知费用小计`,"usage.missingSources":`缺失来源`,"usage.groupPreview":`显示 {{shown}} 组,共 {{total}} 组,省略 {{omitted}} 组`,"usage.costOrigins":`{{reported}} 个回执金额;{{estimated}} 个估算金额`,"usage.totalCosts":`本局总费用`,"usage.costComplete":`费用完整`,"usage.costIncomplete":`费用不完整`,"usage.noRecordedCharges":`无已登记费用`,"usage.noJudgeCalls":`未调用 Judge`,"usage.physicalCalls":`物理调用`,"usage.cacheReadRate":`缓存读取率`,"usage.cacheTotal":`总计`,"usage.cacheScope":`范围`,"usage.cacheCoverage":`覆盖调用`,"usage.cacheCollection":`采集完整性`,"usage.cacheReasons":`原因`,"usage.cacheComplete":`完整`,"usage.cacheIncomplete":`不完整`,"usage.external":`外部调用用量`,"usage.input":`输入 token(不含缓存)`,"usage.output":`输出 token`,"usage.requests":`请求数`,"usage.calls":`已保存调用`,"usage.prices":`封存价格证据`,"usage.coverage":`{{covered}}/{{total}} 个调用成本完整`,"experimentCost.totalCosts":`实验总费用`,"experimentCost.knownSubtotal":`实验已知费用小计`,"experimentCost.scope":`范围:最新已记录的 Attempt。每个计划 Attempt 保留历次执行中的最新已记录结果,被替代的旧执行不累计。`,"experimentCost.selectedSlots":`计划 Attempt`,"experimentCost.resolvedSlots":`已记录 Attempt`,"experimentCost.originAttempts":`唯一 origin Attempt`,"experimentCost.completeAttempts":`费用完整的 Attempt`,"experimentCost.partialAttempts":`费用部分已知的 Attempt`,"experimentCost.unavailableAttempts":`费用不可用的 Attempt`,"experimentCost.unresolvedSlots":`缺失 Attempt`,"cell.evidence":`{{n}} 个 Attempt`,"table.model":`模型`,"cell.mixedExecution":`混合`,"table.adapter":`Adapter`,"table.filterPlaceholder":`筛选行…`,"experimentList.experiment":`实验`,"experimentList.avgDuration":`平均耗时`,"experimentList.passRate":`通过率`,"experimentList.totalScore":`总分`,"experimentList.missedScoreItems":`{{n}} 项未满足`,"experimentList.tokens":`Tokens`,"experimentList.cost":`应用费用`,"experimentList.result":`结果`,"experimentList.status":`状态`,"experimentList.filterPlaceholder":`筛选实验…`,"report.close":`关闭`,"report.details":`详情`,"report.loading":`正在加载…`,"report.loadingDetails":`正在加载详情…`,"report.backToResults":`返回结果`,"report.retry":`重试`,"report.unableToLoad":`无法加载此页面。`,"report.unableToLoadDetails":`无法加载详情。`,"attempt.title":`尝试`,"attempt.experiment":`实验`,"attempt.adapter":`Adapter`,"attempt.adapterRevisionNotDeclared":`未声明修订`,"attempt.eval":`评测`,"attempt.score":`得分`,"attempt.scoreCompleted":`评分完成`,"attempt.started":`开始时间`,"attempt.duration":`耗时`,"attempt.cost":`成本`,"attempt.assertions":`断言`,"attempt.traceDetails":`轨迹详情`,"attempt.traceItem":`项目 {{id}}`,"attempt.traceTool":`工具 {{id}}`,"attempt.traceCommand":`命令 {{id}}`,"attempt.executionTimeline":`执行时间轴`,"attempt.usage":`用量`,"attempt.sources":`来源`,"attempt.fileChanges":`文件变更`,"attempt.artifacts":`产物`,"attempt.loadOnDemand":`展开或选择后载入。`,"attempt.artifactsNone":`未记录产物。`,"attempt.artifactsRetained_one":`保留了 {{count}} 项内容`,"attempt.artifactsRetained_other":`保留了 {{count}} 项内容`,"attempt.truncated":`(已截断)`,"attempt.verdict.passed":`通过`,"attempt.verdict.failed":`失败`,"attempt.verdict.errored":`错误`,"attempt.verdict.skipped":`跳过`,"attempt.verdict.unknown":`未知`,"refresh.action":`刷新`,"refresh.available":`有更新的封存结果可用。`,"refresh.lastGoodStale":`这是上次的当前结果。刷新以重新检查项目。`,"refresh.failed":`刷新失败。上次结果仍可查看,但可能已过期。`,"refresh.reload":`重新加载`,"refresh.reloadRequired":`重新加载 NiceEval 视图`,"refresh.reloadRequiredDetail":`无法确认刷新结果。请先重新加载,再继续审阅结果。`,"refresh.working":`正在刷新…`,"refresh.selectionChanged":`之前的选择已不存在,现已显示最近的可用结果。`}}},Lo=`niceeval:report:locale`;so.use(Do).init({resources:Io,lng:(()=>{try{let e=localStorage.getItem(Lo);if(e===`en`||e===`zh-CN`)return e}catch{}return navigator.language.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`})(),fallbackLng:`en`,supportedLngs:[`en`,`zh-CN`],interpolation:{escapeValue:!1},returnNull:!1}),so.on(`languageChanged`,e=>{document.documentElement.lang=e;try{localStorage.setItem(Lo,e)}catch{}}),document.documentElement.lang=so.resolvedLanguage??`en`;var Ro=so,zo=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Bo=o(((e,t)=>{t.exports=zo()})),M=Bo(),Vo=v.createContext(void 0),Ho=e=>{let t=v.useContext(Vo);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Uo=({client:e,children:t})=>(v.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,M.jsx)(Vo.Provider,{value:e,children:t})),Wo={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Go=new class{#e=Wo;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Ko(e){setTimeout(e,0)}var qo=typeof window>`u`||`Deno`in globalThis;function Jo(){}function Yo(e,t){return typeof e==`function`?e(t):e}function Xo(e){return typeof e==`number`&&e>=0&&e!==1/0}function N(e,t){return Math.max(e+(t||0)-Date.now(),0)}function P(e,t){return typeof e==`function`?e(t):e}function Zo(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==$o(o,t.options))return!1}else if(!ts(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Qo(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(es(t.options.mutationKey)!==es(a))return!1}else if(!ts(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function $o(e,t){return(t?.queryKeyHashFn||es)(e)}function es(e){return JSON.stringify(e,(e,t)=>os(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function ts(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!ts(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!ts(e[r],t[r]))return!1;return!0}return!1}var ns=Object.prototype.hasOwnProperty;function rs(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=as(e)&&as(t);if(!r&&!(os(e)&&os(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:ns.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=rs(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function is(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function as(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function os(e){if(!ss(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!ss(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function ss(e){return Object.prototype.toString.call(e)===`[object Object]`}function cs(e){return new Promise(t=>{Go.setTimeout(t,e)})}function ls(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:rs(e,t)}function us(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ds(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var fs=Symbol();function ps(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===fs?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ms(e,t){return typeof e==`function`?e(...t):!!e}function hs(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var gs=()=>qo,_s=()=>gs(),vs=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ys=new class extends vs{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},bs=Ko;function xs(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=bs,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Ss=xs(),Cs=new class extends vs{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function ws(e){return Math.min(1e3*2**e,3e4)}function Ts(e){return(e??`online`)!==`online`||Cs.isOnline()}var Es=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Ds(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(Jo);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Es(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>ys.isFocused()&&(e.networkMode===`always`||Cs.isOnline())&&e.canRun(),p=()=>Ts(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(_s()?0:3),a=e.retryDelay??ws,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),cs(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var Os=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Xo(this.gcTime)&&(this.#e=Go.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(_s()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Go.clearTimeout(this.#e),this.#e=void 0)}};function ks(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{hs(e,()=>t.signal,()=>n=!0)},u=ps(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?ds:us;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?js:As,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:As(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function As(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function js(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Ms=class extends Os{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Fs(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Fs(this.options);e.data!==void 0&&(this.setState(Ps(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=ls(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(Jo).catch(Jo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>P(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===fs||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>P(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!N(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ps(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?ks(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Ds({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Es&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Es){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ns(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Ps(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Ss.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ns(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ts(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Ps(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Fs(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Is=class extends vs{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Rs(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return zs(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return zs(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof P(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!is(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Bs(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||P(this.options.enabled,this.#t)!==P(t.enabled,this.#t)||P(this.options.staleTime,this.#t)!==P(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||P(this.options.enabled,this.#t)!==P(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return is(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Jo)),t}#h(e){return!_s()&&P(this.options.enabled,this.#t)!==!1&&Xo(e)}#g(){this.#b();let e=P(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=N(this.#r.dataUpdatedAt,e)+1;this.#u=Go.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return P(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=Go.setInterval(()=>{(this.options.refetchIntervalInBackground||ys.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(Go.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(Go.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Rs(e,t),o=i&&Bs(e,n,t,r);(a||o)&&(l={...l,...Ns(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=ls(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=ls(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Vs(e,t),refetch:this.refetch,isEnabled:P(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),is(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();Ss.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Ls(e,t){return P(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||P(t.retryOnMount,e)!==!1)}function Rs(e,t){return Ls(e,t)||e.state.data!==void 0&&zs(e,t,t.refetchOnMount)}function zs(e,t,n){if(P(t.enabled,e)!==!1&&P(t.staleTime,e)!==`static`){let r=P(n,e);return r===`always`||r!==!1&&Vs(e,t)}return!1}function Bs(e,t,n,r){return(e!==t||P(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Vs(e,n)}function Vs(e,t){return P(t.enabled,e)!==!1&&e.isStaleByTime(P(t.staleTime,e))}var Hs=class extends Os{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Us(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=Ds({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Ss.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Us(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ws=class extends vs{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Hs({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Gs(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Gs(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Gs(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Gs(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Ss.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Qo(t,e))}findAll(e={}){return this.getAll().filter(t=>Qo(e,t))}notify(e){Ss.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Ss.batch(()=>Promise.all(e.map(e=>e.continue().catch(Jo))))}};function Gs(e){return e.options.scope?.id}function Ks(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var qs=class extends vs{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,Ss.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!is(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Ks(e,n).forEach(e=>{e.destroy()}),Ks(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=rs(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Is(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&Ss.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},Js=class extends vs{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??$o(r,t),a=this.get(i);return a||(a=new Ms({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Ss.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Zo(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Zo(e,t)):t}notify(e){Ss.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Ss.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Ss.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ys=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Js,this.#t=e.mutationCache||new Ws,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ys.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Cs.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(P(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Yo(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Ss.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Ss.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Ss.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=Ss.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Jo).catch(Jo)}invalidateQueries(e,t={}){return Ss.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Ss.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Jo)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Jo)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(P(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(P(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Jo).catch(Jo)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Jo).catch(Jo)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Cs.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(es(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{ts(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(es(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{ts(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=$o(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===fs&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Xs=v.createContext(!1),Zs=()=>v.useContext(Xs);Xs.Provider;function Qs(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var $s=v.createContext(Qs()),ec=()=>v.useContext($s),tc=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ms(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},nc=e=>{v.useEffect(()=>{e.clearReset()},[e])},rc=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ms(n,[e.error,r])),ic=(e,t)=>t.state.data===void 0,ac=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},oc=(e,t)=>e?.suspense&&t.isPending,sc=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function cc({queries:e,...t},n){let r=Ho(n),i=Zs(),a=ec(),o=t.subscribed!==!1,s=v.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{ac(e);let t=r.getQueryCache().get(e.queryHash);tc(e,a,t)}),nc(a);let[c]=v.useState(()=>new qs(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;v.useSyncExternalStore(v.useCallback(e=>f?c.subscribe(Ss.batchCalls(e)):Jo,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),v.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>oc(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&oc(n,e)?sc(n,new Is(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&rc({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m)throw m.error;return u(d())}function lc(e,t,n){let r=Zs(),i=ec(),a=Ho(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,ac(o),tc(o,i,s),nc(i);let[l]=v.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(v.useSyncExternalStore(v.useCallback(e=>{let t=d?l.subscribe(Ss.batchCalls(e)):Jo;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),v.useEffect(()=>{l.setOptions(o)},[o,l]),oc(o,u))throw sc(o,l,i);if(rc({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function uc(e,t){return lc(e,Is,t)}function dc(e,t){return lc({...e,enabled:!0,suspense:!0,throwOnError:ic,placeholderData:void 0},Is,t)}function fc(e){return e}var pc=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let e=0,r=t.length;e<r;e++)n=t[e](n);return n}}},mc={pipe(){return pc(this,arguments)}},hc=function(){function e(){}return e.prototype=mc,e}(),gc=function(e,t){if(typeof e==`function`)return function(){return e(arguments)?t.apply(this,arguments):e=>t(e,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(e,n){return arguments.length>=2?t(e,n):function(n){return t(n,e)}};case 3:return function(e,n,r){return arguments.length>=3?t(e,n,r):function(r){return t(r,e,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(e){return t(e,...n)}}}},_c=e=>e,vc=(e=>()=>e)(void 0),yc=vc;function bc(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i}}function xc(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),t.set(i,i),i}}var Sc=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete(`stack`);let n=Object.getPrototypeOf(e),r=n;for(;r!==null&&r!==Object.prototype;){let e=Reflect.ownKeys(r);for(let n=0;n<e.length;n++)t.add(e[n]);r=Object.getPrototypeOf(r)}return t.has(`constructor`)&&typeof e.constructor==`function`&&n===e.constructor.prototype&&t.delete(`constructor`),t},Cc=new WeakSet;function wc(e){return typeof e==`string`}function Tc(e){return typeof e==`number`}function Ec(e){return typeof e==`boolean`}function Dc(e){return typeof e==`symbol`}function Oc(e){return wc(e)||Tc(e)||Dc(e)}function kc(e){return typeof e==`function`}function Ac(e){return e!==void 0}function jc(e){return e!=null}function Mc(e){return!1}function Nc(e){return!0}function Pc(e){return typeof e==`object`&&!!e||kc(e)}var Fc=gc(2,(e,t)=>Pc(e)&&t in e),Ic=`~effect/interfaces/Hash`,Lc=e=>{switch(typeof e){case`number`:return Hc(e);case`bigint`:return Uc(e.toString(10));case`boolean`:return Uc(String(e));case`symbol`:return Uc(String(e));case`string`:return Uc(e);case`undefined`:return Uc(`undefined`);case`function`:case`object`:if(e===null)return Uc(`null`);if(e instanceof Date)return Number.isNaN(e.getTime())?Uc(`Invalid Date`):Uc(e.toISOString());if(e instanceof RegExp)return Uc(e.toString());{if(Cc.has(e))return Rc(e);if(Zc.has(e))return Zc.get(e);let t=$c(e,()=>Vc(e)?e[Ic]():typeof e==`function`?Rc(e):e instanceof DataView?qc(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):Array.isArray(e)||ArrayBuffer.isView(e)?qc(e):e instanceof Map?Jc(e):e instanceof Set?Yc(e):Gc(e));return Zc.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},Rc=e=>(Xc.has(e)||Xc.set(e,Hc(Math.floor(Math.random()*(2**53-1)))),Xc.get(e)),zc=gc(2,(e,t)=>e*53^t),Bc=e=>e&3221225471|e>>>1&1073741824,Vc=e=>Fc(e,Ic),Hc=e=>{if(e!==e)return Uc(`NaN`);if(e===1/0)return Uc(`Infinity`);if(e===-1/0)return Uc(`-Infinity`);let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return Bc(t)},Uc=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return Bc(t)},Wc=(e,t)=>{let n=12289;for(let r of t)n^=zc(Lc(r),Lc(e[r]));return Bc(n)},Gc=e=>Wc(e,Sc(e)),Kc=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return Bc(r)},qc=Kc(6151,Lc),Jc=Kc(Uc(`Map`),([e,t])=>zc(Lc(e),Lc(t))),Yc=Kc(Uc(`Set`),Lc),Xc=new WeakMap,Zc=new WeakMap,Qc=new WeakSet;function $c(e,t){if(Qc.has(e))return Uc(`[Circular]`);Qc.add(e);let n=t();return Qc.delete(e),n}var el=`~effect/interfaces/Equal`;function tl(){return arguments.length===1?e=>nl(e,arguments[0]):nl(arguments[0],arguments[1])}function nl(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;return n===typeof t?n===`number`&&e!==e&&t!==t?!0:n!==`object`&&n!==`function`||Cc.has(e)||Cc.has(t)?!1:sl(e,t,ol):!1}function rl(e,t,n){let r=il.has(e),i=al.has(t);if(r&&i)return!0;if(r||i)return!1;il.add(e),al.add(t);let a=n();return il.delete(e),al.delete(t),a}var il=new WeakSet,al=new WeakSet;function ol(e,t){if(Lc(e)!==Lc(t))return!1;if(e instanceof Date){if(!(t instanceof Date))return!1;let n=e.getTime(),r=t.getTime();return n===r||Number.isNaN(n)&&Number.isNaN(r)}if(e instanceof RegExp)return t instanceof RegExp&&e.toString()===t.toString();let n=gl(e),r=gl(t);if(n!==r)return!1;let i=n&&r;return typeof e==`function`&&!i?!1:rl(e,t,()=>{if(i)return e[el](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:ll(e,t);if(ArrayBuffer.isView(e)){let n=e instanceof DataView;if(!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||n!==t instanceof DataView)return!1;if(n){let n=t;return ul(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(n.buffer,n.byteOffset,n.byteLength))}return ul(e,t)}return e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:pl(e,t):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:hl(e,t):dl(e,t)})}function sl(e,t,n){let r=cl.get(e);if(!r)r=new WeakMap,cl.set(e,r);else if(r.has(t))return r.get(t);let i=n(e,t);r.set(t,i);let a=cl.get(t);return a||(a=new WeakMap,cl.set(t,a)),a.set(e,i),i}var cl=new WeakMap;function ll(e,t){for(let n=0;n<e.length;n++)if(!nl(e[n],t[n]))return!1;return!0}function ul(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function dl(e,t){let n=Sc(e),r=Sc(t);if(n.size!==r.size)return!1;for(let i of n)if(!r.has(i)||!nl(e[i],t[i]))return!1;return!0}function fl(e,t){return function(n,r){let i=Array.from(r);for(let[r,a]of n){let n=!1;for(let o=0;o<i.length;o++){let[s,c]=i[o];if(e(r,s)&&t(a,c)){i[o]=i[i.length-1],i.pop(),n=!0;break}}if(!n)return!1}return!0}}var pl=fl(nl,nl);function ml(e){return function(t,n){let r=Array.from(n);for(let n of t){let t=!1;for(let i=0;i<r.length;i++){let a=r[i];if(e(n,a)){r[i]=r[r.length-1],r.pop(),t=!0;break}}if(!t)return!1}return!0}}var hl=ml(nl),gl=e=>Fc(e,el),_l=e=>(t,n)=>t===n||e(t,n),vl=e=>e.length>0;function yl(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function bl(e,t){for(let n of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,n)&&yl(e,n,t[n])}var xl=Symbol.for(`~effect/Redactable`),Sl=e=>Fc(e,xl);function Cl(e){return Sl(e)?wl(e):e}function wl(e){return e[xl](globalThis[`~effect/Fiber/currentFiber`]?.context??Dl)}var Tl=`~effect/Fiber/currentFiber`,El=new Map,Dl={"~effect/Context":{},base:El,depth:0,mapUnsafe:El,pipe(){return pc(this,arguments)}};function Ol(e,t){let n=t?.space??0,r=new WeakSet,i=n?typeof n==`number`?` `.repeat(n):n:``,a=e=>i.repeat(e),o=(e,t)=>{let n=e?.constructor;return n&&n!==Object.prototype.constructor&&n.name?`${n.name}(${t})`:t},s=e=>{try{return Reflect.ownKeys(e)}catch{return[`[ownKeys threw]`]}};function c(e,n=0){if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`||e==null||typeof e==`boolean`||typeof e==`symbol`)return String(e);if(typeof e==`bigint`)return String(e)+`n`;if(typeof e==`object`||typeof e==`function`){if(r.has(e))return kl;r.add(e);let l;if(xl in e)l=c(wl(e),n);else if(Array.isArray(e))l=!i||e.length<=1?`[${e.map(e=>c(e,n)).join(`,`)}]`:`[\n${a(n+1)}${e.map(e=>c(e,n+1)).join(`,
13
13
  `+a(n+1))}\n${a(n)}]`;else if(e instanceof Date)l=Ml(e);else if(!t?.ignoreToString&&Fc(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=Nl(e);l=e instanceof Error&&e.cause?`${t} (cause: ${c(e.cause,n)})`:t}else if(Symbol.iterator in e)l=`${e.constructor.name}(${c(Array.from(e),n)})`;else{let t=s(e);if(!i||t.length<=1){let r=`{${t.map(t=>`${Al(t)}:${c(e[t],n)}`).join(`,`)}}`;l=o(e,r)}else{let r=`{\n${t.map(t=>`${a(n+1)}${Al(t)}: ${c(e[t],n+1)}`).join(`,
14
14
  `)}\n${a(n)}}`;l=o(e,r)}}return r.delete(e),l}return String(e)}return c(e,0)}var kl=`[Circular]`;function Al(e){return typeof e==`string`?JSON.stringify(e):String(e)}function jl(e){return e.map(e=>`[${Al(e)}]`).join(``)}function Ml(e){try{return e.toISOString()}catch{return`Invalid Date`}}function Nl(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}var Pl=Symbol.for(`nodejs.util.inspect.custom`),Fl=e=>{try{return e=Cl(e),Fc(e,`toJSON`)&&kc(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(Fl):e}catch{return`[toJSON threw]`}},Il=class e{called=!1;self;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new e(this.self)}},Ll=(()=>{let e=`~effect/Utils/internal`,t={[e]:e=>e()},n={[e]:e=>{try{return e()}finally{}}};return t[e](()=>Error().stack)?.includes(e)===!0?t[e]:n[e]})(),Rl=`~effect/Effect`,zl=`~effect/Exit`,Bl={_A:_c,_E:_c,_R:_c},Vl=`${Rl}/identifier`,F=`${Rl}/args`,Hl=`${Rl}/evaluate`,Ul=`${Rl}/successCont`,Wl=`${Rl}/failureCont`,Gl=`${Rl}/ensureCont`,Kl=Symbol.for(`effect/Effect/Yield`),ql={pipe(){return pc(this,arguments)},toJSON(){return{...this}},toString(){return Ol(this.toJSON(),{ignoreToString:!0,space:2})},[Pl](){return this.toJSON()}},Jl={[Rl]:Bl,...ql,[Symbol.iterator](){return new Il(this)},toJSON(){return{_id:`Effect`,op:this[Vl],...F in this?{args:this[F]}:void 0}}},Yl=e=>Fc(e,zl),Xl=`~effect/Cause`,Zl=`~effect/Cause/Reason`,Ql=e=>Fc(e,Xl),$l=class{[Xl];reasons;constructor(e){this[Xl]=Xl,this.reasons=e}pipe(){return pc(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${Ol(this.reasons)})`}[Pl](){return this.toJSON()}[el](e){return Ql(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>tl(t,e.reasons[n]))}[Ic](){return qc(this.reasons)}},eu=new WeakMap,tu=class{[Zl];annotations;_tag;constructor(e,t,n){if(this[Zl]=Zl,this._tag=e,t!==nu&&typeof n==`object`&&n&&t.size>0){let e=eu.get(n);e&&(t=new Map([...e,...t])),eu.set(n,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let n=new Map(this.annotations);e.mapUnsafe.forEach((e,r)=>{t?.overwrite!==!0&&n.has(r)||n.set(r,e)});let r=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return r.annotations=n,r}pipe(){return pc(this,arguments)}toString(){return Ol(this)}[Pl](){return this.toString()}},nu=new Map,ru=class extends tu{error;constructor(e,t=nu){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${Ol(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[el](e){return lu(e)&&tl(this.error,e.error)&&tl(this.annotations,e.annotations)}[Ic](){return zc(Uc(this._tag))(zc(Lc(this.error))(Lc(this.annotations)))}},iu=e=>new $l(e),au=e=>new $l([new ru(e)]),ou=class extends tu{defect;constructor(e,t=nu){super(`Die`,t,e),this.defect=e}toString(){return`Die(${Ol(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[el](e){return uu(e)&&tl(this.defect,e.defect)&&tl(this.annotations,e.annotations)}[Ic](){return zc(Uc(this._tag))(zc(Lc(this.defect))(Lc(this.annotations)))}},su=e=>new $l([new ou(e)]),cu=gc(e=>Ql(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new $l(e.reasons.map(e=>e.annotate(t,n)))),lu=e=>e._tag===`Fail`,uu=e=>e._tag===`Die`,du=e=>e._tag===`Interrupt`;function fu(e){return xu(`Effect.evaluate: Not implemented`)}var pu=e=>({...Jl,[Vl]:e.op,[Hl]:e[Hl]??fu,[Ul]:e[Ul],[Wl]:e[Wl],[Gl]:e[Gl]}),mu=e=>{let t=pu(e);return function(){let n=Object.create(t);return n[F]=e.single===!1?arguments:arguments[0],n}},hu=e=>{let t={[zl]:zl,_tag:e.op,get[e.prop](){return this[F]},...pu(e),toString(){return`${e.op}(${Ol(this[F])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[F]}},[el](e){return Yl(e)&&e._tag===this._tag&&tl(this[F],e[F])},[Ic](){return zc(Uc(e.op),Lc(this[F]))}};return function(e){let n=Object.create(t);return n[F]=e,n}},gu=hu({op:`Success`,prop:`value`,[Hl](e){let t=e.getCont(Ul);return t?t[Ul](this[F],e,this):e.yieldWith(this)}}),_u={key:`effect/Cause/StackTrace`},vu={key:`effect/Cause/InterruptorStackTrace`},yu=hu({op:`Failure`,prop:`cause`,[Hl](e){let t=this[F],n=!1;e.currentStackFrame&&(t=cu(t,{mapUnsafe:new Map([[_u.key,e.currentStackFrame]])}),n=!0);let r=e.getCont(Wl);for(;e.interruptible&&e._interruptedCause&&r;)r=e.getCont(Wl);return r?r[Wl](t,e,n?void 0:this):e.yieldWith(n?yu(t):this)}}),bu=e=>yu(au(e)),xu=e=>yu(su(e)),Su=mu({op:`WithFiber`,[Hl](e){return this[F](e)}}),Cu=function(){class e extends globalThis.Error{}let t=pu({op:`YieldableError`,[Hl](){return bu(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),wu=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends Cu{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(bl(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}(),Tu=e=>{class t extends wu{_tag=e}return t.prototype.name=e,t},Eu=`~effect/data/Option`,Du={[Eu]:{_A:e=>e},...ql,[Symbol.iterator](){return new Il(this)}},Ou=Object.defineProperty(Object.assign(Object.create(Du),{_tag:`Some`,_op:`Some`,[el](e){return ju(e)&&Nu(e)&&tl(this.value,e.value)},[Ic](){return zc(Lc(this._tag))(Lc(this.value))},toString(){return`some(${Ol(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:Fl(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),ku=Lc(`None`),Au=Object.assign(Object.create(Du),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[el](e){return ju(e)&&Mu(e)},[Ic](){return ku},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}}}),ju=e=>Fc(e,Eu),Mu=e=>e._tag===`None`,Nu=e=>e._tag===`Some`,Pu=Object.create(Au),Fu=e=>{let t=Object.create(Ou);return t.value=e,t},Iu=`~effect/data/Result`,Lu={[Iu]:{_A:e=>e,_E:e=>e},...ql,[Symbol.iterator](){return new Il(this)}},Ru=Object.assign(Object.create(Lu),{_tag:`Success`,_op:`Success`,[el](e){return Bu(e)&&Hu(e)&&tl(this.success,e.success)},[Ic](){return zc(Lc(this._tag))(Lc(this.success))},toString(){return`success(${Ol(this.success)})`},toJSON(){return{_id:`Result`,_tag:this._tag,value:Fl(this.success)}}}),zu=Object.assign(Object.create(Lu),{_tag:`Failure`,_op:`Failure`,[el](e){return Bu(e)&&Vu(e)&&tl(this.failure,e.failure)},[Ic](){return zc(Lc(this._tag))(Lc(this.failure))},toString(){return`failure(${Ol(this.failure)})`},toJSON(){return{_id:`Result`,_tag:this._tag,failure:Fl(this.failure)}}}),Bu=e=>Fc(e,Iu),Vu=e=>e._tag===`Failure`,Hu=e=>e._tag===`Success`,Uu=e=>{let t=Object.create(zu);return t.failure=e,t},Wu=e=>{let t=Object.create(Ru);return t.success=e,t};function Gu(e){return(t,n)=>t===n?0:e(t,n)}var Ku=Gu((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1),qu=e=>gc(2,(t,n)=>e(t,n)===-1),Ju=e=>gc(2,(t,n)=>e(t,n)===1),Yu=e=>gc(2,(t,n)=>e(t,n)!==1),Xu=e=>gc(2,(t,n)=>e(t,n)!==-1),Zu=()=>Pu,Qu=Fu,$u=Mu,ed=Nu,td=gc(2,(e,t)=>$u(e)?Zu():Qu(t(e.value))),nd=gc(2,(e,t)=>$u(e)?Zu():t(e.value)?Qu(e.value):Zu()),rd=Wu,id=Uu,ad=Vu,od=Hu,sd=gc(2,(e,t)=>ad(e)?id(t(e.failure)):e),cd=globalThis.Array,ld=e=>cd.isArray(e)?e:cd.from(e),ud=gc(2,(e,t)=>[...e,t]),dd=gc(2,(e,t)=>ld(e).concat(ld(t)));cd.isArray;var fd=vl,pd=vl,md=(e,t)=>{let n=Lc(t),r=e.get(n);if(r===void 0)return e.set(n,[t]),!0;for(let e of r)if(tl(e,t))return!1;return r.push(t),!0},hd=gc(2,(e,t)=>{let n=ld(e),r=ld(t);return pd(n)?pd(r)?vd(dd(n,r)):n:r}),gd=()=>[],_d=gc(2,(e,t)=>e.map(t)),vd=e=>{let t=ld(e);if(t.length<2)return[...t];let n=new Map,r=[];for(let e of t)md(n,e)&&r.push(e);return r},yd=`~effect/BigDecimal`,bd={[yd]:yd,[Ic](){let e=Dd(this);return zc(Lc(e.value),Hc(e.scale))},[el](e){return xd(e)&&jd(this,e)},toString(){return`BigDecimal(${Md(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[Pl](){return this.toJSON()},pipe(){return pc(this,arguments)}},xd=e=>Fc(e,yd),Sd=(e,t)=>{let n=Object.create(bd);return n.value=e,n.scale=t,n},Cd=(e,t)=>{if(e!==wd&&e%Td===wd)throw RangeError(`Value must be normalized`);let n=Sd(e,t);return n.normalized=n,n},wd=BigInt(0),Td=BigInt(10),Ed=Cd(wd,0),Dd=e=>{if(e.normalized===void 0){if(e.value===wd)e.normalized=Ed;else{let t=`${e.value}`,n=0;for(let e=t.length-1;e>=0&&t[e]===`0`;e--)n++;n===0&&(e.normalized=e),e.normalized=Cd(BigInt(t.substring(0,t.length-n)),e.scale-n)}}return e.normalized},Od=gc(2,(e,t)=>t>e.scale?Sd(e.value*Td**BigInt(t-e.scale),t):t<e.scale?Sd(e.value/Td**BigInt(e.scale-t),t):e),kd=e=>e.value<wd?Sd(-e.value,e.scale):e,Ad=_l((e,t)=>e.scale>t.scale?Od(t,e.scale).value===e.value:e.scale<t.scale?Od(e,t.scale).value===t.value:e.value===t.value),jd=gc(2,(e,t)=>Ad(e,t)),Md=e=>{let t=Dd(e);if(Math.abs(t.scale)>=16)return Nd(t);let n=t.value<wd,r=n?`${t.value}`.substring(1):`${t.value}`,i,a;if(t.scale>=r.length)i=`0`,a=`0`.repeat(t.scale-r.length)+r;else{let e=r.length-t.scale;if(e>r.length){let t=e-r.length;i=`${r}${`0`.repeat(t)}`,a=``}else a=r.slice(e),i=r.slice(0,e)}let o=a===``?i:`${i}.${a}`;return n?`-${o}`:o},Nd=e=>{if(Pd(e))return`0e+0`;let t=Dd(e),n=`${kd(t).value}`,r=n.slice(0,1),i=n.slice(1),a=`${Fd(t)?`-`:``}${r}`;i!==``&&(a+=`.${i}`);let o=i.length-t.scale;return`${a}e${o>=0?`+`:``}${o}`},Pd=e=>e.value===wd,Fd=e=>e.value<wd,Id=e=>pu({op:e.label,[Hl]:e.evaluate}),Ld=`~effect/Context/Service`,Rd=function(){function e(){}let t=e;Object.setPrototypeOf(t,zd);let n=(e,n)=>(t.key=e,n?.defaultValue&&(t[Vd]=Vd,t.defaultValue=n.defaultValue),n?.make&&(t.make=n.make),n?.fiberCached&&Bd.add(e),t);return arguments.length>0?n(arguments[0],arguments[1]):n},zd={[Ld]:Ld,...Id({label:`Service`,evaluate(e){return gu(cf(e.context,this))}}),toJSON(){return{_id:`Service`,key:this.key}},of(e){return e},context(e){return rf(this,e)},use(e){return Su(t=>e(cf(t.context,this)))},useSync(e){return Su(t=>gu(e(cf(t.context,this))))}},Bd=new Set,Vd=`~effect/Context/Reference`,Hd=`~effect/Context`,Ud=8,Wd=8,Gd=(e,t,n,r)=>{let i=Object.create(Zd);return i.cacheRoot=e??i,i.base=t,i.overlay=n,i.depth=r,i._flat=void 0,i.baseHits=0,i},Kd=(e,t)=>{t&&(Kd(e,t.parent),e.set(t.key,t.value))},qd=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return Kd(t,e.overlay),e._flat=t},Jd=Symbol(),Yd=(e,t)=>{let n=e;for(let e=n.overlay;e;e=e.parent)if(e.key===t)return e.value;let r=n.base.get(t);return r===void 0&&!n.base.has(t)?Jd:(n.overlay&&++n.baseHits>=Wd&&(n.base=qd(n),n.overlay=void 0,n.depth=0),r)},Xd=e=>Gd(void 0,e,void 0,0),Zd={get mapUnsafe(){return qd(this)},...ql,[Hd]:{_Services:e=>e},toJSON(){return{_id:`Context`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[el](e){if(!$d(e))return!1;let t=this.mapUnsafe,n=e.mapUnsafe;if(t.size!==n.size)return!1;for(let[e,r]of t)if(!n.has(e)||!tl(r,n.get(e)))return!1;return!0},[Ic](){return Hc(this.mapUnsafe.size)}},Qd=(e,t)=>e.cacheRoot===t.cacheRoot,$d=e=>Fc(e,Hd),ef=e=>!!e[Vd],tf=()=>nf,nf=Xd(new Map),rf=(e,t)=>Xd(new Map([[e.key,t]])),af=gc(3,(e,t,n)=>of(e,t.key,n)),of=(e,t,n)=>{let r=e,i=Bd.has(t)?void 0:r.cacheRoot;if(r.depth>=Ud){let e=new Map(r.mapUnsafe);return e.set(t,n),Gd(i,e,void 0,0)}return Gd(i,r.base,{key:t,value:n,parent:r.overlay},r.depth+1)},sf=(e,t)=>{let n=Yd(e,t);return n===Jd?void 0:n},cf=gc(2,(e,t)=>{let n=Yd(e,t.key);if(n===Jd){if(ef(t))return uf(t);throw df(t)}return n}),lf=`~effect/Context/defaultValue`,uf=e=>lf in e?e[lf]:e[lf]=e.defaultValue(),df=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(t.stack){let e=t.stack.split(`
15
15
  `);e.splice(1,3),t.stack=e.join(`
16
16
  `)}return t},ff=Rd,pf=ff(`effect/Scheduler`,{fiberCached:!0,defaultValue:()=>new _f}),mf=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},hf=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},gf=class{buckets=[];scheduleTask(e,t){let n=this.buckets,r=n.length,i,a=0;for(;a<r&&!(n[a][0]>t);a++)i=n[a];i&&i[0]===t?i[1].push(e):a===r?n.push([t,[e]]):n.splice(a,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}},_f=class{executionMode;setImmediate;constructor(e=`async`,t){this.executionMode=e,this.setImmediate=t??(e===`sync`?hf:mf)}shouldYield(e){return e.currentOpCount>=e.maxOpsBeforeYield}makeDispatcher(){return new vf(this.setImmediate)}},vf=class{tasks=new gf;running=void 0;setImmediate;constructor(e=mf){this.setImmediate=e}scheduleTask(e,t){this.tasks.scheduleTask(e,t),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let e=0;e<n.length;e++)n[e]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},yf=ff(`effect/Scheduler/MaxOpsBeforeYield`,{fiberCached:!0,defaultValue:()=>2048}),bf=ff(`effect/Scheduler/PreventSchedulerYield`,{fiberCached:!0,defaultValue:()=>!1}),xf=Tu,Sf=[];for(let e=0;e<256;e++)Sf.push(e.toString(16).padStart(2,`0`));var Cf=`effect/Tracer/ParentSpan`,wf=`effect/Tracer`,Tf=`effect/observability/Metric/FiberRuntimeMetricsKey`,Ef=ff(`effect/References/CurrentStackFrame`,{fiberCached:!0,defaultValue:vc}),Df=ff(`effect/References/CurrentLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),Of=ff(`effect/References/MinimumLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),kf=(()=>{let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,`writable`)?e.writable===!0:e.set!==void 0})(),Af=()=>Error.stackTraceLimit,jf=e=>{kf&&(Error.stackTraceLimit=e)},Mf=class extends tu{fiberId;constructor(e,t=nu){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[el](e){return du(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[Ic](){return zc(Uc(`${this._tag}:${this.fiberId}`))(Rc(this.annotations))}},Nf=e=>new $l([new Mf(e)]),Pf=e=>e.reasons.some(du),Ff=gc(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new $l(hd(e.reasons,t.reasons));return tl(e,n)?e:n}),If=gc(2,(e,t)=>{let n=!1,r=e.reasons.map(e=>lu(e)?(n=!0,new ru(t(e.error),e.annotations)):e);return n?iu(r):e}),Lf=`~effect/Fiber`,Rf={_A:_c,_E:_c},zf={id:0},Bf=()=>globalThis[Tl],Vf=class{constructor(e,t=!0){this[Lf]=Rf,this.setContext(e),this.id=++zf.id,this.currentOpCount=0,this.interruptible=t,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this.runtimeMetrics?.recordFiberStart(this.context)}[Lf];id;interruptible;currentOpCount;_stack;_observers;_exit;_children;_interruptedCause;_yielded;_running;_deferredInterrupt;context;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;currentPreventYield;_dispatcher=void 0;get currentDispatcher(){return this._dispatcher??=this.currentScheduler.makeDispatcher()}getRef(e){return cf(this.context,e)}addObserver(e){return this._exit?(e(this._exit),yc):(this._observers.push(e),()=>{if(this._exit)return;let t=this._observers.indexOf(e);t>=0&&this._observers.splice(t,1)})}interruptUnsafe(e,t){if(this._exit)return;let n=Nf(e);this.currentStackFrame&&(n=cu(n,rf(_u,this.currentStackFrame))),t&&(n=cu(n,t)),this._interruptedCause=this._interruptedCause?Ff(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(Jf(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;if(this._yielded!==void 0){let e=this._yielded;this._yielded=void 0,e()}let t=this.runLoop(e);if(t===Kl)return;let n=Uf.interruptChildren&&Uf.interruptChildren(this);if(n!==void 0)return this.evaluate(up(n,()=>t));this._exit=t,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);for(let e=0;e<this._observers.length;e++)this._observers[e](t);this._observers.length=0,this._stack.length=0,this._children=void 0,this.context=tf()}runLoop(e){let t=globalThis[Tl];globalThis[Tl]=this;let n=this._running;this._running=!0;let r=!1,i=e;this.currentOpCount=0;try{for(;;){if(this._deferredInterrupt&&(this._deferredInterrupt=!1,i=Jf(this._interruptedCause)),this.currentOpCount++,!r&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){r=!0;let e=i;i=up(Qf,()=>e)}if(i=this.currentTracerContext?this.currentTracerContext(i,this):i[Hl](this),i===Kl){let e=this._yielded;if(zl in e)return this._deferredInterrupt=!1,this._yielded=void 0,e;if(this._deferredInterrupt){this._yielded=void 0,e();continue}return Kl}}}catch(e){return Fc(i,Hl)?this.runLoop(xu(e)):xu(`Fiber.runLoop: Not a valid effect: ${String(i)}`)}finally{this._running=n,globalThis[Tl]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,Hf;for(;;){let t=this._stack.pop();if(!t)return;let n=t[Gl]&&t[Gl](this);if(n)return n[e]=n,n;if(t[e])return t}}yieldWith(e){return this._yielded=e,Kl}children(){return this._children??=new Set}pipe(){return pc(this,arguments)}setContext(e){let t=this.context;if(this.context=e,t!==void 0&&Qd(t,e))return;let n=this.getRef(pf);n!==this.currentScheduler&&(this.currentScheduler=n,this._dispatcher=void 0),this.currentSpan=sf(e,Cf),this.currentLogLevel=this.getRef(Df),this.minimumLogLevel=this.getRef(Of),this.currentStackFrame=this.getRef(Ef),this.maxOpsBeforeYield=this.getRef(yf),this.currentPreventYield=this.getRef(bf),this.runtimeMetrics=sf(e,Tf);let r=sf(e,wf);this.currentTracerContext=r?r.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag===`Span`?this.currentSpan:void 0}},Hf={[Ul](e,t){return Jf(t._interruptedCause)},[Wl](e,t){return Jf(t._interruptedCause)}},Uf={interruptChildren:void 0},Wf=e=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(vu.key,e.currentStackFrame),Xd(t)},Gf=e=>ip(t=>{let n=e[Symbol.iterator](),r=[],i;function a(){let e=n.next();for(;!e.done;){if(e.value._exit){r.push(e.value._exit),e=n.next();continue}i=e.value.addObserver(e=>{r.push(e),a()});return}t(qf(r))}return a(),Xf(()=>i?.())}),Kf=e=>Su(t=>{let n=Wf(t),r=gd();for(let i of e)i.interruptUnsafe(t.id,n),r.push(i);return lp(Gf(r))}),qf=gu,Jf=yu,Yf=bu,Xf=mu({op:`Sync`,[Hl](e){let t=this[F](),n=e.getCont(Ul);return n?n[Ul](t,e):e.yieldWith(gu(t))}}),Zf=mu({op:`Suspend`,[Hl](e){return this[F]()}}),Qf=mu({op:`Yield`,[Hl](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(vp)},this[F]??0),e.yieldWith(()=>{t=!0})}})(0),$f=e=>Zf(()=>Jf(Ll(e))),ep=e=>xu(e),tp=qf(void 0),np=mu({op:`Async`,single:!1,[Hl](e){let t=Ll(()=>this[F][0].bind(e.currentScheduler)),n=!1,r=!1,i=this[F][1]?new AbortController:void 0,a=t(t=>{n||(n=!0,r?e.evaluate(t):r=t)},i?.signal);return r===!1?(r=!0,e._yielded=()=>{n=!0},i===void 0&&a===void 0||e._stack.push(rp(()=>(n=!0,i?.abort(),a??vp))),Kl):r}}),rp=mu({op:`AsyncFinalizer`,[Gl](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Tp))},[Wl](e,t){return Pf(e)?up(this[F](),()=>Jf(e)):Jf(e)}}),ip=e=>np(e,e.length>=2),ap=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),op=(e,...t)=>ap(e.length,t.length===0?function(){return sp(()=>e.apply(this,arguments))}:function(){let n=sp(()=>e.apply(this,arguments));for(let e of t)n=e(n);return n}),sp=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return qf(r.value);let i=r.value;if(i&&i._tag===`Success`){n=i.value;continue}if(i&&i._tag===`Failure`)return r.value;{let n=!0;return Zf(()=>n?(n=!1,up(r.value,e=>cp(t,e))):Zf(()=>cp(e())))}}}catch(e){return ep(e)}},cp=mu({op:`Iterator`,single:!1,[Ul](e,t){let n=this[F][0];for(;;){let r=n.next(e);if(r.done)return qf(r.value);if(!fp(r.value))return t._stack.push(this),r.value;if(r.value._tag===`Failure`)return r.value;e=r.value.value}},[Hl](e){return this[Ul](this[F][1],e)}}),lp=e=>up(e,e=>vp),up=gc(2,(e,t)=>{let n=Object.create(dp);return n[F]=e,n[Ul]=t.length===1?t:e=>t(e),n}),dp=pu({op:`OnSuccess`,[Hl](e){return e._stack.push(this),this[F]}}),fp=e=>zl in e,pp=gc(2,(e,t)=>fp(e)?e._tag===`Success`?t(e.value):e:up(e,t)),mp=gc(2,(e,t)=>up(e,e=>qf(Ll(()=>t(e))))),hp=gc(2,(e,t)=>fp(e)?yp(e,t):mp(e,t)),gp=e=>e._tag===`Success`,_p=e=>e._tag===`Failure`,vp=gu(void 0),yp=gc(2,(e,t)=>e._tag===`Success`?gu(t(e.value)):e),bp=gc(2,(e,t)=>{let n=Object.create(xp);return n[F]=e,n[Wl]=t.length===1?t:e=>t(e),n}),xp=pu({op:`OnFailure`,[Hl](e){return e._stack.push(this),this[F]}}),Sp=e=>fp(e)?gu(e):Cp(e),Cp=mu({op:`Exit`,[Hl](e){return e._stack.push(this),this[F]},[Ul](e,t,n){return qf(n??gu(e))},[Wl](e,t,n){return qf(n??yu(e))}}),wp=e=>Su(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Tp),e):e),Tp=mu({op:`SetInterruptible`,[Gl](e){if(e.interruptible=this[F],e._interruptedCause&&e.interruptible)return()=>Jf(e._interruptedCause)}})(!0),Ep=e=>{let t=e.onItem,n=e.step,r=(e,i,a,o)=>{for(;a<o;a++){let s=i[a],c=t(e,s,a);if(!fp(c))return up(Sp(c),t=>n(e,s,t,a)??r(e,i,a+1,o)??tp);let l=n(e,s,c,a);if(l)return l._tag===`Failure`?l:void 0}};return(e,i,a)=>{let o=0,s=a?.end??i.length,c=a?.concurrency??1;if(c===1)return r(e,i,0,s);let l=a?.orderedStep===!0,u=!1,d,f,p,m=!1,h,g,_=o,v=l?Array(s):void 0,y=e=>{let t=xu(e);return h=t,u=!0,m=!0,f&&f.size>0?up(wp(Kf(Array.from(f))),()=>t):t},b=(t,r,a)=>{if(!l)return n(e,t,r,a);if(h)return h;for(v[a]=r;_<s;){let t=v[_];if(t===void 0)return;v[_]=void 0;let r=_++,a=n(e,i[r],t,r);if(a)return a}},x=()=>{let n=!1;for(;!h&&o<s;o++){let r=i[o],a=g??t(e,r,o);if(fp(a)){if(h=b(r,a,o),h)break}else if(d){g=void 0;let e=Op(d,a,!0,!0,`inherit`);if(e._exit){if(h=b(r,e._exit,o),h)break;continue}f.add(e);let t=o;if(e.addObserver(i=>{f.delete(e);try{if(h){if(!m&&i._tag===`Failure`)for(let e of i.cause.reasons)if(e._tag===`Interrupt`)continue;else h._tag===`Failure`?h.cause.reasons.push(e):h=yu(iu([e]))}else{let e=b(r,i,t);e&&(h=e._tag===`Failure`?yu(iu(e.cause.reasons.slice())):e,x())}if(n){let e=x();e&&p(e)}else u&&f.size===0&&p(h??tp)}catch(e){p(y(e))}}),f.size<c)continue;n=!0,o++;return}else return ip(e=>{d=Bf(),f=new Set,g=a,p=e;let t;try{t=x()}catch(t){return e(y(t))}return t?e(t):Zf(()=>(h=vp,m=!0,f?Kf(f):tp))})}if(u=!0,h){if(f&&f.size>0){let e=Wf(d);f.forEach(t=>t.interruptUnsafe(d.id,e));return}if(p||h._tag===`Failure`)return h}else if(p){if(f)f.size===0&&p(tp);else return vp}};return x()}},Dp=()=>Ep,Op=(e,t,n=!1,r=!1,i=!1)=>{let a=e,o=i===`inherit`?a.interruptible:!i,s=new Vf(a.context,o);return n?s.evaluate(t):a.currentDispatcher.scheduleTask(()=>s.evaluate(t),0),!r&&!s._exit&&(a.children().add(s),s.addObserver(()=>a._children.delete(s))),s},kp=e=>(t,n)=>{let r=new Vf(n?.scheduler?af(e,pf,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal){if(n.signal.aborted)r.interruptUnsafe();else{let e=()=>r.interruptUnsafe();n.signal.addEventListener(`abort`,e,{once:!0}),r.addObserver(()=>n.signal.removeEventListener(`abort`,e))}}return n?.onFiberStart&&n.onFiberStart(r),r},Ap=(e=>{let t=kp(e);return e=>{if(fp(e))return e;let n=new _f(`sync`),r=t(e,{scheduler:n});return r._dispatcher?.flush(),r._exit??xu(new Mp(r))}})(tf()),jp=`~effect/Cause/AsyncFiberError`,Mp=class extends Tu(`AsyncFiberError`){[jp]=jp;constructor(e){super({message:`An asynchronous Effect was executed with Effect.runSync`,fiber:e})}},Np={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};Np.gray,Np.blue,Np.green,Np.yellow,Np.red,Np.bgBrightRed,Np.black;var Pp=lu,Fp=If,Ip=gu,Lp=yu,Rp=bu,zp=vp,Bp=gp,Vp=_p,Hp=`~effect/time/DateTime`,Up=`~effect/time/DateTime/TimeZone`,Wp={[Hp]:Hp,pipe(){return pc(this,arguments)},[Pl](){return this.toString()},toJSON(){return Kp(this).toJSON()}};({...Wp}),{...Wp};var Gp={[Up]:Up,[Pl](){return this.toString()}};({...Gp}),{...Gp};var Kp=e=>new Date(e.epochMilliseconds),qp=qf,Jp=Yf,Yp=$f,Xp=ep,Zp=up,Qp=Sp,$p=bp,em=Ap,tm=hp,nm=pp,rm=op;function im(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function am(e){return t=>im(t)?.[e]}var om=`~structural`,sm=`~sentinels`,cm=`~constructor`,lm=am(`brands`),um=bc(e=>{let t=im(e)?.identifier;return typeof t==`string`?t:e.getExpected(um)}),dm=Symbol(),fm=Ip,pm=fm(dm),mm=fm(dm),hm=e=>e===dm?Zu():Qu(e),gm=e=>e._tag===`None`?pm:fm(e.value),_m=`~effect/SchemaIssue/Issue`;function vm(e){return Fc(e,_m)&&e[_m]===_m}function ym(e){return Object.hasOwn(e,`input`)}var bm=class{[_m]=_m;constructor(e,t){t?.reportInput===!0&&e!==dm&&(this.input=e)}},xm=class extends bm{_tag=`Filter`;filter;issue;constructor(e,t,n,r){super(n,r),this.filter=e,this.issue=t}},Sm=class extends bm{_tag=`Encoding`;ast;issue;constructor(e,t,n,r){super(n,r),this.ast=e,this.issue=t}},Cm=class extends bm{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},wm=class extends bm{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},Tm=class extends bm{_tag=`UnexpectedKey`;ast;constructor(e,t,n){super(t,n),this.ast=e}},Em=class extends bm{_tag=`Composite`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},Dm=class extends bm{_tag=`InvalidType`;ast;constructor(e,t,n){super(t,n),this.ast=e}},Om=class extends bm{_tag=`InvalidValue`;annotations;constructor(e,t,n){super(t,n),this.annotations=e}},km=class extends bm{_tag=`AnyOf`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},Am=class extends bm{_tag=`OneOf`;ast;successes;constructor(e,t,n,r){super(n,r),this.ast=e,this.successes=t}};function jm(e,t,n){if(vm(e))return e;if(typeof e==`string`)return new Om({message:e},t,n);let r=typeof e.issue==`string`?new Om({message:e.issue},t,n):e.issue;return new Cm(e.path,r)}function Mm(e,t,n){if(e!==void 0)return typeof e==`boolean`?e?void 0:new Om(void 0,t,n):jm(e,t,n)}function Nm(e,t,n,r){return Array.isArray(t)?pd(t)?t.length===1?jm(t[0],n,r):new Em(e,_d(t,e=>jm(e,n,r)),n,r):void 0:Mm(t,n,r)}var Pm=e=>{let t=Gm(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return zm(um(e.ast),e);case`InvalidValue`:{let t=Rm(e);if(t!==void 0)return zm(t,e);let n=Lm(e);return n===void 0?`Expected a valid value`:`Invalid data ${n}`}case`MissingKey`:return`Missing key`;case`UnexpectedKey`:{let t=Lm(e);return t===void 0?`Expected no excess property`:`Unexpected key with value ${t}`}case`Forbidden`:return`Forbidden operation`;case`OneOf`:{let t=Lm(e);return t===void 0?`Expected exactly one member to match`:`Expected exactly one member to match the input ${t}`}}},Fm=e=>Gm(e.issue)??Gm(e);function Im(e){return t=>({issues:Bm(t,[],e?.leafHook??Pm,e?.checkHook??Fm)})}function Lm(e){return ym(e)?Ol(e.input):void 0}function Rm(e){let t=e.annotations?.expected;return typeof t==`string`?t:void 0}function zm(e,t){let n=Lm(t);return n===void 0?`Expected ${e}`:`Expected ${e}, got ${n}`}function Bm(e,t,n,r){switch(e._tag){case`Filter`:{let i=r(e);if(i!==void 0)return[{path:t,message:i}];if(e.issue._tag!==`InvalidValue`)return Bm(e.issue,t,n,r);let a=Rm(e.issue);return[{path:t,message:a===void 0?zm(Vm(e.filter),e):zm(a,e.issue)}]}case`Encoding`:return Bm(e.issue,t,n,r);case`Pointer`:return Bm(e.issue,[...t,...e.path],n,r);case`Composite`:return e.issues.flatMap(e=>Bm(e,t,n,r));case`AnyOf`:return e.issues.length===0?[{path:t,message:Gm(e)??zm(um(e.ast),e)}]:e.issues.flatMap(e=>Bm(e,t,n,r));default:return[{path:t,message:n(e)}]}}function Vm(e){let t=e.annotations?.expected;if(typeof t==`string`)return t;switch(e._tag){case`Filter`:return`<filter>`;case`FilterGroup`:return e.checks.map(e=>Vm(e)).join(` & `)}}function Hm(){return e=>Wm(e,``)}var Um=Hm();function Wm(e,t){let n;switch(e._tag){case`Filter`:{let r=Fm(e);if(r!==void 0)n=r;else{if(e.issue._tag!==`InvalidValue`)return Wm(e.issue,t);let r=Rm(e.issue);n=r===void 0?zm(Vm(e.filter),e):zm(r,e.issue)}break}case`Encoding`:return Wm(e.issue,t);case`Pointer`:return Wm(e.issue,t+jl(e.path));case`Composite`:case`AnyOf`:if(e._tag===`Composite`||e.issues.length>0)return e.issues.map(e=>Wm(e,t)).join(`
17
- `);n=Gm(e)??zm(um(e.ast),e);break;default:n=Pm(e)}return t?`${n}\n at ${t}`:n}function Gm(e){if(e._tag===`Pointer`)return;if(e._tag===`Encoding`)return Gm(e.issue);let t=(e._tag===`Filter`?e.filter.annotations:`annotations`in e?e.annotations:e.ast.annotations)?.[e._tag===`MissingKey`?`messageMissingKey`:e._tag===`UnexpectedKey`?`messageUnexpectedKey`:`message`];if(typeof t==`string`)return t}function Km(e){let t;for(let n of e.reasons){if(!Pp(n)||!vm(n.error))return;t??=n.error}return t}function qm(e,t){let n=Km(e);if(n===void 0)throw Error(t,{cause:e});return n}var Jm=class e extends hc{run;constructor(e){super(),this.run=e}map(t){return new e((e,n)=>this.run(e,n).pipe(tm(td(t))))}compose(t){return Xm(this)?t:Xm(t)?this:new e((e,n)=>this.run(e,n).pipe(nm(e=>t.run(e,n))))}},Ym=new Jm(qp);function Xm(e){return e.run===Ym.run}function Zm(){return Ym}function Qm(e){return $m(td(e))}function $m(e){return new Jm(t=>qp(e(t)))}function eh(e){return new Jm(t=>{let n=nd(t,Ac);return ed(n)?qp(n):tm(e,Qu)})}function th(){return Qm(globalThis.String)}function nh(){return Qm(globalThis.Number)}var rh=`~effect/SchemaTransformation/Transformation`,ih=class e{[rh]=rh;_tag=`Transformation`;decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new e(this.encode,this.decode)}compose(t){return new e(this.decode.compose(t.decode),t.encode.compose(this.encode))}};function ah(e){return Fc(e,rh)&&e[rh]===rh}var oh=e=>ah(e)?e:new ih(e.decode,e.encode);function sh(e){return new ih(Qm(e.decode),Qm(e.encode))}var ch=new ih(Zm(),Zm());function lh(){return ch}var uh=new ih(nh(),th());function dh(e){return t=>t._tag===e}function fh(e){return Fc(e,Ch)&&e[Ch]===Ch}var ph=dh(`Declaration`),mh=dh(`Never`),hh=dh(`Literal`),gh=dh(`UniqueSymbol`),_h=dh(`Arrays`),vh=dh(`Objects`),yh=dh(`Suspend`),bh=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},xh={},Sh=class{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,n=void 0,r=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=n,this.annotations=r}},Ch=`~effect/Schema`,wh=class{[Ch]=Ch;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,r=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=r}toString(){return`<${this._tag}>`}},Th=class e extends wh{_tag=`Declaration`;typeParameters;run;encodingChecks;encodingRun;constructor(e,t,n,r,i,a,o,s){super(n,r,i,a),this.typeParameters=e,this.run=t,this.encodingChecks=o,this.encodingRun=s}getParser(){let e;return(t,n)=>t===dm?pm:(e??=this.run(this.typeParameters))(t,this,n)}_rebuild(t,n,r,i,a){let o=Vg(this.typeParameters,t);return o===this.typeParameters&&n===this.checks&&r===this.encodingChecks&&i===this.run&&a===this.encodingRun?this:new e(o,i,this.annotations,n,void 0,this.context,r,a)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let e=this.annotations?.expected;return typeof e==`string`?e:`<Declaration>`}},Eh=new class extends wh{_tag=`Null`;getParser(){return i_(this,null)}getExpected(){return`null`}},Dh=class extends wh{_tag=`Undefined`;getParser(){return i_(this,void 0)}toCodecJson(){return Ag(this,[Oh])}getExpected(){return`undefined`}},Oh=new bh(Eh,new ih(Qm(()=>void 0),Qm(()=>null))),kh=new Dh,Ah=new class extends wh{_tag=`Never`;getParser(){return a_(this,Mc)}getExpected(){return`never`}},jh=new class extends wh{_tag=`Unknown`;getParser(){return a_(this,Nc)}getExpected(){return`unknown`}},Mh=class extends wh{_tag=`Literal`;literal;constructor(e,t,n,r,i){if(super(t,n,r,i),typeof e==`number`&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${Ol(e)}`);this.literal=e}getParser(){return i_(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==`bigint`?Nh(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:Nh(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function Nh(e){let t=globalThis.String(e.literal);return Ag(e,[new bh(new Mh(t),new ih(Qm(()=>e.literal),Qm(()=>t)))])}var Ph=new class extends wh{_tag=`String`;getParser(){return a_(this,wc)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&p_(n,e,void 0,this,t)?void 0:e}getExpected(){return`string`}},Fh=class extends wh{_tag=`Number`;getParser(){return a_(this,Tc)}matchKey(e,t){return this._match(c_,e,t)}matchPart(e,t){return this._match(s_,e,t)}_match(e,t,n){if(!e.test(t))return;let r=globalThis.Number(t);return n.disableChecks||!this.checks?r:p_(this.checks,r,void 0,this,n)?void 0:r}toCodecJson(){return this.checks&&(Ih(this.checks,`effect/schema/isFinite`)||Ih(this.checks,`effect/schema/isInt`))?this:Ag(this,[Tg])}toCodecStringTree(){return this.toCodecJson()===this?Ag(this,[d_]):Ag(this,[f_])}getExpected(){return`number`}};function Ih(e,t){return e.some(e=>e.annotations?.representation?.id===t||e._tag===`FilterGroup`&&Ih(e.checks,t))}var Lh=new Fh,Rh=new class extends wh{_tag=`Boolean`;getParser(){return a_(this,Ec)}getExpected(){return`boolean`}},zh=class e extends wh{_tag=`Arrays`;isMutable;elements;rest;encodingChecks;constructor(e,t,n,r,i,a,o,s){super(r,i,a,o),this.isMutable=e,this.elements=t,this.rest=n,this.encodingChecks=s;let c=!1;for(let e=0;e<t.length;e++)if(Xg(t[e]))c=!0;else if(c)throw Error(`A required element cannot follow an optional element. ts(1257)`);if(c&&n.length>1)throw Error(`A required element cannot follow an optional element. ts(1257)`);for(let e=1;e<n.length;e++)if(Xg(n[e]))throw Error(`An optional element cannot follow a rest element. ts(1266)`)}getParser(e,t=e){let n=this,r,i,a=n.elements.length,o=Math.max(0,n.rest.length-1);function s(e,t){return t<a?r[t]:t>=e?i[t-e+1]:i[0]}return rm(function*(e,c){if(e===dm)return dm;if(!Array.isArray(e))return yield*Jp(new Dm(n,e,c));r||(r=n.elements.map(e=>({ast:e,parser:t(e)})),i=n.rest.map(e=>({ast:e,parser:t(e)})));let l=e.length,u={ast:n,getParser:s,input:e,len:l,tailThreshold:Math.max(a,l-o),output:new globalThis.Array(l),issues:void 0,options:c},d=Bh(u,e,{concurrency:Vh(c?.concurrency)?.concurrency,end:n.rest.length===0?a:Math.max(l,a+o)});if(d&&(yield*d),n.rest.length===0&&l>a)for(let t=a;t<=l-1;t++){let r=new Tm(n,e[t],c),i=new Cm([t],r);if(c.errors===`all`)u.issues?u.issues.push(i):u.issues=[i];else return yield*Jp(new Em(n,[i],e,c))}return u.issues?yield*Jp(new Em(n,u.issues,e,c)):u.output})}_rebuild(t,n,r){let i=Vg(this.elements,t),a=Vg(this.rest,t);return i===this.elements&&a===this.rest&&n===this.checks&&r===this.encodingChecks?this:new e(this.isMutable,i,a,this.annotations,n,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return`array`}},Bh=Dp()({onItem(e,t,n){let r=n<e.len?t:dm;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step(e,t,n,r){if(n._tag===`Failure`)return Hh(e,e.ast,r,n);let i=n===mm?t:n[F];if(i!==dm)e.output[r]=i;else{let t=e.getParser(e.tailThreshold,r);if(Xg(t.ast))return;let n=new Cm([r],new wm(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return Rp(new Em(e.ast,[n],e.input,e.options))}}}),Vh=e=>(e=e===`unbounded`?1/0:e??1,e>1?{concurrency:e}:void 0),Hh=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let i=Km(r.cause);if(i===void 0)return Lp(Fp(r.cause,r=>new Em(t,[new Cm([n],r)],e.input,e.options)));let a=new Cm([n],i);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return Rp(new Em(t,[a],e.input,e.options))},Uh=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;function Wh(e,t,n=xh){let r,i;function a(t){switch(t._tag){case`String`:case`TemplateLiteral`:return(r??=Object.keys(e)).filter(e=>t.matchPart(e,n)!==void 0);case`Number`:return(r??=Object.keys(e)).filter(e=>t.matchKey(e,n)!==void 0);case`Symbol`:return(i??=Object.getOwnPropertySymbols(e)).filter(e=>t.matchKey(e,n)!==void 0);case`Union`:return[...new Set(t.types.flatMap(a))];default:return[]}}return a(o_(e_(t)))}var Gh=class{name;type;constructor(e,t){this.name=e,this.type=t}};function Kh(e){switch(e._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return e.types.every(Kh);default:return!1}}function qh(e){return Kh(e)&&Kh(e_(e))}var Jh=class{parameter;type;constructor(e,t){if(!qh(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,Xg(t)&&!r_(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},Yh=class e extends wh{_tag=`Objects`;propertySignatures;indexSignatures;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=o;let s=e.map(e=>e.name).filter((e,t,n)=>n.indexOf(e)!==t);if(s.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(s)}. ts(2300)`)}getParser(e,t=e){let n=this,r=[];for(let e of n.propertySignatures)r.push(e.name);let i=r.length,a=n.indexSignatures.length,o=i&&a?new Set(r):void 0;if(!i&&!a)return a_(n,jc);let s,c,l=(e,t,r,a,s)=>{if(s._tag===`Failure`)return Hh(e,n,t,s)??zp;let c=s===mm?a:s[F];if(r!==dm&&c!==dm){if(i&&(o.has(t)||o.has(r)))return zp;yl(e.out,r,c)}return zp},u=(e,t,r,i)=>{if(!i){let n=r.parserKey(t,e.options);if(!fp(n))return Zp(Qp(n),n=>u(e,t,r,n));i=n}if(i._tag===`Failure`)return Hh(e,n,t,i)??zp;let a=i===mm?t:i[F],o=e.input[t],s=r.parserValue(o,e.options);return fp(s)?l(e,t,a,o,s):Zp(Qp(s),n=>l(e,t,a,o,n))},d=(e,t,n)=>{let r=e.input[t],i=n.parserValue(r,e.options);return fp(i)?l(e,t,t,r,i):Zp(Qp(i),n=>l(e,t,t,r,n))},f=a?Dp()({onItem:(e,[t,n])=>u(e,t,n),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0,p=()=>(s||(s=n.propertySignatures.map(e=>({parser:t(e.type),name:e.name,type:e.type})),c=a?n.indexSignatures.map(n=>({is:n,parserKey:e(o_(n.parameter)),parserValue:t(n.type)})):void 0),s),m=rm(function*(e,t){if(e===dm)return dm;if(typeof e!=`object`||!e||Array.isArray(e))return yield*Jp(new Dm(n,e,t));p();let l=e,m={},h={ast:n,input:l,out:m,issues:void 0,options:t},g=t.errors===`all`,_=t.onExcessProperty===`error`,v=t.onExcessProperty===`preserve`,y;if(!a&&(_||v)){o??=new Set(r),y=Reflect.ownKeys(l);for(let r=0;r<y.length;r++){let i=y[r];if(!o.has(i)){if(_){let r=new Tm(n,l[i],t),a=new Cm([i],r);if(g){h.issues?h.issues.push(a):h.issues=[a];continue}return yield*Jp(new Em(n,[a],e,t))}yl(m,i,l[i])}}}let b=Vh(t?.concurrency);if(i){let e=Zh(h,s,b);e&&(yield*e)}if(a&&!b)for(let e=0;e<a;e++){let n=c[e],r=n.is.parameter===Ph?d:u,i=n.is.parameter===Ph?Object.keys(l):Wh(l,n.is.parameter,t);for(let e=0;e<i.length;e++){let t=r(h,i[e],n);if(!fp(t))yield*t;else if(t._tag===`Failure`)return yield*t}}else if(f){let e=gd();for(let n=0;n<a;n++){let r=c[n],i=Wh(l,r.is.parameter,t);for(let t=0;t<i.length;t++)e.push([i[t],r])}let n=f(h,e,b);n&&(yield*n)}if(h.issues)return yield*Jp(new Em(n,h.issues,e,t));if(t.propertyOrder===`original`){let e=(y??Reflect.ownKeys(l)).concat(r),t={};for(let n of e)Object.hasOwn(m,n)&&yl(t,n,m[n]);return t}return m});if(a)return m;let h=(e,t,n)=>{let r=s[t];return Zp(Qp(n),n=>{let i=Xh(e,r,n);if(i)return i;let a=()=>fm(e.out),o=Zh(e,s.slice(t+1));return o?nm(o,a):a()})};return(e,t)=>{if(e===dm)return pm;if(t.errors===`all`||t.onExcessProperty!==void 0||t.propertyOrder===`original`||t.concurrency!==void 0)return m(e,t);if(typeof e!=`object`||!e||Array.isArray(e))return Jp(new Dm(n,e,t));let r=p(),i=e,a={},o={ast:n,input:i,out:a,issues:void 0,options:t};try{for(let e=0;e<r.length;e++){let n=r[e],s=n.name,c=Object.hasOwn(i,s),l=c?i[s]:dm,u=n.parser(l,t);if(!fp(u))return h(o,e,u);if(u===mm){c&&yl(a,s,l);continue}let d=Xh(o,n,u);if(d)return d}}catch(e){return Xp(e)}return fm(a)}}_rebuild(t,n,r,i){let a=Vg(this.propertySignatures,e=>{let n=t(e.type);return n===e.type?e:new Gh(e.name,n)}),o=Vg(this.indexSignatures,e=>{let r=n(e.parameter),i=t(e.type);return r===e.parameter&&i===e.type?e:new Jh(r,i)});return a===this.propertySignatures&&o===this.indexSignatures&&r===this.checks&&i===this.encodingChecks?this:new e(a,o,this.annotations,r,void 0,this.context,i)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?`object | array`:`object`}};function Xh(e,t,n){if(n._tag===`Failure`)return Hh(e,e.ast,t.name,n);if(n===mm)return;let r=n[F];if(r!==dm){yl(e.out,t.name,r);return}if(delete e.out[t.name],!Xg(t.type)){let n=new Cm([t.name],new wm(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}return Rp(new Em(e.ast,[n],e.input,e.options))}}var Zh=Dp()({onItem(e,t){if(!Object.hasOwn(e.input,t.name))return t.parser(dm,e.options);let n=e.input[t.name];return yl(e.out,t.name,n),t.parser(n,e.options)},step:Xh});function Qh(e,t){return e?t?[...e,...t]:e:t}function $h(e,t,n){return new Yh(Reflect.ownKeys(e).map(t=>new Gh(t,e[t].ast)),[],n,t)}function eg(e){return e.ast}function tg(e,t=void 0){return new zh(!1,e.map(e=>e.ast),[],void 0,t)}function ng(e,t,n){return new dg(e.map(eg),t,void 0,n)}var rg=xc(e=>{for(;;){if(yh(e))return jh;let t=e.encoding;if(!t)return e.recur?.(rg,_c)??e;if(t.some(e=>e.transformation._tag===`Middleware`&&e.transformation.decode!==_c))return jh;e=t[t.length-1].to}});function ig(e){switch(e._tag){case`Null`:return[`null`];case`Undefined`:return[`undefined`];case`String`:case`TemplateLiteral`:return[`string`];case`Number`:return[`number`];case`Boolean`:return[`boolean`];case`Symbol`:case`UniqueSymbol`:return[`symbol`];case`BigInt`:return[`bigint`];case`Arrays`:return[`array`];case`ObjectKeyword`:return[`object`,`array`,`function`];case`Objects`:return e.propertySignatures.length||e.indexSignatures.length?[`object`]:[`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`];case`Enum`:return Array.from(new Set(e.enums.map(([,e])=>typeof e)));case`Literal`:return[typeof e.literal];case`Union`:return Array.from(new Set(e.types.flatMap(ig)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function ag(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[sm];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!Xg(t)){if(hh(t))return[{key:e.name,literal:t.literal}];if(gh(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>{if(!Xg(e)){if(hh(e))return[{key:t,literal:e.literal}];if(gh(e))return[{key:t,literal:e.symbol}]}return[]});case`Union`:{if(e.types.length===0)return[];let t=e.types.map(e=>ag(rg(e)));return t[0].filter(e=>t.every(t=>t.some(t=>t.key===e.key&&t.literal===e.literal)))}case`Suspend`:return ag(e.thunk())}}var og=new WeakMap,sg=Object.freeze([]);function cg(e){let t=og.get(e);if(t)return t;let n,r=0,i,a,o=!0;for(let t=0;t<e.length;t++){let s=e[t],c=rg(s);if(mh(c))continue;if(o){if(hh(c)||gh(c)){a??=new Map;let e=hh(c)?c.literal:c.symbol,t=a.get(e);t||a.set(e,t=[]),t.push(s)}else o=!1}let l=ag(c);if(l.length){n??=new Map,r++;for(let{key:e,literal:r}of l){let i=n.get(e);i||n.set(e,i=[new Map,new Set]),i[1].add(t);let a=i[0].get(r);a||i[0].set(r,a=new Set),a.add(t)}}else{i??={};let e=ig(c);for(let n of e)(i[n]??=[]).push(t)}}if(o&&a)a.forEach(Object.freeze),t=e=>a.get(e)??sg;else if(n?.size===1&&!i){let[r,[i]]=n.entries().next().value,a=i;for(let[t,n]of i)a.set(t,Object.freeze(Array.from(n,t=>e[t])));t=(t,n)=>{if(Pc(t)){let i=Object.hasOwn(t,r)?t[r]:void 0;if(i!==void 0)return a.get(i)??sg;if(n)return e}return sg}}else if(n){let a;for(let e of n)(!a||e[1][0].size>a[1][0].size)&&e[1][1].size===r&&(a=e);t=(t,r)=>{let o=i?.[t===null?`null`:Array.isArray(t)?`array`:typeof t]??sg;if(!Pc(t))return o.map(t=>e[t]);let s=new Set(o),c;if(a){let[n,[i]]=a,l=Object.hasOwn(t,n),u=l?t[n]:void 0;if(l&&(!r||u!==void 0)){let t=i.get(u);if(!t)return o.map(t=>e[t]);for(let e of t)s.add(e);c=n}}if(c===void 0)for(let[e,[i,a]]of n){let n=Object.hasOwn(t,e),o=n?t[e]:void 0;if(n&&(!r||o!==void 0)){let e=i.get(o);if(e)for(let t of e)s.add(t)}else if(r)for(let e of a)s.add(e)}for(let[e,[i,a]]of n){if(e===c)continue;let n=Object.hasOwn(t,e),o=n?t[e]:void 0;if(n&&(!r||o!==void 0)){let e=i.get(o);for(let t of s)a.has(t)&&!e?.has(t)&&s.delete(t)}}return Array.from(s).sort((e,t)=>e-t).map(t=>e[t])}}else t=t=>(i?.[t===null?`null`:Array.isArray(t)?`array`:typeof t]??sg).map(t=>e[t]).filter(lg(t));return og.set(e,t),t}function lg(e){return t=>{let n=rg(t);return n._tag===`Literal`?n.literal===e:n._tag!==`UniqueSymbol`||n.symbol===e}}function ug(e,t,n=!1){return cg(t)(e,n)}var dg=class e extends wh{_tag=`Union`;types;mode;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.types=e,this.mode=t,this.encodingChecks=o}getParser(e,t){let n=this;return(r,i)=>{if(r===dm)return pm;let a=ug(r,n.types,t!==void 0);if(a.length===1){let t=e(a[0])(r,i);return t._tag===`Success`?t:fp(t)?fg(n,t.cause,r,i):$p(t,e=>fg(n,e,r,i))}let o={ast:n,compile:e,input:r,out:void 0,successes:n.mode===`oneOf`?[]:void 0,issues:void 0,options:i},s=Vh(i?.concurrency),c=pg(o,a,s?{...s,orderedStep:!0}:void 0);return c?nm(c,e=>o.out===mm?qp(r):o.out?o.out:Jp(new km(n,o.issues??[],r,i))):o.out?o.out:Jp(new km(n,o.issues??[],r,i))}}_rebuild(t,n,r){let i=Vg(this.types,t);return i===this.types&&n===this.checks&&r===this.encodingChecks?this:new e(i,this.mode,this.annotations,n,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let n of this.types){let r=n.matchPart(e,t);if(r!==void 0)return r}}getExpected(e){let t=this.annotations?.expected;if(typeof t==`string`)return t;if(this.types.length===0)return`never`;let n=this.types.map(t=>{let n=e_(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(hh);if(t.length>0)return`${hg(n.isMutable)}[ ${t.map(t=>e(t)+gg(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>hh(e.type));if(t.length>0)return`{ ${t.map(t=>`${hg(t.type.context?.isMutable)}${Al(t.name)}${gg(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};function fg(e,t,n,r){let i=Km(t);return i?Rp(new km(e,[i],n,r)):Lp(t)}var pg=Dp()({onItem(e,t){return e.compile(t)(e.input,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=Km(n.cause);if(t===void 0)return n;e.issues?e.issues.push(t):e.issues=[t]}else{if(e.out&&e.successes)return e.successes.push(t),Rp(new Am(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(t);else return zp}}}),mg=new dg([new Mh(`Infinity`),new Mh(`-Infinity`),new Mh(`NaN`)],`anyOf`);function hg(e){return e?``:`readonly `}function gg(e){return e?`?`:``}function _g(e){let t=!1,n;return()=>t?n:(n=e(),t=!0,n)}var vg=class e extends wh{_tag=`Suspend`;thunk;constructor(e,t,n,r,i){if(n)throw Error(`Cannot add checks to Suspend`);super(t,void 0,r,i),this.thunk=_g(e)}getParser(e){let t;return(n,r)=>(t??=e(this.thunk()))(n,r)}recur(t){return new e(()=>t(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(e){return e(this.thunk())}},yg=class e extends hc{_tag=`Filter`;run;annotations;aborted;constructor(e,t=void 0,n=!1){super(),this.run=e,this.annotations=t,this.aborted=n}annotate(t){return new e(this.run,{...this.annotations,...t},this.aborted)}abort(){return new e(this.run,this.annotations,!0)}and(e,t){return new bg([this,e],t)}},bg=class e extends hc{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(t){return new e(this.checks,{...this.annotations,...t})}and(t,n){return new e([this,t],n)}};function xg(e,t,n=!1){return new yg((t,n,r)=>Nm(n,e(t,n,r),t,r),t,n)}function Sg(e,t){return new yg((t,n,r)=>e(t)?void 0:new Om(void 0,t,r),t,!0)}function Cg(e){return xg(e=>globalThis.Number.isFinite(e),{expected:`a finite number`,representation:{id:`effect/schema/isFinite`,payload:null},toJsonSchema:()=>({type:`number`}),toCode:()=>({runtime:`Schema.isFinite()`}),arbitrary:{constraint:{noInfinity:!0,noNaN:!0}},...e})}var wg=Pg(Lh,[Cg()]),Tg=new bh(new dg([wg,mg],`anyOf`),new ih(nh(),Qm(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function Eg(e,t){let n=e.source,r=new globalThis.RegExp(n,e.flags);return xg(e=>(r.lastIndex=0,r.test(e)),{expected:`a string matching the RegExp ${n}`,representation:{id:`effect/schema/isPattern`,payload:{source:n,flags:e.flags}},toJsonSchema:()=>({pattern:n}),arbitrary:{constraint:{patterns:[e.source]}},...t})}function Dg(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}var Og=new WeakMap;function kg(e){return Og.get(e)??e}function Ag(e,t){return e.encoding===t?e:Dg(e,e=>{e.encoding.value=t})}function jg(e,t){if(e.context===t)return e;let n=kg(e);if(n.context===t)return n;let r=Dg(e,e=>{e.context.value=t});return Og.set(r,n),r}function Mg(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return Ng(e,ud(e.checks.slice(0,-1),n.annotate(t)))}return Dg(e,e=>{e.annotations.value={...e.annotations.value,...t}})}function Ng(e,t){if(e._tag===`Suspend`&&t)throw Error(`Cannot add checks to Suspend`);return e.checks===t?e:Dg(e,e=>{e.checks.value=t})}function Pg(e,t){return Ng(e,Qh(e.checks,t))}function Fg(e,t){let n=t(e.to);return n===e.to?e:new bh(n,e.transformation)}function Ig(e,t){let n=e,r=n[n.length-1],i=Fg(r,t);return i===r?e:ud(e.slice(0,e.length-1),i)}function Lg(e){return t=>t.encoding?Ag(t,Ig(t.encoding,e)):t}function Rg(e,t){function n(r){if(r.encoding){let e=r.encoding[r.encoding.length-1];return t?.stopAt?.(e)?r:Ag(r,Ig(r.encoding,n))}return e(r)}return xc(n)}function zg(e,t,n){let r=new bh(e,t);return Ag(n,n.encoding?[...n.encoding,r]:[r])}function Bg(e,t){let n=lm(e);return Mg(e,{brands:n?[...n,t]:[t]})}function Vg(e,t){let n=!1,r=Array(e.length);for(let i=0;i<e.length;i++){let a=e[i],o=t(a);o!==a&&(n=!0),r[i]=o}return n?r:e}function Hg(e,t){return jg(e,e.context?new Sh(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new Sh(!1,!1,void 0,t))}var Ug=xc(e=>Wg(jg(e,e.context?e.context.isOptional===!1?new Sh(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new Sh(!0,!1)))),Wg=Lg(Ug),Gg=bc(e=>Ug(new dg([e,kh],`anyOf`)));function Kg(e,t){let n=new bh(jh,new ih(eh(t),Zm()));return jg(e,e.context?new Sh(e.context.isOptional,e.context.isMutable,n,e.context.annotations):new Sh(!1,!1,n))}function qg(e,t,n){return zg(e,n,t)}function Jg(e){let t=[],n=[];function r(e){switch(e._tag){case`Literal`:Oc(e.literal)&&t.push(e.literal);return;case`UniqueSymbol`:t.push(e.symbol);return;case`Never`:return;case`Union`:for(let t=0;t<e.types.length;t++)r(e.types[t]);return;default:n.push(e)}}return r(e),{literals:t,parameters:n}}function Yg(e,t){let{literals:n,parameters:r}=Jg(e);return new Yh(n.map(e=>new Gh(e,t)),r.map(e=>new Jh(e,t)))}function Xg(e){return e.context?.isOptional??!1}function Zg(e){return e.annotations?.[`~structural`]===!0||e._tag===`FilterGroup`&&e.checks.every(Zg)}function Qg(e){function t(e){return Zg(e)?[e]:e._tag===`FilterGroup`?e.checks.flatMap(t):[]}let n=e.flatMap(t);return fd(n)?n:void 0}var $g=xc(e=>{if(e.encoding)return $g(Ag(e,void 0));let t=e,n=t.recur?.($g)??t,r=n.encodingChecks;if(r){let t=n===e?r:_h(n)||vh(n)||ph(n)&&n.typeParameters.length>0?Qg(r):void 0;return Dg(n,e=>{e.encodingChecks.value=void 0,e.checks.value=Qh(n.checks,t)})}return n}),e_=xc(e=>$g(n_(e)));function t_(e,t){let n=t,r=n.length,i=n[r-1],a=[new bh(n_(Ag(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new bh(n_(n[e-1].to),n[e].transformation.flip()));let o=n_(i.to);return o.encoding?Ag(o,[...o.encoding,...a]):Ag(o,a)}var n_=bc(e=>{if(e.encoding)return t_(e,e.encoding);let t=e;return t.flip?.(n_)??t.recur?.(n_)??t});function r_(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(r_);default:return!1}}function i_(e,t){let n=fm(t);return(r,i)=>r===dm?pm:r===t?n:Jp(new Dm(e,r,i))}function a_(e,t){return(n,r)=>n===dm?pm:t(n)?mm:Jp(new Dm(e,n,r))}var o_=Rg(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(o_)}}),s_=new globalThis.RegExp(`^${Uh}$`),c_=new globalThis.RegExp(`^(?:${Uh}|Infinity|-Infinity|NaN)$`);function l_(e){return Eg(s_,{expected:`a string representing a finite number`,representation:{id:`effect/schema/isStringFinite`,payload:null},toJsonSchema:()=>({pattern:s_.source}),...e})}var u_=Pg(Ph,[l_()]),d_=new bh(u_,uh),f_=new bh(new dg([u_,mg],`anyOf`),uh);function p_(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`){if(n=p_(o.checks,t,n,r,i),n&&(i.errors!==`all`||n[n.length-1].filter.aborted))return n}else{let e=o.run(t,r,i);if(e){let r=new xm(o,e,t,i);if(n?n.push(r):n=[r],i.errors!==`all`||o.aborted)return n}}}return n}function m_(e){if(!ph(e))return;let t=e.annotations?.[cm];return kc(t)?t(e.typeParameters):void 0}function h_(e){let t=O_(M_,$g(e.ast));return(e,n)=>t(e,n?.disableChecks?n?.parseOptions?{...n.parseOptions,disableChecks:!0}:{disableChecks:!0}:n?.parseOptions)}function g_(e){let t=h_(e);return(e,n)=>{let r=em(t(e,n));return Bp(r)?Qu(r.value):(qm(r.cause,`Option adapter can only return none for schema issues`),Zu())}}function __(e){let t=h_(e);return(e,n)=>{let r=em(t(e,n));if(Bp(r))return r.value;let i=qm(r.cause,`Constructor adapter can only throw schema issues`);throw Error(`Schema validation failed`,{cause:i})}}function v_(e){return y_(e.ast)}function y_(e){let t=k_(D_($g(e)));return e=>{let n=t(e,xh);return Bp(n)?!0:(qm(n.cause,`Type guard adapter can only return false for schema issues`),!1)}}function b_(e,t){let n=D_(e.ast);return t===void 0?n:(e,r)=>n(e,T_(t,r))}function x_(e,t){return k_(b_(e,t))}function S_(e,t){return A_(b_(e,t))}function C_(e,t){let n=D_(n_(e.ast));return t===void 0?n:(e,r)=>n(e,T_(t,r))}function w_(e,t){return k_(C_(e,t))}var T_=(e,t)=>t?{...e,...t}:e,E_=e=>e===dm?Jp(new Om):qp(e);function D_(e){return O_(j_,e)}function O_(e,t){let n;return(r,i)=>{let a=(n??=e(t))(r,i??xh);return a===mm?qp(r):fp(a)?a[F]===dm?E_(dm):a:nm(a,E_)}}function k_(e){return(t,n)=>em(e(t,n))}function A_(e){let t=k_(e);return(e,n)=>{let r=t(e,n);return Bp(r)?rd(r.value):id(qm(r.cause,`Result adapter can only return schema issues`))}}var j_=bc(e=>L_(e,j_)),M_=bc(e=>L_(e,M_,P_)),N_=bc(e=>L_(e,M_,P_,e.context?.constructorDefault));function P_(e){return e.context?.constructorDefault?N_(e):M_(e)}function F_(e,t,n,r){let i;if(fp(e)&&e._tag===`Success`){let a=hm(e===mm?t:e[F]);i=n._tag===`Transformation`?n.decode.run(a,r):n.decode(fm(a),r)}else i=n._tag===`Transformation`?nm(e,e=>n.decode.run(hm(e),r)):n.decode(tm(e,hm),r);return fp(i)&&i._tag===`Success`?gm(i[F]):nm(i,gm)}function I_(e,t){let n;return(r,i)=>r===dm?pm:e.isConstructed(r)?mm:F_((n??=t(e.link.to))(r,i),r,e.link.transformation,i)}function L_(e,t,n,r){let i=n?m_(e):void 0,a=i?I_(i,t):e.getParser(t,n),o=e.checks,s=r?e.encoding?[...e.encoding,r]:[r]:e.encoding,c=e.encodingChecks,l=(o?o[o.length-1].annotations:e.annotations)?.parseOptions;if(!s&&!o&&!c)return l?(e,t)=>a(e,T_(t,l)):a;let u,d=(t,n)=>{let r=a(t,n);if(c&&!n.disableChecks){if(fp(r)){if(r._tag===`Success`){let i=r===mm?t:r[F];if(t!==dm&&i!==dm){let i=p_(c,t,void 0,e,n);i&&(r=Jp(new Em(e,i,t,n)))}}}else r=Zp(r,r=>{if(t!==dm&&r!==dm){let r=p_(c,t,void 0,e,n);if(r)return Jp(new Em(e,r,t,n))}return qp(r)})}if(o&&!n.disableChecks){if(fp(r)){if(r._tag===`Success`){let i=r===mm?t:r[F];if(i===dm)return r;let a=p_(o,i,void 0,e,n);a&&(r=Jp(new Em(e,a,i,n)))}}else r=Zp(r,t=>{if(t!==dm){let r=p_(o,t,void 0,e,n);if(r)return Jp(new Em(e,r,t,n))}return qp(t)})}return r};return s?(n,r)=>{l&&(r=T_(r,l));let i=u??=s.map(e=>t(e.to)),a=n,o=i[i.length-1](n,r);for(let e=s.length-1;e>=0;e--)if(o=F_(o,a,s[e].transformation,r),e!==0){let t=i[e-1];o._tag===`Success`?(a=o[F],o=t(a,r)):o=nm(o,e=>{let n=t(e,r);return n===mm?fm(e):n})}if(o._tag===`Success`){let e=o[F],t=d(e,r);return t===mm?o:t}return o=$p(o,t=>Yp(()=>Fp(t,t=>new Sm(e,t,n,r)))),nm(o,e=>{let t=d(e,r);return t===mm?fm(e):t})}:l?(e,t)=>d(e,T_(t,l)):d}var R_=`~effect/Schema/Schema`,z_={[R_]:R_,pipe(){return pc(this,arguments)},annotate(e){return this.rebuild(Mg(this.ast,e))},annotateKey(e){return this.rebuild(Hg(this.ast,e))},check(...e){return this.rebuild(Pg(this.ast,e))}};function B_(e,t){function n(){}let r=Object.defineProperties(Object.setPrototypeOf(n,z_),Object.getOwnPropertyDescriptors({...t}));return r.ast=e,r.rebuild=e=>B_(e,t),r.makeEffect=h_(r),r.make=__(r),r.makeOption=g_(r),r}var V_=gc(2,(e,t)=>({...e,...t})),H_=gc(2,(e,t)=>W_(e,(e,n)=>[Object.hasOwn(t,e)?t[e]:e,n])),U_=e=>e;function W_(e,t){let n={};for(let r of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;let i=t(r,e[r]);if(i){let[e,t]=i;yl(n,e,t)}}return n}var G_=R_;function K_(){return(e,t,n)=>nv(new Th(e.map(eg),e=>t(e.map(e=>nv(e))),n))}function q_(e,t){return K_()([],()=>(t,n,r)=>e(t)?qp(t):Jp(new Dm(n,t,r)),t)}var J_=`~effect/SchemaError/SchemaError`,Y_=class extends xf(`SchemaError`){[J_]=J_;constructor(e){let t=Af();jf(0);try{super({issue:e})}finally{jf(t)}}get message(){return Um(this.issue)}toString(){return`SchemaError(${this.message})`}};function X_(e){return Fc(e,J_)&&e[J_]===J_}var Z_=v_;function Q_(e,t){let n=x_(e,t);return(e,t)=>$_(n(e,t))}function $_(e){return Bp(e)?e:Lp(Fp(e.cause,e=>new Y_(e)))}function ev(e,t){let n=S_(e,t);return(e,t)=>sd(n(e,t),e=>new Y_(e))}function tv(e,t){let n=w_(e,t);return(e,t)=>$_(n(e,t))}var nv=B_;function rv(e){return Fc(e,G_)&&e[G_]===G_}var iv=U_(e=>nv(Ug(e.ast),{schema:e})),I=U_(e=>{let t=vv(e);return nv(Gg(e.ast),{schema:t})}),L=U_(e=>nv($g(e.ast),{schema:e})),av=U_(e=>nv(e_(e.ast),{schema:e}));function R(e){let t=nv(new Mh(e),{literal:e,transform(n){return t.pipe(xv(R(n),{decode:Qm(()=>n),encode:Qm(()=>e)}))}});return t}var ov=nv(Ah),sv=nv(Eh),cv=nv(kh),z=nv(Ph),B=nv(Lh),V=nv(Rh);function lv(e,t){return nv(e,{fields:t,mapFields(e,t){let n=e(this.fields);return lv($h(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function H(e){return lv($h(e,void 0),e)}function uv(e){return U_(t=>t.mapFields(V_(e)))}var dv=e=>typeof e==`symbol`?e:globalThis.String(e);function fv(e){return function(t){let n={},r=Object.create(null),i=Object.create(null),a=new Set;for(let o of Reflect.ownKeys(t.fields)){let s=av(t.fields[o]),c=Object.hasOwn(e,o),l=c?e[o]:o,u=dv(l);if(a.has(u))throw new globalThis.Error(`Duplicate encoded keys: ${Al(l)}`);a.add(u),yl(n,l,s),c&&(r[o]=l,i[l]=o)}return H(n).pipe(xv(t,sh({decode:H_(i),encode:H_(r)})))}}function pv(e,t){return nv(Yg(e.ast,t.ast),{key:e,value:t})}function mv(e,t){return nv(e,{elements:t,mapElements(e,t){let n=e(this.elements);return mv(tg(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function hv(e){return mv(tg(e),e)}var U=U_(e=>nv(new zh(!1,[],[e.ast]),{value:e})),gv=U_(e=>nv(new zh(!1,[e.ast],[e.ast]),{value:e}));function _v(e,t){return nv(e,{members:t,mapMembers(e,t){let n=e(this.members);return _v(ng(n,this.ast.mode,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function W(e,t){return _v(ng(e,t?.mode??`anyOf`,void 0),e)}function G(e){let t=e.map(R);return nv(ng(t,`anyOf`,void 0),{literals:e,members:t,mapMembers(e){return W(e(this.members))},pick(e){return G(e)},transform(e){return W(t.map((t,n)=>t.transform(e[n])))}})}var K=U_(e=>W([e,sv])),vv=U_(e=>W([e,cv]));function yv(e){return nv(new vg(()=>e().ast))}function q(...e){return t=>t.check(...e)}function bv(e,t){return n=>nv(Pg(n.ast,[Sg(e,t)]),{schema:n})}function J(e){return t=>nv(Bg(t.ast,e),{schema:t,identifier:e})}function xv(e,t){return n=>nv(qg(n.ast,e.ast,t?oh(t):lh()),{from:n,to:e})}function Sv(e){return t=>nv(Kg(t.ast,e),{schema:t})}function Cv(e){return R(e).pipe(Sv(qp(e)))}function wv(e,t){return H({_tag:Cv(e),...t})}var Y=xg;function Tv(e,t){let n=e.source,r=e.flags,i=r===``?`new RegExp(${Ol(n)})`:`new RegExp(${Ol(n)}, ${Ol(r)})`;return Eg(e,{toCode:()=>({runtime:`Schema.isPattern(${i})`}),...t})}var Ev=nv(wg);function Dv(e){let t=Ju(e.order),n=e.formatter??Ol;return(r,i)=>Y(e=>t(e,r),{expected:`a value greater than ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r,exclusiveMinimum:!0}}},...e.annotate?.(r),...i})}function Ov(e){let t=Xu(e.order),n=e.formatter??Ol;return(r,i)=>Y(e=>t(e,r),{expected:`a value greater than or equal to ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r}}},...e.annotate?.(r),...i})}function kv(e){let t=Yu(e.order),n=e.formatter??Ol;return(r,i)=>Y(e=>t(e,r),{expected:`a value less than or equal to ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,maximum:r}}},...e.annotate?.(r),...i})}function Av(e){let t=Xu(e.order),n=Ju(e.order),r=Yu(e.order),i=qu(e.order),a=e.formatter??Ol;return(o,s)=>{let c=o.exclusiveMinimum?n:t,l=o.exclusiveMaximum?i:r;return Y(e=>c(e,o.minimum)&&l(e,o.maximum),{expected:`a value between ${a(o.minimum)}${o.exclusiveMinimum?` (excluded)`:``} and ${a(o.maximum)}${o.exclusiveMaximum?` (excluded)`:``}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:o.minimum,maximum:o.maximum,...o.exclusiveMinimum&&{exclusiveMinimum:!0},...o.exclusiveMaximum&&{exclusiveMaximum:!0}}}},...e.annotate?.(o),...s})}}function jv(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${Ol(e)}`);return e}var Mv=Dv({order:Ku,annotate:e=>({representation:{id:`effect/schema/isGreaterThan`,payload:{exclusiveMinimum:jv(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${Ol(e)})`})})}),Nv=Ov({order:Ku,annotate:e=>({representation:{id:`effect/schema/isGreaterThanOrEqualTo`,payload:{minimum:jv(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${Ol(e)})`})})}),Pv=kv({order:Ku,annotate:e=>({representation:{id:`effect/schema/isLessThanOrEqualTo`,payload:{maximum:jv(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${Ol(e)})`})})}),Fv=Av({order:Ku,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:`effect/schema/isBetween`,payload:{minimum:jv(e.minimum),maximum:jv(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?`exclusiveMinimum`:`minimum`]:e.minimum,[n?`exclusiveMaximum`:`maximum`]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${Ol(e.minimum)}, maximum: ${Ol(e.maximum)}, exclusiveMinimum: ${Ol(t)}, exclusiveMaximum: ${Ol(n)} })`})}}});function Iv(e){return Y(e=>globalThis.Number.isSafeInteger(e),{expected:`an integer`,representation:{id:`effect/schema/isInt`,payload:null},toJsonSchema:()=>({type:`integer`}),toCode:()=>({runtime:`Schema.isInt()`}),arbitrary:{constraint:{integer:!0}},...e})}function Lv(e,t){return e=Math.max(0,Math.floor(e)),Y(t=>t.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:`effect/schema/isMinLength`,payload:{minLength:e}},toJsonSchema:({type:t})=>t===`array`?{minItems:e}:{minLength:e},toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[om]:!0,arbitrary:{constraint:{minLength:e}},...t})}function Rv(e){return Lv(1,e)}var zv=z.check(Rv());globalThis.RegExp,globalThis.URL,globalThis.File,globalThis.FormData,globalThis.URLSearchParams,globalThis.Uint8Array;var Bv=globalThis.Symbol.for(`immer-draftable`),Vv={};function Hv(e,t,n,r,i){let a=Gv(n,t,r),o=Wv(t),s=class extends e{constructor(...[e,t]){let r=t?.[`~payload`],i=r?.token===Vv?r.value:n.make(e??{},t);super(i,{...t,disableChecks:!0,"~payload":{token:Vv,value:i}})}static[G_]=G_;get[o](){return o}static[Bv]=!0;static identifier=t;static fields=n.fields;static get ast(){return a(this).ast}static pipe(){return pc(this,arguments)}static rebuild(e){return a(this).rebuild(e)}static make(e,t){return new this(e,t)}static makeOption(e,t){return g_(a(this))(e??{},t)}static makeEffect(e,t){return a(this).makeEffect(e??{},t)}static annotate(e){return this.rebuild(Mg(this.ast,e))}static annotateKey(e){return this.rebuild(Hg(this.ast,e))}static check(...e){return this.rebuild(Pg(this.ast,e))}static extend(e){return(t,r)=>{let a=Kv(t)?t:H(t),o={...n.fields,...a.fields},s=$h(o,n.ast.checks,{identifier:e});return Hv(this,e,lv(Pg(s,a.ast.checks),o),r,i)}}static mapFields(e,t){return n.mapFields(e,t)}};return i!==void 0&&Object.assign(s.prototype,i(t)),s}function Uv(e){return new ih(Qm(t=>new e(t,{"~payload":{token:Vv,value:t}})),Zm())}function Wv(e){return`~effect/Schema/Class/${e}`}function Gv(e,t,n){let r;return i=>{if(r!==void 0)return r;let a=Wv(t),o=e=>e instanceof i||Fc(e,a),s=Uv(i);return r=xv(nv(new Th([e.ast],()=>(e,t,n)=>o(e)?qp(e):Jp(new Dm(t,e,n)),{identifier:t,[cm]:([e])=>({isConstructed:o,link:new bh(e,s)}),toCodec:([e])=>new bh(e.ast,s),toArbitrary:([e])=>()=>({arbitrary:e.arbitrary.map(e=>new i(e)),terminal:e.terminal?.map(e=>new i(e))}),toFormatter:([e])=>t=>`${i.identifier}(${e(t)})`,[sm]:ag(e.ast),...n})),s)(e)}}function Kv(e){return rv(e)}var qv=e=>(t,n)=>Hv(wu,e,Kv(t)?t:H(t),n,e=>({name:e})),Jv=e=>(t,n,r)=>{let i=Kv(n)?n.mapFields(e=>({_tag:Cv(t),...e}),{unsafePreserveChecks:!0}):wv(t,n);return qv(e??t)(i,r)},Yv=new WeakMap,Xv=new WeakMap,Zv=new WeakMap;function Qv(e){let t=Xv.get(e);if(t!==void 0||!fh(e)||!ph(e))return t;if(!(e.typeParameters.length!==0||e.checks!==void 0||e.encoding!==void 0||e.context!==void 0||e.encodingChecks!==void 0||e.encodingRun!==void 0&&e.encodingRun!==e.run))return Zv.get(e.run)}function $v(e,t){let n=q_(t=>iy(t)&&Yv.get(t)?.kind===e,{identifier:e===`text`?`RecordTextContent`:`RecordBytesContent`});return Xv.set(n,Object.freeze({kind:e,maximumBytes:t})),Xv.set(n.ast,Object.freeze({kind:e,maximumBytes:t})),Zv.set(n.ast.run,Object.freeze({kind:e,maximumBytes:t})),n}var ey=$v(`text`,void 0),ty=$v(`bytes`,void 0),ny=Object.freeze({maximumBytes(e){if(!Number.isSafeInteger(e)||e<0)throw TypeError(`Record content maximumBytes must be a non-negative safe integer`);return t=>{let n=Xv.get(t);if(n===void 0)throw TypeError(`Record content maximumBytes requires a package-owned content declaration`);return $v(n.kind,e)}}});function ry(e){let t=Qv(e);return t===void 0?void 0:Object.freeze({...t,category:`content`})}function iy(e){return typeof e==`object`&&!!e&&Yv.has(e)}function ay(e){return iy(e)&&Yv.get(e)?.kind===`text`}function oy(e){return iy(e)&&Yv.get(e)?.kind===`bytes`}var sy=Object.freeze({entries:4096,groupDepth:16,displayCodePoints:256,jsonDepth:8,jsonObjectKeys:64,jsonArrayItems:256,stringBytes:8192,diagnosticDepth:2,diagnosticNodes:64,diagnosticBytes:65536,collectionDiagnosticCandidates:8}),cy=[`less-than`,`at-most`,`greater-than`,`at-least`],ly=`@niceeval/assertions/AssertionEntryId`,uy=65536;Object.freeze({errors:`all`,onExcessProperty:`error`});var dy=new TextEncoder,fy=/[\p{Cc}]/u,py=/^ae_[a-z0-9]{20}$/,my=/^[\x21-\x7e]+$/;function hy(e){return dy.encode(e).byteLength}function gy(e){return Array.from(e).length}function _y(e){return hy(e)<=sy.stringBytes}function vy(e){return!fy.test(e)&&gy(e)<=sy.displayCodePoints}function yy(e){return hy(e)<=128&&my.test(e)}function by(e){return Number.isFinite(e)&&Number.isInteger(e)&&e>=0}function xy(e){return Number.isFinite(e)&&e>=0}function Sy(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Cy(e){return Object.keys(e).length<=sy.jsonObjectKeys}function wy(e){return e.length<=sy.jsonArrayItems}function Ty(e){return py.test(e)}function Ey(e){try{let t=JSON.stringify(e);return typeof t==`string`&&hy(t)<=4194304}catch{return!1}}function Dy(e){let t=new Set;for(let n of e.entries){if(t.has(n.entryId))return!1;t.add(n.entryId)}return!0}function Oy(e){let t=e.coverage;return t.state===`complete`?e.limitations.length===0:t.state!==`partial`||e.limitations.some(e=>e.kind===t.reason)}var ky=z.check(Y(_y,{identifier:`AssertionsBoundedJsonString`,description:`a UTF-8 string no longer than 8 KiB`})),Ay=z.check(Y(vy,{identifier:`AssertionDisplayText`,description:`text without control characters and at most 256 code points`})),jy=ky.check(Y(e=>e.length>0&&!fy.test(e),{identifier:`MatcherSourceIdentity`,description:`a non-empty bounded source identity without control characters`})),My=z.check(Y(yy,{identifier:`AssertionCriterionIdentifier`,description:`a non-empty printable ASCII identifier no longer than 128 bytes`})),Ny=Ev.check(Y(by,{identifier:`AssertionNonNegativeInteger`,description:`a finite non-negative integer`})),Py=Ev.check(Y(e=>Number.isSafeInteger(e)&&e>0,{identifier:`AssertionPositiveInteger`,description:`a positive safe integer`})),Fy=Ev.check(Y(e=>Number.isSafeInteger(e)&&e>=0,{identifier:`AssertionNonNegativeSafeInteger`,description:`a non-negative safe integer`})),Iy=Ev.check(Y(xy,{identifier:`AssertionNonNegativeNumber`,description:`a finite non-negative number`}));function Ly(e){if(e===`0`)return!0;if(!/^[1-9][0-9]*$/.test(e))return!1;let t=Number(e);return Number.isSafeInteger(t)&&t>=0&&t<4294967295}function Ry(e,t,n){if(e===null||typeof e==`boolean`)return!0;if(typeof e==`number`)return Number.isFinite(e);if(typeof e==`string`)return _y(e);if(typeof e!=`object`||t>=sy.jsonDepth)return!1;try{if(n.has(e))return!1;if(n.add(e),Array.isArray(e)){if(Object.getPrototypeOf(e)!==Array.prototype||!wy(e))return!1;for(let t of Reflect.ownKeys(e)){if(t===`length`)continue;if(typeof t!=`string`||!Ly(t))return!1;let n=Object.getOwnPropertyDescriptor(e,t);if(n===void 0||!n.enumerable||!(`value`in n))return!1}for(let r=0;r<e.length;r+=1)if(!Object.prototype.hasOwnProperty.call(e,r)||!Ry(e[r],t+1,n))return!1;return!0}let r=e;if(!Sy(r)||!Cy(r))return!1;for(let e of Reflect.ownKeys(r)){if(typeof e!=`string`||!_y(e))return!1;let i=Object.getOwnPropertyDescriptor(r,e);if(i===void 0||!i.enumerable||!(`value`in i)||!Ry(i.value,t+1,n))return!1}return!0}catch{return!1}finally{n.delete(e)}}function zy(e){return Ry(e,0,new WeakSet)}function By(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Ry(e,0,new WeakSet)}var Vy=yv(()=>W([sv,V,Ev,ky,U(Vy),pv(ky,Vy)]).check(Y(zy,{identifier:`AssertionsBoundedJsonValue`,description:`a recursive JSON value within the Assertions limits`}))),Hy=Vy,Uy=pv(ky,Vy).check(Y(By,{identifier:`AssertionsBoundedJsonObject`,description:`a recursive JSON object within the Assertions limits`})),Wy=z.check(Y(Ty,{identifier:`AssertionEntryId`,description:`an attachment-local ae_ identifier with 20 lowercase base-36 characters`})).pipe(J(ly)),Gy=H({key:I(Ay),label:I(Ay),groupPath:U(Ay).check(Y(e=>e.length<=sy.groupDepth,{identifier:`AssertionDisplayGroupPath`,description:`a group path no deeper than 16 segments`}))}),Ky=H({kind:R(`builtin`),id:My,data:Hy}),qy=H({name:My,schemaId:My,data:Hy});W([Ky,qy]);var Jy=W([W([H({kind:R(`builtin`),id:R(`value-match/v1`),data:H({subject:R(`explicit-value`),matcher:W([H({state:R(`declared`),name:ky}),H({state:R(`unavailable`)})])})}),H({kind:R(`builtin`),id:R(`numeric-comparison/v1`),data:H({comparator:G(cy),threshold:Ev,subject:W([H({kind:R(`explicit-value`)}),H({kind:R(`scope-metric`),metric:R(`tokens`),scope:G([`turn`,`session`,`attempt`]),unit:R(`tokens`)}),H({kind:R(`scope-metric`),metric:R(`cost`),scope:G([`turn`,`session`,`attempt`]),unit:R(`usd`)}),H({kind:R(`collection-cardinality`),collection:R(`tool-calls`),scope:G([`turn`,`session`,`attempt`])})])})}),H({kind:R(`builtin`),id:R(`scope-status/v1`),data:H({scope:G([`turn`,`session`,`attempt`]),assertion:G([`succeeded`,`no-failed-actions`])})}),H({kind:R(`builtin`),id:R(`occurrence/v1`),data:H({scope:G([`turn`,`session`,`attempt`]),occurrence:G([`tool`,`skill`,`event`]),assertion:G([`present`,`absent`,`count`,`order`]),matcher:I(ky),quantifier:I(W([H({kind:R(`absent`)}),H({kind:G([`at-least`,`exact`]),count:Py})]))})}),H({kind:R(`builtin`),id:R(`occurrence/v2`),data:H({scope:G([`turn`,`session`,`attempt`]),occurrence:G([`tool`,`skill`,`event`]),assertion:G([`present`,`absent`,`count`,`order`]),matcher:I(ky),quantifier:I(W([H({kind:R(`absent`)}),H({kind:R(`exact`),count:Py}),H({kind:G([`at-least`,`less-than`,`at-most`,`greater-than`]),count:Fy})]))})}),H({kind:R(`builtin`),id:R(`judge-measurement/v1`),data:H({recipe:z,scale:R(`unit-interval`)})}),H({kind:R(`builtin`),id:R(`judge-measurement/v2`),data:H({name:z,scale:R(`unit-interval`)})}),H({kind:R(`builtin`),id:R(`llm-measurement/v1`),data:H({name:z,scale:R(`unit-interval`)})}),W([H({kind:R(`builtin`),id:R(`sandbox-result/v1`),data:H({operation:R(`changed-paths`),paths:U(ky)})}),H({kind:R(`builtin`),id:R(`sandbox-result/v1`),data:H({operation:R(`no-changes`)})}),H({kind:R(`builtin`),id:R(`sandbox-result/v1`),data:H({operation:R(`file-changed`),path:ky,status:I(G([`added`,`modified`,`deleted`])),before:I(ky),after:I(ky)})}),H({kind:R(`builtin`),id:R(`sandbox-result/v1`),data:H({operation:R(`file-deleted`),path:ky})}),H({kind:R(`builtin`),id:R(`sandbox-result/v1`),data:H({operation:R(`not-in-diff`),pattern:ky,flags:ky,content:G([`added`,`removed`,`both`])})})]),H({kind:R(`builtin`),id:R(`direct-score/v1`),data:H({source:R(`author`)})})]),qy]),Yy=W([H({state:R(`complete`)}),H({state:R(`partial`),reason:G([`sampled`,`truncated`,`redacted`,`provider-limited`,`capacity-limited`])}),H({state:R(`unavailable`),reason:G([`not-collected`,`source-unavailable`,`producer-failed`])}),H({state:R(`not-applicable`),reason:G([`optional-material`,`unsupported-subject`])})]),Xy=W([H({kind:R(`redacted`),fieldCount:Ny}),H({kind:R(`sampled`),captured:Ny,knownTotal:I(Ny)}),H({kind:R(`truncated`),omittedBytes:Ny}),H({kind:R(`provider-limited`)}),H({kind:R(`capacity-limited`),capturedItems:Ny,knownTotalItems:Ny,omittedBytes:K(Ny)})]),Zy=H({state:R(`not-scored`)}),Qy=H({state:R(`earned`),points:Iy,earned:Iy}).check(Y(e=>e.earned<=e.points,{identifier:`AssertionEarnedScore`,description:`an earned score no greater than its points`})),$y=H({state:R(`unavailable`),points:Iy,reason:G([`source-unavailable`,`evaluation-errored`,`not-applicable`])});function eb(e){return e.matched+e.mismatched+e.unavailable!==e.examined||e.knownTotal!==null&&e.examined>e.knownTotal||e.complete&&e.knownTotal===null?!1:!e.exhaustive||e.knownTotal!==null&&e.examined===e.knownTotal}var tb=H({examined:Ny,matched:Ny,mismatched:Ny,unavailable:Ny,knownTotal:K(Ny),complete:V,exhaustive:V,decisive:V}).check(Y(eb,{identifier:`AssertionCollectionReceipt`,description:`a collection receipt whose counts and completion boundary agree`})),nb=yv(()=>W([H({kind:R(`unavailable`),reason:G([`not-recorded`,`not-declared`,`source-unavailable`])}),H({kind:R(`value`),value:W([sv,V,Ev,ky])}),H({kind:R(`text`),text:ky}),H({kind:R(`list`),items:U(nb)}),H({kind:R(`fields`),fields:U(H({label:ky,value:nb}))})])),rb=W([H({state:R(`exact`)}),H({state:R(`unavailable`),reason:G([`historical-not-recorded`,`source-unavailable`,`ambiguous`])})]),ib=W([H({kind:R(`tool-occurrence`),toolOccurrenceId:jy,relation:rb}),H({kind:R(`event`),eventId:jy,toolOccurrenceId:I(jy),relation:rb})]),ab=U(H({locator:ib,result:G([`matched`,`mismatched`,`unavailable`,`not-evaluated`]),difference:I(nb)})).check(Y(e=>e.length<=8,{identifier:`MatcherRetainedRows`,description:`at most eight representative matcher rows`})),ob=H({step:Py,summary:nb}),sb=H({family:R(`niceeval.agent-turns`),schemaVersion:Py}),cb=G([`complete`,`partial`,`unavailable`]),lb=H({scope:R(`turn`),sessionId:jy,turnId:jy,scopeId:jy,throughSessionSequence:Ny,source:sb,collectionAtCut:cb}),ub=H({scope:R(`session`),sessionId:jy,scopeId:jy,throughSessionSequence:Ny,source:sb,collectionAtCut:cb}),db=W([lb,ub,H({scope:R(`attempt`),scopeId:jy,sessions:U(H({sessionId:jy,throughSessionSequence:Ny})).check(Y(e=>e.every((t,n)=>n===0||e[n-1].sessionId<t.sessionId),{identifier:`MatcherAttemptVectorCut`,description:`a unique vector cut in canonical session identity order`})),source:sb,collectionAtCut:cb})]),fb=H({sourceRows:Ny,comparisons:Ny,unavailableComparisons:Ny,definitePrefixLength:Ny,possiblePrefixLength:Ny,stepReceipts:U(H({step:Py,comparisons:Ny,matched:Ny,mismatched:Ny,unavailable:Ny}).check(Y(e=>e.matched+e.mismatched+e.unavailable===e.comparisons,{identifier:`MatcherOrderStepReceipt`,description:`an order step receipt whose result counts equal its comparisons`}))),complete:V,exhaustive:V,decisive:V}),pb=H({step:Py,locator:ib,sessionId:jy,sessionSequence:Py,result:G([`matched`,`unavailable`])}),mb=H({longestDefinitePrefix:U(pb),longestPossiblePrefix:U(pb),firstBlockingStep:Py,suffixChecked:tb,representatives:ab});function hb(e,t,n,r){if(e.length!==n)return!1;let i=0;for(let[n,a]of e.entries()){if(a.step!==n+1||a.sessionId!==t.sessionId||a.sessionSequence<=i||a.sessionSequence>t.throughSessionSequence||r===`matched`&&a.result!==`matched`||a.result===`matched`&&a.locator.relation.state!==`exact`)return!1;i=a.sessionSequence}return!0}function gb(e){let t=e.querySteps.length,n=e.receipt;if(e.querySteps.some((e,t)=>e.step!==t+1)||n.stepReceipts.length!==t||n.stepReceipts.some((e,t)=>e.step!==t+1)||n.definitePrefixLength>n.possiblePrefixLength||n.possiblePrefixLength>t||n.comparisons!==n.stepReceipts.reduce((e,t)=>e+t.comparisons,0)||n.unavailableComparisons!==n.stepReceipts.reduce((e,t)=>e+t.unavailable,0)||n.complete!==(e.sourceSnapshot.collectionAtCut===`complete`)||n.stepReceipts.some(e=>e.comparisons>n.sourceRows)||n.stepReceipts.some((e,t)=>t>0&&e.comparisons!==n.stepReceipts[0].comparisons)||n.exhaustive&&n.stepReceipts.some(e=>e.comparisons!==n.sourceRows))return!1;switch(e.result.state){case`matched`:return n.definitePrefixLength===t&&n.possiblePrefixLength===t&&n.decisive&&hb(e.result.witnessPath,e.sourceSnapshot,t,`matched`);case`mismatched`:{let r=e.result.failureFrontier;return n.complete&&n.exhaustive&&n.decisive&&n.possiblePrefixLength<t&&r.firstBlockingStep===n.possiblePrefixLength+1&&r.suffixChecked.complete&&r.suffixChecked.exhaustive&&r.suffixChecked.decisive&&r.suffixChecked.knownTotal===r.suffixChecked.examined&&r.suffixChecked.matched===0&&r.suffixChecked.unavailable===0&&hb(r.longestDefinitePrefix,e.sourceSnapshot,n.definitePrefixLength,`matched`)&&hb(r.longestPossiblePrefix,e.sourceSnapshot,n.possiblePrefixLength,`possible`)}case`unavailable`:return e.result.reason.length>0&&!n.decisive}}var _b=H({kind:R(`collection-filter`),sourceSnapshot:db,query:ob,receipt:tb,retainedRows:ab}).check(Y(e=>e.query.step===1&&e.receipt.knownTotal!==null&&e.receipt.complete===(e.sourceSnapshot.collectionAtCut===`complete`),{identifier:`MatcherCollectionFilterArtifact`,description:`a collection matcher artifact with one query and a matching source cut`})),vb=W([H({state:R(`matched`),witnessPath:U(pb)}),H({state:R(`mismatched`),failureFrontier:mb}),H({state:R(`unavailable`),reason:jy})]),yb=H({kind:R(`ordered-sequence`),sourceSnapshot:W([lb,ub]),querySteps:U(ob).check(Y(e=>e.length>=2&&e.length<=64,{identifier:`MatcherOrderQuerySteps`,description:`between two and 64 ordered matcher query steps`})),receipt:fb,result:vb,retainedRows:ab}).check(Y(gb,{identifier:`MatcherOrderedSequenceArtifact`,description:`an ordered matcher artifact with consistent receipts, paths, and cut`}));function bb(e){try{return hy(JSON.stringify(e))<=uy}catch{return!1}}var xb=W([_b,yb]).check(Y(bb,{identifier:`MatcherQueryArtifactSize`,description:`a matcher query artifact no larger than 64 KiB`})),Sb=W([H({kind:R(`boolean`),expected:R(!0)}),H({kind:R(`at-least`),threshold:Iy}),H({kind:R(`record-only`)})]),Cb=H({requirement:W([H({state:R(`available`),value:G([`required`,`optional`])}),H({state:R(`unavailable`),reason:R(`not-recorded`)})]),condition:W([H({state:R(`available`),value:Sb}),H({state:R(`unavailable`),reason:R(`not-recorded`)})])});W([H({state:R(`matched`),gate:G([`not-gate`,`satisfied`]),score:W([Zy,Qy]),diagnostic:I(Uy),receipt:I(tb)}),H({state:R(`mismatched`),reason:R(`condition-not-met`),gate:G([`not-gate`,`failed`]),score:W([Zy,Qy]),diagnostic:I(Uy),receipt:I(tb)}),H({state:R(`unavailable`),reason:G([`evidence-unavailable`,`source-unavailable`,`redacted`]),gate:G([`not-gate`,`unavailable`]),score:W([Zy,$y]),diagnostic:I(Uy),receipt:I(tb)}),H({state:R(`errored`),reason:G([`evaluator-failed`,`producer-interrupted`,`invalid-subject`]),gate:G([`not-gate`,`unavailable`]),score:W([Zy,$y]),diagnostic:I(Uy),receipt:I(tb)}),H({state:R(`not-applicable`),reason:R(`coverage-not-applicable`),gate:G([`not-gate`,`not-applicable`]),score:W([Zy,$y]),diagnostic:I(Uy),receipt:I(tb)})]);function wb(e){let t=U(e),n=U(L(Xy)),r=H({source:e,evidence:t,coverage:L(Yy),limitations:n}).check(Y(e=>Oy(e),{identifier:`AssertionCoverageLimitations`,description:`coverage and limitations with a consistent sealed relationship`})),i=H({observed:L(nb),receipt:I(L(tb))}),a=W([H({kind:R(`ordinary`),observed:L(nb),receipt:I(L(tb))}),H({kind:R(`matcher-current`),observed:L(nb),artifact:L(xb),receipt:I(ov)}),H({kind:R(`matcher-legacy`),observed:L(nb),reason:R(`historical-not-recorded`),legacyDiagnostic:I(L(nb)),receipt:I(ov)})]),o=H({result:G([`matched`,`mismatched`,`unavailable`,`errored`,`not-applicable`]),reason:K(G([`condition-not-met`,`evidence-unavailable`,`source-unavailable`,`redacted`,`evaluator-failed`,`producer-interrupted`,`invalid-subject`,`coverage-not-applicable`])),gate:G([`not-gate`,`satisfied`,`failed`,`unavailable`,`not-applicable`])}),s=W([H({state:R(`retained`),value:L(nb)}),H({state:R(`unavailable`),reason:R(`not-recorded`)})]),c=H({entryId:L(Wy),display:L(Gy),criterion:W([H({state:R(`available`),value:L(Uy)}),H({state:R(`unavailable`),reason:R(`not-recorded`)})]),materials:r,evaluation:i,decision:o,policy:L(Cb),contribution:W([L(Zy),L(Qy),L($y)]),explanationRetention:s}),l=H({entryId:L(Wy),display:L(Gy),criterion:W([H({state:R(`available`),value:L(Uy)}),H({state:R(`unavailable`),reason:R(`not-recorded`)})]),materials:r,evaluation:a,decision:o,policy:L(Cb),contribution:W([L(Zy),L(Qy),L($y)]),explanationRetention:s}).check(Y(e=>e.evaluation.kind===`ordinary`||e.explanationRetention.state===`unavailable`,{identifier:`MatcherExplanationOwnership`,description:`matcher artifacts and legacy diagnostics are not duplicated in explanation retention`})),u=U(c).check(Y(e=>e.length<=sy.entries,{identifier:`AssertionsEntryCount`,description:`at most 4,096 assertion entries`})),d=U(l).check(Y(e=>e.length<=sy.entries,{identifier:`AssertionsEntryCount`,description:`at most 4,096 assertion entries`})),f=H({entries:d}).check(Y(Dy,{identifier:`AssertionsUniqueEntryIds`,description:`unique attachment-local assertion entry IDs`}),Y(Ey,{identifier:`AssertionsDocumentSize`,description:`a JSON document no larger than 4 MiB`})),p=H({entryId:L(Wy),display:L(Gy),criterion:W([H({state:R(`available`),value:L(Jy)}),H({state:R(`unavailable`),reason:R(`not-recorded`)})]),materials:r,evaluation:a,decision:o,policy:L(Cb),contribution:W([L(Zy),L(Qy),L($y)]),explanationRetention:s}),m=H({entries:U(p).check(Y(e=>e.length<=sy.entries,{identifier:`AssertionsEntryCount`,description:`at most 4,096 assertion entries`}))}).check(Y(Dy,{identifier:`AssertionsUniqueEntryIds`,description:`unique attachment-local assertion entry IDs`}),Y(Ey,{identifier:`AssertionsDocumentSize`,description:`a JSON document no larger than 4 MiB`}));return Object.freeze({material:e,entry:p,entries:d,historicalV2Entries:u,outerDocument:f,document:m})}Object.freeze({code:`assertions-document-invalid`});var Tb=/^@1[0-9A-HJKMNP-TV-Z]{12}$/;z.pipe(bv(e=>Tb.test(e),{identifier:`AttemptLocator`,description:`a canonical @-prefixed Attempt locator`})),new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);var Eb=`@niceeval/record/RecordId`,Db=`@niceeval/record/RunId`,Ob=`@niceeval/record/SlotId`,kb=`@niceeval/record/AttemptId`,Ab=`@niceeval/record/UtcMillis`,jb=`@niceeval/record/RecordAttachmentName`,Mb=`@niceeval/record/RecordAttachmentSchemaId`,Nb=`@niceeval/record/RecordFormatId`,Pb=`@niceeval/record/ExperimentId`,Fb=`@niceeval/record/EvalId`,Ib=`@niceeval/record/ExecutionIdentityDigest`,Lb=`@niceeval/record/Sha256Digest`,Rb=`@niceeval/record/SourceItemId`,zb=`@niceeval/record/FileChangeId`,Bb=`@niceeval/record/ArtifactId`,Vb=`@niceeval/record/RecordBlobKey`,Hb=`@niceeval/record/SourceSegmentId`,Ub=`@niceeval/record/CanonicalRunRelativePath`,Wb=`@niceeval/record/CanonicalProjectRelativePath`,Gb=`niceeval.record.attachments`,Kb=/^[A-Za-z0-9](?:[A-Za-z0-9._-]{0,253}[A-Za-z0-9])?$/,qb=/^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\..*)?$/i,Jb=`[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?`,Yb=RegExp(`^(?:${Jb}\\.)+${Jb}$`),Xb=/^niceeval\.record\.attachments$/,Zb=/^[a-f0-9]{64}$/;function Qb(e){return Kb.test(e)&&!qb.test(e)}function $b(e,t){return e===t?0:e<t?-1:1}function ex(e){return Number.isSafeInteger(e)&&e>=0}function tx(e){return e.length>0&&e.length<=1024&&!/[\u0000-\u001f\u007f]/.test(e)}function nx(e){return Zb.test(e)}function rx(e){return Qb(e)}function ix(e){return/^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$/.test(e)}function ax(e){return e.length>0&&e.length<=4096&&!e.startsWith(`/`)&&!e.startsWith(`\\`)&&!e.includes(`\\`)&&e.split(`/`).every(Qb)}function ox(e){return e.length>0&&e.length<=4096&&!e.startsWith(`/`)&&!e.startsWith(`\\`)&&!e.includes(`\\`)&&!/[\u0000-\u001f\u007f]/.test(e)&&e.split(`/`).every(e=>e.length>0&&e!==`.`&&e!==`..`)}function sx(e){return e.length<=255&&Qb(e)&&Yb.test(e)}function cx(e){return sx(e)?{name:e,version:`1`}:void 0}function lx(e){let t=cx(e);return t!==void 0&&sx(t.name)}function ux(e){return Xb.test(e)}var dx=z.check(Y(Qb,{identifier:`RecordPortableSegment`,description:`an ASCII portable file-name segment without path separators or reserved device names`})),fx=dx.pipe(J(Eb)),px=dx.pipe(J(Db)),mx=dx.pipe(J(Ob)),hx=dx.pipe(J(kb)),gx=z.check(Y(tx,{identifier:`RecordDomainIdentity`,description:`a bounded durable identity without control characters`})),_x=gx.pipe(J(Pb)),vx=gx.pipe(J(Fb)),yx=z.check(Y(nx,{identifier:`ExecutionIdentityDigest`,description:`a lowercase hexadecimal SHA-256 execution identity digest`})).pipe(J(Ib)),bx=z.check(Y(nx,{identifier:`Sha256Digest`,description:`a lowercase hexadecimal SHA-256 digest`})).pipe(J(Lb)),xx=dx.pipe(J(Rb)),Sx=dx.pipe(J(zb)),Cx=dx.pipe(J(Bb)),wx=z.check(Y(rx,{identifier:`RecordBlobKey`,description:`an opaque portable Attachment blob key`})).pipe(J(Vb));z.check(Y(ix,{identifier:`SourceSegmentId`,description:`a bounded opaque source receipt segment identity`})).pipe(J(Hb)),z.check(Y(ax,{identifier:`CanonicalRunRelativePath`,description:`a slash-separated portable path inside one sealed Run`})).pipe(J(Ub));var Tx=z.check(Y(ox,{identifier:`CanonicalProjectRelativePath`,description:`a slash-separated project-relative path without dot segments`})).pipe(J(Wb)),Ex=B.check(Y(ex,{identifier:`UtcMillis`,description:`a non-negative JSON-safe Unix-epoch millisecond value`})).pipe(J(Ab));z.check(Y(sx,{identifier:`RecordAttachmentName`,description:`a lowercase reverse-domain portable Attachment name`})).pipe(J(jb)),z.check(Y(lx,{identifier:`RecordAttachmentSchemaId`,description:`a RecordAttachment name followed by /vN`})).pipe(J(Mb)),z.check(Y(ux,{identifier:`RecordFormatId`,description:`the current generic Attachment Record format identity`})).pipe(J(Nb));var Dx=G([Gb]).pipe(J(Nb)),Ox=new TextEncoder,kx=Object.freeze({"$niceeval.record.blob-ref":!0});function Ax(e,t,n){e.failure===void 0&&(e.failure=Object.freeze({code:t,path:Object.freeze([...n])}))}function jx(e,t){if(e===t)return 0;let n=Ox.encode(e),r=Ox.encode(t),i=Math.min(n.byteLength,r.byteLength);for(let e=0;e<i;e+=1){let t=n[e]-r[e];if(t!==0)return t}return n.byteLength-r.byteLength}function Mx(e){for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n>=55296&&n<=56319){let n=e.charCodeAt(t+1);if(t+1>=e.length||n<56320||n>57343)return!1;t+=1}else if(n>=56320&&n<=57343)return!1}return!0}function Nx(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Px(e,t){let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0&&`value`in n&&n.enumerable===!0)return Object.freeze({value:n.value})}function Fx(e,t){let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0&&`value`in n)return Object.freeze({value:n.value})}function Ix(e,t,n,r,i){if(t>r.maximumDepth||(i.nodes+=1,i.nodes>r.maximumNodes))return Ax(i,`record-json-limit-exceeded`,n),!1;if(typeof e==`string`){if(!Mx(e))return Ax(i,`record-json-invalid`,n),!1;if(Ox.encode(e).byteLength>r.maximumStringUtf8Bytes)return Ax(i,`record-json-limit-exceeded`,n),!1}return!0}function Lx(e,t,n,r){let i=Reflect.ownKeys(e);if(i.some(e=>typeof e!=`string`))return Ax(r,`record-json-invalid`,t);if(i.length>n.maximumObjectKeys)return Ax(r,`record-json-limit-exceeded`,t);let a=i;for(let e of a){if(!Mx(e))return Ax(r,`record-json-invalid`,[...t,e]);if(e.length===0||Ox.encode(e).byteLength>n.maximumKeyUtf8Bytes)return Ax(r,`record-json-limit-exceeded`,[...t,e])}return Object.freeze([...a].sort(jx))}function Rx(e){let t=Object.create(null);for(let[n,r]of e)Object.defineProperty(t,n,{configurable:!1,enumerable:!0,value:r,writable:!1});return Object.freeze(t)}function zx(e,t,n,r,i,a){if(e.length>r.maximumArrayItems)return Ax(a,`record-json-limit-exceeded`,n);let o=new Set([`length`]);for(let t=0;t<e.length;t+=1)o.add(String(t));let s=Reflect.ownKeys(e);if(s.length!==o.size||s.some(e=>typeof e!=`string`||!o.has(e)))return Ax(a,`record-json-invalid`,n);let c=Fx(e,`length`);if(c===void 0||c.value!==e.length)return Ax(a,`record-json-invalid`,n);let l=[];for(let o=0;o<e.length;o+=1){let s=Px(e,String(o));if(s===void 0)return Ax(a,`record-json-invalid`,[...n,String(o)]);let c=Vx(s.value,t+1,[...n,String(o)],r,i,a);if(c===void 0)return;l.push(c)}return Object.freeze(l)}function Bx(e,t,n,r,i,a){let o=Lx(e,n,r,a);if(o===void 0)return;let s=[];for(let c of o){let o=Px(e,c);if(o===void 0)return Ax(a,`record-json-invalid`,[...n,c]);let l=Vx(o.value,t+1,[...n,c],r,i,a);if(l===void 0)return;s.push([c,l])}return Rx(s)}function Vx(e,t,n,r,i,a){if(Ix(e,t,n,r,a)){if(e===null||typeof e==`boolean`||typeof e==`string`)return e;if(typeof e==`number`)return Number.isFinite(e)&&!Object.is(e,-0)?e:Ax(a,`record-json-invalid`,n);if(typeof e!=`object`)return Ax(a,`record-json-invalid`,n);try{if(i.isBlobRef?.(e))return e;if(a.ancestors.has(e))return Ax(a,`record-json-invalid`,n);a.ancestors.add(e);try{return Array.isArray(e)?zx(e,t,n,r,i,a):Nx(e)?Bx(e,t,n,r,i,a):Ax(a,`record-json-invalid`,n)}finally{a.ancestors.delete(e)}}catch{return Ax(a,`record-json-invalid`,n)}}}function Hx(e,t){if(e===null||typeof e==`boolean`||typeof e==`number`||typeof e==`string`)return e;if(typeof e!=`object`)return;if(t.isBlobRef?.(e))return kx;if(Array.isArray(e)){let n=[];for(let r of e){let e=Hx(r,t);if(e===void 0)return;n.push(e)}return Object.freeze(n)}if(!Nx(e))return;let n=[];for(let r of Object.keys(e).sort(jx)){let i=Hx(e[r],t);if(i===void 0)return;n.push([r,i])}return Rx(n)}function Ux(e){let t=JSON.stringify(e);return t===void 0?void 0:Ox.encode(t).byteLength}function Wx(e,t,n={}){let r={nodes:0,ancestors:new WeakSet,failure:void 0},i=Vx(e,0,[],t,n,r);if(i===void 0)return id(r.failure??Object.freeze({code:`record-json-invalid`,path:Object.freeze([])}));let a=Hx(i,n),o=a===void 0?void 0:Ux(a);return o===void 0||o>t.maximumJsonBytes?id(Object.freeze({code:`record-json-limit-exceeded`,path:Object.freeze([])})):rd(i)}var Gx=Object.freeze({errors:`all`,exact:!0,onExcessProperty:`error`}),Kx=Object.freeze({kind:`schema`,issues:Object.freeze([])});function qx(e){try{let t=Im()(e.issue).issues.map(e=>Object.freeze({path:Object.freeze((e.path??[]).map(e=>typeof e==`object`&&e&&`key`in e?e.key:e)),message:e.message}));return Object.freeze({kind:`schema`,issues:Object.freeze(t)})}catch{return Kx}}function Jx(e){if(e.cause.reasons.length===1){let[t]=e.cause.reasons;if(t!==void 0&&Pp(t)&&X_(t.error))return qx(t.error)}throw e.cause}function Yx(e){return Object.freeze({kind:`canonical`,failure:e})}function Xx(e){for(let[t,n]of Object.entries(e))if(!Number.isSafeInteger(n)||n<=0)throw TypeError(`Record schema limit ${t} must be a positive safe integer`);return Object.freeze({...e})}function Zx(e){return e===null||typeof e==`boolean`||typeof e==`string`||typeof e==`number`&&Number.isFinite(e)&&!Object.is(e,-0)}function Qx(e,t){if(e.context?.isOptional!==!0)return tS(e,t);if(e._tag===`Never`)return!0;if(e._tag!==`Union`)return tS(e,t);let n=!1;for(let r of e.types){if(r._tag===`Undefined`||r._tag===`Never`){n=!0;continue}if(!tS(r,t))return!1}return n}function $x(e,t){return e.propertySignatures.every(e=>typeof e.name==`string`&&e.name.length>0&&Qx(e.type,t))&&e.indexSignatures.every(e=>e.parameter._tag===`String`&&Qx(e.type,t))}function eS(e,t){if(e.encoding===void 0)return!0;if(e._tag!==`Objects`||e.encoding.length!==1)return!1;let n=e.encoding[0];return n.transformation._tag!==`Transformation`||n.to._tag!==`Objects`||e.propertySignatures.length!==n.to.propertySignatures.length||e.indexSignatures.length!==n.to.indexSignatures.length?!1:$x(n.to,t)}function tS(e,t){let n=t.states.get(e);if(n===`allowed`||n===`pending`)return!0;if(n===`rejected`)return!1;t.states.set(e,`pending`);let r;try{switch(e._tag){case`Literal`:r=Zx(e.literal);break;case`Null`:case`String`:case`Number`:case`Boolean`:r=!0;break;case`Objects`:r=$x(e,t);break;case`Arrays`:r=e.elements.every(e=>tS(e,t))&&e.rest.every(e=>tS(e,t));break;case`Union`:r=e.types.every(e=>tS(e,t));break;case`Suspend`:r=tS(e.thunk(),t);break;case`Declaration`:r=t.declarations.has(e)||t.getAttachmentDeclaration?.(e)!==void 0;break;default:r=!1}}catch{r=!1}return r&&=eS(e,t),!r&&t.failure===void 0&&(t.failure=e._tag),t.states.set(e,r?`allowed`:`rejected`),r}function nS(e){let t=[...e.attachmentDeclarations??[],...e.blobRef===void 0?[]:[{schema:e.blobRef.schema,isValue:e.blobRef.isBlobRef}]];if(t.some(e=>e.schema.ast._tag!==`Declaration`))throw TypeError(`Record Attachment opaque values must be Effect Schema Declarations`);let n={declarations:new Set(t.map(e=>e.schema.ast)),getAttachmentDeclaration:e.getAttachmentDeclaration,states:new WeakMap,failure:void 0};if(!tS(e.schema.ast,n))throw TypeError(`Record schema may contain only canonical JSON nodes, Schema.encodeKeys transformations, and its minted Attachment BlobRef (rejected ${n.failure??`AST`})`)}function rS(e,t,n,r=new WeakSet){if(r.has(e))return;r.add(e);let i=t.attachmentDeclarations?.find(t=>t.schema.ast===e)?.metadata,a=t.getAttachmentDeclaration?.(e);if(i!==void 0||a!==void 0){n.push(i??a?.metadata);return}switch(e._tag){case`Objects`:for(let i of e.propertySignatures)rS(i.type,t,n,r);for(let i of e.indexSignatures)rS(i.type,t,n,r);break;case`Arrays`:for(let i of e.elements)rS(i,t,n,r);for(let i of e.rest)rS(i,t,n,r);break;case`Union`:for(let i of e.types)rS(i,t,n,r);break;case`Suspend`:rS(e.thunk(),t,n,r)}}function iS(e,t,n=new WeakSet){if(typeof e!=`object`||!e||t?.(e)===!0||n.has(e))return e;n.add(e);for(let r of Object.values(Object.getOwnPropertyDescriptors(e)))`value`in r&&iS(r.value,t,n);return Object.freeze(e),e}function aS(e){nS(e);let t=Xx(e.limits),n=[...e.attachmentDeclarations??[],...e.blobRef===void 0?[]:[{schema:e.blobRef.schema,isValue:e.blobRef.isBlobRef}]],r=n.length===0?{}:{isBlobRef:t=>n.some(e=>e.isValue(t))||e.isAttachmentOpaque?.(t)!==void 0},i=Q_(e.schema,Gx),a=tv(e.schema,Gx),o=Q_(L(e.schema),Gx),s=[];rS(e.schema.ast,e,s);let c=e=>{let n=Wx(e,t,r);return ad(n)?id(Yx(n.failure)):rd(n.success)},l=(t,r,i)=>{let a=t=>{let r=n.find(e=>e.schema.ast===t);return r===void 0?e.getAttachmentDeclaration?.(t):{metadata:`metadata`in r?r.metadata:void 0}},o=new WeakMap,s=(e,t)=>{let n=a(e);if(n!==void 0){let e=r(t,n.metadata);return e._tag===`matched`?{matched:!0,value:e.value}:{matched:!1,value:t}}if(typeof t!=`object`||!t)return{matched:!1,value:t};let i=o.get(t)?.get(e);if(i!==void 0)return{matched:!1,value:i};switch(e._tag){case`Suspend`:return s(e.thunk(),t);case`Objects`:{let n={...t},r=o.get(t)??new WeakMap;r.set(e,n),o.set(t,r);let i=!1;for(let r of e.propertySignatures){if(typeof r.name!=`string`)continue;let e=Object.getOwnPropertyDescriptor(t,r.name);if(e!==void 0&&`value`in e){let t=s(r.type,e.value);i||=t.matched,n[r.name]=t.value}}return i?{matched:!0,value:n}:{matched:!1,value:t}}case`Arrays`:{if(!Array.isArray(t))return{matched:!1,value:t};let n=[...t],r=o.get(t)??new WeakMap;r.set(e,n),o.set(t,r);let i=!1;for(let r=0;r<e.elements.length;r+=1){let a=s(e.elements[r],t[r]);i||=a.matched,n[r]=a.value}if(e.rest.length>0)for(let r=e.elements.length;r<t.length;r+=1){let a=s(e.rest[0],t[r]);i||=a.matched,n[r]=a.value}return i?{matched:!0,value:n}:{matched:!1,value:t}}case`Union`:for(let n of e.types){let e=s(n,t);if(e.matched)return e}return{matched:!1,value:t};default:return{matched:!1,value:t}}};return s(i===`type`?e.schema.ast:e_(e.schema.ast),t).value};return Object.freeze({schema:e.schema,limits:t,opaqueDeclarationMetadata:Object.freeze(s),decode:e=>{let t=c(e);if(ad(t))return id(t.failure);let n=i(t.success);if(Vp(n))return id(Jx(n));let a=o(n.value);if(Vp(a))return id(Jx(a));let s=c(a.value);if(ad(s))return id(s.failure);let l=o(s.success);return Vp(l)?id(Jx(l)):rd(iS(l.value,r.isBlobRef))},enumerateOpaque:t=>{let r=[],i=new WeakMap,a=t=>{let r=n.find(e=>e.schema.ast===t);return r===void 0?e.getAttachmentDeclaration?.(t):{metadata:`metadata`in r?r.metadata:void 0,accepts:r.isValue}},o=(e,t)=>{let n=a(e);if(n!==void 0){typeof t==`object`&&t&&n.accepts(t)&&r.push(Object.freeze({value:t,metadata:n.metadata}));return}if(typeof t!=`object`||!t)return;let s=i.get(t)??new WeakSet;if(!s.has(e))switch(s.add(e),i.set(t,s),e._tag){case`Suspend`:o(e.thunk(),t);return;case`Objects`:for(let n of e.propertySignatures){if(typeof n.name!=`string`)continue;let e=Object.getOwnPropertyDescriptor(t,n.name);e!==void 0&&`value`in e&&o(n.type,e.value)}return;case`Arrays`:if(!Array.isArray(t))return;for(let n=0;n<e.elements.length;n+=1)o(e.elements[n],t[n]);if(e.rest.length>0)for(let n=e.elements.length;n<t.length;n+=1)o(e.rest[0],t[n]);return;case`Union`:for(let n of e.types)o(n,t);return}};return o(e.schema.ast,t),Object.freeze(r)},mapOpaque:(e,t)=>l(e,t,`type`),mapOpaqueEncoded:(e,t)=>l(e,t,`encoded`),encode:e=>{let t=c(e);if(ad(t))return id(t.failure);let n=a(t.success);return Vp(n)?id(Jx(n)):c(n.value)}})}var oS=G([`record-attachment-owner-invalid`,`record-attachment-schema-id-mismatch`,`record-attachment-schema-invalid`,`record-attachment-payload-invalid`,`record-attachment-json-invalid`,`record-attachment-blob-refs-invalid`,`record-attachment-blob-ref-illegal`,`record-attachment-blob-ref-missing`,`record-attachment-blob-ref-extra`,`record-attachment-blob-ref-duplicate`,`record-attachment-closure-mismatch`,`record-attachment-snapshot-bytes-invalid`,`record-attachment-blob-budget-exceeded`,`record-attachment-materialized-invalid`,`record-attachment-family-invalid`]);function sS(e,t=[]){return Object.freeze({code:e,path:Object.freeze([...t])})}var cS=class extends Error{code;cause;constructor(e=`invalid-family-definition`,t){super(e===`migration-chain-invalid`?`Invalid Record Attachment migration chain`:`Invalid Record Attachment family definition`,{cause:t}),this.code=e,this.cause=t,this.name=`RecordAttachmentSpiDefinitionError`}},lS=Symbol(`@niceeval/record/RecordAttachmentDefinition`),uS=Symbol(`@niceeval/record/RecordAttachmentPersistence`),dS=new WeakMap,fS=new WeakMap,pS=new WeakSet,mS=new WeakMap,hS=new WeakMap,gS=new WeakMap,_S=Object.freeze({maximumJsonBytes:1048576,maximumDepth:64,maximumNodes:1e5,maximumObjectKeys:1e4,maximumArrayItems:1e5,maximumKeyUtf8Bytes:16384,maximumStringUtf8Bytes:1048576});function vS(e){let t=hS.get(e);if(t!==void 0||!fh(e)||!ph(e))return t;if(!(e.typeParameters.length!==0||e.checks!==void 0||e.encoding!==void 0||e.context!==void 0||e.encodingChecks!==void 0||e.encodingRun!==void 0&&e.encodingRun!==e.run))return gS.get(e.run)}function yS(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0}function bS(e){return e===`run`||e===`attempt`}function xS(e){throw new cS(`invalid-family-definition`,e)}function SS(e){return e.ast.context===void 0}function CS(e){(!bS(e.owner)||!sx(e.family)||!SS(e.schema)||e.validate!==void 0&&typeof e.validate!=`function`)&&xS();let t=_S,n=Object.freeze({owner:e.owner,family:e.family,schema:e.schema,validate:e.validate,[lS]:()=>({owner:e.owner,family:e.family})});try{dS.set(n,Object.freeze({codec:aS({schema:e.schema,limits:t,attachmentDeclarations:[{schema:ey,isValue:ay,metadata:ry(ey)},{schema:ty,isValue:oy,metadata:ry(ty)}],getAttachmentDeclaration:e=>{let t=OS(e);if(t!==void 0)return t;let n=ry(e);return n===void 0?void 0:Object.freeze({metadata:n,accepts:n.kind===`text`?ay:oy})},isAttachmentOpaque:e=>DS(e)?{category:`reference`}:iy(e)?{category:`content`}:void 0})}))}catch(e){xS(e)}return n}function wS(e){(!TS(e.attachment)||!yS(e.revision))&&xS();let t=Object.freeze({attachment:e.attachment,revision:e.revision,[uS]:()=>({attachment:e.attachment,revision:e.revision})});return pS.add(t),t}Object.freeze({to(e,t){let n=ES(e);n===void 0&&xS();let r=q_(e=>{let r=DS(e)?mS.get(e):void 0;return r!==void 0&&r.definition===n&&(t===void 0||!ad(ev(t)(r.value)))},{identifier:`RecordAttachmentReference<${n.owner}:${n.family}>`});return hS.set(r,Object.freeze({definition:n,valueSchema:t})),hS.set(r.ast,Object.freeze({definition:n,valueSchema:t})),gS.set(r.ast.run,Object.freeze({definition:n,valueSchema:t})),r}});function TS(e){return typeof e==`object`&&!!e&&dS.has(e)}function ES(e){return TS(e)?e:typeof e==`object`&&e||typeof e==`function`?fS.get(e):void 0}function DS(e){return typeof e==`object`&&!!e&&mS.has(e)}function OS(e){let t=vS(e);return t===void 0?void 0:Object.freeze({metadata:Object.freeze({category:`reference`,definition:t.definition,valueSchema:t.valueSchema}),accepts:e=>DS(e)&&mS.get(e)?.definition===t.definition&&(t.valueSchema===void 0||!ad(ev(t.valueSchema)(mS.get(e)?.value)))})}var kS=gv(H({code:G(`record-schema-invalid.record-run-time-order-invalid.record-run-context-invalid.record-run-context-size-exceeded.record-run-context-experiment-mismatch.record-run-order-invalid.record-expected-slot-order-invalid.record-expected-slot-duplicate.record-run-duplicate.record-member-slot-order-invalid.record-member-slot-duplicate.record-member-slot-unexpected.record-member-slot-missing.record-member-action-invalid.record-attempt-order-invalid.record-attempt-duplicate.record-attempt-owner-invalid.record-attempt-slot-unexpected.record-attempt-slot-mismatch.record-attempt-eval-mismatch.record-attempt-digest-mismatch.record-attempt-reference-missing.record-origin-member-missing.record-origin-member-duplicate.record-attachment-schema-id-mismatch.record-fixed-family-owner-invalid`.split(`.`)),path:U(z)}));function AS(e,t=[]){return Object.freeze({code:e,path:Object.freeze([...t])})}function jS(e){let[t,...n]=e;if(t===void 0)return;let r=[t,...n];return Object.freeze(r)}var MS=G([`record`,`run`,`member`,`attempt`,`attachment-envelope`,`record-core`]),NS=G([`record-schema-invalid`,`record-invariant-invalid`]);Jv()(`RecordCodecError`,{code:NS,document:MS,issues:kS}),Jv()(`RecordCoreInvalid`,{code:R(`record-core-invalid`),issues:kS}),Jv()(`RecordReferenceInvalid`,{code:R(`record-reference-invalid`)}),Jv()(`RecordAttachmentEnvelopeInvalid`,{code:R(`record-attachment-envelope-invalid`),issues:kS});function PS(e){let t=aS({schema:e.schema,limits:e.limits});return Object.freeze({...t,kind:`core`})}var FS=[`completed`,`errored`,`cancelled`,`interrupted`],IS=[`executed`,`carried`,`accepted`,`not-dispatched`,`interrupted`],LS=[`executed`,`carried`,`accepted`],RS=[`not-dispatched`,`interrupted`],zS=`niceeval.record-attachment`,BS=[`run`,`attempt`];function VS(e){return`${e.originRunId}\u0000${e.attemptId}`}var HS=`niceeval.run/v1`,US=B.pipe(q(Y(e=>Number.isSafeInteger(e)&&e>=0))),WS=G([`active`,`completed`,`interrupted`,`failed`]),GS=G([`early-exit-satisfied`,`budget-exhausted`,`stopped-by-failure`,`interrupted-before-publication`,`dispatch-failed`]),KS=H({state:R(`pending`)}),qS=H({state:R(`published`),action:G([`executed`,`carried`,`accepted`]),attemptId:z,attemptLocator:z,originRunId:z,originSlotId:z}),JS=H({state:R(`absent`),reason:GS}),YS=W([KS,qS,JS]),XS=H({slotId:z,evalId:z,attemptOrdinal:US,executionIdentityDigest:z,publication:YS}),ZS=H({published:US,expected:US,missing:US}),QS=H({runId:z,invocationId:z,experimentId:z,state:WS,startedAt:z,completedAt:I(z),coverage:ZS}),$S=QS.pipe(uv({slots:U(XS)}));H({identity:z,revision:US}),W([H({protocol:R(HS),operation:R(`run.list`),runs:U(QS),continuation:I(z)}),H({protocol:R(HS),operation:R(`run.get`),run:$S})]);var eC=z.check(Tv(/\S/u)),tC=z.check(Tv(/^[A-Za-z][A-Za-z0-9_-]{0,63}$(?![\s\S])/u));pv(tC,H({model:eC,reasoningEffort:iv(eC)})).check(Y(e=>Object.keys(e).length>0&&Object.keys(e).length<=64));var nC=pv(tC,H({model:K(eC),reasoningEffort:K(eC)})).check(Y(e=>Object.keys(e).length<=64)),rC=Ev.check(Iv(),Fv({minimum:1,maximum:3e5})),iC=Object.freeze({maximumJsonBytes:262144,maximumDepth:8,maximumNodes:4096,maximumObjectKeys:64,maximumArrayItems:256,maximumKeyUtf8Bytes:256,maximumStringUtf8Bytes:8192}),aC=yv(()=>W([sv,V,B,z,U(aC),pv(z,aC)])),oC=pv(z,aC),sC=z.pipe(q(Lv(1))),cC=H({name:sC,contract:sC,behaviorRevision:K(sC),cleanupTimeoutMs:iv(rC)}),lC=PS({schema:H({experimentId:_x,execution:H({models:iv(nC),adapter:cC,model:K(z),reasoningEffort:K(z),flags:oC,experimentHooks:iv(H({version:R(1),setup:G([`absent`,`opaque`]),teardown:G([`absent`,`opaque`])}))}).check(Y(e=>e.models===void 0||e.model===(e.models.default?.model??null)&&e.reasoningEffort===(e.models.default?.reasoningEffort??null))),labels:pv(z,z)}),limits:iC}),uC=lC.schema;function dC(e){let t=jS([e.kind===`canonical`?AS(e.failure.code===`record-json-limit-exceeded`?`record-run-context-size-exceeded`:`record-run-context-invalid`,e.failure.path):AS(`record-run-context-invalid`)]);if(t===void 0)throw Error(`Run context failure must contain one issue`);return t}function fC(e){let t=lC.decode(e);return ad(t)?id(dC(t.failure)):rd(t.success)}function pC(e){let t=fC(e);return ad(t)?t.failure:Object.freeze([])}function mC(e,t,n){for(let r of n)e.push(AS(r.code,[...t,...r.path]))}function hC(e,t){return e===void 0||$b(e,t)<0}function gC(e){let t=[],n=new Set,r=new Set,i;for(let[a,o]of e.entries()){let e=[`expectedSlots`,String(a),`slotId`];hC(i,o.slotId)||t.push(AS(i===o.slotId?`record-expected-slot-duplicate`:`record-expected-slot-order-invalid`,e)),n.has(o.slotId)&&i!==o.slotId&&t.push(AS(`record-expected-slot-duplicate`,e));let s=`${o.evalId}\u0000${String(o.attemptOrdinal)}`;r.has(s)&&t.push(AS(`record-expected-slot-duplicate`,[`expectedSlots`,String(a),`attemptOrdinal`])),n.add(o.slotId),r.add(s),i=o.slotId}return Object.freeze(t)}function _C(e){let t=[];e.completedAt<e.startedAt&&t.push(AS(`record-run-time-order-invalid`,[`completedAt`])),mC(t,[`context`],pC(e.context));let n=fC(e.context);return od(n)&&n.success.experimentId!==e.experimentId&&t.push(AS(`record-run-context-experiment-mismatch`,[`context`,`experimentId`])),mC(t,[],gC(e.expectedSlots)),Object.freeze(t)}function vC(e){return(e.action===`executed`||e.action===`carried`||e.action===`accepted`)==(e.attempt!==null)?Object.freeze([]):Object.freeze([AS(`record-member-action-invalid`,[`attempt`])])}function yC(e){return Object.freeze([])}function bC(e){return[`runs`,String(e)]}function xC(e,t){return[...bC(e),`members`,String(t)]}function SC(e,t){return[...bC(e),`attempts`,String(t)]}function CC(e){return VS(e)}function wC(e){return new Map(e.expectedSlots.map(e=>[e.slotId,e]))}function TC(e,t){return e.slotId===t.slotId&&e.evalId===t.evalId&&e.attemptOrdinal===t.attemptOrdinal&&e.executionIdentityDigest===t.executionIdentityDigest}function EC(e,t,n){let r=wC(e.run),i=new Set,a;for(let[o,s]of e.members.entries()){let e=xC(t,o);mC(n,e,vC(s)),hC(a,s.slotId)||n.push(AS(a===s.slotId?`record-member-slot-duplicate`:`record-member-slot-order-invalid`,[...e,`slotId`])),i.has(s.slotId)&&a!==s.slotId&&n.push(AS(`record-member-slot-duplicate`,[...e,`slotId`])),r.has(s.slotId)||n.push(AS(`record-member-slot-unexpected`,[...e,`slotId`])),i.add(s.slotId),a=s.slotId}for(let[r,a]of e.run.expectedSlots.entries())i.has(a.slotId)||n.push(AS(`record-member-slot-missing`,[...bC(t),`run`,`expectedSlots`,String(r),`slotId`]))}function DC(e){let t=[],n=new Map,r=new Map,i;for(let[a,o]of e.runs.entries()){let e=o.run.runId,s=bC(a);hC(i,e)||t.push(AS(i===e?`record-run-duplicate`:`record-run-order-invalid`,[...s,`run`,`runId`])),n.has(e)&&i!==e&&t.push(AS(`record-run-duplicate`,[...s,`run`,`runId`])),n.set(e,a),i=e,mC(t,[...s,`run`],_C(o.run)),EC(o,a,t);let c=wC(o.run),l;for(let[n,i]of o.attempts.entries()){let o=SC(a,n);if(mC(t,o,yC(i)),hC(l,i.attemptId)||t.push(AS(l===i.attemptId?`record-attempt-duplicate`:`record-attempt-order-invalid`,[...o,`attemptId`])),l=i.attemptId,i.originRunId!==e){t.push(AS(`record-attempt-owner-invalid`,[...o,`originRunId`]));continue}let s=c.get(i.slotId);s===void 0?t.push(AS(`record-attempt-slot-unexpected`,[...o,`slotId`])):(s.evalId!==i.evalId&&t.push(AS(`record-attempt-eval-mismatch`,[...o,`evalId`])),s.executionIdentityDigest!==i.executionIdentityDigest&&t.push(AS(`record-attempt-digest-mismatch`,[...o,`executionIdentityDigest`])));let u=CC({originRunId:e,attemptId:i.attemptId});r.has(u)?t.push(AS(`record-attempt-duplicate`,[...o,`attemptId`])):r.set(u,{runIndex:a,attemptIndex:n,attempt:i})}}let a=new Map;for(let[n,i]of e.runs.entries())for(let[o,s]of i.members.entries()){if(s.attempt===null)continue;let c=xC(n,o),l=r.get(CC(s.attempt));if(l===void 0){t.push(AS(`record-attempt-reference-missing`,[...c,`attempt`]));continue}if(s.action!==`accepted`){let n=wC(i.run).get(s.slotId),r=wC(e.runs[l.runIndex].run).get(l.attempt.slotId);(n===void 0||r===void 0||!TC(n,r))&&t.push(AS(`record-attempt-slot-mismatch`,[...c,`attempt`]))}if(s.action===`executed`){if(s.attempt.originRunId!==i.run.runId){t.push(AS(`record-member-action-invalid`,[...c,`action`]));continue}let e=CC(s.attempt);a.set(e,(a.get(e)??0)+1)}else s.attempt.originRunId===i.run.runId&&t.push(AS(`record-member-action-invalid`,[...c,`action`]))}for(let[e,n]of r.entries()){let r=a.get(e)??0,i=SC(n.runIndex,n.attemptIndex);r===0?t.push(AS(`record-origin-member-missing`,i)):r>1&&t.push(AS(`record-origin-member-duplicate`,i))}return Object.freeze(t)}var OC=Object.freeze({maximumJsonBytes:1048576,maximumDepth:8,maximumNodes:4096,maximumObjectKeys:64,maximumArrayItems:256,maximumKeyUtf8Bytes:256,maximumStringUtf8Bytes:8192}),kC=Object.freeze({...OC,maximumJsonBytes:8388608,maximumNodes:32768,maximumArrayItems:4096});function AC(e){return e.length===0?void 0:e.map(e=>({path:e.path,issue:e.code}))}var jC=G(FS),MC=B.pipe(q(Y(e=>Number.isSafeInteger(e)&&e>=0,{identifier:`RecordAttemptOrdinal`,description:`a zero-based non-negative JSON-safe attempt ordinal`}))),NC=PS({schema:H({originRunId:px,attemptId:hx}),limits:OC}).schema,PC=PS({schema:H({slotId:mx,evalId:vx,attemptOrdinal:MC,executionIdentityDigest:yx}),limits:OC}).schema,FC=PS({schema:H({format:Dx,recordId:fx}),limits:OC}).schema,IC=PS({schema:H({runId:px,experimentId:_x,context:uC,startedAt:Ex,completedAt:Ex,expectedSlots:U(PC)}).pipe(q(Y(e=>AC(_C(e)),{identifier:`RecordRunDocumentInvariant`,description:`a Run document with valid chronology, context, and expected Slots`}))),limits:OC}).schema,LC=PS({schema:W([H({slotId:mx,action:G(LS),attempt:NC}),H({slotId:mx,action:G(RS),attempt:sv,absenceReason:GS})]).pipe(q(Y(e=>AC(vC(e)),{identifier:`RecordMemberDocumentInvariant`,description:`a Member action paired with its required Attempt reference`}))),limits:OC}).schema,RC=PS({schema:H({attemptId:hx,originRunId:px,slotId:mx,evalId:vx,executionIdentityDigest:yx,outcome:jC}).pipe(q(Y(e=>AC(yC(e)),{identifier:`RecordAttemptDocumentInvariant`,description:`an Attempt document satisfying its local invariant`}))),limits:OC}).schema,zC=PS({schema:H({run:IC,members:U(LC),attempts:U(RC)}),limits:kC}).schema;PS({schema:H({record:FC,runs:U(zC)}).pipe(q(Y(e=>AC(DC(e)),{identifier:`RecordCoreInvariant`,description:`a complete Record Core with consistent Run, Member, and Attempt documents`}))),limits:kC}).schema;var BC=Gx,VC=PC,HC=IC,UC=LC,WC=RC;ev(W([H({format:R(`niceeval.attempt-publication-closure/v1`),originRun:HC}),H({originRun:HC})]),{errors:`all`,onExcessProperty:`error`}),G(IS);var GC=B.pipe(q(Y(e=>Number.isSafeInteger(e)&&e>=0))),KC=B.pipe(q(Y(e=>Number.isSafeInteger(e)&&e>0))),qC=H({sha256:bx,byteLength:GC}),JC=H({key:wx,sha256:bx,byteLength:GC}),YC=H({owner:G(BS),family:z.pipe(q(Y(sx)))});function XC(e){let t;for(let n of e.contents){if(t!==void 0&&t>=n.key)return!1;t=n.key}let n;for(let t of e.references){let e=`${t.owner}\u0000${t.family}`;if(n!==void 0&&n>=e)return!1;n=e}return!0}H({format:G([zS]),ownerKind:G(BS),family:z.pipe(q(Y(sx))),schemaVersion:KC,payload:qC,contents:U(JC),references:U(YC)}).pipe(q(Y(XC)));var ZC=Object.freeze({run:`run`,attempt:`attempt`});Object.freeze({maximumJsonBytes:16777216,maximumDepth:32,maximumNodes:2e5,maximumObjectKeys:5e4,maximumArrayItems:1e5,maximumKeyUtf8Bytes:256,maximumStringUtf8Bytes:1048576});var QC=B.pipe(q(Y(e=>Number.isSafeInteger(e)&&e>=0,{identifier:`RecordNonNegativeSafeInteger`,description:`a non-negative JSON-safe integer`}))),$C=B.pipe(q(Y(e=>Number.isSafeInteger(e)&&e>0,{identifier:`RecordPositiveSafeInteger`,description:`a positive JSON-safe integer`}))),ew=B.pipe(q(Y(e=>Number.isFinite(e)&&e>=0,{identifier:`RecordFiniteNonNegativeNumber`,description:`a finite non-negative JSON number`}))),tw=z.pipe(q(Y(e=>new TextEncoder().encode(e).byteLength<=16384&&!/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/.test(e),{identifier:`RecordSafeText`,description:`bounded text without NUL or unsafe control characters`}))),nw=z.pipe(q(Y(e=>/^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$/.test(e),{identifier:`RecordSafeIdentifier`,description:`a bounded ASCII identifier`}))),rw=z.pipe(q(Y(e=>e.length>0&&e.length<=255&&/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+(?:;[!#$%&'*+.^_`|~0-9A-Za-z-]+=[!#$%&'*+.^_`|~0-9A-Za-z-]+)*$/.test(e),{identifier:`RecordMediaType`,description:`a bounded MIME media type without free-form parameters`}))),iw=W([H({code:G([`capture-failed`,`capture-interrupted`]),stage:nw}),H({code:G([`collection-cap-reached`,`unsupported-input`]),omittedAtLeast:$C})]),aw=hv([]).pipe(q(Y(e=>e.length===0,{identifier:`RecordEmptyArray`,description:`an exact empty array`}))),ow=W([H({state:R(`complete`),limitations:aw}),H({state:R(`partial`),limitations:gv(iw)})]);function sw(e){let t,n=new Set;for(let r of e){if(n.has(r)||t!==void 0&&t>=r)return!1;n.add(r),t=r}return!0}var cw=Object.freeze({maximumArtifacts:4e3,maximumContentBytes:1073741824}),lw=H({artifactId:Cx,mediaType:L(rw),label:L(tw),byteLength:QC,sha256:bx,content:ty.pipe(ny.maximumBytes(cw.maximumContentBytes))}),uw=H({collection:L(ow),artifacts:U(lw)}).pipe(fv({collection:`collection-data`,artifacts:`artifacts-data`}));function dw(e){return sS(`record-attachment-schema-invalid`,e)}function fw(e){let t=[];e.artifacts.length>cw.maximumArtifacts&&t.push(dw([`artifacts`])),sw(e.artifacts.map(e=>e.artifactId))||t.push(dw([`artifacts`,`artifactId`]));for(let[n,r]of e.artifacts.entries())r.byteLength>cw.maximumContentBytes&&t.push(dw([`artifacts`,String(n),`byteLength`]));return Object.freeze(t)}var pw=CS({owner:ZC.attempt,family:`niceeval.artifacts`,schema:uw,validate:fw}),mw=CS({owner:ZC.run,family:`niceeval.artifacts`,schema:uw,validate:fw});wS({attachment:pw,revision:2}),wS({attachment:mw,revision:2});var hw=class{#e=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);#t=new Uint8Array(64);#n=new Uint32Array(64);#r=0;#i=0;#a=!1;update(e){if(this.#a)throw Error(`SHA-256 digest is already finalized`);this.#i+=e.byteLength;let t=0;for(;t<e.byteLength;){let n=Math.min(64-this.#r,e.byteLength-t);this.#t.set(e.subarray(t,t+n),this.#r),this.#r+=n,t+=n,this.#r===64&&(this.#o(this.#t),this.#r=0)}return this}digestHex(){if(this.#a)throw Error(`SHA-256 digest is already finalized`);this.#a=!0;let e=BigInt(this.#i)*8n;this.#t[this.#r++]=128,this.#r>56&&(this.#t.fill(0,this.#r),this.#o(this.#t),this.#r=0),this.#t.fill(0,this.#r,56);for(let t=0;t<8;t+=1)this.#t[63-t]=Number(e>>BigInt(t*8)&255n);return this.#o(this.#t),[...this.#e].map(e=>e.toString(16).padStart(8,`0`)).join(``)}#o(e){let t=this.#n;for(let n=0;n<16;n+=1){let r=n*4;t[n]=(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])>>>0}for(let e=16;e<64;e+=1){let n=t[e-15],r=t[e-2],i=gw(n,7)^gw(n,18)^n>>>3,a=gw(r,17)^gw(r,19)^r>>>10;t[e]=t[e-16]+i+t[e-7]+a>>>0}let[n,r,i,a,o,s,c,l]=this.#e;for(let e=0;e<64;e+=1){let u=gw(o,6)^gw(o,11)^gw(o,25),d=o&s^~o&c,f=l+u+d+_w[e]+t[e]>>>0,p=(gw(n,2)^gw(n,13)^gw(n,22))+(n&r^n&i^r&i)>>>0;l=c,c=s,s=o,o=a+f>>>0,a=i,i=r,r=n,n=f+p>>>0}this.#e[0]=this.#e[0]+n>>>0,this.#e[1]=this.#e[1]+r>>>0,this.#e[2]=this.#e[2]+i>>>0,this.#e[3]=this.#e[3]+a>>>0,this.#e[4]=this.#e[4]+o>>>0,this.#e[5]=this.#e[5]+s>>>0,this.#e[6]=this.#e[6]+c>>>0,this.#e[7]=this.#e[7]+l>>>0}};function gw(e,t){return e>>>t|e<<32-t}var _w=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function vw(e){return new TextEncoder().encode(e).byteLength}var yw=Object.freeze({defaultBytes:65536,maximumBytes:262144}),bw=QC,xw=QC.pipe(q(Y(e=>e>0&&e<=yw.maximumBytes))),Sw=H({artifactId:Cx,offset:I(bw),limit:I(xw)}),Cw=W([H({state:R(`not-found`),artifactId:Cx}),H({state:R(`available`),artifactId:Cx,name:L(tw),mediaType:L(rw),byteLength:QC,sha256:bx,offset:bw,base64:z.pipe(q(Y(e=>e.length<=Math.ceil(yw.maximumBytes/3)*4&&e.length%4==0&&/^[A-Za-z0-9+/]*={0,2}$/.test(e)))),nextOffset:K(bw)})]);xf(`InspectionArtifactError`),ev(Sw,BC),ev(H({"$niceeval.record.content":z}),BC);var{content:ww,...Tw}=lw.fields,Ew=QC.pipe(q(Y(e=>e>0&&e<=128))),Dw=H(Tw),Ow=H({collection:L(ow),artifacts:U(Dw)});ev(H({"$niceeval.record.content":z}),BC),Object.freeze({conversation:Object.freeze({maxPayloadBytes:2097152,maxItems:2048,maxTurns:256,maxClosureBytes:0}),commands:Object.freeze({maxPayloadBytes:2097152,maxItems:256,maxClosureBytes:33554432}),usage:Object.freeze({maxPayloadBytes:1048576,maxItems:2048,maxClosureBytes:0}),timing:Object.freeze({maxPayloadBytes:1048576,maxItems:4096,maxClosureBytes:0}),diagnostics:Object.freeze({maxPayloadBytes:524288,maxItems:512,maxClosureBytes:0})});var kw=`@niceeval/o11y/NonNegativeSafeInteger`,Aw=`@niceeval/o11y/PositiveSafeInteger`,jw=`@niceeval/o11y/SafeIdentifier`,Mw=`@niceeval/o11y/SourceNativeToolName`,Nw=`@niceeval/o11y/StableLabel`,Pw=`@niceeval/o11y/SafeText`,Fw=`@niceeval/o11y/CanonicalDecimal`,Iw=`@niceeval/o11y/CurrencyCode`,Lw=new TextEncoder,Rw=/^[a-z][a-z0-9.-]{0,63}$/,zw=/^(?:0|[1-9][0-9]*)(?:\.[0-9]*[1-9])?$/,Bw=/^[A-Z]{3}$/,Vw=/[\u0000-\u0009\u000B-\u001F]/u;function Hw(e){return Lw.encode(e).byteLength}function Uw(e){for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n>=55296&&n<=56319){let n=e.charCodeAt(t+1);if(n<56320||n>57343)return!1;t+=1}else if(n>=56320&&n<=57343)return!1}return!0}function Ww(e){return Number.isSafeInteger(e)&&e>=0}function Gw(e){return Number.isSafeInteger(e)&&e>0}function Kw(e){return Ww(e)?e:void 0}function qw(e){return Gw(e)?e:void 0}function Jw(e){return Hw(e)<=64&&Rw.test(e)}function Yw(e){return Hw(e)<=64&&Rw.test(e)}function Xw(e){return e.length>0&&!e.includes(`
18
- `)&&Qw(e,256)}function Zw(e){return Uw(e)&&!Vw.test(e)}function Qw(e,t){return Number.isSafeInteger(t)&&t>=0&&Zw(e)&&Hw(e)<=t}function $w(e){return Hw(e)<=64&&zw.test(e)}function eT(e){return Bw.test(e)}var tT=`@niceeval/o11y/TurnId`,nT=`@niceeval/o11y/ItemId`,rT=`@niceeval/o11y/CallId`,iT=`@niceeval/o11y/EventId`,aT=`@niceeval/o11y/ToolOccurrenceId`,oT=`@niceeval/o11y/SessionScopeId`,sT=`@niceeval/o11y/LegacySourceLocalCallId`,cT=`@niceeval/o11y/CommandId`,lT=`@niceeval/o11y/UsageObservationId`,uT=`@niceeval/o11y/IntervalId`,dT=`@niceeval/o11y/DiagnosticId`;Object.freeze([`turn`,`item`,`call`,`event`,`tool-occurrence`,`session-scope`,`command`,`usage-observation`,`interval`,`diagnostic`]);var fT=`[0123456789abcdefghjkmnpqrstvwxyz]`,pT=Object.freeze({turn:`turn_`,item:`item_`,call:`call_`,event:`event_`,"tool-occurrence":`tool_`,"session-scope":`session_`,command:`command_`,"usage-observation":`usage_`,interval:`interval_`,diagnostic:`diagnostic_`});function mT(e){return RegExp(`^${e}${fT}{26}$`)}var hT=mT(pT.turn),gT=mT(pT.item),_T=mT(pT.call),vT=mT(pT.event),yT=mT(pT[`tool-occurrence`]),bT=mT(pT[`session-scope`]),xT=mT(pT.command),ST=mT(pT[`usage-observation`]),CT=mT(pT.interval),wT=mT(pT.diagnostic);function TT(e){return hT.test(e)}function ET(e){return gT.test(e)}function DT(e){return _T.test(e)}function OT(e){return vT.test(e)}function kT(e){return yT.test(e)}function AT(e){return bT.test(e)}function jT(e){return _T.test(e)}function MT(e){return xT.test(e)}function NT(e){return ST.test(e)}function PT(e){return CT.test(e)}function FT(e){return wT.test(e)}Object.freeze([`niceeval.agent-turns`,`niceeval.sandbox-commands`,`niceeval.runner-activities`,`niceeval.runner-diagnostics`]),Object.freeze([`niceeval.runner-activities`,`niceeval.runner-diagnostics`]);function IT(e){return typeof e==`object`&&!!e}function LT(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&`value`in n?n.value:void 0}function RT(e){if(!IT(e))return!1;let t=LT(e,`family`),n=LT(e,`kind`),r=LT(e,`id`);return typeof t==`string`&&typeof n==`string`&&typeof r==`string`}function zT(e){if(!RT(e))return!1;switch(e.kind){case`turn`:return e.family===`niceeval.agent-turns`&&TT(e.id);case`item`:return e.family===`niceeval.agent-turns`&&ET(e.id);case`call`:return e.family===`niceeval.agent-turns`&&DT(e.id);case`event`:return e.family===`niceeval.agent-turns`&&OT(e.id);case`tool-occurrence`:return e.family===`niceeval.agent-turns`&&kT(e.id);case`session-scope`:return e.family===`niceeval.agent-turns`&&AT(e.id);case`command`:return e.family===`niceeval.sandbox-commands`&&MT(e.id);case`usage-observation`:return e.family===`niceeval.agent-turns`&&NT(e.id);case`interval`:return e.family===`niceeval.runner-activities`&&PT(e.id);case`diagnostic`:return e.family===`niceeval.runner-diagnostics`&&FT(e.id);default:return!1}}function BT(e){return RT(e)?e.family===`niceeval.runner-activities`&&e.kind===`interval`&&PT(e.id)||e.family===`niceeval.runner-diagnostics`&&e.kind===`diagnostic`&&FT(e.id):!1}function VT(e,t){return e===t?0:e<t?-1:1}function HT(e,t){let n=VT(e.family,t.family);if(n!==0)return n;let r=VT(e.kind,t.kind);return r===0?VT(e.id,t.id):r}function UT(e,t){if(e.length>16)return!1;let n;for(let t of e){if(!zT(t)||n!==void 0&&HT(n,t)>=0)return!1;n=t}return!0}function WT(e,t){if(e.length>16)return!1;let n;for(let t of e){if(!BT(t)||n!==void 0&&HT(n,t)>=0)return!1;n=t}return!0}var GT=Object.freeze([`conversation-item`,`conversation-text`,`command-manifest`,`command-stdout`,`command-stderr`,`usage-observation`,`timing-interval`,`diagnostic`]),KT=Object.freeze([`adapter`,`command-capture`,`usage-capture`,`timing-capture`,`diagnostic-capture`,`attempt-finalizer`,`run-teardown`]);function qT(e,t){return e.some(e=>e===t)}function JT(e){return qT(GT,e)}function YT(e){return qT(KT,e)}function XT(e){switch(e.code){case`stream-truncated`:case`invalid-utf8-replaced`:case`unsafe-control-stripped`:return e.stream===`stdout`?`command-stdout`:`command-stderr`;default:return e.target}}function ZT(e){switch(e.code){case`text-truncated`:return e.target===`conversation-text`?e.itemId:e.target===`command-manifest`?e.commandId:e.diagnosticId;case`stream-truncated`:case`invalid-utf8-replaced`:case`unsafe-control-stripped`:return e.commandId;default:return``}}function QT(e){return e.code===`capture-failed`||e.code===`capture-interrupted`?e.stage:``}function $T(e){return[e.code,XT(e),ZT(e),QT(e)].join(`\0`)}function eE(e,t){let n=VT(e.code,t.code);if(n!==0)return n;let r=VT(XT(e),XT(t));if(r!==0)return r;let i=VT(ZT(e),ZT(t));return i===0?VT(QT(e),QT(t)):i}function tE(e){return e===`stdout`||e===`stderr`}function nE(e){switch(e.code){case`capture-failed`:case`capture-interrupted`:return YT(e.stage)&&JT(e.target);case`collection-cap-reached`:return JT(e.target)&&Ww(e.retained)&&Gw(e.omittedAtLeast);case`unsupported-input`:return JT(e.target)&&Gw(e.omittedAtLeast);case`text-truncated`:return Ww(e.retainedBytes)&&Gw(e.omittedBytes)&&(e.target===`conversation-text`&&ET(e.itemId)||e.target===`command-manifest`&&MT(e.commandId)||e.target===`diagnostic`&&FT(e.diagnosticId));case`stream-truncated`:return MT(e.commandId)&&tE(e.stream)&&Ww(e.retainedBytes)&&Gw(e.omittedBytes);case`invalid-utf8-replaced`:return MT(e.commandId)&&tE(e.stream)&&Gw(e.replacementCount);case`unsafe-control-stripped`:return MT(e.commandId)&&tE(e.stream)&&Gw(e.strippedCount);case`redacted`:return JT(e.target)&&Gw(e.replacementCount)}}function rE(e){let t=[];(e.state===`complete`&&e.limitations.length!==0||e.state===`partial`&&e.limitations.length===0)&&t.push(Object.freeze({code:`observability-collection-state-invalid`}));let n,r=new Set;for(let[i,a]of e.limitations.entries()){let e=Kw(i);if(e===void 0)throw Error(`Array index must be a safe integer`);if(!nE(a)){t.push(Object.freeze({code:`observability-limitation-invalid`,index:e}));continue}if(n!==void 0&&eE(n,a)>=0){let e=qw(i);if(e===void 0)throw Error(`Non-first array index must be positive`);t.push(Object.freeze({code:`observability-limitation-order-invalid`,index:e}))}let o=$T(a);if(r.has(o)){let e=qw(i);if(e===void 0)throw Error(`Duplicate cannot be at index zero`);t.push(Object.freeze({code:`observability-limitation-duplicate`,index:e}))}r.add(o),n=a}return Object.freeze(t)}var iE=`niceeval.query/v1`,aE=`2.0.0`;function oE(e,t=new Set){if(e===null||typeof e==`string`||typeof e==`boolean`)return!0;if(typeof e==`number`)return Number.isFinite(e);if(typeof e!=`object`||t.has(e))return!1;let n=new Set(t);if(n.add(e),Array.isArray(e))return e.every(e=>oE(e,n));let r=Object.getPrototypeOf(e);return r!==Object.prototype&&r!==null?!1:Object.values(e).every(e=>oE(e,n))}var sE=H({state:R(`available`),byteLength:B,sha256:z,base64:z}),cE=H({state:R(`available`),byteLength:B,sha256:z}),lE=W([H({kind:R(`unavailable`),reason:R(`not-recorded`)}),H({kind:R(`content`),content:W([sE,cE]),encoding:G([`json`,`utf-8`,`binary`]),byteLength:B,preview:K(z)})]),uE=W([H({state:R(`available`),request:z}),H({state:R(`invalid`)}),H({state:R(`unsupported`),schemaVersion:B})]),dE=H({state:G([`unavailable`,`errored`]),code:z,message:z}),fE=H({ordinal:B,transport:R(`attempted`),result:W([H({state:R(`returned`),response:z}),H({state:R(`failed`),code:z,message:z}),H({state:R(`interrupted`)})])}),pE=q_(oE),mE=W([H({ordinal:B,operation:G([`score`,`classify`,`extract`,`batchClassify`]),state:R(`rejected`),transport:R(`not-sent`),failure:dE}),H({ordinal:B,operation:G([`score`,`classify`,`extract`,`batchClassify`]),state:R(`admitted`),request:z,attempts:U(fE),result:W([H({state:R(`completed`),output:z}),dE,H({state:R(`interrupted`)})])})]),hE=H({schemaVersion:R(1),protocol:R(`niceeval.score-match-audit/v1`),definition:H({name:z,version:z,config:z,digest:z,limits:H({maxCalls:B,maxMaterialBytes:B,maxAuditBytes:B})}),input:z,calls:U(mE),result:W([H({state:R(`measured`),value:B}),dE,H({state:R(`interrupted`)})])}),gE=H({rubric:z,anchors:U(H({measurement:B,description:z})),material:pE}),_E=H({rubric:z,choices:U(z),material:pE}),vE=H({rubric:z,choices:U(z),items:U(H({id:z,text:z})),material:pE}),yE=W([H({operation:R(`score`),input:gE}),H({operation:R(`classify`),input:_E}),H({operation:R(`batchClassify`),input:vE})]),bE=W([H({ordinal:B,operation:G([`score`,`classify`,`extract`,`batchClassify`]),state:R(`rejected`),transport:R(`not-sent`),failure:dE}),H({ordinal:B,operation:G([`score`,`classify`,`batchClassify`]),state:R(`admitted`),request:z,attempts:U(fE),mapping:yE,result:W([H({state:R(`completed`),output:z}),dE,H({state:R(`interrupted`)})])})]),xE=H({schemaVersion:R(2),protocol:R(`niceeval.score-match-audit/v2`),definition:H({name:z,version:z,config:z,digest:z,limits:H({maxCalls:B,maxMaterialBytes:B,maxAuditBytes:B})}),input:z,calls:U(bE),result:W([H({state:R(`measured`),value:B}),dE,H({state:R(`interrupted`)})])}),SE=H({schemaVersion:R(3),protocol:R(`niceeval.score-match-audit/v3`),definition:H({name:z,version:z,config:z,digest:z,limits:H({maxCalls:B,maxMaterialBytes:B,maxAuditBytes:B})}),input:z,images:U(H({imageId:z,evidenceIndex:B,mediaType:G([`image/png`,`image/jpeg`]),byteLength:B,sha256:z,paths:U(z)})),calls:U(W([H({ordinal:B,operation:G([`score`,`classify`,`extract`,`batchClassify`]),state:R(`rejected`),transport:R(`not-sent`),failure:dE}),H({ordinal:B,operation:G([`score`,`classify`,`extract`,`batchClassify`]),state:R(`admitted`),requestTemplate:z,wireBody:H({byteLength:B,sha256:z}),attempts:U(fE),result:mE.members[1].fields.result})])),result:W([H({state:R(`measured`),value:B}),dE,H({state:R(`interrupted`)})])}),CE=W([H({state:R(`available`),audit:W([hE,xE,SE])}),H({state:R(`invalid`)}),H({state:R(`unsupported`),schemaVersion:B})]),wE=wb(lE).entry,TE=H({...wE.fields,judgeMaterial:I(uE),scoreMatchAudit:I(CE)}),EE=H({entryId:Wy,sourceOrder:B,role:G([`declaration`,`threshold`,`score`,`gate`,`optional`,`stop`]),source:H({sourceItemId:z,sha256:z}),start:H({line:B,column:B}),end:H({line:B,column:B})}),DE=W([nb,Sb]),OE=G([`condition-not-met`,`evidence-unavailable`,`source-unavailable`,`redacted`,`evaluator-failed`,`producer-interrupted`,`invalid-subject`,`coverage-not-applicable`,`not-recorded`,`not-declared`]),kE=yv(()=>H({label:z,state:z,expected:K(DE),observed:K(nb),reason:K(OE),anchor:K(nb),children:U(kE)})),AE=G([`historical-not-recorded`,`source-unavailable`,`ambiguous`]),jE=W([H({state:R(`exact`),turnId:z,eventId:z,anchor:z}),H({state:R(`unavailable`),reason:AE})]),ME=W([H({kind:R(`tool-occurrence`),toolOccurrenceId:z}),H({kind:R(`event`),eventId:z})]),NE=H({kind:G([`tool`,`event`,`legacy-source-row`]),rowId:z,number:z,phase:G([`at-evaluation`,`outside-evaluation-snapshot`,`historical`]),summary:z,detail:nb,locator:I(ME),evaluation:H({result:G([`matched`,`mismatched`,`unavailable`,`not-evaluated`,`not-retained`,`outside-snapshot`,`legacy`]),difference:I(nb)}),conversationTarget:jE}),PE=W([H({state:R(`unavailable`),reason:AE,rows:hv([]),limitations:hv([])}),H({state:G([`complete`,`partial`]),rows:U(NE),limitations:U(nb)})]),FE=W([H({kind:R(`collection-filter`),summary:nb}),H({kind:R(`ordered-sequence`),summaries:U(nb)})]),IE=H({step:B,summary:nb,state:G([`matched`,`possible`,`blocked`,`not-reached`]),sourceRow:I(z),conversationTarget:I(jE)}),LE=W([H({state:R(`legacy`),subject:G([`tool`,`event`,`source-row`]),query:H({state:R(`unavailable`),reason:R(`historical-not-recorded`)}),source:H({final:PE,atEvaluation:PE}),identityRelation:H({state:R(`unavailable`),reason:R(`historical-not-recorded`)}),overlayRetention:R(`unavailable`),steps:hv([]),legacyDiagnostic:I(nb)}),H({state:R(`current`),subject:G([`tool`,`event`,`source-row`]),query:FE,receipt:W([tb,fb]),source:H({final:PE,atEvaluation:PE}),identityRelation:W([H({state:R(`exact`)}),H({state:R(`unavailable`),reason:G([`source-unavailable`,`ambiguous`])})]),overlayRetention:G([`complete`,`partial`,`unavailable`]),steps:U(IE)})]),RE=H({state:R(`unavailable`),reason:R(`not-recorded`)}),zE=H({state:R(`missing`),sourceState:G([`not-recorded`,`invalid`]),comparator:sv,sourceLedger:sv,receipt:sv,result:sv,targets:hv([]),debugger:sv,sandboxCommandJoin:RE}),BE=W([zE,H({state:R(`ordinary`),sourceState:sv,comparator:sv,sourceLedger:K(tb),receipt:K(tb),result:sv,targets:hv([]),debugger:sv,sandboxCommandJoin:RE}),H({state:R(`legacy`),sourceState:R(`unavailable`),comparator:sv,sourceLedger:sv,receipt:sv,result:sv,targets:hv([]),reason:R(`historical-not-recorded`),debugger:LE,sandboxCommandJoin:RE}),H({state:R(`available`),sourceState:G([`complete`,`partial`,`unavailable`]),comparator:K(W([ob,U(ob)])),sourceLedger:H({sourceSnapshot:db,receipt:W([tb,fb])}),receipt:W([tb,fb]),result:K(vb),targets:U(H({state:G([`matched`,`mismatched`,`unavailable`,`not-evaluated`]),anchor:ME,difference:K(nb)})),debugger:LE,sandboxCommandJoin:RE})]),VE=L(W([H({entryId:z,state:G([`not-recorded`,`invalid`]),issues:I(U(H({code:oS,path:U(z)}))),sourceSites:hv([]),check:kE,matcher:zE}),H({entryId:Wy,display:L(Gy),entry:L(TE),sourceSites:U(EE),check:kE,matcher:BE})])),HE=G([`usage-not-recorded`,`source-invalid`,`adapter-usage-required`,`collection-incomplete`,`call-status-unknown`,`no-calls`,`cache-read-missing`,`input-total-missing`,`zero-input-total`,`unsafe-token-total`]),UE={rate:W([H({state:R(`exact`),value:B.check(Y(e=>Number.isFinite(e)&&e>=0&&e<=1))}),H({state:R(`unavailable`),reason:HE})]),recordedCalls:QC,coveredCalls:QC,missingCacheReadCalls:QC,missingInputTotalCalls:QC,unknownStatusCalls:QC,collectionComplete:V,reasons:U(HE)},WE=e=>{let t=e.recordedCalls;return t<=4e3&&e.coveredCalls<=t&&e.unknownStatusCalls<=t&&e.missingCacheReadCalls<=t&&e.missingInputTotalCalls<=t&&e.coveredCalls<=t-Math.max(e.missingCacheReadCalls,e.missingInputTotalCalls)&&e.coveredCalls>=t-e.missingCacheReadCalls-e.missingInputTotalCalls&&new Set(e.reasons).size===e.reasons.length&&(e.rate.state===`exact`?e.reasons.length===0&&e.collectionComplete&&t>0&&e.coveredCalls===t&&e.unknownStatusCalls===0:e.rate.reason===e.reasons[0])},GE=H({total:H(UE).check(Y(WE)),modelSlots:U(H({modelSlot:K(z),...UE}).check(Y(WE))),models:U(H({modelSlot:K(z),provider:K(z),model:K(z),...UE}).check(Y(WE)))}).check(Y(e=>e.modelSlots.length<=65&&e.models.length<=4e3));Object.freeze({errors:`all`,onExcessProperty:`error`});var KE=B.pipe(q(Y(Ww,{identifier:`ObservabilityNonNegativeSafeInteger`,description:`a JSON-safe non-negative integer`})),J(kw)),qE=B.pipe(q(Y(Gw,{identifier:`ObservabilityPositiveSafeInteger`,description:`a positive JSON-safe integer`})),J(Aw)),JE=z.pipe(q(Y(Jw,{identifier:`ObservabilitySafeIdentifier`,description:`a lowercase ASCII identifier no longer than 64 bytes`})),J(jw));z.pipe(q(Y(Yw,{identifier:`ObservabilityStableLabel`,description:`a provider-neutral lowercase ASCII label no longer than 64 bytes`})),J(Nw));var YE=z.pipe(q(Y(Zw,{identifier:`ObservabilitySafeText`,description:`strict UTF-8 text without NUL or C0 controls other than LF`})),J(Pw)),XE=z.pipe(q(Y(Xw,{identifier:`ObservabilitySourceNativeToolName`,description:`a non-empty source-native tool name no longer than 256 UTF-8 bytes`})),J(Mw)),ZE=z.pipe(q(Y($w,{identifier:`ObservabilityCanonicalDecimal`,description:`a non-negative canonical decimal string no longer than 64 bytes`})),J(Fw)),QE=z.pipe(q(Y(eT,{identifier:`ObservabilityCurrencyCode`,description:`an uppercase three-letter currency code`})),J(Iw)),$E=z.pipe(q(Y(TT,{identifier:`ObservabilityTurnId`,description:`a turn_ identifier with 26 lowercase Crockford base-32 characters`})),J(tT)),eD=z.pipe(q(Y(ET,{identifier:`ObservabilityItemId`,description:`an item_ identifier with 26 lowercase Crockford base-32 characters`})),J(nT)),tD=z.pipe(q(Y(DT,{identifier:`ObservabilityCallId`,description:`a call_ identifier with 26 lowercase Crockford base-32 characters`})),J(rT)),nD=z.pipe(q(Y(jT,{identifier:`ObservabilityLegacySourceLocalCallId`,description:`a v1 source-local call identifier`})),J(sT)),rD=z.pipe(q(Y(OT,{identifier:`ObservabilityEventId`,description:`an event_ identifier with 26 lowercase Crockford base-32 characters`})),J(iT)),iD=z.pipe(q(Y(kT,{identifier:`ObservabilityToolOccurrenceId`,description:`a tool_ identifier with 26 lowercase Crockford base-32 characters`})),J(aT)),aD=z.pipe(q(Y(AT,{identifier:`ObservabilitySessionScopeId`,description:`a session_ identifier with 26 lowercase Crockford base-32 characters`})),J(oT)),oD=z.pipe(q(Y(MT,{identifier:`ObservabilityCommandId`,description:`a command_ identifier with 26 lowercase Crockford base-32 characters`})),J(cT)),sD=z.pipe(q(Y(NT,{identifier:`ObservabilityUsageObservationId`,description:`a usage_ identifier with 26 lowercase Crockford base-32 characters`})),J(lT)),cD=z.pipe(q(Y(PT,{identifier:`ObservabilityIntervalId`,description:`an interval_ identifier with 26 lowercase Crockford base-32 characters`})),J(uT)),lD=z.pipe(q(Y(FT,{identifier:`ObservabilityDiagnosticId`,description:`a diagnostic_ identifier with 26 lowercase Crockford base-32 characters`})),J(dT)),uD=G([`conversation-item`,`conversation-text`,`command-manifest`,`command-stdout`,`command-stderr`,`usage-observation`,`timing-interval`,`diagnostic`]).pipe(q(Y(JT,{identifier:`ObservabilityCollectionTarget`,description:`a closed Observability collection target`}))),dD=G([`adapter`,`command-capture`,`usage-capture`,`timing-capture`,`diagnostic-capture`,`attempt-finalizer`,`run-teardown`]).pipe(q(Y(YT,{identifier:`ObservabilityCollectionStage`,description:`a closed Observability capture stage`}))),fD=W([H({code:R(`capture-failed`),stage:dD,target:uD}),H({code:R(`capture-interrupted`),stage:dD,target:uD}),H({code:R(`collection-cap-reached`),target:uD,retained:KE,omittedAtLeast:qE}),H({code:R(`unsupported-input`),target:uD,omittedAtLeast:qE}),H({code:R(`text-truncated`),target:R(`conversation-text`),itemId:eD,retainedBytes:KE,omittedBytes:qE}),H({code:R(`text-truncated`),target:R(`command-manifest`),commandId:oD,retainedBytes:KE,omittedBytes:qE}),H({code:R(`text-truncated`),target:R(`diagnostic`),diagnosticId:lD,retainedBytes:KE,omittedBytes:qE}),H({code:R(`stream-truncated`),commandId:oD,stream:G([`stdout`,`stderr`]),retainedBytes:KE,omittedBytes:qE}),H({code:R(`invalid-utf8-replaced`),commandId:oD,stream:G([`stdout`,`stderr`]),replacementCount:qE}),H({code:R(`unsafe-control-stripped`),commandId:oD,stream:G([`stdout`,`stderr`]),strippedCount:qE}),H({code:R(`redacted`),target:uD,replacementCount:qE})]).pipe(q(Y(nE,{identifier:`ObservabilityLimitation`,description:`a semantically valid closed Observability limitation`})));W([H({state:R(`complete`),limitations:hv([])}),H({state:R(`partial`),limitations:gv(fD)})]).pipe(q(Y(e=>rE(e).length===0,{identifier:`ObservabilityCollection`,description:`a complete empty or partial canonically ordered limitation collection`})));var pD=H({family:R(`niceeval.agent-turns`),kind:R(`turn`),id:$E}),mD=H({family:R(`niceeval.agent-turns`),kind:R(`item`),id:eD}),hD=H({family:R(`niceeval.agent-turns`),kind:R(`call`),id:tD}),gD=H({family:R(`niceeval.agent-turns`),kind:R(`event`),id:rD}),_D=H({family:R(`niceeval.agent-turns`),kind:R(`tool-occurrence`),id:iD}),vD=H({family:R(`niceeval.agent-turns`),kind:R(`session-scope`),id:aD}),yD=H({family:R(`niceeval.sandbox-commands`),kind:R(`command`),id:oD}),bD=H({family:R(`niceeval.agent-turns`),kind:R(`usage-observation`),id:sD}),xD=H({family:R(`niceeval.runner-activities`),kind:R(`interval`),id:cD}),SD=H({family:R(`niceeval.runner-diagnostics`),kind:R(`diagnostic`),id:lD}),CD=W([pD,mD,hD,gD,_D,vD,yD,bD,xD,SD]),wD=W([xD,SD]);U(CD).pipe(q(Y(e=>e.length<=16&&UT(e,`niceeval.agent-turns`)))),U(CD).pipe(q(Y(e=>e.length<=16&&UT(e,`niceeval.sandbox-commands`)))),U(CD).pipe(q(Y(e=>e.length<=16&&UT(e,`niceeval.agent-turns`)))),U(CD).pipe(q(Y(e=>e.length<=16&&UT(e,`niceeval.runner-activities`)))),U(CD).pipe(q(Y(e=>e.length<=16&&UT(e,`niceeval.runner-diagnostics`)))),U(wD).pipe(q(Y(e=>e.length<=16&&WT(e,`niceeval.runner-activities`)))),U(wD).pipe(q(Y(e=>e.length<=16&&WT(e,`niceeval.runner-diagnostics`))));var TD=Object.freeze([`input`,`output`,`cache-read`,`cache-write`]);function ED(e){let[t,n=``]=e.split(`.`);return Object.freeze({digits:BigInt(`${t}${n}`),scale:n.length})}function DD(e){if(e.digits===0n)return`0`;if(e.scale===0)return e.digits.toString();let t=e.digits.toString().padStart(e.scale+1,`0`),n=t.slice(0,-e.scale),r=t.slice(-e.scale).replace(/0+$/u,``);return r.length===0?n:`${n}.${r}`}function OD(e){if(!Number.isFinite(e)||e<0)return;let t=e.toString().toLowerCase();if(!t.includes(`e`))return t.includes(`.`)?t.replace(/\.?0+$/u,``):t;let[n,r]=t.split(`e`),i=Number(r);if(n===void 0||!Number.isSafeInteger(i))return;let[a,o=``]=n.split(`.`),s=`${a}${o}`,c=a.length+i;return c<=0?DD({digits:BigInt(s),scale:s.length-c}):c>=s.length?`${s}${`0`.repeat(c-s.length)}`:DD({digits:BigInt(s),scale:s.length-c})}function kD(e,t){let n=ED(e);return DD({digits:n.digits*BigInt(t),scale:n.scale+6})}function AD(e){if(e.length===0)return`0`;let t=e.map(ED),n=Math.max(...t.map(e=>e.scale));return DD({digits:t.reduce((e,t)=>e+t.digits*10n**BigInt(n-t.scale),0n),scale:n})}function jD(e){let t=new TextEncoder().encode(JSON.stringify(e));return`sha256:${new hw().update(t).digestHex()}`}var MD=z.pipe(q(Y(e=>e.trim().length>0&&new TextEncoder().encode(e).byteLength<=256&&!/[\u0000-\u001f\u007f]/u.test(e)))),ND=K(QC),PD=H({callId:MD,retryOf:K(MD),provider:K(MD),model:K(MD),status:G([`succeeded`,`failed`,`cancelled`,`unknown`]),inputTokens:ND,inputTotalTokens:ND,outputTokens:ND,cacheReadTokens:ND,cacheWriteTokens:ND}),FD=H({transportProvider:K(MD),endpointId:K(MD)}),ID=H({amount:ZE,currency:QE,source:H({kind:R(`reported`),id:MD})}),LD=z.pipe(q(Y(e=>/^sha256:[0-9a-f]{64}$/u.test(e)))),RD=K(ZE),zD=H({input:RD,output:RD,cacheRead:RD,cacheWrite:RD}),BD=H({kind:R(`configured-profile`),id:MD,asOf:K($C),profileDigest:LD}),VD=H({basis:R(`catalog-reference`),currency:R(`USD`),source:BD,requestModel:MD,selector:MD,match:G([`exact`,`provider-wildcard`]),ratesPerMTok:zD}),HD=H({bucket:G(TD),tokens:QC,ratePerMTok:RD,amount:ZE}),UD=H({bucket:G(TD),reason:G([`tokens-unknown`,`rate-unknown`])}),WD=H({kind:R(`adapter-call-price-estimate`),callId:MD,state:G([`complete`,`partial`]),amount:ZE,currency:R(`USD`),source:H({kind:R(`estimated`),id:MD}),pricing:VD,charges:gv(HD),missing:U(UD)}),GD=z.check(Tv(/^[A-Za-z][A-Za-z0-9_-]{0,63}$(?![\s\S])/u)),KD=H({...PD.fields,route:FD,cost:K(ID)}),qD=H({...KD.fields,modelSlot:K(GD)});Object.freeze({maximumCalls:4e3}),H({collection:ow,calls:U(PD)}),H({collection:ow,calls:U(KD),priceReceipts:U(WD)}),H({collection:ow,calls:U(qD),priceReceipts:U(WD)});var JD=Object.freeze({maximumCalls:4e3,maximumModelBytes:8192,maximumReceiptBytes:32768,maximumReceiptFields:24}),YD=new TextEncoder;function XD(e){return z.check(Y(t=>t.trim().length>0&&!/[\ud800-\udfff]/u.test(t)&&YD.encode(t).byteLength<=e&&!/[\u0000-\u001f\u007f]/u.test(t)))}var ZD=XD(256),QD=XD(JD.maximumModelBytes),$D=z.check(Tv(/^sha256:[0-9a-f]{64}$/u)),eO=K(QC),tO=K(ZE),nO=H({path:G(Object.freeze([`model`,`provider`,`usage.completion_tokens`,`usage.cost`,`usage.input_tokens`,`usage.output_tokens`,`usage.prompt_tokens`,`usage.prompt_tokens_details.cache_write_tokens`,`usage.prompt_tokens_details.cached_tokens`,`usage.total_tokens`])),value:W([z.check(Y(e=>!/[\ud800-\udfff]/u.test(e)&&YD.encode(e).byteLength<=JD.maximumModelBytes&&!/[\u0000-\u001f\u007f]/u.test(e))),ew.check(Y(e=>!Object.is(e,-0))),sv])}),rO=H({state:G([`available`,`unavailable`]),reason:K(G([`response-unavailable`,`cancelled`,`response-too-large`,`invalid-json`,`usage-not-reported`,`invalid-usage`,`response-model-too-large`])),responseDigest:K($D),fields:U(nO)}).check(Y(e=>e.fields.length>JD.maximumReceiptFields||YD.encode(JSON.stringify(e)).byteLength>JD.maximumReceiptBytes||e.fields.some((t,n)=>n>0&&e.fields[n-1].path>=t.path)?!1:e.state===`available`?e.fields.some(e=>e.value!==null)&&e.responseDigest!==null&&(e.reason===null||e.reason===`invalid-usage`||e.reason===`usage-not-reported`||e.reason===`response-model-too-large`):e.fields.length===0&&e.reason!==null&&(e.reason===`invalid-json`||e.reason===`invalid-usage`||e.reason===`usage-not-reported`||e.reason===`response-model-too-large`?e.responseDigest!==null:e.responseDigest===null))),iO=H({callId:ZD,entryIndex:QC,entryId:Wy,logicalOrdinal:$C,transmissionOrdinal:$C,operation:G([`score`,`classify`,`extract`,`batchClassify`]),requestModel:QD,transportProvider:G([`openai`,`vercel`,`openrouter`,`typesafe`]),provider:K(ZD),model:K(QD),status:G([`succeeded`,`failed`,`cancelled`,`unknown`]),httpStatus:K(QC.check(Y(e=>e>=100&&e<=599))),inputTokens:eO,inputTotalTokens:eO,outputTokens:eO,cacheReadTokens:eO,cacheWriteTokens:eO,cost:K(H({amount:ZE,currency:QE,source:H({kind:R(`reported`),id:ZD})})),receipt:rO}).check(Y(e=>oO(e))),aO=H({kind:R(`judge-call-price-estimate`),callId:ZD,state:G([`complete`,`partial`]),amount:ZE,currency:R(`USD`),source:H({kind:R(`estimated`),id:ZD}),pricing:H({basis:R(`catalog-reference`),currency:R(`USD`),source:H({kind:R(`configured-profile`),id:ZD,asOf:K($C),profileDigest:$D}),requestModel:QD,selector:QD,match:G([`exact`,`provider-wildcard`]),ratesPerMTok:H({input:tO,output:tO,cacheRead:tO,cacheWrite:tO})}),charges:gv(H({bucket:G(TD),tokens:QC,ratePerMTok:tO,amount:ZE})),missing:U(H({bucket:G(TD),reason:G([`tokens-unknown`,`rate-unknown`])}))}).check(Y(e=>sO(e)));H({collection:ow,calls:U(iO),priceReceipts:U(aO)}).check(Y(e=>uO(e).length===0));function oO(e){if(e.callId!==`judge:${e.entryIndex}:${e.logicalOrdinal}:${e.transmissionOrdinal}`)return!1;let t=[e.inputTokens,e.cacheReadTokens,e.cacheWriteTokens],n=t.filter(e=>e!==null),r=n.reduce((e,t)=>e+t,0);if(!Number.isSafeInteger(r)||e.inputTotalTokens!==null&&(r>e.inputTotalTokens||n.length===3&&r!==e.inputTotalTokens)||e.inputTotalTokens!==null&&e.outputTokens!==null&&!Number.isSafeInteger(e.inputTotalTokens+e.outputTokens))return!1;let i=new Map(e.receipt.fields.map(e=>[e.path,e.value]));for(let t of e.receipt.fields)if(t.value!==null){if(t.path===`model`){if(typeof t.value!=`string`||!Z_(QD)(t.value))return!1}else if(t.path===`provider`){if(e.transportProvider!==`openrouter`||typeof t.value!=`string`||!Z_(ZD)(t.value))return!1}else if(t.path===`usage.cost`){let n=typeof t.value==`number`?OD(t.value):t.value;if(e.transportProvider!==`openrouter`||n===void 0||!Z_(ZE)(n))return!1}else if(typeof t.value!=`number`||!Z_(QC)(t.value)||(e.transportProvider===`typesafe`?![`usage.input_tokens`,`usage.output_tokens`,`usage.total_tokens`].includes(t.path):[`usage.input_tokens`,`usage.output_tokens`].includes(t.path))||t.path===`usage.prompt_tokens_details.cache_write_tokens`&&e.transportProvider!==`openrouter`)return!1}if((i.get(`model`)??null)!==e.model||(i.get(`provider`)??null)!==e.provider)return!1;let a=e.transportProvider===`typesafe`?`usage.input_tokens`:`usage.prompt_tokens`,o=e.transportProvider===`typesafe`?`usage.output_tokens`:`usage.completion_tokens`;if(e.inputTotalTokens!==null&&i.get(a)!==e.inputTotalTokens||e.outputTokens!==null&&i.get(o)!==e.outputTokens||e.receipt.reason!==`invalid-usage`&&(typeof i.get(a)==`number`&&e.inputTotalTokens===null||typeof i.get(o)==`number`&&e.outputTokens===null||typeof i.get(`usage.prompt_tokens_details.cached_tokens`)==`number`&&e.cacheReadTokens===null||typeof i.get(`usage.prompt_tokens_details.cache_write_tokens`)==`number`&&e.cacheWriteTokens===null))return!1;let s=i.get(`usage.total_tokens`);if(typeof s==`number`&&(e.inputTotalTokens!==null&&e.inputTotalTokens>s||e.outputTokens!==null&&e.outputTokens>s||e.inputTotalTokens!==null&&e.outputTokens!==null&&e.inputTotalTokens+e.outputTokens!==s)||e.transportProvider===`typesafe`&&t.some(e=>e!==null)||e.transportProvider!==`typesafe`&&e.inputTotalTokens===0&&t.some(e=>e!==0)||e.cacheReadTokens!==null&&i.get(`usage.prompt_tokens_details.cached_tokens`)!==e.cacheReadTokens&&(e.inputTotalTokens!==0||e.cacheReadTokens!==0||i.has(`usage.prompt_tokens_details.cached_tokens`))||e.cacheWriteTokens!==null&&i.get(`usage.prompt_tokens_details.cache_write_tokens`)!==e.cacheWriteTokens&&(e.inputTotalTokens!==0||e.cacheWriteTokens!==0||i.has(`usage.prompt_tokens_details.cache_write_tokens`))||e.inputTokens!==null&&(e.inputTotalTokens===null||e.cacheReadTokens===null||e.cacheWriteTokens===null||e.inputTokens!==e.inputTotalTokens-e.cacheReadTokens-e.cacheWriteTokens)||e.inputTotalTokens!==null&&e.cacheReadTokens!==null&&e.cacheWriteTokens!==null&&e.inputTokens===null)return!1;let c=i.get(`usage.cost`);if(c!=null&&e.cost===null)return!1;if(e.cost!==null){let t=c,n=typeof t==`number`?OD(t):t;if(e.transportProvider!==`openrouter`||e.cost.currency!==`USD`||e.cost.source.id!==`openrouter.usage.cost`||e.cost.amount!==n)return!1}return!0}function sO(e){let t=e.pricing,n=t.match===`exact`?t.requestModel:t.requestModel.includes(`/`)?`${t.requestModel.slice(0,t.requestModel.indexOf(`/`))}/*`:void 0;if(t.selector!==n||e.source.id!==t.source.id||t.source.profileDigest!==jD({basis:t.basis,currency:t.currency,source:{kind:t.source.kind,id:t.source.id,asOf:t.source.asOf},requestModel:t.requestModel,selector:t.selector,match:t.match,ratesPerMTok:{input:t.ratesPerMTok.input,output:t.ratesPerMTok.output,cacheRead:t.ratesPerMTok.cacheRead,cacheWrite:t.ratesPerMTok.cacheWrite}}))return!1;let r=new Map(e.charges.map(e=>[e.bucket,e])),i=new Map(e.missing.map(e=>[e.bucket,e]));if(r.size!==e.charges.length||i.size!==e.missing.length||TD.some(e=>Number(r.has(e))+Number(i.has(e))!==1))return!1;for(let n of e.charges){let e=cO(t.ratesPerMTok,n.bucket);if(n.ratePerMTok!==e||n.tokens>0&&e===null||n.amount!==(e===null?`0`:kD(e,n.tokens)))return!1}return e.state===(i.size===0?`complete`:`partial`)&&e.amount===AD(e.charges.map(e=>e.amount))}function cO(e,t){switch(t){case`input`:return e.input;case`output`:return e.output;case`cache-read`:return e.cacheRead;case`cache-write`:return e.cacheWrite}}function lO(e,t){switch(t){case`input`:return e.inputTokens;case`output`:return e.outputTokens;case`cache-read`:return e.cacheReadTokens;case`cache-write`:return e.cacheWriteTokens}}function uO(e){let t=e=>[sS(`record-attachment-schema-invalid`,e)];if(e.calls.length>JD.maximumCalls)return t([`calls`]);let n=new Map,r=new Map,i=new Map,a=new Map;for(let o of e.calls){if(!oO(o)||n.has(o.callId)||r.has(o.entryIndex)&&r.get(o.entryIndex)!==o.entryId||i.has(o.entryId)&&i.get(o.entryId)!==o.entryIndex)return t([`calls`,`callId`]);n.set(o.callId,o),r.set(o.entryIndex,o.entryId),i.set(o.entryId,o.entryIndex);let e=`${o.entryIndex}:${o.logicalOrdinal}`,s=a.get(e);if(s===void 0&&(s={operation:o.operation,model:o.requestModel,provider:o.transportProvider,ordinals:new Set},a.set(e,s)),s.operation!==o.operation||s.model!==o.requestModel||s.provider!==o.transportProvider)return t([`calls`,`logicalOrdinal`]);s.ordinals.add(o.transmissionOrdinal)}for(let e of a.values())for(let n=1;n<=e.ordinals.size;n++)if(!e.ordinals.has(n))return t([`calls`,`transmissionOrdinal`]);let o=new Set;for(let r of e.priceReceipts){let e=n.get(r.callId);if(e===void 0||o.has(r.callId)||e.cost!==null||r.pricing.requestModel!==e.requestModel||!sO(r))return t([`priceReceipts`,`callId`]);o.add(r.callId);let i=new Map(r.charges.map(e=>[e.bucket,e])),a=new Map(r.missing.map(e=>[e.bucket,e]));for(let n of TD){let o=lO(e,n),s=cO(r.pricing.ratesPerMTok,n),c=i.get(n);if(o===null?c!==void 0||a.get(n)?.reason!==`tokens-unknown`:o===0||s!==null?c?.tokens!==o:c!==void 0||a.get(n)?.reason!==`rate-unknown`)return t([`priceReceipts`,`charges`])}}return[]}function dO(e,t){for(let n of[`modelSlot`,`provider`,`model`]){let r=e[n],i=t[n];if(r!==i)return r===null?-1:i===null?1:r<i?-1:1}return 0}function fO(e,t){return e.entryIndex-t.entryIndex||e.logicalOrdinal-t.logicalOrdinal||e.transmissionOrdinal-t.transmissionOrdinal}var pO=Object.freeze({completed:`completed`,failed:`failed`,cancelled:`cancelled`,interrupted:`interrupted`}),mO=[pO.completed,pO.failed,pO.cancelled,pO.interrupted],hO=Object.freeze({attemptSetup:`attempt.setup`,sandboxPrepare:`sandbox.prepare`,agentEnsure:`agent.ensure`,evalRun:`eval.run`,agentSend:`agent.send`,sandboxCommand:`sandbox.command`,assertionEvaluate:`assertion.evaluate`,verdictFold:`verdict.fold`,attemptTeardown:`attempt.teardown`,runSetup:`run.setup`,runDiscovery:`run.discovery`,runPlan:`run.plan`,runDispatch:`run.dispatch`,runTeardown:`run.teardown`,collection:`collection`}),gO=[hO.attemptSetup,hO.sandboxPrepare,hO.agentEnsure,hO.evalRun,hO.agentSend,hO.sandboxCommand,hO.assertionEvaluate,hO.verdictFold,hO.attemptTeardown];hO.attemptSetup,hO.sandboxPrepare,hO.agentEnsure,hO.evalRun,hO.sandboxCommand,hO.assertionEvaluate,hO.verdictFold,hO.attemptTeardown;var _O=[hO.runSetup,hO.runDiscovery,hO.runPlan,hO.runDispatch,hO.runTeardown],vO=[hO.collection];[...gO,...vO],[..._O,...vO];var yO=[hO.attemptSetup,hO.sandboxPrepare,hO.agentEnsure,hO.evalRun,hO.sandboxCommand,hO.attemptTeardown],bO=Object.freeze({...pO,unknown:`unknown`}),xO=[bO.completed,bO.failed,bO.cancelled,bO.interrupted,bO.unknown],SO=Object.freeze({timeout:`timeout`,cancelled:`cancelled`,transportLost:`transport-lost`}),CO=[SO.timeout,SO.cancelled,SO.transportLost],wO=Object.freeze({spawnFailed:`spawn-failed`,cancelledBeforeStart:`cancelled-before-start`}),TO=[wO.spawnFailed,wO.cancelledBeforeStart],EO=nw,DO=G([`adapter`,`session-manager`,`sandbox-wrapper`,`runner-clock`,`runner-diagnostic-sink`,`attempt-finalizer`,`run-teardown`]),OO=G([`turn`,`turn-item`,`usage-observation`,`turn-context`,`command`,`stdout`,`stderr`,`activity`,`diagnostic`,`diagnostic-cause`,`value-byte`,`content-byte`]),kO=W([H({code:G([`capture-failed`,`capture-interrupted`]),stage:DO,target:OO}),H({code:G([`collection-cap-reached`,`unsupported-input`]),target:OO,omittedAtLeast:$C}),H({code:G([`text-truncated`,`redacted`,`invalid-utf8-replaced`,`unsafe-control-stripped`]),target:OO,replacementOrOmittedCount:$C})]);function AO(e){switch(e.code){case`capture-failed`:case`capture-interrupted`:return[e.code,e.stage,e.target].join(`\0`);case`collection-cap-reached`:case`unsupported-input`:return[e.code,e.target,String(e.omittedAtLeast)].join(`\0`);case`text-truncated`:case`redacted`:case`invalid-utf8-replaced`:case`unsafe-control-stripped`:return[e.code,e.target,String(e.replacementOrOmittedCount)].join(`\0`)}}function jO(e){let t,n=new Set;for(let r of e){let e=AO(r);if(n.has(e)||t!==void 0&&t>=e)return!1;n.add(e),t=e}return!0}var MO=W([H({state:R(`complete`),limitations:aw}),H({state:R(`partial`),limitations:gv(kO).pipe(q(Y(jO)))})]);Object.freeze({maximumBlobs:1,maximumBlobBytes:1,maximumTotalBytes:1});var NO={itemId:eD,eventId:rD,sessionSequence:qE},PO=W([H({state:R(`exact`),toolOccurrenceId:iD}),H({state:R(`unavailable`),reason:G([`orphan-finish`,`ambiguous-operation`])})]),FO=W([H({...NO,kind:R(`message`),role:G([`user`,`assistant`]),text:YE}),H({...NO,kind:R(`tool-start`),toolOccurrenceId:iD,tool:XE,inputSummary:YE}),H({...NO,kind:R(`tool-finish`),occurrence:PO,outcome:G([`completed`,`rejected`,`failed`,`cancelled`]),outputSummary:YE}),H({...NO,kind:G([`thinking-summary`,`compaction`,`context-injection`]),summary:YE}),H({...NO,kind:R(`subagent`),state:G([`started`,`completed`,`failed`]),label:JE,summary:YE}),H({...NO,kind:R(`input-request`),state:G([`requested`,`answered`,`cancelled`]),promptSummary:YE,responseSummary:K(YE)}),H({...NO,kind:G([`skill-load`,`conversation-error`]),code:JE,summary:YE})]),IO={itemId:eD,sequence:$C},LO=W([H({...IO,kind:R(`message`),role:G([`user`,`assistant`]),text:YE}),H({...IO,kind:R(`tool-call`),callId:nD,tool:XE,inputSummary:YE}),H({...IO,kind:R(`tool-result`),callId:nD,outcome:G([`completed`,`rejected`,`failed`,`cancelled`]),outputSummary:YE}),H({...IO,kind:G([`thinking-summary`,`compaction`,`context-injection`]),summary:YE}),H({...IO,kind:R(`subagent`),state:G([`started`,`completed`,`failed`]),label:JE,summary:YE}),H({...IO,kind:R(`input-request`),state:G([`requested`,`answered`,`cancelled`]),promptSummary:YE,responseSummary:K(YE)}),H({...IO,kind:G([`skill-load`,`conversation-error`]),code:JE,summary:YE})]),RO=W([H({usageObservationId:sD,kind:R(`token-bucket`),provider:JE,bucket:G([`input`,`output`,`cache-read`,`cache-write`,`reasoning`,`other`]),tokens:KE}),H({usageObservationId:sD,kind:R(`request`),provider:JE,requestKind:G([`model`,`tool`])}),H({usageObservationId:sD,kind:R(`provider-cost`),provider:JE,amount:z.pipe(q(Y(e=>/^(?:0|[1-9][0-9]*)(?:\.[0-9]*[1-9])?$/u.test(e)))),currency:QE})]),zO=G([`complete`,`partial`,`unavailable`]),BO=z.pipe(q(Y(e=>e.trim().length>0&&!!Qw(e,16384),{identifier:`AgentTurnEvidenceCoverageReason`,description:`non-empty durable coverage reason within the conversation text limit`}))),VO=W([H({status:R(`complete`)}),H({status:G([`partial`,`unavailable`]),reason:BO})]),HO=H({events:VO,actions:VO,messages:VO,usage:VO,status:VO,data:VO}),UO=W([H({state:R(`recorded`),status:G([`completed`,`failed`,`waiting`]),evidenceCoverage:H({events:zO,actions:zO,messages:zO,usage:zO,status:zO,data:zO})}),H({state:R(`unavailable`),reason:G([`send-failed`,`send-interrupted`])})]),WO=W([H({state:R(`recorded`),status:G([`completed`,`failed`,`waiting`]),evidenceCoverage:HO}),H({state:R(`unavailable`),reason:G([`send-failed`,`send-interrupted`])})]),GO={segmentId:EO,turnId:$E,sequence:$C,outcome:G(mO),usage:U(RO)},KO=H({...GO,sessionId:aD,terminal:WO,items:U(FO)}),qO=H({...GO,terminal:WO,items:U(LO)}),JO=H({...GO,sessionId:aD,terminal:UO,items:U(FO)}),YO=H({...GO,terminal:UO,items:U(LO)});H({collection:MO,segments:U(YO)}).pipe(fv({collection:`collection-data`,segments:`segments-data`})),W([H({state:R(`current`),collection:MO,segments:U(JO)}).pipe(fv({collection:`collection-data`,segments:`segments-data`})),H({state:R(`legacy`),collection:MO,segments:U(YO)}).pipe(fv({collection:`collection-data`,segments:`segments-data`}))]),W([H({state:R(`current`),collection:MO,segments:U(KO)}).pipe(fv({collection:`collection-data`,segments:`segments-data`})),H({state:R(`legacy`),collection:MO,segments:U(qO)}).pipe(fv({collection:`collection-data`,segments:`segments-data`}))]);var XO=z.pipe(q(Y(e=>new TextEncoder().encode(e).byteLength>0&&new TextEncoder().encode(e).byteLength<=256,{identifier:`ExecutionTraceIdentifier`}))),ZO=z.pipe(q(Y(e=>new TextEncoder().encode(e).byteLength<=512,{identifier:`ExecutionTraceSummary`}))),QO=B.pipe(q(Y(e=>Number.isSafeInteger(e)&&e>=0,{identifier:`ExecutionTraceNonNegativeSafeInteger`})));B.pipe(q(Y(e=>Number.isSafeInteger(e)&&e>0,{identifier:`ExecutionTracePositiveSafeInteger`})));var $O=B.pipe(q(Y(Number.isFinite,{identifier:`ExecutionTraceFiniteNumber`}))),ek=z.pipe(q(Y(e=>/^[0-9a-f]{64}$/u.test(e),{identifier:`ExecutionTraceSha256`}))),tk=yv(()=>W([sv,V,$O,z,U(tk),pv(z,tk)])),nk=W([H({state:R(`complete`),limitations:hv([])}),H({state:R(`partial`),limitations:gv(H({code:XO,message:z}))})]),rk=H({scopeId:XO,label:z,boundary:tk}),ik=W([H({relation:XO,targetKey:XO}),H({relation:XO,unresolved:H({sourceEventId:XO,reason:z})})]),ak=G([`user`,`assistant`,`system`,`other`]),ok=U(H({label:z,value:W([z,$O,V,sv])})),sk=W([H({kind:R(`text`),text:z}),H({kind:R(`message`),role:ak,speaker:I(z),text:z}),H({kind:R(`fields`),fields:ok}),H({kind:R(`code`),language:I(z),text:z}),H({kind:R(`image`),artifactId:XO,alt:z})]),ck=W([H({kind:R(`text`),text:z}),H({kind:R(`message`),role:ak,speaker:I(z),text:z}),H({kind:R(`fields`),fields:ok}),H({kind:R(`code`),language:I(z),text:z}),H({kind:R(`image`),artifactId:XO,alt:z,mediaType:G([`image/png`,`image/jpeg`,`image/webp`,`image/gif`]),byteLength:QO,sha256:ek})]),lk=H({key:XO,label:z,artifactId:XO,pointer:z}),uk=H({key:XO,type:XO,source:H({id:XO,eventId:I(XO),sequence:I(QO)}),actor:I(H({id:XO,label:I(z)})),time:I(H({clockId:XO,value:$O,unit:XO})),summary:ZO,payload:I(tk),links:I(U(ik)),evidence:I(U(lk)),scopeMemberships:I(U(H({scopeId:XO,state:G([`included`,`excluded`,`unknown`])}))),display:I(U(sk))});H({traceId:XO,schema:H({id:XO}),collection:nk,scopes:U(rk),events:U(uk)});var dk=H({kind:R(`trace-header`),traceId:XO,sourceTraceId:XO,schema:H({id:XO,revision:I(QO)}),collection:nk,scopes:U(rk)}),fk=H({kind:R(`event`),traceId:XO,eventId:XO,ordinal:QO,key:XO,type:XO,source:H({id:XO,eventId:I(XO),sequence:I(QO)}),actor:I(H({id:XO,label:I(z)})),time:I(H({clockId:XO,value:$O,unit:XO})),summary:ZO,payload:I(tk),links:U(ik),evidence:U(H({key:XO,label:z,artifactId:XO,pointer:z,evidenceId:XO,artifactSha256:ek,targetSha256:ek,targetByteLength:QO})),scopeMemberships:U(H({scopeId:XO,state:G([`included`,`excluded`,`unknown`])})),display:I(gv(ck))});W([dk,fk]),Object.freeze({maximumTraces:32,maximumEvents:1e5,maximumCanonicalInputBytes:67108864,maximumPayloadBytes:16384,maximumSummaryBytes:512,maximumLinksPerEvent:32,maximumEvidencePerEvent:8,maximumScopesPerEvent:8,maximumJsonDepth:32,maximumIdentifierBytes:256,maximumEvidenceSourceBytes:268435456,maximumEvidenceTargetBytes:134217728,maximumDetailPreviewBytes:2048,maximumDetailBytes:524288,maximumOutlineEvents:32,maximumOutlineBytes:65536,maximumDisplayBlocksPerEvent:4,maximumDisplayBytesPerEvent:8192,maximumDisplayFields:16,maximumDisplayLabelBytes:128,maximumDisplayAltBytes:512,maximumDisplayPreviewBytes:1024,maximumOutlineEventBytes:8192,maximumDisplayInlineImageBytes:16777216});var pk=Object.freeze({maximumWindows:256,maximumChangesPerWindow:1e4,maximumRetainedChanges:1e4,maximumTextRevisionBytes:1048576,maximumContents:2e4,maximumContentBytes:1048576,maximumTotalContentBytes:134217728,maximumPayloadJsonBytes:16777216,maximumPolicyEntries:256,maximumPolicyEntryUtf8Bytes:4096}),mk=new TextEncoder;function hk(e){return mk.encode(e).byteLength}function gk(e){let t,n=new Set;for(let r of e){if(n.has(r)||t!==void 0&&$b(t,r)>=0)return!1;n.add(r),t=r}return!0}function _k(e){return gk(e.map(Ck))}var vk=z.pipe(q(Y(e=>/^(?:turn[1-9][0-9]*|session[1-9][0-9]*\/turn[1-9][0-9]*)$/.test(e),{identifier:`FileChangesWindowId`,description:`a canonical agent send-window id`}))),yk=U(z.pipe(q(Y(e=>hk(e)<=pk.maximumPolicyEntryUtf8Bytes,{identifier:`FileChangesPolicyEntry`,description:`a File Changes include or ignore entry within its UTF-8 budget`})))).pipe(q(Y(e=>e.length<=pk.maximumPolicyEntries&&gk(e),{identifier:`FileChangesPolicyEntries`,description:`an ASCII-canonical, deduplicated bounded policy entry sequence`}))),bk=H({kind:R(`agent-send-window-endpoints`),policy:H({defaultPolicy:R(`niceeval.sandbox-ledger/default-excludes/v1`),include:yk,ignore:yk})}),xk=G([`checkpoint`,`export`,`finalizer-export`,`normalize`]),Sk=W([H({code:G([`capture-failed`,`capture-interrupted`]),stage:xk,atWindowId:K(vk)}),H({code:R(`collection-cap-reached`),target:G([`window`,`change`,`content`,`value`,`content-byte`]),omittedAtLeast:$C,atWindowId:K(vk)}),H({code:R(`unsupported-input`),target:R(`endpoint-metadata`),omittedAtLeast:$C})]);function Ck(e){switch(e.code){case`capture-failed`:case`capture-interrupted`:return[e.code,e.stage,e.atWindowId??``].join(`\0`);case`collection-cap-reached`:return[e.code,e.target,e.atWindowId??``,String(e.omittedAtLeast)].join(`\0`);case`unsupported-input`:return[e.code,e.target,String(e.omittedAtLeast)].join(`\0`)}}var wk=W([H({state:R(`complete`),limitations:aw}),H({state:R(`partial`),limitations:gv(Sk).pipe(q(Y(_k,{identifier:`FileChangesPartialLimitations`,description:`a deterministic deduplicated File Changes limitation sequence`})))})]),Tk=W([H({kind:R(`text`),sha256:bx,byteLength:QC.pipe(q(Y(e=>e<=pk.maximumTextRevisionBytes,{identifier:`FileChangesTextRevisionByteLength`,description:`a retained text revision within the File Changes text budget`}))),content:W([H({state:R(`available`),content:ey.pipe(ny.maximumBytes(pk.maximumContentBytes))}),H({state:R(`omitted`),reason:R(`collection-cap`)})])}),H({kind:R(`elided`),reason:G([`binary`,`oversized-text`]),byteLength:QC}),H({kind:R(`unavailable`),reason:G([`unsupported-input`,`capture-failed`,`capture-interrupted`])})]),Ek=W([H({state:R(`absent`)}),H({state:R(`present`),revision:Tk})]);H({attribution:bk,collection:wk,windows:U(H({windowId:vk,sequence:$C,changes:U(H({changeId:Sx,path:Tx,kind:G([`created`,`modified`,`deleted`]),before:Ek,after:Ek}).pipe(q(Y(e=>{switch(e.kind){case`created`:return e.before.state===`absent`&&e.after.state===`present`;case`modified`:return e.before.state===`present`&&e.after.state===`present`;case`deleted`:return e.before.state===`present`&&e.after.state===`absent`}},{identifier:`FileChange`,description:`a coherent created, modified, or deleted endpoint transition`})))).pipe(q(Y(e=>e.length<=pk.maximumChangesPerWindow&&gk(e.map(e=>e.path)),{identifier:`FileChangesWindowChanges`,description:`a bounded ASCII-path-canonical unique window change sequence`})))}))}).pipe(fv({attribution:`attribution-data`,collection:`collection-data`,windows:`windows-data`}));var Dk=G([`available`,`partial`,`unavailable`,`empty`,`unsupported`,`failed`]),Ok=z.pipe(q(Y(ET))),kk=z.pipe(q(Y(kT))),Ak=z.pipe(q(Y(MT))),jk=W([H({kind:R(`redacted`),fieldCount:B}),H({kind:R(`sampled`),captured:B,knownTotal:I(B)}),H({kind:R(`truncated`),omittedBytes:B}),H({kind:R(`provider-limited`)}),H({kind:R(`capacity-limited`),capturedItems:B,knownTotalItems:B,omittedBytes:K(B)})]),Mk=W([H({code:G([`assertions-not-recorded`,`assertions-revision-unsupported`,`assertions-current-invalid`]),locator:z}),H({code:G([`attempt-origin-missing`,`attempt-not-observed`]),runId:z,slotId:z,evalId:z,attemptOrdinal:B}),H({code:R(`score-contribution-unavailable`),locator:z,entryId:z,reason:G([`source-unavailable`,`evaluation-errored`,`not-applicable`])}),H({code:R(`score-partial`),locator:K(z)})]),Nk=H({identity:H({kind:R(`attempt`),locator:z})}),Pk=H({state:Dk,value:K(B),samples:B,total:B,basis:G([`slot`,`eval`]),issues:U(Mk),refs:U(Nk),unit:I(G([`points`,`USD`,`ms`,`tokens`])),bounds:I(H({min:B,max:B}))}),Fk=H({...Pk.fields,source:K(G([`reported`,`estimated`,`mixed`]))}),Ik=W([H({identity:H({kind:R(`attempt`),locator:z}),state:G([`not-recorded`,`unsupported`,`failed`])}),H({identity:H({kind:R(`attempt`),locator:z}),entryId:z,groupPath:U(z),state:G([`complete`,`partial`,`unavailable`,`not-applicable`]),reason:I(G([`sampled`,`truncated`,`redacted`,`provider-limited`,`capacity-limited`,`not-collected`,`source-unavailable`,`producer-failed`,`optional-material`,`unsupported-subject`])),limitations:U(jk)})]),Lk={evaluationKind:G([`pass`,`points`,`mixed`]),denominator:H({expected:B,observed:B,classified:B,missing:B}),verdict:H({tally:H({passed:B,failed:B,errored:B,skipped:B}),passRate:Pk}),score:Pk,costUSD:Fk,durationMs:Pk,tokens:Pk,coverage:U(Ik),issues:U(Mk)},Rk=H({...qS.fields,verdict:K(G([`passed`,`failed`,`errored`,`skipped`])),score:Pk,costUSD:Fk,durationMs:Pk,tokens:Pk}),zk=W([H({state:R(`available`),value:z}),H({state:R(`mixed`)}),H({state:R(`unavailable`)})]),Bk=pv(z,zk),Vk=H({runId:z,slotId:z,evalId:z,attemptOrdinal:B,labels:Bk,publication:W([KS,Rk,JS])}),Hk=H({groupPath:U(z),...Lk}),Uk=H({experimentId:z,adapter:W([H({state:R(`available`),value:cC}),H({state:R(`mixed`)})]),model:zk,labels:Bk,groups:U(Hk),...Lk}),Wk=H({experimentId:z,evalId:z,groupPath:U(z),members:U(Vk),...Lk}),Gk=H({totals:H(Lk),experiments:U(Uk),cells:U(Wk)}),Kk=H({costSummary:yv(()=>$A),modelUsage:H({attempts:U(H({locator:z,originRunId:z,usage:yv(()=>H({state:sj.fields.state,configuredModels:sj.fields.configuredModels,modelGroups:sj.fields.modelGroups,judgeUsage:ij,totalCosts:sj.fields.totalCosts,totals:sj.fields.totals}))})),totalAttemptCount:QC,omittedAttemptCount:QC,unresolvedAttemptCount:QC}).check(Y(e=>e.attempts.length<=64&&e.totalAttemptCount===e.attempts.length+e.omittedAttemptCount&&e.attempts.every((t,n)=>n===0||e.attempts[n-1].originRunId<t.originRunId||e.attempts[n-1].originRunId===t.originRunId&&e.attempts[n-1].locator<t.locator))),experiment:Uk,cells:U(Wk)}),qk=H({runId:px,experimentId:_x,state:WS,context:I(uC),startedAt:Ex,completedAt:I(Ex),expectedSlots:U(VC)}),Jk=U(QS),Yk=W([H({state:R(`not-scored`)}),H({state:R(`complete`),earned:B,possible:B}),H({state:R(`unavailable`),earned:B,possible:B,unavailable:B})]),Xk=K(G([`passed`,`failed`,`errored`,`skipped`])),Zk=H({channel:G([`events`,`actions`,`messages`,`usage`,`status`,`data`]),status:G([`complete`,`partial`,`unavailable`]),reason:I(z)}),Qk=W([Zk,H({owner:R(`assertion-material`),state:R(`partial`),reason:G([`sampled`,`truncated`,`redacted`,`provider-limited`,`capacity-limited`]),limitations:U(jk)}),H({owner:R(`assertion-material`),state:R(`unavailable`),reason:G([`not-collected`,`source-unavailable`,`producer-failed`]),limitations:U(jk)}),H({owner:R(`assertion-material`),state:R(`not-applicable`),reason:G([`optional-material`,`unsupported-subject`]),limitations:U(jk)})]),$k=H({state:G([`available`,`not-recorded`,`partial`,`unavailable`])}),eA=H({assertions:$k,trace:$k,sources:$k,diff:$k,artifacts:$k,timing:$k,usage:$k,conversation:$k,commands:$k,diagnostics:$k}),tA=H({state:G([`available`,`not-recorded`,`invalid`]),entries:U(H({entryId:z,display:H({label:I(z),key:I(z),groupPath:U(z)})}))}),nA=W([H({state:R(`not-recorded`),entryCount:R(0)}),H({state:R(`available`),entryCount:B,sourceSiteCount:B}),H({state:G([`unsupported`,`failed`,`invalid`]),entryCount:R(0)})]),rA=H({core:WC,locator:z,originRun:HC,targets:U(H({runId:z,member:UC})),evidence:nA,assertions:tA,sections:eA,verdict:Xk,score:Yk,evidenceCoverage:U(Zk),limitations:U(Qk)}),iA=W([H({state:R(`available`),text:z}),H({state:R(`omitted`),reason:R(`inspection-result-byte-limit`),byteLength:B,byteLimit:B})]),aA=W([H({state:R(`mapped`),sourceItemId:z,sha256:z}),H({state:R(`unmapped`),reason:G([`source-snapshot-not-recorded`,`position-unrepresentable`])})]),oA=H({entryId:z,sourceOrder:B,role:G([`declaration`,`threshold`,`score`,`gate`,`optional`,`stop`]),start:H({line:B,column:B}),end:H({line:B,column:B}),source:aA}),sA=W([H({state:G([`not-recorded`,`invalid`]),sourceSites:hv([]),hasMoreSourceSites:R(!1),omittedSourceSiteCount:R(0)}),H({state:R(`available`),sourceSites:U(oA),hasMoreSourceSites:V,omittedSourceSiteCount:B})]),cA=H({state:G([`available`,`not-recorded`,`invalid`]),items:U(H({sourceItemId:z,path:z,byteLength:B,sha256:z,content:iA})),hasMore:V,omittedItemCount:B,assertions:sA}),lA=G([`complete`,`partial`,`not-recorded`,`invalid`]),uA=W([kO,H({issue:z}),H({source:R(`agent-turns`),turnId:$E,channel:G([`conversation`,`events`,`actions`,`messages`,`status`,`data`]),state:G([`partial`,`unavailable`]),reason:z}),H({source:R(`turn-contexts`),state:G([`partial`,`not-recorded`,`invalid`]),limitations:U(W([kO,H({issue:z})]))})]),dA=G(mO),fA=W([H({state:R(`not-recorded`)}),H({state:R(`unmapped`),reason:G([`location-not-captured`,`source-snapshot-not-recorded`,`position-unrepresentable`]),sessionIndex:B,turnIndex:B,sourceOrder:K(B)}),H({state:R(`mapped`),sourceItemId:xx,sha256:bx,start:H({line:B,column:B}),end:H({line:B,column:B}),sessionIndex:B,turnIndex:B,sourceOrder:B})]),pA=W([H({state:R(`complete`)}),H({state:G([`partial`,`unavailable`]),reason:z})]),mA=W([H({state:R(`recorded`),status:G([`completed`,`failed`,`waiting`]),coverage:H({events:pA,actions:pA,messages:pA,status:pA,data:pA})}),H({state:R(`unavailable`),reason:G([`send-failed`,`send-interrupted`]),coverage:H({state:R(`unavailable`),reason:G([`send-failed`,`send-interrupted`])})})]),hA=W([kO,H({issue:z})]),gA=H({sourceItemId:xx,sha256:bx,start:H({line:B,column:B}),end:H({line:B,column:B})}),_A=H({state:lA,limitations:U(hA),limitationsTruncated:V,omittedLimitationCount:B,items:U(H({diagnosticId:z,sequence:B,turnId:K(z),phase:G([`attempt.setup`,`sandbox.prepare`,`agent.ensure`,`eval.run`,`agent.send`,`sandbox.command`,`assertion.evaluate`,`verdict.fold`,`attempt.teardown`]),kind:G([`advisory`,`execution-error`]),code:z,summary:z,summaryTruncated:V,causes:U(H({code:z,summary:z,summaryTruncated:V})),causesTruncated:V,omittedCauseCount:B,redaction:W([H({state:R(`none`)}),H({state:R(`applied`),replacements:B})]),sourceFrame:K(gA)})),hasMore:V,omittedDiagnosticCount:B}),vA=H({preview:z,omittedBytes:B}),yA=G([`user`,`assistant`,`system`,`other`]),bA=W([H({state:R(`absent`)}),H({state:R(`present`),blocks:U(W([H({kind:R(`text`),text:vA}),H({kind:R(`message`),role:yA,speaker:I(z),text:vA}),H({kind:R(`fields`),fields:U(H({label:z,value:W([vA,B,V,sv])}))}),H({kind:R(`code`),language:I(z),text:vA}),H({kind:R(`image`),artifactId:z,alt:z,mediaType:z,byteLength:B,sha256:z})]))})]),xA={itemId:Ok,turnId:z,sequence:B},SA=W([H({...xA,kind:R(`message`),role:G([`user`,`assistant`]),text:z,textTruncated:V}),H({...xA,kind:R(`tool-call`),tool:z,input:z,inputTruncated:V,toolOccurrenceId:I(kk)}),H({...xA,kind:R(`tool-result`),outcome:G([`completed`,`rejected`,`failed`,`cancelled`]),output:z,outputTruncated:V,toolOccurrenceId:I(kk)}),H({...xA,kind:G([`thinking-summary`,`compaction`,`context-injection`]),summary:z,summaryTruncated:V}),H({...xA,kind:R(`subagent`),state:G([`started`,`completed`,`failed`]),label:z,summary:z,summaryTruncated:V}),H({...xA,kind:R(`input-request`),state:G([`requested`,`answered`,`cancelled`]),prompt:z,promptTruncated:V,response:K(z),responseTruncated:V}),H({...xA,kind:G([`skill-load`,`conversation-error`]),code:z,summary:z,summaryTruncated:V})]),CA=W([H({kind:R(`exited`),exitCode:B}),H({kind:R(`terminated`),reason:G(CO)}),H({kind:R(`not-started`),reason:G(TO)})]),wA=H({execution:H({state:lA,limitations:U(W([H({code:R(`capture-failed`),stage:R(`adapter`)}),H({code:R(`capture-interrupted`),stage:R(`attempt-finalizer`)}),H({code:R(`collection-cap-reached`),omittedAtLeast:B}),H({code:R(`legacy-source-state`),state:G([`partial`,`invalid`]),message:z})])),traces:U(dk.pipe(uv({eventCount:B}))),events:U(H({traceId:z,eventId:z,origin:W([H({kind:R(`execution-event`),eventId:z}),H({kind:R(`agent-item`),itemId:Ok})]),ordinal:B,type:z,source:fk.fields.source,actor:fk.fields.actor,time:fk.fields.time,summary:z,links:fk.fields.links,evidence:U(H({evidenceId:z,key:z,label:z})),scopeMemberships:fk.fields.scopeMemberships,display:bA})),identityIndex:H({traceIds:U(z),omittedTraceIdCount:B,eventIds:U(z),omittedEventIdCount:B,evidenceIds:U(z),omittedEvidenceIdCount:B}),hasMore:V,omittedEventCount:B,continuation:I(z)}),conversation:H({state:lA,limitations:U(uA),limitationsTruncated:V,omittedLimitationCount:B,turns:U(H({turnId:z,sequence:B,sessionId:I(aD),outcome:dA,terminal:mA,context:fA})),turnsTruncated:V,omittedTurnCount:B,items:U(SA),itemsTruncated:V,omittedItemCount:B}),commands:H({state:lA,limitations:U(uA),limitationsTruncated:V,omittedLimitationCount:B,items:U(H({commandId:Ak,phase:G(yO),outcome:CA})),hasMore:V,omittedCommandCount:B}),diagnostics:_A,identityIndex:H({itemIds:U(Ok),omittedItemIdCount:B,toolOccurrenceIds:H({ids:U(kk),omittedIdCount:B}),commandIds:U(Ak),omittedCommandIdCount:B})}),TA={itemId:Ok,turnId:z,turnSequence:B,turnOutcome:dA,sessionId:I(z),eventId:I(z),sequence:I(B)},EA=W([H({...TA,kind:R(`message`),role:G([`user`,`assistant`]),text:z}),H({...TA,kind:R(`tool-call`),toolOccurrenceId:I(kk),tool:z,input:z}),H({...TA,kind:R(`tool-result`),toolOccurrenceId:I(kk),outcome:G([`completed`,`rejected`,`failed`,`cancelled`]),output:z}),H({...TA,kind:G([`thinking-summary`,`compaction`,`context-injection`]),summary:z}),H({...TA,kind:R(`subagent`),state:G([`started`,`completed`,`failed`]),label:z,summary:z}),H({...TA,kind:R(`input-request`),state:G([`requested`,`answered`,`cancelled`]),prompt:z,response:K(z)}),H({...TA,kind:G([`skill-load`,`conversation-error`]),code:z,summary:z})]),DA=H({turnId:z,sequence:B,outcome:dA}),OA=W([H({kind:R(`shell`),command:z}),H({kind:R(`argv`),executable:z,arguments:U(z)})]),kA=W([H({kind:R(`sandbox-default`)}),H({kind:R(`project-relative`),path:z}),H({kind:R(`redacted`)})]),AA=H({text:z,retainedBytes:B,totalSafeUtf8Bytes:B,sha256:z,truncation:H({state:G([`not-truncated`,`truncated`]),omittedSafeUtf8Bytes:B})}),jA=W([H({kind:R(`execution-event`),event:fk,evidence:U(H({evidenceId:z,key:z,label:z,artifactId:z,pointer:z,targetSha256:z,targetByteLength:B,offset:R(0),base64:z,nextOffset:K(B),truncated:V}))}),H({kind:R(`execution-evidence`),evidenceId:z,eventId:z,traceId:z,key:z,label:z,artifactId:z,pointer:z,artifactSha256:z,targetSha256:z,targetByteLength:B,offset:B,base64:z,nextOffset:K(B)}),H({kind:R(`item`),itemId:Ok,item:EA}),H({kind:R(`tool-occurrence`),toolOccurrenceId:kk,call:K(EA),result:K(EA),turn:H({call:K(DA),result:K(DA)})}),H({kind:R(`command`),commandId:Ak,invocation:OA,workingDirectory:kA,outcome:CA,turnId:K(z),phase:G([`attempt.setup`,`sandbox.prepare`,`agent.ensure`,`eval.run`,`sandbox.command`,`attempt.teardown`]),sequence:B,stdout:AA,stderr:AA})]),MA=W([kO,H({issue:z})]),NA=W([H({state:R(`complete`)}),H({state:G([`partial`,`unavailable`]),reason:z})]),PA=W([MA,H({source:R(`agent-turns`),turnId:z,channel:R(`usage`),state:G([`partial`,`unavailable`]),reason:z})]),[FA,IA,LA]=RO.members,RA=W([H({turnId:$E,...FA.fields}),H({turnId:$E,...IA.fields}),H({turnId:$E,...LA.fields})]),zA=H({state:G([`available`,`partial`,`unavailable`]),value:K(B),observationCount:B}),BA=H({currency:z,value:z,observationCount:B}),VA=Z_(QE),HA=z.check(Tv(/^(?:0|[1-9][0-9]*)(?:\.[0-9]*[1-9])?$(?![\s\S])/u)),UA=z.check(Y(e=>VA(e))),WA=H({amount:HA,currency:UA,source:H({kind:G([`reported`,`estimated`]),id:z}),state:G([`complete`,`partial`])}),GA=H({...qD.fields,effectiveCost:K(WA)}),KA=H({state:G([`complete`,`partial`,`unavailable`]),source:K(G([`reported`,`estimated`,`mixed`])),values:U(H({currency:UA,value:HA,source:G([`reported`,`estimated`,`mixed`]),coveredCalls:QC,reportedCalls:QC,estimatedCalls:QC})),totalCalls:QC}),qA=QC.check(Pv(4e3)),JA=H({state:G([`available`,`partial`,`unavailable`]),value:K(QC),observationCount:qA}).check(Y(e=>e.state===`unavailable`==(e.value===null))),YA=W([H({state:R(`not-recorded`)}),H({state:R(`available`),bindings:U(H({modelSlot:GD,model:K(z.check(Tv(/\S/u))),reasoningEffort:K(z.check(Tv(/\S/u))),recordedCalls:K(qA)})).check(Y(e=>e.length<=64&&e.every((t,n)=>n===0||e[n-1].modelSlot<t.modelSlot)))})]),XA=H({modelSlot:K(GD),provider:qD.fields.provider,model:qD.fields.model,recordedCalls:qA.check(Mv(0)),tokens:H({inputTotalTokens:JA,outputTokens:JA,totalTokens:JA}),costs:KA}).check(Y(e=>e.costs.totalCalls===e.recordedCalls&&Object.values(e.tokens).every(t=>t.observationCount<=e.recordedCalls))),ZA=W([H({state:R(`available`),basis:R(`recorded-calls`),groups:U(XA).check(Y(e=>e.length<=64&&e.every((t,n)=>n===0||dO(e[n-1],t)<0))),totalGroupCount:qA,groupsTruncated:V,omittedGroupCount:qA}).check(Y(e=>e.totalGroupCount===e.groups.length+e.omittedGroupCount&&e.groups.length===Math.min(e.totalGroupCount,64)&&e.groupsTruncated===e.omittedGroupCount>0)),H({state:R(`unavailable`),basis:G([`recorded-calls`,`reported-sends`,`unavailable`]),reason:G([`source-invalid`,`usage-not-recorded`,`physical-call-identity-not-recorded`]),groups:hv([]),totalGroupCount:sv,groupsTruncated:R(!1),omittedGroupCount:R(0)})]),QA=H({state:G([`complete`,`partial`,`unavailable`]),values:U(H({currency:UA,value:HA,source:G([`reported`,`estimated`,`mixed`])})),missingSources:U(G([`application`,`judge`])).check(Y(e=>e.length<=2&&e.every((t,n)=>n===0||e[n-1]===`application`&&t===`judge`)))}).check(Y(e=>e.state===(e.missingSources.length===0?`complete`:e.values.length===0?`unavailable`:`partial`)&&e.values.every((t,n)=>n===0||e.values[n-1].currency<t.currency))),$A=H({scope:R(`latest-recorded-slots`),totalCosts:QA,coverage:H({selectedSlotCount:QC,resolvedSlotCount:QC,originAttemptCount:QC,completeAttemptCount:QC,partialAttemptCount:QC,unavailableAttemptCount:QC,unresolvedSlotCount:QC}).check(Y(e=>e.selectedSlotCount===e.resolvedSlotCount+e.unresolvedSlotCount&&e.originAttemptCount<=e.resolvedSlotCount&&e.originAttemptCount===e.completeAttemptCount+e.partialAttemptCount+e.unavailableAttemptCount))}),ej=KA.check(Y(e=>e.totalCalls<=4e3&&e.source===null==(e.values.length===0)&&e.values.every((t,n)=>t.coveredCalls<=t.reportedCalls+t.estimatedCalls&&t.reportedCalls+t.estimatedCalls<=e.totalCalls&&t.source===(t.reportedCalls===0?`estimated`:t.estimatedCalls===0?`reported`:`mixed`)&&(n===0||e.values[n-1].currency<t.currency))&&e.values.reduce((e,t)=>e+t.reportedCalls+t.estimatedCalls,0)<=e.totalCalls&&(e.state!==`unavailable`||e.values.length===0)&&(e.state!==`complete`||e.values.reduce((e,t)=>e+t.coveredCalls,0)===e.totalCalls))),tj=W([H({state:R(`unavailable`),reason:R(`judge-usage-not-recorded`)}),H({state:R(`invalid`),reason:R(`judge-usage-source-invalid`)})]),nj={state:G([`complete`,`partial`]),coverage:R(`physical-transmissions`),collection:ow,totals:H({requests:JA,inputTotalTokens:JA,outputTokens:JA,totalTokens:JA,costs:ej})},rj=H(nj).check(Y(e=>{let t=e.totals.requests;return e.state===e.collection.state&&t.value===t.observationCount&&t.state===(e.state===`complete`?`available`:`partial`)&&e.totals.costs.totalCalls===t.value&&(e.state===`complete`||e.totals.costs.state!==`complete`)&&[e.totals.inputTotalTokens,e.totals.outputTokens,e.totals.totalTokens].every(n=>n.observationCount<=t.observationCount&&(n.state!==`available`||e.state===`complete`&&n.observationCount===t.observationCount))&&(t.value!==0||e.state!==`complete`||[e.totals.inputTotalTokens,e.totals.outputTokens,e.totals.totalTokens].every(e=>e.state===`available`&&e.value===0)&&e.totals.costs.state===`complete`)})),ij=W([tj,rj]),aj=W([tj,H({...nj,calls:U(iO),callsTruncated:V,omittedCallCount:qA,priceReceipts:U(aO)}).check(Y(e=>Z_(rj)({state:e.state,coverage:e.coverage,collection:e.collection,totals:e.totals})&&e.calls.length<=128&&e.calls.length+e.omittedCallCount===e.totals.requests.value&&e.callsTruncated===e.omittedCallCount>0&&e.calls.every((t,n)=>n===0||fO(e.calls[n-1],t)<0)&&vw(JSON.stringify({calls:e.calls,priceReceipts:e.priceReceipts}))<=131072&&uO({collection:e.collection,calls:e.calls,priceReceipts:e.priceReceipts}).length===0))]),oj=H({inputTotalTokens:I(zA),inputTokens:zA,outputTokens:zA,requests:zA,providerCosts:I(H({state:G([`available`,`partial`,`unavailable`]),values:U(BA),observationCount:B})),costs:I(KA)}),sj=H({cacheRead:GE,configuredModels:YA,modelGroups:ZA,judgeUsage:aj,totalCosts:QA,source:I(R(`adapter`)),coverage:I(R(`recorded-calls`)),calls:I(U(GA)),priceReceipts:I(K(U(WD))),callsTruncated:I(V),omittedCallCount:I(B),state:lA,limitations:U(PA),limitationsTruncated:V,omittedLimitationCount:B,turns:U(H({turnId:z,coverage:NA})),turnsTruncated:V,omittedTurnCount:B,observations:U(RA),totals:oj,hasMore:V,omittedObservationCount:B}),cj=G([`complete`,`partial`,`not-recorded`,`invalid`,`unavailable`]),lj=H({state:cj,facts:U(Zk),limitations:U(Qk)}),uj=H({state:cj,summary:K(H({turnCount:B,observationCount:B})),totals:oj,limitations:U(PA),limitationsTruncated:V,omittedLimitationCount:B}),dj=W([H({kind:R(`member-not-observed`),state:G([`pending`,`not-dispatched`,`interrupted`])}),H({kind:R(`attempt-unresolved`),originRunId:z,attemptId:z}),H({kind:R(`coverage`),detail:Qk}),H({kind:R(`usage`),detail:PA})]),fj=H({...VC.fields,publication:YS,state:G([`executed`,`carried`,`accepted`,`not-dispatched`,`interrupted`,`pending`]),locator:K(z),relation:K(G([`origin`,`reference`])),outcome:K(G([`completed`,`errored`,`cancelled`,`interrupted`])),verdict:Xk,score:K(Yk),coverage:lj,usage:uj,limitations:U(dj)}),pj=H({slotId:z,locator:K(z),limitation:dj}),mj=H({value:qk,members:U(UC),attempts:U(WC),denominator:H({expected:B,published:B,missing:B}),slots:U(fj),coverage:H({state:cj,expectedMemberCount:B,observedMemberCount:B,completeMemberCount:B,factCount:B,limitations:U(pj)}),usage:H({state:cj,expectedMemberCount:B,observedMemberCount:B,recordedAttemptCount:B,totals:oj,limitations:U(pj)}),limitations:U(pj)}),hj=H({state:lA,limitations:U(MA),limitationsTruncated:V,omittedLimitationCount:B,activities:U(H({activityId:z,sequence:B,parentActivityId:K(z),turnId:K(z),phase:z,label:z,startOffsetMs:B,durationMs:B,outcome:G(xO)})),hasMore:V,omittedActivityCount:B}),gj=W([H({kind:R(`text`),sha256:z,byteLength:B,content:G([`available`,`omitted`])}),H({kind:R(`elided`),reason:G([`binary`,`oversized-text`]),byteLength:B}),H({kind:R(`unavailable`),reason:G([`unsupported-input`,`capture-failed`,`capture-interrupted`])})]),_j=W([H({state:R(`absent`)}),H({state:R(`present`),revision:gj})]),vj=H({windowId:z,sequence:B,changes:U(H({changeId:z,path:z,kind:G([`created`,`modified`,`deleted`]),before:_j,after:_j}))}),yj=W([H({state:R(`not-recorded`),windows:hv([])}),H({state:R(`invalid`),issues:U(z),windows:hv([])}),H({state:G([`complete`,`partial`]),limitations:U(Sk),windows:U(vj)})]),bj=z.check(Y(e=>Tb.test(e))),xj={experimentId:_x,evalId:vx,attemptOrdinal:QC},Sj=H({sourceRunId:px,locator:bj}),Cj=yv(()=>W([sv,V,B,z,U(Cj),pv(z,Cj)])),wj=G([`no-result`,`pending`,`not-published`,`identity-mismatch`,`outcome-ineligible`,`score-incomplete`,`evidence-unavailable`,`timeout-exceeded`,`adoption-unproven`]),Tj=W([H({...xj,state:R(`reuse`),sourceRunId:px,locator:bj,relation:G([`origin`,`reference`]),action:G([`executed`,`carried`,`accepted`])}),H({...xj,state:R(`gap`),reason:wj,issues:U(Cj),sourceRunId:K(px),previous:K(Sj)})]),Ej=H({targetIdentity:zv,coverage:H({expected:QC,covered:QC,gaps:QC}),slots:U(Tj),...Gk.fields,history:U(H({...xj,sourceRunId:px,locator:K(bj)}))}).check(Y(e=>e.coverage.covered+e.coverage.gaps===e.coverage.expected&&e.slots.length===e.coverage.expected&&e.slots.filter(e=>e.state===`reuse`).length===e.coverage.covered)),Dj=z.pipe(bv(e=>Tb.test(e),{identifier:`AttemptLocator`,description:`a canonical @-prefixed Attempt locator`})),Oj=z.pipe(q(Y(ET))),kj=z.pipe(q(Y(kT))),Aj=z.pipe(q(Y(MT))),jj=U(px),Mj=U(_x).check(Y(e=>e.length>0&&new Set(e).size===e.length)),Nj=(e,t)=>H({kind:R(e),...t}),Pj=H({kind:G([`project-record`,`external-record`]),publicationCutoffIdentity:z}),Fj=H({storeGeneration:z,revision:B.check(Iv(),Nv(0))}),Ij=H({requestedRunIds:U(z),selectedRunIds:U(z),missingRunIds:U(z)}),Lj=H({protocol:R(iE),outcome:R(`success`),behaviorVersion:R(aE),source:Pj,publicationCutoff:Fj,selection:Ij,issues:hv([]),evidence:H({refs:U(z)})}),Rj=H({protocol:R(iE),outcome:R(`success`),behaviorVersion:R(aE),source:Pj,publicationCutoff:Fj,selection:H({requestedRunIds:U(z),selectedRunIds:U(z),missingRunIds:U(z),returnedRunCount:B,truncated:V}),issues:hv([]),evidence:H({refs:U(z)})}),zj=W([H({code:R(`selection-run-missing`),side:G([`left`,`right`]),runId:z}),H({code:R(`comparison-member-set-mismatch`)})]),Bj=Lj.pipe(uv({issues:U(zj)})),Vj=W([H({state:R(`not-recorded`)}),H({state:R(`available`),value:Ow,collection:H({state:G([`complete-page`,`bounded-page`]),items:U(Dw),hasMore:V,nextOffset:K(bw),total:bw}),contents:U(H({logicalHandle:z,byteLength:B,digest:z})),contentsTruncated:V})]),Hj=H({key:z,runId:z,slotId:z,evalId:z,attemptOrdinal:B,locator:z}),Uj=H({mode:G([`side-by-side`,`exact`,`paired`]),left:H({runs:U(HC),members:U(Hj)}),right:H({runs:U(HC),members:U(Hj)}),exactMemberSet:V,pairs:U(H({key:z,left:Hj,right:Hj}))}),Wj=e=>Object.freeze(e),Gj=Object.freeze({"project.get":Wj({request:Nj(`project.get`,{experimentIds:I(Mj)}),result:{project:Ej},factKinds:[`current-project`,`core`,`assertions`,`attempt-cost`]}),"overview.get":Wj({request:Nj(`overview.get`,{runIds:I(jj)}),result:{overview:Gk},factKinds:[`core`,`assertions`,`attempt-cost`]}),"experiment.get":Wj({request:Nj(`experiment.get`,{experimentId:_x}),result:{experiment:Kk},factKinds:[`core`,`assertions`,`attempt-cost`,`agent-turns`,`adapter-usage`,`judge-usage`]}),"run.list":Wj({request:Nj(`run.list`,{continuation:I(z)}),result:{runs:Jk,continuation:I(z)},factKinds:[`core`]}),"run.get":Wj({request:Nj(`run.get`,{runId:px}),result:{run:mj},factKinds:[`core`,`assertions`,`agent-turns`,`adapter-usage`,`judge-usage`]}),"attempt.get":Wj({request:Nj(`attempt.get`,{locator:Dj}),result:{attempt:rA},factKinds:[`core`,`assertions`]}),"attempt.assertion.detail":Wj({request:Nj(`attempt.assertion.detail`,{locator:Dj,entryId:Wy}),result:{assertion:VE},factKinds:[`assertions`,`agent-turns`,`sources`]}),"attempt.assertion.image":Wj({request:Nj(`attempt.assertion.image`,{locator:Dj,entryId:Wy,imageId:z,offset:I(bw),limit:I(xw)}),result:{image:W([H({state:R(`available`),imageId:z,mediaType:G([`image/png`,`image/jpeg`]),byteLength:B,sha256:z,offset:B,base64:z,nextOffset:K(B)}),H({state:R(`invalid`)}),H({state:R(`not-recorded`)})])},factKinds:[`assertions`]}),"attempt.trace":Wj({request:Nj(`attempt.trace`,{locator:Dj,traceId:I(z),sourceId:I(z),actorId:I(z),eventType:I(z),continuation:I(z)}),result:{trace:wA},factKinds:[`execution-traces`,`agent-turns`,`turn-contexts`,`sandbox-commands`,`runner-activities`,`runner-diagnostics`]}),"attempt.trace.detail":Wj({request:Nj(`attempt.trace.detail`,{locator:Dj,selector:W([Nj(`execution-event`,{eventId:z}),Nj(`execution-evidence`,{evidenceId:z,offset:I(bw),limit:I(xw)}),Nj(`item`,{itemId:Oj}),Nj(`tool-occurrence`,{toolOccurrenceId:kj}),Nj(`command`,{commandId:Aj})])}),result:{detail:jA},factKinds:[`execution-traces`,`agent-turns`,`sandbox-commands`,`artifacts`]}),"attempt.timing":Wj({request:Nj(`attempt.timing`,{locator:Dj}),result:{timing:hj},factKinds:[`runner-activities`]}),"attempt.usage":Wj({request:Nj(`attempt.usage`,{locator:Dj}),result:{usage:sj},factKinds:[`agent-turns`,`adapter-usage`,`judge-usage`]}),"attempt.diff":Wj({request:Nj(`attempt.diff`,{locator:Dj}),result:{diff:yj},factKinds:[`file-changes`]}),"attempt.sources":Wj({request:Nj(`attempt.sources`,{locator:Dj}),result:{sources:cA},factKinds:[`assertions`,`sources`]}),"attempt.artifacts":Wj({request:Nj(`attempt.artifacts`,{locator:Dj,offset:I(bw),limit:I(Ew)}),result:{artifacts:Vj},factKinds:[`artifacts`]}),"attempt.artifact":Wj({request:Nj(`attempt.artifact`,{locator:Dj,artifactId:Cx,offset:I(bw),limit:I(xw)}),result:{artifact:Cw},factKinds:[`artifacts`]}),"runs.compare":Wj({request:Nj(`runs.compare`,{mode:G([`side-by-side`,`exact`,`paired`]),leftRunIds:jj,rightRunIds:jj}),result:{comparison:Uj},factKinds:[`core`]})}),Kj=G(Object.freeze(Object.keys(Gj))),qj=Object.entries(Gj),Jj=H({protocol:R(iE),operation:W(qj.map(([,e])=>e.request))}),Yj=(e,t)=>{let n=uv({operation:R(e),...t.result});return e===`run.list`?Rj.pipe(n):e===`runs.compare`?Bj.pipe(n):Lj.pipe(n)},Xj=W(qj.map(([e,t])=>Yj(e,t))),Zj=(e,t)=>{let n=uv({outcome:R(`explanation`),operation:R(e),factKinds:hv(t.factKinds.map(e=>R(e)))});return e===`run.list`?Rj.pipe(n):Lj.pipe(n)},Qj=W(qj.map(([e,t])=>Zj(e,t))),$j=W(qj.map(([e])=>H({id:R(e)}))),eM=W([H({protocol:R(iE),outcome:R(`discovery`),operations:U($j)}),Xj,Qj,H({protocol:R(iE),outcome:R(`failure`),operation:K(Kj),failure:H({code:G([`inspection-request-invalid`,`inspection-selection-missing`,`inspection-source-invalid`,`inspection-record-integrity-failure`,`inspection-operation-failed`,`inspection-result-invalid`,`evidence-budget-exceeded`,`restart-required`,`current-target-unavailable`]),reason:z,identity:I(H({runId:z})),correction:G([`fix-request`,`choose-existing-selection`,`fix-record-source`,`retry`,`upgrade-or-report`,`restart`])})})]);function tM(e){let t=ev(eM,{errors:`all`,onExcessProperty:`error`})(e);return od(t)?{success:!0,value:e}:{success:!1,reason:String(t.failure)}}function nM(e,t){return e.outcome===`success`&&e.operation===t?{success:!0,value:e}:{success:!1,reason:`expected success ${t}, received ${e.outcome}${`operation`in e?` ${e.operation}`:``}`}}var rM=ev(Jj,{onExcessProperty:`error`});function iM(e){let t=rM({protocol:iE,operation:e});return ad(t)?id(Object.freeze({classification:`protocol/query`,code:`inspection-request-invalid`,reason:String(t.failure)})):rd(t.success.operation)}var aM=new WeakSet;ev(Jj,{onExcessProperty:`error`});function oM(e){let t=new Set,n=(e,r)=>{if(e===null||typeof e==`string`||typeof e==`boolean`)return e;if(typeof e==`number`)return Number.isFinite(e)?e:sM(r,`numbers must be finite`);if(Array.isArray(e)){if(t.has(e))return sM(r,`cyclic arrays are not encodable`);t.add(e);let i=[];for(let[t,a]of e.entries()){let e=n(a,[...r,String(t)]);if(lM(e))return e;i.push(e)}return t.delete(e),Object.freeze(i)}if(typeof e!=`object`||!e)return sM(r,`unsupported ${typeof e} value`);if(t.has(e))return sM(r,`cyclic objects are not encodable`);let i=Object.getPrototypeOf(e);if(i!==Object.prototype&&i!==null)return sM(r,`only plain objects may cross Inspection delivery`);t.add(e);let a=Object.create(null);for(let t of Object.keys(e).sort(dM)){let i=n(Reflect.get(e,t),[...r,t]);if(lM(i))return i;a[t]=i}return t.delete(e),Object.freeze(a)};return n(e,[])}function sM(e,t){let n=Object.freeze({code:`inspection-result-invalid`,reason:`${e.length===0?`$`:e.join(`.`)}: ${t}`});return aM.add(n),n}function cM(e){return uM(e)&&aM.has(e)}var lM=cM;function uM(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function dM(e,t){return e<t?-1:+(e>t)}function fM(e){let t=oM(e);return cM(t)?id(t):rd(`${pM(t)}\n`)}function pM(e){if(e===null||typeof e==`boolean`||typeof e==`number`||typeof e==`string`)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(pM).join(`,`)}]`;let t=e;return`{${Object.keys(t).sort(mM).map(e=>`${JSON.stringify(e)}:${pM(t[e])}`).join(`,`)}}`}function mM(e,t){return e<t?-1:+(e>t)}new TextEncoder;function hM(e,t){let n=fM(t);if(ad(n))throw Error(`Inspection operation query key is invalid: ${n.failure.reason}`);return[`inspection`,e,`${t.kind}:${n.success}`]}function gM(e,t){return fc({queryKey:hM(e.identity,t),queryFn:()=>e.inspectRepository(t)})}var _M=(0,v.createContext)(null);function vM({runtime:e,children:t}){let n=(0,v.useSyncExternalStore)(t=>e.subscribe(t),()=>e.current,()=>e.current);if(n===void 0)throw Error(`No View generation has been committed.`);return(0,M.jsx)(_M.Provider,{value:n.binding,children:(0,M.jsx)(Uo,{client:e.queryClient,children:t})})}function yM(){let e=(0,v.useContext)(_M);if(e===null)throw Error(`useCurrentGeneration must be used inside InspectionRuntimeProvider.`);return e}function bM(e,t={}){let n=(0,v.useContext)(_M);if(n===null)throw Error(`useInspectionQuery must be used inside InspectionRuntimeProvider.`);let r=(t.enabled??!0)&&e!==null;if(e===null)return uc({queryKey:[`inspection`,n.identity,`disabled`],queryFn:fs,enabled:!1});let i=gM(n,e);return uc({queryKey:i.queryKey,queryFn:i.queryFn,enabled:r,...t.select===void 0?{}:{select:t.select}})}var xM=class{generation;#e=!1;constructor(e){this.generation=e}get identity(){return this.generation.identity}inspect(e){return this.#e?Promise.reject(Error(`Generation lease is released.`)):this.generation.queryClient.fetchQuery(gM(this.generation,e))}release(){this.#e||(this.#e=!0,this.generation.releaseLease())}},SM=class{repository;queryClient;onClosed;identity;#e=`preparing`;#t=0;#n=0;#r;binding;constructor(e,t,n){this.repository=e,this.queryClient=t,this.onClosed=n,this.identity=e.generationId;let r=this;this.binding=Object.freeze({identity:this.identity,queryClient:this.queryClient,get snapshot(){return r.snapshot},inspectRepository(e){return r.inspectRepository(e)}})}get status(){return this.#e}get snapshot(){if(this.#r===void 0)throw Error(`View generation snapshot is not ready.`);return this.#r}attachSnapshot(e){if(this.#e!==`preparing`||this.#r!==void 0)throw Error(`A View generation snapshot can only be attached once while preparing.`);this.#r=e}acquire(){if(this.#e===`retiring`||this.#e===`closed`)throw Error(`View generation is ${this.#e}.`);return this.#t+=1,new xM(this)}inspectRepository(e){if(this.#e===`retiring`||this.#e===`closed`)return Promise.reject(Error(`View generation is ${this.#e}.`));this.#n+=1;let t;try{t=this.repository.inspect(e)}catch(e){return this.#i(),Promise.reject(e)}return t.finally(()=>this.#i())}publish(){if(this.#e!==`preparing`)throw Error(`Only a preparing generation can be published.`);this.#e=`current`}drain(){this.#e!==`retiring`&&this.#e!==`closed`&&(this.#e=`retiring`,this.#s(),this.#a())}close(){this.#t=0,this.#o()}releaseLease(){this.#t>0&&--this.#t,this.#a()}#i(){this.#n>0&&--this.#n,this.#a()}#a(){this.#e===`retiring`&&this.#t===0&&this.#n===0&&this.#o()}#o(){this.#e!==`closed`&&(this.#e=`closed`,this.#s(),this.repository.close(),this.onClosed())}#s(){this.queryClient.removeQueries({type:`inactive`,predicate:e=>e.queryKey[1]===this.identity})}},CM=class{#e;#t=new Set;#n=new Map;#r=new Set;#i=!1;queryClient=new Ys({defaultOptions:{queries:{gcTime:3e5,retry:1,staleTime:1/0,refetchOnMount:!1,refetchOnReconnect:!1,refetchOnWindowFocus:!1}}});get current(){return this.#e}acquireCurrent(){this.#a();let e=this.#e;if(e===void 0)throw Error(`No View generation has been committed.`);return e.acquire()}subscribe(e){return this.#a(),this.#r.add(e),()=>this.#r.delete(e)}prepare(e){if(this.#i)throw e.close(),Error(`View runtime is disposed.`);let t=this.#n.get(e.generationId);if(t!==void 0)throw t.repository!==e&&e.close(),Error(`View generation ${e.generationId} already has an owner.`);let n;n=new SM(e,this.queryClient,()=>{this.#n.get(n.identity)===n&&this.#n.delete(n.identity)});try{let e={generation:n,lease:n.acquire()};return this.#n.set(n.identity,n),this.#t.add(n),e}catch(e){throw n.close(),e}}attachSnapshot(e,t){if(this.#a(),!this.#t.has(e.generation)||this.#n.get(e.generation.identity)!==e.generation)throw Error(`Only a prepared View generation can receive a snapshot.`);e.generation.attachSnapshot(t)}commit(e){if(this.#a(),!this.#t.has(e.generation)||this.#n.get(e.generation.identity)!==e.generation||e.generation.status!==`preparing`)throw Error(`Only an open View generation can be committed.`);e.generation.snapshot,this.#t.delete(e.generation);let t=this.#e;e.generation.publish(),this.#e=e.generation,e.lease.release();for(let e of this.#r)e();return t}retire(e){e!==void 0&&e!==this.#e&&this.#n.get(e.identity)===e&&e.drain()}reject(e){this.#t.has(e.generation)&&this.#n.get(e.generation.identity)===e.generation&&e.generation.status===`preparing`&&(this.#t.delete(e.generation),e.lease.release(),e.generation.close())}dispose(){if(!this.#i){this.#i=!0,this.#r.clear(),this.#e=void 0,this.#t.clear();for(let e of[...this.#n.values()])e.close();this.#n.clear(),this.queryClient.clear()}}#a(){if(this.#i)throw Error(`View runtime is disposed.`)}},wM=class extends Error{classification=`route-input`;translationKey=`report.unableToLoad`},TM=class extends Error{classification=`selection`;translationKey=`report.unableToLoad`};function EM(e){let t=iM(e);if(ad(t))throw new wM(`Invalid Insight route input.`);return t.success}function DM(e=[]){let t=EM({kind:`overview.get`,...e.length===0?{}:{runIds:e}});if(t.kind!==`overview.get`)throw new wM(`Invalid overview operation.`);return t}function OM(e){let t=EM({kind:`project.get`,...e===void 0?{}:{experimentIds:e}});if(t.kind!==`project.get`)throw new wM(`Invalid current project operation.`);return t}function kM(e){let t=EM({kind:`run.get`,runId:e});if(t.kind!==`run.get`)throw new wM(`Invalid run route.`);return t}function AM(e){let t=EM({kind:`attempt.get`,locator:e}),n=EM({kind:`attempt.trace`,locator:e});if(t.kind!==`attempt.get`||n.kind!==`attempt.trace`)throw new wM(`Invalid attempt route.`);return[t,n]}function jM(e){let t=EM(e);switch(t.kind){case`attempt.assertion.detail`:case`attempt.trace.detail`:case`attempt.timing`:case`attempt.usage`:case`attempt.sources`:case`attempt.diff`:case`attempt.artifacts`:return t;default:throw new wM(`Invalid Attempt detail operation.`)}}function MM(e){return Object.freeze({state:`available`,value:e})}function NM(){return Object.freeze({state:`unavailable`})}function PM(e,t){let n=e.attempt.originRun.expectedSlots.find(({slotId:t})=>t===e.attempt.core.slotId),r=e.attempt.score,i=r.state===`complete`?r.earned:void 0;return Object.freeze({locator:e.attempt.locator,runId:e.attempt.originRun.runId,experimentId:e.attempt.originRun.experimentId,evalId:e.attempt.core.evalId,summary:Object.freeze({experimentId:e.attempt.originRun.experimentId,adapter:e.attempt.originRun.context.execution.adapter,identity:Object.freeze({runId:e.attempt.originRun.runId,evalId:e.attempt.core.evalId,attempt:n===void 0?NM():MM(n.attemptOrdinal)}),verdict:e.attempt.verdict??`unknown`,startedAt:new Date(e.attempt.originRun.startedAt).toISOString(),durationMs:NM(),capabilities:Object.freeze({source:e.attempt.sections.sources.state,execution:e.attempt.sections.trace.state,timing:e.attempt.sections.timing.state,diff:e.attempt.sections.diff.state}),...i===void 0?{}:{totalScore:i}}),assertionEntryIds:Object.freeze(e.attempt.assertions.entries.map(({entryId:e})=>e)),traceItemIds:Object.freeze([...t.trace.identityIndex.itemIds]),toolOccurrenceIds:Object.freeze([...t.trace.identityIndex.toolOccurrenceIds.ids]),commandIds:Object.freeze([...t.trace.identityIndex.commandIds])})}function FM(e,t){let[n,r]=AM(t);return fc({queryKey:[`insight-attempt`,e.identity,t],queryFn:async()=>{let[t,i]=await Promise.all([e.queryClient.fetchQuery(gM(e,n)),e.queryClient.fetchQuery(gM(e,r))]);return PM(t,i)}})}function IM(e,t,n,r,i,a){return fc({queryKey:[`insight-results`,e.identity,r,i??null,a??null],queryFn:async()=>{let o=t.groups.find(({identity:e})=>e.kind===i&&(e.kind===`named`?e.groupId===a:e.experimentId===a));if(o===void 0&&t.groups.length>0)throw new TM(`Results selection is unavailable.`);let s=o?.members??[];if(s.length===1)return e.queryClient.fetchQuery(LM(e,n,r,s[0]));let c=r===`current`?(await e.queryClient.fetchQuery(gM(e,s.length===0?OM():OM(s)))).project:void 0,l=c===void 0?void 0:(await e.queryClient.fetchQuery(gM(e,OM()))).project.history;return Object.freeze({overview:n,selectedExperiments:s,selectionTitle:o?.label??`Results`,targetMode:r,...c===void 0?{}:{current:c},...l===void 0?{}:{currentHistory:l}})}})}function LM(e,t,n,r){return fc({queryKey:[`insight-experiment`,e.identity,n,r],queryFn:async()=>{if(!t.catalog.experiments.includes(r))throw new TM(`Experiment selection is unavailable.`);let i=[r];if(n===`current`){let a=(await e.queryClient.fetchQuery(gM(e,OM(i)))).project,o=(await e.queryClient.fetchQuery(gM(e,OM()))).project.history;return Object.freeze({overview:t,selectedExperiments:i,selectionTitle:r,current:a,currentHistory:o,targetMode:n})}if(n===`unavailable`)return Object.freeze({overview:t,selectedExperiments:i,selectionTitle:r,targetMode:n});let a=iM({kind:`experiment.get`,experimentId:r});if(ad(a)||a.success.kind!==`experiment.get`)throw new wM(`Invalid experiment route.`);let o=await e.queryClient.fetchQuery(gM(e,a.success));return Object.freeze({overview:t,selectedExperiments:Object.freeze(i),selectionTitle:i[0]??`Results`,targetMode:n,costSummary:o.experiment.costSummary})}})}function RM(e){return e.experiments.map(t=>{let n=e.slots.filter(e=>e.experimentId===t.experimentId),r=n.filter(e=>e.state===`reuse`).length;return Object.freeze({experiment:t,slots:n,covered:r,gaps:n.length-r})})}function zM(e){let t=e.overview.cells.map(e=>Object.freeze({experimentId:e.experimentId,evalId:e.evalId,evaluationKind:e.evaluationKind,passRate:BM(e.verdict.passRate),score:BM(e.score),costUSD:BM(e.costUSD),durationMs:BM(e.durationMs),tokens:BM(e.tokens),tally:Object.freeze({...e.verdict.tally}),members:Object.freeze(e.members.map(e=>Object.freeze({runId:e.runId,attemptOrdinal:e.attemptOrdinal,publication:e.publication.state===`published`?Object.freeze({state:`published`,locator:e.publication.attemptLocator,score:BM(e.publication.score),costUSD:BM(e.publication.costUSD),durationMs:BM(e.publication.durationMs),tokens:BM(e.publication.tokens)}):e.publication})))})),n=e.overview.experiments.map(e=>Object.freeze({experimentId:e.experimentId,evaluationKind:e.evaluationKind,passRate:BM(e.verdict.passRate),score:BM(e.score),costUSD:BM(e.costUSD),durationMs:BM(e.durationMs),tokens:BM(e.tokens),adapter:e.adapter,model:e.model,groups:Object.freeze(e.groups.map(e=>Object.freeze({groupPath:Object.freeze([...e.groupPath]),evaluationKind:e.evaluationKind,passRate:BM(e.verdict.passRate),score:BM(e.score),costUSD:BM(e.costUSD),durationMs:BM(e.durationMs),tokens:BM(e.tokens)})))})),r=n.map(({experimentId:e})=>e),i=GM(t.flatMap(e=>e.members.map(t=>({runId:t.runId,experimentId:e.experimentId}))),({runId:e})=>e),a=GM(t.flatMap(e=>e.members.flatMap(t=>t.publication.state===`published`?[{locator:t.publication.locator,experimentId:e.experimentId}]:[])),({locator:e})=>e);return Object.freeze({cells:Object.freeze(t),experiments:Object.freeze(n),catalog:Object.freeze({experiments:Object.freeze(r),runExperiments:Object.freeze(i),attemptExperiments:Object.freeze(a)})})}function BM(e){return Object.freeze({value:e.value,state:e.state,samples:e.samples,total:e.total,basis:e.basis,issues:Object.freeze(e.issues),refs:Object.freeze(e.refs.map(e=>Object.freeze({identity:Object.freeze({kind:e.identity.kind,locator:e.identity.locator})}))),...e.unit===void 0?{}:{unit:e.unit},...`source`in e&&(e.source===`reported`||e.source===`estimated`||e.source===`mixed`||e.source===null)?{source:e.source}:{},...e.bounds===void 0?{}:{bounds:Object.freeze({...e.bounds})}})}function VM(e,t){let n=new Set(t),r=e.cells.filter(({experimentId:e})=>n.has(e)),i=[...new Set(r.map(({evalId:e})=>e))];return t.flatMap(t=>{let n=e.experiments.find(e=>e.experimentId===t);if(n===void 0)return[];let a=r.filter(e=>e.experimentId===t);if(a.length===0)return[];let o=a.map(HM),s=n.evaluationKind,c=i.filter(e=>!a.some(t=>t.evalId===e));return[Object.freeze({experimentId:t,adapter:n.adapter,model:n.model,flags:null,evaluationKind:s,score:n.score,costUSD:n.costUSD,durationMs:n.durationMs,tokens:n.tokens,endToEndPassRate:n.passRate,missingEvalIds:Object.freeze(c),groupMetrics:UM(n.groups),evalRows:Object.freeze(o),href:`#/experiment/${encodeURIComponent(t)}`})]})}function HM(e){let t=e.members.flatMap(t=>{if(t.publication.state!==`published`)return[];let n=e.members.length===1?WM(e.tally):null;return[Object.freeze({locator:t.publication.locator,experimentId:e.experimentId,evalId:e.evalId,attemptOrdinal:t.attemptOrdinal,verdict:n,failureSummary:null,evaluationKind:e.evaluationKind===`pass`?`pass`:`points`,score:t.publication.score,costUSD:t.publication.costUSD,durationMs:t.publication.durationMs,tokens:t.publication.tokens,startedAt:null,href:`#/attempt/${t.publication.locator.startsWith(`@`)?t.publication.locator.slice(1):t.publication.locator}`})]});return Object.freeze({evalId:e.evalId,evaluationKind:e.evaluationKind===`pass`?`pass`:`points`,score:e.score,costUSD:e.costUSD,durationMs:e.durationMs,tokens:e.tokens,endToEndPassRate:e.passRate,attempts:Object.freeze(t)})}function UM(e){return new Map(e.map(e=>[e.groupPath.join(`/`),Object.freeze({passRate:e.passRate,score:e.score,costUSD:e.costUSD,durationMs:e.durationMs,tokens:e.tokens})]))}function WM(e){return e.passed===1&&e.failed===0&&e.errored===0&&e.skipped===0?`passed`:e.passed===0&&e.failed===1&&e.errored===0&&e.skipped===0?`failed`:e.passed===0&&e.failed===0&&e.errored===1&&e.skipped===0?`errored`:e.passed===0&&e.failed===0&&e.errored===0&&e.skipped===1?`skipped`:null}function GM(e,t){let n=new Map;for(let r of e)n.set(t(r),r);return Object.freeze([...n.values()])}function KM(e){return Object.freeze({runId:e.run.value.runId,experimentId:e.run.value.experimentId,adapter:e.run.value.context?.execution.adapter??null,members:Object.freeze(e.run.slots.map((e,t)=>Object.freeze({key:`${e.slotId}:${t}`,slotId:e.slotId,evalId:e.evalId,attemptOrdinal:e.attemptOrdinal,state:e.state,locator:e.locator,outcome:e.outcome,verdict:e.verdict,...e.score===null?{}:{score:e.score}})))})}function qM(e,t){let n=kM(t);return fc({queryKey:[`insight-run`,e.identity,t],queryFn:async()=>KM(await e.queryClient.fetchQuery(gM(e,n)))})}var JM=Object.defineProperty,YM=(e,t)=>JM(e,`name`,{value:t,configurable:!0}),XM=!!(typeof window<`u`&&window.document&&window.document.createElement);function ZM(e,t,{checkForDefaultPrevented:n=!0}={}){return YM(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}YM(ZM,`composeEventHandlers`);function QM(e){if(!XM)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}YM(QM,`getOwnerWindow`);function $M(e){if(!XM)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}YM($M,`getOwnerDocument`);function eN(e,t=!1){let{activeElement:n}=$M(e);if(!n?.nodeName)return null;if(tN(n)&&n.contentDocument)return eN(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=$M(n).getElementById(e);if(t)return t}}return n}YM(eN,`getActiveElement`);function tN(e){return e.tagName===`IFRAME`}YM(tN,`isFrame`);var nN=Object.defineProperty,rN=(e,t)=>nN(e,`name`,{value:t,configurable:!0});function iN(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}rN(iN,`setRef`);function aN(...e){return t=>{let n=!1,r=e.map(e=>{let r=iN(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():iN(e[t],null)}}}}rN(aN,`composeRefs`);function oN(...e){return v.useCallback(aN(...e),e)}rN(oN,`useComposedRefs`);var sN=Object.defineProperty,cN=(e,t)=>sN(e,`name`,{value:t,configurable:!0});function lN(e,t){let n=v.createContext(t);n.displayName=e+`Context`;let r=cN(e=>{let{children:t,...r}=e,i=v.useMemo(()=>r,Object.values(r));return(0,M.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=v.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return cN(i,`useContext`),[r,i]}cN(lN,`createContext`);function uN(e,t=[]){let n=[];function r(t,r){let i=v.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=cN(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=v.useMemo(()=>o,Object.values(o));return(0,M.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=v.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return cN(s,`useContext`),[o,s]}cN(r,`createContext`);let i=cN(()=>{let t=n.map(e=>v.createContext(e));return cN(function(n){let r=n?.[e]||t;return v.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,dN(i,...t)]}cN(uN,`createContextScope`);function dN(...e){let t=e[0];if(e.length===1)return t;let n=cN(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return cN(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}cN(dN,`composeContextScopes`);var fN=globalThis?.document?v.useLayoutEffect:()=>{},pN=Object.defineProperty,mN=(e,t)=>pN(e,`name`,{value:t,configurable:!0}),hN=v.useId||(()=>void 0),gN=0;function _N(e){let[t,n]=v.useState(hN());return fN(()=>{e||n(e=>e??String(gN++))},[e]),e||(t?`radix-${t}`:``)}mN(_N,`useId`);var vN=Object.defineProperty,yN=(e,t)=>vN(e,`name`,{value:t,configurable:!0}),bN=v.useEffectEvent,xN=v.useInsertionEffect;function SN(e){if(typeof bN==`function`)return bN(e);let t=v.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof xN==`function`?xN(()=>{t.current=e}):fN(()=>{t.current=e}),v.useMemo(()=>((...e)=>t.current?.(...e)),[])}yN(SN,`useEffectEvent`);var CN=Object.defineProperty,wN=(e,t)=>CN(e,`name`,{value:t,configurable:!0}),TN=v.useInsertionEffect||fN;function EN({prop:e,defaultProp:t,onChange:n=wN(()=>{},`onChange`),caller:r}){let[i,a,o]=DN({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,v.useCallback(t=>{if(s){let n=ON(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}wN(EN,`useControllableState`);function DN({defaultProp:e,onChange:t}){let[n,r]=v.useState(e),i=v.useRef(n),a=v.useRef(t);return TN(()=>{a.current=t},[t]),v.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}wN(DN,`useUncontrolledState`);function ON(e){return typeof e==`function`}wN(ON,`isFunction`);var kN=Symbol(`RADIX:SYNC_STATE`);function AN(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=SN(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=v.useReducer((t,n)=>{if(n.type===kN)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=v.useRef(p);v.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=v.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return v.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:kN,state:i})},[i,d.state,c]),[h,f]}wN(AN,`useControllableStateReducer`);var jN=Object.defineProperty,MN=(e,t)=>jN(e,`name`,{value:t,configurable:!0});function NN(e){let t=v.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];VN(r)&&typeof GN==`function`&&(r=GN(r._payload)),v.Children.forEach(r,e=>{if(zN(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;VN(n)&&typeof GN==`function`&&(n=GN(n._payload)),a=IN(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=v.cloneElement(a,void 0,s):!o&&v.Children.count(r)===1&&v.isValidElement(r)&&(a=r);let c=a?RN(a):void 0,l=oN(n,c);if(!a){if(r||r===0)throw Error(o?WN(e):UN(e));return r}let u=LN(i,a.props??{});return a.type!==v.Fragment&&(u.ref=n?l:c),v.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}MN(NN,`createSlot`);var PN=Symbol.for(`radix.slottable`);function FN(e){let t=MN(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=PN,t}MN(FN,`createSlottable`);var IN=MN((e,t)=>{if(`child`in e.props){let t=e.props.child;return v.isValidElement(t)?v.cloneElement(t,void 0,e.props.children(t.props.children)):null}return v.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function LN(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}MN(LN,`mergeProps`);function RN(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}MN(RN,`getElementRef`);function zN(e){return v.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===PN}MN(zN,`isSlottable`);var BN=Symbol.for(`react.lazy`);function VN(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===BN&&`_payload`in e&&HN(e._payload)}MN(VN,`isLazyComponent`);function HN(e){return typeof e==`object`&&!!e&&`then`in e}MN(HN,`isPromiseLike`);var UN=MN(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),WN=MN(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),GN=v.use,KN=Object.defineProperty,qN=(e,t)=>KN(e,`name`,{value:t,configurable:!0}),JN=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=NN(`Primitive.${t}`),r=v.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,M.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function YN(e,t){e&&y.flushSync(()=>e.dispatchEvent(t))}qN(YN,`dispatchDiscreteCustomEvent`);var XN=Object.defineProperty,ZN=(e,t)=>XN(e,`name`,{value:t,configurable:!0});function QN(e){let t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>((...e)=>t.current?.(...e)),[])}ZN(QN,`useCallbackRef`);var $N=Object.defineProperty,eP=(e,t)=>$N(e,`name`,{value:t,configurable:!0}),tP=`dismissableLayer.update`,nP=`dismissableLayer.pointerDownOutside`,rP=`dismissableLayer.focusOutside`,iP,aP=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),oP=v.forwardRef(eP(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=v.useContext(aP),[d,f]=v.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=v.useState({}),h=oN(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=_?g.indexOf(_):-1,b=d?g.indexOf(d):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=y,C=v.useRef(!1),w=lP(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:v.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return S&&!t},[u.branches,S])}),T=uP(e=>{if(r&&C.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),E=d?b===g.length-1:!1,D=QN(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return v.useEffect(()=>{if(E)return p.addEventListener(`keydown`,D,{capture:!0}),()=>p.removeEventListener(`keydown`,D,{capture:!0})},[p,E,D]),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(iP=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),dP(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=iP))}},[d,p,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),dP())},[d,u]),v.useEffect(()=>{let e=eP(()=>m({}),`handleUpdate`);return document.addEventListener(tP,e),()=>document.removeEventListener(tP,e)},[]),(0,M.jsx)(JN.div,{...l,ref:h,style:{pointerEvents:x?S?`auto`:`none`:void 0,...e.style},onFocusCapture:ZM(e.onFocusCapture,T.onFocusCapture),onBlurCapture:ZM(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:ZM(e.onPointerDownCapture,w.onPointerDownCapture)})},`DismissableLayer`));function sP(){let e=v.useContext(aP),[t,n]=v.useState(null);return v.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}eP(sP,`useDismissableLayerSurface`);var cP=eP(()=>!0,`IS_TRUE`);function lP(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=cP}=t,s=QN(e),c=v.useRef(!1),l=v.useRef(!1),u=v.useRef(new Map),d=v.useRef(()=>{});return v.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}eP(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}eP(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}eP(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}eP(p,`handleInteractionBubble`);let m=eP(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||fP(nP,s,p,{discrete:!0})};if(eP(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:eP(()=>c.current=!0,`onPointerDownCapture`)}}eP(lP,`usePointerDownOutside`);function uP(e,t=globalThis?.document){let n=QN(e),r=v.useRef(!1);return v.useEffect(()=>{let e=eP(e=>{e.target&&!r.current&&fP(rP,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:eP(()=>r.current=!0,`onFocusCapture`),onBlurCapture:eP(()=>r.current=!1,`onBlurCapture`)}}eP(uP,`useFocusOutside`);function dP(){let e=new CustomEvent(tP);document.dispatchEvent(e)}eP(dP,`dispatchUpdate`);function fP(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?YN(i,a):i.dispatchEvent(a)}eP(fP,`handleAndDispatchCustomEvent`);var pP=Object.defineProperty,mP=(e,t)=>pP(e,`name`,{value:t,configurable:!0}),hP=`focusScope.autoFocusOnMount`,gP=`focusScope.autoFocusOnUnmount`,_P={bubbles:!1,cancelable:!0},vP=v.forwardRef(mP(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=v.useState(null),l=QN(i),u=QN(a),d=v.useRef(null),f=oN(t,c),p=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:TP(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||TP(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&TP(s)};mP(e,`handleFocusIn`),mP(t,`handleFocusOut`),mP(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),v.useEffect(()=>{if(s){EP.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(hP,_P);s.addEventListener(hP,l),s.dispatchEvent(t),t.defaultPrevented||(yP(kP(xP(s)),{select:!0}),document.activeElement===e&&TP(s))}return()=>{s.removeEventListener(hP,l),setTimeout(()=>{let t=new CustomEvent(gP,_P);s.addEventListener(gP,u),s.dispatchEvent(t),t.defaultPrevented||TP(e??document.body,{select:!0}),s.removeEventListener(gP,u),EP.remove(p)},0)}}},[s,l,u,p]);let m=v.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=bP(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&TP(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&TP(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,M.jsx)(JN.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function yP(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(TP(r,{select:t}),document.activeElement!==n)return}mP(yP,`focusFirst`);function bP(e){let t=xP(e);return[SP(t,e),SP(t.reverse(),e)]}mP(bP,`getTabbableEdges`);function xP(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:mP(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}mP(xP,`getTabbableCandidates`);function SP(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):CP(r,{upTo:t})))return r}mP(SP,`findVisible`);function CP(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}mP(CP,`isHidden`);function wP(e){return e instanceof HTMLInputElement&&`select`in e}mP(wP,`isSelectableInput`);function TP(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&wP(e)&&t&&e.select()}}mP(TP,`focus`);var EP=DP();function DP(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=OP(e,t),e.unshift(t)},remove(t){e=OP(e,t),e[0]?.resume()}}}mP(DP,`createFocusScopesStack`);function OP(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}mP(OP,`arrayRemove`);function kP(e){return e.filter(e=>e.tagName!==`A`)}mP(kP,`removeLinks`);var AP=Object.defineProperty,jP=v.forwardRef(((e,t)=>AP(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=v.useState(!1);fN(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?y.createPortal((0,M.jsx)(JN.div,{...r,ref:t}),o):null},`Portal`)),MP=Object.defineProperty,NP=(e,t)=>MP(e,`name`,{value:t,configurable:!0});function PP(e,t){return v.useReducer((e,n)=>t[e][n]??e,e)}NP(PP,`useStateMachine`);var FP=NP(e=>{let{present:t,children:n}=e,r=IP(t),i=typeof n==`function`?n({present:r.isPresent}):v.Children.only(n),a=RP(r.ref,BP(i));return typeof n==`function`||r.isPresent?v.cloneElement(i,{ref:a}):null},`Presence`);function IP(e){let[t,n]=v.useState(),r=v.useRef(null),i=v.useRef(e),a=v.useRef(`none`),o=v.useRef(void 0),[s,c]=PP(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return v.useEffect(()=>{s===`mounted`?(a.current=o.current??zP(r.current),o.current=void 0):a.current=`none`},[s]),fN(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=zP(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),fN(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=NP(a=>{let o=zP(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=NP(e=>{e.target===t&&(a.current=zP(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:v.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=zP(t)}else r.current=null;n(e)},[])}}NP(IP,`usePresence`);function LP(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}NP(LP,`setRef`);function RP(...e){let t=v.useRef(e);return t.current=e,v.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=LP(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():LP(n[e],null)}}},[])}NP(RP,`useStableComposedRefs`);function zP(e){return e?.animationName||`none`}NP(zP,`getAnimationName`);function BP(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}NP(BP,`getElementRef`);var VP=Object.defineProperty,HP=(e,t)=>VP(e,`name`,{value:t,configurable:!0}),UP=0,WP=null;function GP(e){return KP(),e.children}HP(GP,`FocusGuards`);function KP(){v.useEffect(()=>{WP||={start:qP(),end:qP()};let{start:e,end:t}=WP;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),UP++,()=>{UP===1&&(WP?.start.remove(),WP?.end.remove(),WP=null),UP=Math.max(0,UP-1)}},[])}HP(KP,`useFocusGuards`);function qP(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}HP(qP,`createFocusGuard`);var JP=function(){return JP=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},JP.apply(this,arguments)};function YP(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function XP(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var ZP=`right-scroll-bar-position`,QP=`width-before-scroll-bar`,$P=`with-scroll-bars-hidden`,eF=`--removed-body-scroll-bar-size`;function tF(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function nF(e,t){var n=(0,v.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var rF=typeof window<`u`?v.useLayoutEffect:v.useEffect,iF=new WeakMap;function aF(e,t){var n=nF(t||null,function(t){return e.forEach(function(e){return tF(e,t)})});return rF(function(){var t=iF.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||tF(e,null)}),i.forEach(function(e){r.has(e)||tF(e,a)})}iF.set(n,e)},[e]),n}function oF(e){return e}function sF(e,t){t===void 0&&(t=oF);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function cF(e){e===void 0&&(e={});var t=sF(null);return t.options=JP({async:!0,ssr:!1},e),t}var lF=function(e){var t=e.sideCar,n=YP(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return v.createElement(r,JP({},n))};lF.isSideCarExport=!0;function uF(e,t){return e.useMedium(t),lF}var dF=cF(),fF=function(){},pF=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:fF,onWheelCapture:fF,onTouchMoveCapture:fF}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,y=_===void 0?`div`:_,b=e.gapMode,x=YP(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=f,C=aF([n,t]),w=JP(JP({},x),i);return v.createElement(v.Fragment,null,u&&v.createElement(S,{sideCar:dF,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:b}),o?v.cloneElement(v.Children.only(s),JP(JP({},w),{ref:C})):v.createElement(y,JP({},w,{className:c,ref:C}),s))});pF.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},pF.classNames={fullWidth:QP,zeroRight:ZP};var mF=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function hF(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=mF();return t&&e.setAttribute(`nonce`,t),e}function gF(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function _F(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var vF=function(){var e=0,t=null;return{add:function(n){e==0&&(t=hF())&&(gF(t,n),_F(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},yF=function(){var e=vF();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},bF=function(){var e=yF();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},xF={left:0,top:0,right:0,gap:0},SF=function(e){return parseInt(e||``,10)||0},CF=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[SF(n),SF(r),SF(i)]},wF=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return xF;var t=CF(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},TF=bF(),EF=`data-scroll-locked`,DF=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
19
- .${$P} {
17
+ `);n=Gm(e)??zm(um(e.ast),e);break;default:n=Pm(e)}return t?`${n}\n at ${t}`:n}function Gm(e){if(e._tag===`Pointer`)return;if(e._tag===`Encoding`)return Gm(e.issue);let t=(e._tag===`Filter`?e.filter.annotations:`annotations`in e?e.annotations:e.ast.annotations)?.[e._tag===`MissingKey`?`messageMissingKey`:e._tag===`UnexpectedKey`?`messageUnexpectedKey`:`message`];if(typeof t==`string`)return t}function Km(e){let t;for(let n of e.reasons){if(!Pp(n)||!vm(n.error))return;t??=n.error}return t}function qm(e,t){let n=Km(e);if(n===void 0)throw Error(t,{cause:e});return n}var Jm=class e extends hc{run;constructor(e){super(),this.run=e}map(t){return new e((e,n)=>this.run(e,n).pipe(tm(td(t))))}compose(t){return Xm(this)?t:Xm(t)?this:new e((e,n)=>this.run(e,n).pipe(nm(e=>t.run(e,n))))}},Ym=new Jm(qp);function Xm(e){return e.run===Ym.run}function Zm(){return Ym}function Qm(e){return $m(td(e))}function $m(e){return new Jm(t=>qp(e(t)))}function eh(e){return new Jm(t=>{let n=nd(t,Ac);return ed(n)?qp(n):tm(e,Qu)})}function th(){return Qm(globalThis.String)}function nh(){return Qm(globalThis.Number)}var rh=`~effect/SchemaTransformation/Transformation`,ih=class e{[rh]=rh;_tag=`Transformation`;decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new e(this.encode,this.decode)}compose(t){return new e(this.decode.compose(t.decode),t.encode.compose(this.encode))}};function ah(e){return Fc(e,rh)&&e[rh]===rh}var oh=e=>ah(e)?e:new ih(e.decode,e.encode);function sh(e){return new ih(Qm(e.decode),Qm(e.encode))}var ch=new ih(Zm(),Zm());function lh(){return ch}var uh=new ih(nh(),th());function dh(e){return t=>t._tag===e}function fh(e){return Fc(e,Ch)&&e[Ch]===Ch}var ph=dh(`Declaration`),mh=dh(`Never`),hh=dh(`Literal`),gh=dh(`UniqueSymbol`),_h=dh(`Arrays`),vh=dh(`Objects`),yh=dh(`Suspend`),bh=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},xh={},Sh=class{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,n=void 0,r=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=n,this.annotations=r}},Ch=`~effect/Schema`,wh=class{[Ch]=Ch;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,r=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=r}toString(){return`<${this._tag}>`}},Th=class e extends wh{_tag=`Declaration`;typeParameters;run;encodingChecks;encodingRun;constructor(e,t,n,r,i,a,o,s){super(n,r,i,a),this.typeParameters=e,this.run=t,this.encodingChecks=o,this.encodingRun=s}getParser(){let e;return(t,n)=>t===dm?pm:(e??=this.run(this.typeParameters))(t,this,n)}_rebuild(t,n,r,i,a){let o=Vg(this.typeParameters,t);return o===this.typeParameters&&n===this.checks&&r===this.encodingChecks&&i===this.run&&a===this.encodingRun?this:new e(o,i,this.annotations,n,void 0,this.context,r,a)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let e=this.annotations?.expected;return typeof e==`string`?e:`<Declaration>`}},Eh=new class extends wh{_tag=`Null`;getParser(){return i_(this,null)}getExpected(){return`null`}},Dh=class extends wh{_tag=`Undefined`;getParser(){return i_(this,void 0)}toCodecJson(){return Ag(this,[Oh])}getExpected(){return`undefined`}},Oh=new bh(Eh,new ih(Qm(()=>void 0),Qm(()=>null))),kh=new Dh,Ah=new class extends wh{_tag=`Never`;getParser(){return a_(this,Mc)}getExpected(){return`never`}},jh=new class extends wh{_tag=`Unknown`;getParser(){return a_(this,Nc)}getExpected(){return`unknown`}},Mh=class extends wh{_tag=`Literal`;literal;constructor(e,t,n,r,i){if(super(t,n,r,i),typeof e==`number`&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${Ol(e)}`);this.literal=e}getParser(){return i_(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==`bigint`?Nh(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:Nh(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function Nh(e){let t=globalThis.String(e.literal);return Ag(e,[new bh(new Mh(t),new ih(Qm(()=>e.literal),Qm(()=>t)))])}var Ph=new class extends wh{_tag=`String`;getParser(){return a_(this,wc)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&p_(n,e,void 0,this,t)?void 0:e}getExpected(){return`string`}},Fh=class extends wh{_tag=`Number`;getParser(){return a_(this,Tc)}matchKey(e,t){return this._match(c_,e,t)}matchPart(e,t){return this._match(s_,e,t)}_match(e,t,n){if(!e.test(t))return;let r=globalThis.Number(t);return n.disableChecks||!this.checks?r:p_(this.checks,r,void 0,this,n)?void 0:r}toCodecJson(){return this.checks&&(Ih(this.checks,`effect/schema/isFinite`)||Ih(this.checks,`effect/schema/isInt`))?this:Ag(this,[Tg])}toCodecStringTree(){return this.toCodecJson()===this?Ag(this,[d_]):Ag(this,[f_])}getExpected(){return`number`}};function Ih(e,t){return e.some(e=>e.annotations?.representation?.id===t||e._tag===`FilterGroup`&&Ih(e.checks,t))}var Lh=new Fh,Rh=new class extends wh{_tag=`Boolean`;getParser(){return a_(this,Ec)}getExpected(){return`boolean`}},zh=class e extends wh{_tag=`Arrays`;isMutable;elements;rest;encodingChecks;constructor(e,t,n,r,i,a,o,s){super(r,i,a,o),this.isMutable=e,this.elements=t,this.rest=n,this.encodingChecks=s;let c=!1;for(let e=0;e<t.length;e++)if(Xg(t[e]))c=!0;else if(c)throw Error(`A required element cannot follow an optional element. ts(1257)`);if(c&&n.length>1)throw Error(`A required element cannot follow an optional element. ts(1257)`);for(let e=1;e<n.length;e++)if(Xg(n[e]))throw Error(`An optional element cannot follow a rest element. ts(1266)`)}getParser(e,t=e){let n=this,r,i,a=n.elements.length,o=Math.max(0,n.rest.length-1);function s(e,t){return t<a?r[t]:t>=e?i[t-e+1]:i[0]}return rm(function*(e,c){if(e===dm)return dm;if(!Array.isArray(e))return yield*Jp(new Dm(n,e,c));r||(r=n.elements.map(e=>({ast:e,parser:t(e)})),i=n.rest.map(e=>({ast:e,parser:t(e)})));let l=e.length,u={ast:n,getParser:s,input:e,len:l,tailThreshold:Math.max(a,l-o),output:new globalThis.Array(l),issues:void 0,options:c},d=Bh(u,e,{concurrency:Vh(c?.concurrency)?.concurrency,end:n.rest.length===0?a:Math.max(l,a+o)});if(d&&(yield*d),n.rest.length===0&&l>a)for(let t=a;t<=l-1;t++){let r=new Tm(n,e[t],c),i=new Cm([t],r);if(c.errors===`all`)u.issues?u.issues.push(i):u.issues=[i];else return yield*Jp(new Em(n,[i],e,c))}return u.issues?yield*Jp(new Em(n,u.issues,e,c)):u.output})}_rebuild(t,n,r){let i=Vg(this.elements,t),a=Vg(this.rest,t);return i===this.elements&&a===this.rest&&n===this.checks&&r===this.encodingChecks?this:new e(this.isMutable,i,a,this.annotations,n,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return`array`}},Bh=Dp()({onItem(e,t,n){let r=n<e.len?t:dm;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step(e,t,n,r){if(n._tag===`Failure`)return Hh(e,e.ast,r,n);let i=n===mm?t:n[F];if(i!==dm)e.output[r]=i;else{let t=e.getParser(e.tailThreshold,r);if(Xg(t.ast))return;let n=new Cm([r],new wm(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return Rp(new Em(e.ast,[n],e.input,e.options))}}}),Vh=e=>(e=e===`unbounded`?1/0:e??1,e>1?{concurrency:e}:void 0),Hh=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let i=Km(r.cause);if(i===void 0)return Lp(Fp(r.cause,r=>new Em(t,[new Cm([n],r)],e.input,e.options)));let a=new Cm([n],i);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return Rp(new Em(t,[a],e.input,e.options))},Uh=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;function Wh(e,t,n=xh){let r,i;function a(t){switch(t._tag){case`String`:case`TemplateLiteral`:return(r??=Object.keys(e)).filter(e=>t.matchPart(e,n)!==void 0);case`Number`:return(r??=Object.keys(e)).filter(e=>t.matchKey(e,n)!==void 0);case`Symbol`:return(i??=Object.getOwnPropertySymbols(e)).filter(e=>t.matchKey(e,n)!==void 0);case`Union`:return[...new Set(t.types.flatMap(a))];default:return[]}}return a(o_(e_(t)))}var Gh=class{name;type;constructor(e,t){this.name=e,this.type=t}};function Kh(e){switch(e._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return e.types.every(Kh);default:return!1}}function qh(e){return Kh(e)&&Kh(e_(e))}var Jh=class{parameter;type;constructor(e,t){if(!qh(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,Xg(t)&&!r_(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},Yh=class e extends wh{_tag=`Objects`;propertySignatures;indexSignatures;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=o;let s=e.map(e=>e.name).filter((e,t,n)=>n.indexOf(e)!==t);if(s.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(s)}. ts(2300)`)}getParser(e,t=e){let n=this,r=[];for(let e of n.propertySignatures)r.push(e.name);let i=r.length,a=n.indexSignatures.length,o=i&&a?new Set(r):void 0;if(!i&&!a)return a_(n,jc);let s,c,l=(e,t,r,a,s)=>{if(s._tag===`Failure`)return Hh(e,n,t,s)??zp;let c=s===mm?a:s[F];if(r!==dm&&c!==dm){if(i&&(o.has(t)||o.has(r)))return zp;yl(e.out,r,c)}return zp},u=(e,t,r,i)=>{if(!i){let n=r.parserKey(t,e.options);if(!fp(n))return Zp(Qp(n),n=>u(e,t,r,n));i=n}if(i._tag===`Failure`)return Hh(e,n,t,i)??zp;let a=i===mm?t:i[F],o=e.input[t],s=r.parserValue(o,e.options);return fp(s)?l(e,t,a,o,s):Zp(Qp(s),n=>l(e,t,a,o,n))},d=(e,t,n)=>{let r=e.input[t],i=n.parserValue(r,e.options);return fp(i)?l(e,t,t,r,i):Zp(Qp(i),n=>l(e,t,t,r,n))},f=a?Dp()({onItem:(e,[t,n])=>u(e,t,n),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0,p=()=>(s||(s=n.propertySignatures.map(e=>({parser:t(e.type),name:e.name,type:e.type})),c=a?n.indexSignatures.map(n=>({is:n,parserKey:e(o_(n.parameter)),parserValue:t(n.type)})):void 0),s),m=rm(function*(e,t){if(e===dm)return dm;if(typeof e!=`object`||!e||Array.isArray(e))return yield*Jp(new Dm(n,e,t));p();let l=e,m={},h={ast:n,input:l,out:m,issues:void 0,options:t},g=t.errors===`all`,_=t.onExcessProperty===`error`,v=t.onExcessProperty===`preserve`,y;if(!a&&(_||v)){o??=new Set(r),y=Reflect.ownKeys(l);for(let r=0;r<y.length;r++){let i=y[r];if(!o.has(i)){if(_){let r=new Tm(n,l[i],t),a=new Cm([i],r);if(g){h.issues?h.issues.push(a):h.issues=[a];continue}return yield*Jp(new Em(n,[a],e,t))}yl(m,i,l[i])}}}let b=Vh(t?.concurrency);if(i){let e=Zh(h,s,b);e&&(yield*e)}if(a&&!b)for(let e=0;e<a;e++){let n=c[e],r=n.is.parameter===Ph?d:u,i=n.is.parameter===Ph?Object.keys(l):Wh(l,n.is.parameter,t);for(let e=0;e<i.length;e++){let t=r(h,i[e],n);if(!fp(t))yield*t;else if(t._tag===`Failure`)return yield*t}}else if(f){let e=gd();for(let n=0;n<a;n++){let r=c[n],i=Wh(l,r.is.parameter,t);for(let t=0;t<i.length;t++)e.push([i[t],r])}let n=f(h,e,b);n&&(yield*n)}if(h.issues)return yield*Jp(new Em(n,h.issues,e,t));if(t.propertyOrder===`original`){let e=(y??Reflect.ownKeys(l)).concat(r),t={};for(let n of e)Object.hasOwn(m,n)&&yl(t,n,m[n]);return t}return m});if(a)return m;let h=(e,t,n)=>{let r=s[t];return Zp(Qp(n),n=>{let i=Xh(e,r,n);if(i)return i;let a=()=>fm(e.out),o=Zh(e,s.slice(t+1));return o?nm(o,a):a()})};return(e,t)=>{if(e===dm)return pm;if(t.errors===`all`||t.onExcessProperty!==void 0||t.propertyOrder===`original`||t.concurrency!==void 0)return m(e,t);if(typeof e!=`object`||!e||Array.isArray(e))return Jp(new Dm(n,e,t));let r=p(),i=e,a={},o={ast:n,input:i,out:a,issues:void 0,options:t};try{for(let e=0;e<r.length;e++){let n=r[e],s=n.name,c=Object.hasOwn(i,s),l=c?i[s]:dm,u=n.parser(l,t);if(!fp(u))return h(o,e,u);if(u===mm){c&&yl(a,s,l);continue}let d=Xh(o,n,u);if(d)return d}}catch(e){return Xp(e)}return fm(a)}}_rebuild(t,n,r,i){let a=Vg(this.propertySignatures,e=>{let n=t(e.type);return n===e.type?e:new Gh(e.name,n)}),o=Vg(this.indexSignatures,e=>{let r=n(e.parameter),i=t(e.type);return r===e.parameter&&i===e.type?e:new Jh(r,i)});return a===this.propertySignatures&&o===this.indexSignatures&&r===this.checks&&i===this.encodingChecks?this:new e(a,o,this.annotations,r,void 0,this.context,i)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?`object | array`:`object`}};function Xh(e,t,n){if(n._tag===`Failure`)return Hh(e,e.ast,t.name,n);if(n===mm)return;let r=n[F];if(r!==dm){yl(e.out,t.name,r);return}if(delete e.out[t.name],!Xg(t.type)){let n=new Cm([t.name],new wm(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}return Rp(new Em(e.ast,[n],e.input,e.options))}}var Zh=Dp()({onItem(e,t){if(!Object.hasOwn(e.input,t.name))return t.parser(dm,e.options);let n=e.input[t.name];return yl(e.out,t.name,n),t.parser(n,e.options)},step:Xh});function Qh(e,t){return e?t?[...e,...t]:e:t}function $h(e,t,n){return new Yh(Reflect.ownKeys(e).map(t=>new Gh(t,e[t].ast)),[],n,t)}function eg(e){return e.ast}function tg(e,t=void 0){return new zh(!1,e.map(e=>e.ast),[],void 0,t)}function ng(e,t,n){return new dg(e.map(eg),t,void 0,n)}var rg=xc(e=>{for(;;){if(yh(e))return jh;let t=e.encoding;if(!t)return e.recur?.(rg,_c)??e;if(t.some(e=>e.transformation._tag===`Middleware`&&e.transformation.decode!==_c))return jh;e=t[t.length-1].to}});function ig(e){switch(e._tag){case`Null`:return[`null`];case`Undefined`:return[`undefined`];case`String`:case`TemplateLiteral`:return[`string`];case`Number`:return[`number`];case`Boolean`:return[`boolean`];case`Symbol`:case`UniqueSymbol`:return[`symbol`];case`BigInt`:return[`bigint`];case`Arrays`:return[`array`];case`ObjectKeyword`:return[`object`,`array`,`function`];case`Objects`:return e.propertySignatures.length||e.indexSignatures.length?[`object`]:[`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`];case`Enum`:return Array.from(new Set(e.enums.map(([,e])=>typeof e)));case`Literal`:return[typeof e.literal];case`Union`:return Array.from(new Set(e.types.flatMap(ig)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function ag(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[sm];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!Xg(t)){if(hh(t))return[{key:e.name,literal:t.literal}];if(gh(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>{if(!Xg(e)){if(hh(e))return[{key:t,literal:e.literal}];if(gh(e))return[{key:t,literal:e.symbol}]}return[]});case`Union`:{if(e.types.length===0)return[];let t=e.types.map(e=>ag(rg(e)));return t[0].filter(e=>t.every(t=>t.some(t=>t.key===e.key&&t.literal===e.literal)))}case`Suspend`:return ag(e.thunk())}}var og=new WeakMap,sg=Object.freeze([]);function cg(e){let t=og.get(e);if(t)return t;let n,r=0,i,a,o=!0;for(let t=0;t<e.length;t++){let s=e[t],c=rg(s);if(mh(c))continue;if(o){if(hh(c)||gh(c)){a??=new Map;let e=hh(c)?c.literal:c.symbol,t=a.get(e);t||a.set(e,t=[]),t.push(s)}else o=!1}let l=ag(c);if(l.length){n??=new Map,r++;for(let{key:e,literal:r}of l){let i=n.get(e);i||n.set(e,i=[new Map,new Set]),i[1].add(t);let a=i[0].get(r);a||i[0].set(r,a=new Set),a.add(t)}}else{i??={};let e=ig(c);for(let n of e)(i[n]??=[]).push(t)}}if(o&&a)a.forEach(Object.freeze),t=e=>a.get(e)??sg;else if(n?.size===1&&!i){let[r,[i]]=n.entries().next().value,a=i;for(let[t,n]of i)a.set(t,Object.freeze(Array.from(n,t=>e[t])));t=(t,n)=>{if(Pc(t)){let i=Object.hasOwn(t,r)?t[r]:void 0;if(i!==void 0)return a.get(i)??sg;if(n)return e}return sg}}else if(n){let a;for(let e of n)(!a||e[1][0].size>a[1][0].size)&&e[1][1].size===r&&(a=e);t=(t,r)=>{let o=i?.[t===null?`null`:Array.isArray(t)?`array`:typeof t]??sg;if(!Pc(t))return o.map(t=>e[t]);let s=new Set(o),c;if(a){let[n,[i]]=a,l=Object.hasOwn(t,n),u=l?t[n]:void 0;if(l&&(!r||u!==void 0)){let t=i.get(u);if(!t)return o.map(t=>e[t]);for(let e of t)s.add(e);c=n}}if(c===void 0)for(let[e,[i,a]]of n){let n=Object.hasOwn(t,e),o=n?t[e]:void 0;if(n&&(!r||o!==void 0)){let e=i.get(o);if(e)for(let t of e)s.add(t)}else if(r)for(let e of a)s.add(e)}for(let[e,[i,a]]of n){if(e===c)continue;let n=Object.hasOwn(t,e),o=n?t[e]:void 0;if(n&&(!r||o!==void 0)){let e=i.get(o);for(let t of s)a.has(t)&&!e?.has(t)&&s.delete(t)}}return Array.from(s).sort((e,t)=>e-t).map(t=>e[t])}}else t=t=>(i?.[t===null?`null`:Array.isArray(t)?`array`:typeof t]??sg).map(t=>e[t]).filter(lg(t));return og.set(e,t),t}function lg(e){return t=>{let n=rg(t);return n._tag===`Literal`?n.literal===e:n._tag!==`UniqueSymbol`||n.symbol===e}}function ug(e,t,n=!1){return cg(t)(e,n)}var dg=class e extends wh{_tag=`Union`;types;mode;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.types=e,this.mode=t,this.encodingChecks=o}getParser(e,t){let n=this;return(r,i)=>{if(r===dm)return pm;let a=ug(r,n.types,t!==void 0);if(a.length===1){let t=e(a[0])(r,i);return t._tag===`Success`?t:fp(t)?fg(n,t.cause,r,i):$p(t,e=>fg(n,e,r,i))}let o={ast:n,compile:e,input:r,out:void 0,successes:n.mode===`oneOf`?[]:void 0,issues:void 0,options:i},s=Vh(i?.concurrency),c=pg(o,a,s?{...s,orderedStep:!0}:void 0);return c?nm(c,e=>o.out===mm?qp(r):o.out?o.out:Jp(new km(n,o.issues??[],r,i))):o.out?o.out:Jp(new km(n,o.issues??[],r,i))}}_rebuild(t,n,r){let i=Vg(this.types,t);return i===this.types&&n===this.checks&&r===this.encodingChecks?this:new e(i,this.mode,this.annotations,n,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let n of this.types){let r=n.matchPart(e,t);if(r!==void 0)return r}}getExpected(e){let t=this.annotations?.expected;if(typeof t==`string`)return t;if(this.types.length===0)return`never`;let n=this.types.map(t=>{let n=e_(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(hh);if(t.length>0)return`${hg(n.isMutable)}[ ${t.map(t=>e(t)+gg(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>hh(e.type));if(t.length>0)return`{ ${t.map(t=>`${hg(t.type.context?.isMutable)}${Al(t.name)}${gg(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};function fg(e,t,n,r){let i=Km(t);return i?Rp(new km(e,[i],n,r)):Lp(t)}var pg=Dp()({onItem(e,t){return e.compile(t)(e.input,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=Km(n.cause);if(t===void 0)return n;e.issues?e.issues.push(t):e.issues=[t]}else{if(e.out&&e.successes)return e.successes.push(t),Rp(new Am(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(t);else return zp}}}),mg=new dg([new Mh(`Infinity`),new Mh(`-Infinity`),new Mh(`NaN`)],`anyOf`);function hg(e){return e?``:`readonly `}function gg(e){return e?`?`:``}function _g(e){let t=!1,n;return()=>t?n:(n=e(),t=!0,n)}var vg=class e extends wh{_tag=`Suspend`;thunk;constructor(e,t,n,r,i){if(n)throw Error(`Cannot add checks to Suspend`);super(t,void 0,r,i),this.thunk=_g(e)}getParser(e){let t;return(n,r)=>(t??=e(this.thunk()))(n,r)}recur(t){return new e(()=>t(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(e){return e(this.thunk())}},yg=class e extends hc{_tag=`Filter`;run;annotations;aborted;constructor(e,t=void 0,n=!1){super(),this.run=e,this.annotations=t,this.aborted=n}annotate(t){return new e(this.run,{...this.annotations,...t},this.aborted)}abort(){return new e(this.run,this.annotations,!0)}and(e,t){return new bg([this,e],t)}},bg=class e extends hc{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(t){return new e(this.checks,{...this.annotations,...t})}and(t,n){return new e([this,t],n)}};function xg(e,t,n=!1){return new yg((t,n,r)=>Nm(n,e(t,n,r),t,r),t,n)}function Sg(e,t){return new yg((t,n,r)=>e(t)?void 0:new Om(void 0,t,r),t,!0)}function Cg(e){return xg(e=>globalThis.Number.isFinite(e),{expected:`a finite number`,representation:{id:`effect/schema/isFinite`,payload:null},toJsonSchema:()=>({type:`number`}),toCode:()=>({runtime:`Schema.isFinite()`}),arbitrary:{constraint:{noInfinity:!0,noNaN:!0}},...e})}var wg=Pg(Lh,[Cg()]),Tg=new bh(new dg([wg,mg],`anyOf`),new ih(nh(),Qm(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function Eg(e,t){let n=e.source,r=new globalThis.RegExp(n,e.flags);return xg(e=>(r.lastIndex=0,r.test(e)),{expected:`a string matching the RegExp ${n}`,representation:{id:`effect/schema/isPattern`,payload:{source:n,flags:e.flags}},toJsonSchema:()=>({pattern:n}),arbitrary:{constraint:{patterns:[e.source]}},...t})}function Dg(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}var Og=new WeakMap;function kg(e){return Og.get(e)??e}function Ag(e,t){return e.encoding===t?e:Dg(e,e=>{e.encoding.value=t})}function jg(e,t){if(e.context===t)return e;let n=kg(e);if(n.context===t)return n;let r=Dg(e,e=>{e.context.value=t});return Og.set(r,n),r}function Mg(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return Ng(e,ud(e.checks.slice(0,-1),n.annotate(t)))}return Dg(e,e=>{e.annotations.value={...e.annotations.value,...t}})}function Ng(e,t){if(e._tag===`Suspend`&&t)throw Error(`Cannot add checks to Suspend`);return e.checks===t?e:Dg(e,e=>{e.checks.value=t})}function Pg(e,t){return Ng(e,Qh(e.checks,t))}function Fg(e,t){let n=t(e.to);return n===e.to?e:new bh(n,e.transformation)}function Ig(e,t){let n=e,r=n[n.length-1],i=Fg(r,t);return i===r?e:ud(e.slice(0,e.length-1),i)}function Lg(e){return t=>t.encoding?Ag(t,Ig(t.encoding,e)):t}function Rg(e,t){function n(r){if(r.encoding){let e=r.encoding[r.encoding.length-1];return t?.stopAt?.(e)?r:Ag(r,Ig(r.encoding,n))}return e(r)}return xc(n)}function zg(e,t,n){let r=new bh(e,t);return Ag(n,n.encoding?[...n.encoding,r]:[r])}function Bg(e,t){let n=lm(e);return Mg(e,{brands:n?[...n,t]:[t]})}function Vg(e,t){let n=!1,r=Array(e.length);for(let i=0;i<e.length;i++){let a=e[i],o=t(a);o!==a&&(n=!0),r[i]=o}return n?r:e}function Hg(e,t){return jg(e,e.context?new Sh(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new Sh(!1,!1,void 0,t))}var Ug=xc(e=>Wg(jg(e,e.context?e.context.isOptional===!1?new Sh(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new Sh(!0,!1)))),Wg=Lg(Ug),Gg=bc(e=>Ug(new dg([e,kh],`anyOf`)));function Kg(e,t){let n=new bh(jh,new ih(eh(t),Zm()));return jg(e,e.context?new Sh(e.context.isOptional,e.context.isMutable,n,e.context.annotations):new Sh(!1,!1,n))}function qg(e,t,n){return zg(e,n,t)}function Jg(e){let t=[],n=[];function r(e){switch(e._tag){case`Literal`:Oc(e.literal)&&t.push(e.literal);return;case`UniqueSymbol`:t.push(e.symbol);return;case`Never`:return;case`Union`:for(let t=0;t<e.types.length;t++)r(e.types[t]);return;default:n.push(e)}}return r(e),{literals:t,parameters:n}}function Yg(e,t){let{literals:n,parameters:r}=Jg(e);return new Yh(n.map(e=>new Gh(e,t)),r.map(e=>new Jh(e,t)))}function Xg(e){return e.context?.isOptional??!1}function Zg(e){return e.annotations?.[`~structural`]===!0||e._tag===`FilterGroup`&&e.checks.every(Zg)}function Qg(e){function t(e){return Zg(e)?[e]:e._tag===`FilterGroup`?e.checks.flatMap(t):[]}let n=e.flatMap(t);return fd(n)?n:void 0}var $g=xc(e=>{if(e.encoding)return $g(Ag(e,void 0));let t=e,n=t.recur?.($g)??t,r=n.encodingChecks;if(r){let t=n===e?r:_h(n)||vh(n)||ph(n)&&n.typeParameters.length>0?Qg(r):void 0;return Dg(n,e=>{e.encodingChecks.value=void 0,e.checks.value=Qh(n.checks,t)})}return n}),e_=xc(e=>$g(n_(e)));function t_(e,t){let n=t,r=n.length,i=n[r-1],a=[new bh(n_(Ag(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new bh(n_(n[e-1].to),n[e].transformation.flip()));let o=n_(i.to);return o.encoding?Ag(o,[...o.encoding,...a]):Ag(o,a)}var n_=bc(e=>{if(e.encoding)return t_(e,e.encoding);let t=e;return t.flip?.(n_)??t.recur?.(n_)??t});function r_(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(r_);default:return!1}}function i_(e,t){let n=fm(t);return(r,i)=>r===dm?pm:r===t?n:Jp(new Dm(e,r,i))}function a_(e,t){return(n,r)=>n===dm?pm:t(n)?mm:Jp(new Dm(e,n,r))}var o_=Rg(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(o_)}}),s_=new globalThis.RegExp(`^${Uh}$`),c_=new globalThis.RegExp(`^(?:${Uh}|Infinity|-Infinity|NaN)$`);function l_(e){return Eg(s_,{expected:`a string representing a finite number`,representation:{id:`effect/schema/isStringFinite`,payload:null},toJsonSchema:()=>({pattern:s_.source}),...e})}var u_=Pg(Ph,[l_()]),d_=new bh(u_,uh),f_=new bh(new dg([u_,mg],`anyOf`),uh);function p_(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`){if(n=p_(o.checks,t,n,r,i),n&&(i.errors!==`all`||n[n.length-1].filter.aborted))return n}else{let e=o.run(t,r,i);if(e){let r=new xm(o,e,t,i);if(n?n.push(r):n=[r],i.errors!==`all`||o.aborted)return n}}}return n}function m_(e){if(!ph(e))return;let t=e.annotations?.[cm];return kc(t)?t(e.typeParameters):void 0}function h_(e){let t=O_(M_,$g(e.ast));return(e,n)=>t(e,n?.disableChecks?n?.parseOptions?{...n.parseOptions,disableChecks:!0}:{disableChecks:!0}:n?.parseOptions)}function g_(e){let t=h_(e);return(e,n)=>{let r=em(t(e,n));return Bp(r)?Qu(r.value):(qm(r.cause,`Option adapter can only return none for schema issues`),Zu())}}function __(e){let t=h_(e);return(e,n)=>{let r=em(t(e,n));if(Bp(r))return r.value;let i=qm(r.cause,`Constructor adapter can only throw schema issues`);throw Error(`Schema validation failed`,{cause:i})}}function v_(e){return y_(e.ast)}function y_(e){let t=k_(D_($g(e)));return e=>{let n=t(e,xh);return Bp(n)?!0:(qm(n.cause,`Type guard adapter can only return false for schema issues`),!1)}}function b_(e,t){let n=D_(e.ast);return t===void 0?n:(e,r)=>n(e,T_(t,r))}function x_(e,t){return k_(b_(e,t))}function S_(e,t){return A_(b_(e,t))}function C_(e,t){let n=D_(n_(e.ast));return t===void 0?n:(e,r)=>n(e,T_(t,r))}function w_(e,t){return k_(C_(e,t))}var T_=(e,t)=>t?{...e,...t}:e,E_=e=>e===dm?Jp(new Om):qp(e);function D_(e){return O_(j_,e)}function O_(e,t){let n;return(r,i)=>{let a=(n??=e(t))(r,i??xh);return a===mm?qp(r):fp(a)?a[F]===dm?E_(dm):a:nm(a,E_)}}function k_(e){return(t,n)=>em(e(t,n))}function A_(e){let t=k_(e);return(e,n)=>{let r=t(e,n);return Bp(r)?rd(r.value):id(qm(r.cause,`Result adapter can only return schema issues`))}}var j_=bc(e=>L_(e,j_)),M_=bc(e=>L_(e,M_,P_)),N_=bc(e=>L_(e,M_,P_,e.context?.constructorDefault));function P_(e){return e.context?.constructorDefault?N_(e):M_(e)}function F_(e,t,n,r){let i;if(fp(e)&&e._tag===`Success`){let a=hm(e===mm?t:e[F]);i=n._tag===`Transformation`?n.decode.run(a,r):n.decode(fm(a),r)}else i=n._tag===`Transformation`?nm(e,e=>n.decode.run(hm(e),r)):n.decode(tm(e,hm),r);return fp(i)&&i._tag===`Success`?gm(i[F]):nm(i,gm)}function I_(e,t){let n;return(r,i)=>r===dm?pm:e.isConstructed(r)?mm:F_((n??=t(e.link.to))(r,i),r,e.link.transformation,i)}function L_(e,t,n,r){let i=n?m_(e):void 0,a=i?I_(i,t):e.getParser(t,n),o=e.checks,s=r?e.encoding?[...e.encoding,r]:[r]:e.encoding,c=e.encodingChecks,l=(o?o[o.length-1].annotations:e.annotations)?.parseOptions;if(!s&&!o&&!c)return l?(e,t)=>a(e,T_(t,l)):a;let u,d=(t,n)=>{let r=a(t,n);if(c&&!n.disableChecks){if(fp(r)){if(r._tag===`Success`){let i=r===mm?t:r[F];if(t!==dm&&i!==dm){let i=p_(c,t,void 0,e,n);i&&(r=Jp(new Em(e,i,t,n)))}}}else r=Zp(r,r=>{if(t!==dm&&r!==dm){let r=p_(c,t,void 0,e,n);if(r)return Jp(new Em(e,r,t,n))}return qp(r)})}if(o&&!n.disableChecks){if(fp(r)){if(r._tag===`Success`){let i=r===mm?t:r[F];if(i===dm)return r;let a=p_(o,i,void 0,e,n);a&&(r=Jp(new Em(e,a,i,n)))}}else r=Zp(r,t=>{if(t!==dm){let r=p_(o,t,void 0,e,n);if(r)return Jp(new Em(e,r,t,n))}return qp(t)})}return r};return s?(n,r)=>{l&&(r=T_(r,l));let i=u??=s.map(e=>t(e.to)),a=n,o=i[i.length-1](n,r);for(let e=s.length-1;e>=0;e--)if(o=F_(o,a,s[e].transformation,r),e!==0){let t=i[e-1];o._tag===`Success`?(a=o[F],o=t(a,r)):o=nm(o,e=>{let n=t(e,r);return n===mm?fm(e):n})}if(o._tag===`Success`){let e=o[F],t=d(e,r);return t===mm?o:t}return o=$p(o,t=>Yp(()=>Fp(t,t=>new Sm(e,t,n,r)))),nm(o,e=>{let t=d(e,r);return t===mm?fm(e):t})}:l?(e,t)=>d(e,T_(t,l)):d}var R_=`~effect/Schema/Schema`,z_={[R_]:R_,pipe(){return pc(this,arguments)},annotate(e){return this.rebuild(Mg(this.ast,e))},annotateKey(e){return this.rebuild(Hg(this.ast,e))},check(...e){return this.rebuild(Pg(this.ast,e))}};function B_(e,t){function n(){}let r=Object.defineProperties(Object.setPrototypeOf(n,z_),Object.getOwnPropertyDescriptors({...t}));return r.ast=e,r.rebuild=e=>B_(e,t),r.makeEffect=h_(r),r.make=__(r),r.makeOption=g_(r),r}var V_=gc(2,(e,t)=>({...e,...t})),H_=gc(2,(e,t)=>W_(e,(e,n)=>[Object.hasOwn(t,e)?t[e]:e,n])),U_=e=>e;function W_(e,t){let n={};for(let r of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;let i=t(r,e[r]);if(i){let[e,t]=i;yl(n,e,t)}}return n}var G_=R_;function K_(){return(e,t,n)=>nv(new Th(e.map(eg),e=>t(e.map(e=>nv(e))),n))}function q_(e,t){return K_()([],()=>(t,n,r)=>e(t)?qp(t):Jp(new Dm(n,t,r)),t)}var J_=`~effect/SchemaError/SchemaError`,Y_=class extends xf(`SchemaError`){[J_]=J_;constructor(e){let t=Af();jf(0);try{super({issue:e})}finally{jf(t)}}get message(){return Um(this.issue)}toString(){return`SchemaError(${this.message})`}};function X_(e){return Fc(e,J_)&&e[J_]===J_}var Z_=v_;function Q_(e,t){let n=x_(e,t);return(e,t)=>$_(n(e,t))}function $_(e){return Bp(e)?e:Lp(Fp(e.cause,e=>new Y_(e)))}function ev(e,t){let n=S_(e,t);return(e,t)=>sd(n(e,t),e=>new Y_(e))}function tv(e,t){let n=w_(e,t);return(e,t)=>$_(n(e,t))}var nv=B_;function rv(e){return Fc(e,G_)&&e[G_]===G_}var iv=U_(e=>nv(Ug(e.ast),{schema:e})),I=U_(e=>{let t=vv(e);return nv(Gg(e.ast),{schema:t})}),L=U_(e=>nv($g(e.ast),{schema:e})),av=U_(e=>nv(e_(e.ast),{schema:e}));function R(e){let t=nv(new Mh(e),{literal:e,transform(n){return t.pipe(Sv(R(n),{decode:Qm(()=>n),encode:Qm(()=>e)}))}});return t}var ov=nv(Ah),sv=nv(Eh),cv=nv(kh),z=nv(Ph),B=nv(Lh),V=nv(Rh);function lv(e,t){return nv(e,{fields:t,mapFields(e,t){let n=e(this.fields);return lv($h(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function H(e){return lv($h(e,void 0),e)}function uv(e){return U_(t=>t.mapFields(V_(e)))}var dv=e=>typeof e==`symbol`?e:globalThis.String(e);function fv(e){return function(t){let n={},r=Object.create(null),i=Object.create(null),a=new Set;for(let o of Reflect.ownKeys(t.fields)){let s=av(t.fields[o]),c=Object.hasOwn(e,o),l=c?e[o]:o,u=dv(l);if(a.has(u))throw new globalThis.Error(`Duplicate encoded keys: ${Al(l)}`);a.add(u),yl(n,l,s),c&&(r[o]=l,i[l]=o)}return H(n).pipe(Sv(t,sh({decode:H_(i),encode:H_(r)})))}}function pv(e,t){return nv(Yg(e.ast,t.ast),{key:e,value:t})}function mv(e,t){return nv(e,{elements:t,mapElements(e,t){let n=e(this.elements);return mv(tg(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function hv(e){return mv(tg(e),e)}var U=U_(e=>nv(new zh(!1,[],[e.ast]),{value:e})),gv=U_(e=>nv(new zh(!1,[e.ast],[e.ast]),{value:e}));function _v(e,t){return nv(e,{members:t,mapMembers(e,t){let n=e(this.members);return _v(ng(n,this.ast.mode,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function W(e,t){return _v(ng(e,t?.mode??`anyOf`,void 0),e)}function G(e){let t=e.map(R);return nv(ng(t,`anyOf`,void 0),{literals:e,members:t,mapMembers(e){return W(e(this.members))},pick(e){return G(e)},transform(e){return W(t.map((t,n)=>t.transform(e[n])))}})}var K=U_(e=>W([e,sv])),vv=U_(e=>W([e,cv]));function yv(e){return nv(new vg(()=>e().ast))}function q(...e){return t=>t.check(...e)}function bv(e,t){return n=>nv(Pg(n.ast,[Sg(e,t)]),{schema:n})}function xv(e){return t=>nv(Bg(t.ast,e),{schema:t,identifier:e})}function Sv(e,t){return n=>nv(qg(n.ast,e.ast,t?oh(t):lh()),{from:n,to:e})}function Cv(e){return t=>nv(Kg(t.ast,e),{schema:t})}function wv(e){return R(e).pipe(Cv(qp(e)))}function Tv(e,t){return H({_tag:wv(e),...t})}var J=xg;function Ev(e,t){let n=e.source,r=e.flags,i=r===``?`new RegExp(${Ol(n)})`:`new RegExp(${Ol(n)}, ${Ol(r)})`;return Eg(e,{toCode:()=>({runtime:`Schema.isPattern(${i})`}),...t})}var Dv=nv(wg);function Ov(e){let t=Ju(e.order),n=e.formatter??Ol;return(r,i)=>J(e=>t(e,r),{expected:`a value greater than ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r,exclusiveMinimum:!0}}},...e.annotate?.(r),...i})}function kv(e){let t=Xu(e.order),n=e.formatter??Ol;return(r,i)=>J(e=>t(e,r),{expected:`a value greater than or equal to ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r}}},...e.annotate?.(r),...i})}function Av(e){let t=Yu(e.order),n=e.formatter??Ol;return(r,i)=>J(e=>t(e,r),{expected:`a value less than or equal to ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,maximum:r}}},...e.annotate?.(r),...i})}function jv(e){let t=Xu(e.order),n=Ju(e.order),r=Yu(e.order),i=qu(e.order),a=e.formatter??Ol;return(o,s)=>{let c=o.exclusiveMinimum?n:t,l=o.exclusiveMaximum?i:r;return J(e=>c(e,o.minimum)&&l(e,o.maximum),{expected:`a value between ${a(o.minimum)}${o.exclusiveMinimum?` (excluded)`:``} and ${a(o.maximum)}${o.exclusiveMaximum?` (excluded)`:``}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:o.minimum,maximum:o.maximum,...o.exclusiveMinimum&&{exclusiveMinimum:!0},...o.exclusiveMaximum&&{exclusiveMaximum:!0}}}},...e.annotate?.(o),...s})}}function Mv(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${Ol(e)}`);return e}var Nv=Ov({order:Ku,annotate:e=>({representation:{id:`effect/schema/isGreaterThan`,payload:{exclusiveMinimum:Mv(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${Ol(e)})`})})}),Pv=kv({order:Ku,annotate:e=>({representation:{id:`effect/schema/isGreaterThanOrEqualTo`,payload:{minimum:Mv(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${Ol(e)})`})})}),Fv=Av({order:Ku,annotate:e=>({representation:{id:`effect/schema/isLessThanOrEqualTo`,payload:{maximum:Mv(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${Ol(e)})`})})}),Iv=jv({order:Ku,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:`effect/schema/isBetween`,payload:{minimum:Mv(e.minimum),maximum:Mv(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?`exclusiveMinimum`:`minimum`]:e.minimum,[n?`exclusiveMaximum`:`maximum`]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${Ol(e.minimum)}, maximum: ${Ol(e.maximum)}, exclusiveMinimum: ${Ol(t)}, exclusiveMaximum: ${Ol(n)} })`})}}});function Lv(e){return J(e=>globalThis.Number.isSafeInteger(e),{expected:`an integer`,representation:{id:`effect/schema/isInt`,payload:null},toJsonSchema:()=>({type:`integer`}),toCode:()=>({runtime:`Schema.isInt()`}),arbitrary:{constraint:{integer:!0}},...e})}function Rv(e,t){return e=Math.max(0,Math.floor(e)),J(t=>t.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:`effect/schema/isMinLength`,payload:{minLength:e}},toJsonSchema:({type:t})=>t===`array`?{minItems:e}:{minLength:e},toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[om]:!0,arbitrary:{constraint:{minLength:e}},...t})}function zv(e){return Rv(1,e)}var Bv=z.check(zv());globalThis.RegExp,globalThis.URL,globalThis.File,globalThis.FormData,globalThis.URLSearchParams,globalThis.Uint8Array;var Vv=globalThis.Symbol.for(`immer-draftable`),Hv={};function Uv(e,t,n,r,i){let a=Kv(n,t,r),o=Gv(t),s=class extends e{constructor(...[e,t]){let r=t?.[`~payload`],i=r?.token===Hv?r.value:n.make(e??{},t);super(i,{...t,disableChecks:!0,"~payload":{token:Hv,value:i}})}static[G_]=G_;get[o](){return o}static[Vv]=!0;static identifier=t;static fields=n.fields;static get ast(){return a(this).ast}static pipe(){return pc(this,arguments)}static rebuild(e){return a(this).rebuild(e)}static make(e,t){return new this(e,t)}static makeOption(e,t){return g_(a(this))(e??{},t)}static makeEffect(e,t){return a(this).makeEffect(e??{},t)}static annotate(e){return this.rebuild(Mg(this.ast,e))}static annotateKey(e){return this.rebuild(Hg(this.ast,e))}static check(...e){return this.rebuild(Pg(this.ast,e))}static extend(e){return(t,r)=>{let a=qv(t)?t:H(t),o={...n.fields,...a.fields},s=$h(o,n.ast.checks,{identifier:e});return Uv(this,e,lv(Pg(s,a.ast.checks),o),r,i)}}static mapFields(e,t){return n.mapFields(e,t)}};return i!==void 0&&Object.assign(s.prototype,i(t)),s}function Wv(e){return new ih(Qm(t=>new e(t,{"~payload":{token:Hv,value:t}})),Zm())}function Gv(e){return`~effect/Schema/Class/${e}`}function Kv(e,t,n){let r;return i=>{if(r!==void 0)return r;let a=Gv(t),o=e=>e instanceof i||Fc(e,a),s=Wv(i);return r=Sv(nv(new Th([e.ast],()=>(e,t,n)=>o(e)?qp(e):Jp(new Dm(t,e,n)),{identifier:t,[cm]:([e])=>({isConstructed:o,link:new bh(e,s)}),toCodec:([e])=>new bh(e.ast,s),toArbitrary:([e])=>()=>({arbitrary:e.arbitrary.map(e=>new i(e)),terminal:e.terminal?.map(e=>new i(e))}),toFormatter:([e])=>t=>`${i.identifier}(${e(t)})`,[sm]:ag(e.ast),...n})),s)(e)}}function qv(e){return rv(e)}var Jv=e=>(t,n)=>Uv(wu,e,qv(t)?t:H(t),n,e=>({name:e})),Yv=e=>(t,n,r)=>{let i=qv(n)?n.mapFields(e=>({_tag:wv(t),...e}),{unsafePreserveChecks:!0}):Tv(t,n);return Jv(e??t)(i,r)},Xv=new WeakMap,Zv=new WeakMap,Qv=new WeakMap;function $v(e){let t=Zv.get(e);if(t!==void 0||!fh(e)||!ph(e))return t;if(!(e.typeParameters.length!==0||e.checks!==void 0||e.encoding!==void 0||e.context!==void 0||e.encodingChecks!==void 0||e.encodingRun!==void 0&&e.encodingRun!==e.run))return Qv.get(e.run)}function ey(e,t){let n=q_(t=>ay(t)&&Xv.get(t)?.kind===e,{identifier:e===`text`?`RecordTextContent`:`RecordBytesContent`});return Zv.set(n,Object.freeze({kind:e,maximumBytes:t})),Zv.set(n.ast,Object.freeze({kind:e,maximumBytes:t})),Qv.set(n.ast.run,Object.freeze({kind:e,maximumBytes:t})),n}var ty=ey(`text`,void 0),ny=ey(`bytes`,void 0),ry=Object.freeze({maximumBytes(e){if(!Number.isSafeInteger(e)||e<0)throw TypeError(`Record content maximumBytes must be a non-negative safe integer`);return t=>{let n=Zv.get(t);if(n===void 0)throw TypeError(`Record content maximumBytes requires a package-owned content declaration`);return ey(n.kind,e)}}});function iy(e){let t=$v(e);return t===void 0?void 0:Object.freeze({...t,category:`content`})}function ay(e){return typeof e==`object`&&!!e&&Xv.has(e)}function oy(e){return ay(e)&&Xv.get(e)?.kind===`text`}function sy(e){return ay(e)&&Xv.get(e)?.kind===`bytes`}var cy=Object.freeze({entries:4096,groupDepth:16,displayCodePoints:256,jsonDepth:8,jsonObjectKeys:64,jsonArrayItems:256,stringBytes:8192,diagnosticDepth:2,diagnosticNodes:64,diagnosticBytes:65536,collectionDiagnosticCandidates:8});function ly(e,t){return t===`ratio`?`${Number((e*100).toPrecision(12))}%`:t===`usd`?`$${e}`:t===void 0?String(e):`${e} ${t}`}var uy=[`less-than`,`at-most`,`greater-than`,`at-least`,`between`],dy=`@niceeval/assertions/AssertionEntryId`,fy=65536;Object.freeze({errors:`all`,onExcessProperty:`error`});var py=new TextEncoder,my=/[\p{Cc}]/u,hy=/^ae_[a-z0-9]{20}$/,gy=/^[\x21-\x7e]+$/;function _y(e){return py.encode(e).byteLength}function vy(e){return Array.from(e).length}function yy(e){return _y(e)<=cy.stringBytes}function by(e){return!my.test(e)&&vy(e)<=cy.displayCodePoints}function xy(e){return _y(e)<=128&&gy.test(e)}function Sy(e){return Number.isFinite(e)&&Number.isInteger(e)&&e>=0}function Cy(e){return Number.isFinite(e)&&e>=0}function wy(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Ty(e){return Object.keys(e).length<=cy.jsonObjectKeys}function Ey(e){return e.length<=cy.jsonArrayItems}function Dy(e){return hy.test(e)}function Oy(e){try{let t=JSON.stringify(e);return typeof t==`string`&&_y(t)<=4194304}catch{return!1}}function ky(e){let t=new Set;for(let n of e.entries){if(t.has(n.entryId))return!1;t.add(n.entryId)}return!0}function Ay(e){let t=e.coverage;return t.state===`complete`?e.limitations.length===0:t.state!==`partial`||e.limitations.some(e=>e.kind===t.reason)}var jy=z.check(J(yy,{identifier:`AssertionsBoundedJsonString`,description:`a UTF-8 string no longer than 8 KiB`})),My=z.check(J(by,{identifier:`AssertionDisplayText`,description:`text without control characters and at most 256 code points`})),Ny=jy.check(J(e=>e.length>0&&!my.test(e),{identifier:`MatcherSourceIdentity`,description:`a non-empty bounded source identity without control characters`})),Py=z.check(J(xy,{identifier:`AssertionCriterionIdentifier`,description:`a non-empty printable ASCII identifier no longer than 128 bytes`})),Fy=Dv.check(J(Sy,{identifier:`AssertionNonNegativeInteger`,description:`a finite non-negative integer`})),Iy=Dv.check(J(e=>Number.isSafeInteger(e)&&e>0,{identifier:`AssertionPositiveInteger`,description:`a positive safe integer`})),Ly=Dv.check(J(e=>Number.isSafeInteger(e)&&e>=0,{identifier:`AssertionNonNegativeSafeInteger`,description:`a non-negative safe integer`})),Ry=Dv.check(J(Cy,{identifier:`AssertionNonNegativeNumber`,description:`a finite non-negative number`}));function zy(e){if(e===`0`)return!0;if(!/^[1-9][0-9]*$/.test(e))return!1;let t=Number(e);return Number.isSafeInteger(t)&&t>=0&&t<4294967295}function By(e,t,n){if(e===null||typeof e==`boolean`)return!0;if(typeof e==`number`)return Number.isFinite(e);if(typeof e==`string`)return yy(e);if(typeof e!=`object`||t>=cy.jsonDepth)return!1;try{if(n.has(e))return!1;if(n.add(e),Array.isArray(e)){if(Object.getPrototypeOf(e)!==Array.prototype||!Ey(e))return!1;for(let t of Reflect.ownKeys(e)){if(t===`length`)continue;if(typeof t!=`string`||!zy(t))return!1;let n=Object.getOwnPropertyDescriptor(e,t);if(n===void 0||!n.enumerable||!(`value`in n))return!1}for(let r=0;r<e.length;r+=1)if(!Object.prototype.hasOwnProperty.call(e,r)||!By(e[r],t+1,n))return!1;return!0}let r=e;if(!wy(r)||!Ty(r))return!1;for(let e of Reflect.ownKeys(r)){if(typeof e!=`string`||!yy(e))return!1;let i=Object.getOwnPropertyDescriptor(r,e);if(i===void 0||!i.enumerable||!(`value`in i)||!By(i.value,t+1,n))return!1}return!0}catch{return!1}finally{n.delete(e)}}function Vy(e){return By(e,0,new WeakSet)}function Hy(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&By(e,0,new WeakSet)}var Uy=yv(()=>W([sv,V,Dv,jy,U(Uy),pv(jy,Uy)]).check(J(Vy,{identifier:`AssertionsBoundedJsonValue`,description:`a recursive JSON value within the Assertions limits`}))),Wy=Uy,Gy=pv(jy,Uy).check(J(Hy,{identifier:`AssertionsBoundedJsonObject`,description:`a recursive JSON object within the Assertions limits`})),Ky=z.check(J(Dy,{identifier:`AssertionEntryId`,description:`an attachment-local ae_ identifier with 20 lowercase base-36 characters`})).pipe(xv(dy)),qy=H({key:I(My),label:I(My),groupPath:U(My).check(J(e=>e.length<=cy.groupDepth,{identifier:`AssertionDisplayGroupPath`,description:`a group path no deeper than 16 segments`}))}),Jy=H({kind:R(`builtin`),id:Py,data:Wy}),Yy=H({name:Py,schemaId:Py,data:Wy});W([Jy,Yy]);var Xy=W([W([H({kind:R(`builtin`),id:R(`value-match/v1`),data:H({subject:R(`explicit-value`),matcher:W([H({state:R(`declared`),name:jy}),H({state:R(`unavailable`)})])})}),H({kind:R(`builtin`),id:R(`numeric-comparison/v1`),data:H({comparator:G(uy),threshold:Dv,upperThreshold:I(Dv),unit:I(G([`ms`,`seconds`,`tokens`,`usd`,`ratio`,`count`,`bytes`])),subject:W([H({kind:R(`explicit-value`)}),H({kind:R(`scope-metric`),metric:R(`tokens`),scope:G([`turn`,`session`,`attempt`]),unit:R(`tokens`)}),H({kind:R(`scope-metric`),metric:R(`cost`),scope:G([`turn`,`session`,`attempt`]),unit:R(`usd`)}),H({kind:R(`collection-cardinality`),collection:R(`tool-calls`),scope:G([`turn`,`session`,`attempt`])})])}).check(J(e=>e.comparator===`between`?e.upperThreshold!==void 0&&e.upperThreshold>=e.threshold:e.upperThreshold===void 0,{message:`Only between comparisons have an ordered upper threshold.`}))}),H({kind:R(`builtin`),id:R(`scope-status/v1`),data:H({scope:G([`turn`,`session`,`attempt`]),assertion:G([`succeeded`,`no-failed-actions`])})}),H({kind:R(`builtin`),id:R(`occurrence/v1`),data:H({scope:G([`turn`,`session`,`attempt`]),occurrence:G([`tool`,`skill`,`event`]),assertion:G([`present`,`absent`,`count`,`order`]),matcher:I(jy),quantifier:I(W([H({kind:R(`absent`)}),H({kind:G([`at-least`,`exact`]),count:Iy})]))})}),H({kind:R(`builtin`),id:R(`occurrence/v2`),data:H({scope:G([`turn`,`session`,`attempt`]),occurrence:G([`tool`,`skill`,`event`]),assertion:G([`present`,`absent`,`count`,`order`]),matcher:I(jy),quantifier:I(W([H({kind:R(`absent`)}),H({kind:R(`exact`),count:Iy}),H({kind:G([`at-least`,`less-than`,`at-most`,`greater-than`]),count:Ly})]))})}),H({kind:R(`builtin`),id:R(`judge-measurement/v1`),data:H({recipe:z,scale:R(`unit-interval`)})}),H({kind:R(`builtin`),id:R(`judge-measurement/v2`),data:H({name:z,scale:R(`unit-interval`)})}),H({kind:R(`builtin`),id:R(`llm-measurement/v1`),data:H({name:z,scale:R(`unit-interval`)})}),W([H({kind:R(`builtin`),id:R(`sandbox-result/v1`),data:H({operation:R(`changed-paths`),paths:U(jy)})}),H({kind:R(`builtin`),id:R(`sandbox-result/v1`),data:H({operation:R(`no-changes`)})}),H({kind:R(`builtin`),id:R(`sandbox-result/v1`),data:H({operation:R(`file-changed`),path:jy,status:I(G([`added`,`modified`,`deleted`])),before:I(jy),after:I(jy)})}),H({kind:R(`builtin`),id:R(`sandbox-result/v1`),data:H({operation:R(`file-deleted`),path:jy})}),H({kind:R(`builtin`),id:R(`sandbox-result/v1`),data:H({operation:R(`not-in-diff`),pattern:jy,flags:jy,content:G([`added`,`removed`,`both`])})})]),H({kind:R(`builtin`),id:R(`direct-score/v1`),data:H({source:R(`author`)})})]),Yy]),Zy=W([H({state:R(`complete`)}),H({state:R(`partial`),reason:G([`sampled`,`truncated`,`redacted`,`provider-limited`,`capacity-limited`])}),H({state:R(`unavailable`),reason:G([`not-collected`,`source-unavailable`,`producer-failed`])}),H({state:R(`not-applicable`),reason:G([`optional-material`,`unsupported-subject`])})]),Qy=W([H({kind:R(`redacted`),fieldCount:Fy}),H({kind:R(`sampled`),captured:Fy,knownTotal:I(Fy)}),H({kind:R(`truncated`),omittedBytes:Fy}),H({kind:R(`provider-limited`)}),H({kind:R(`capacity-limited`),capturedItems:Fy,knownTotalItems:Fy,omittedBytes:K(Fy)})]),$y=H({state:R(`not-scored`)}),eb=H({state:R(`earned`),points:Ry,earned:Ry}).check(J(e=>e.earned<=e.points,{identifier:`AssertionEarnedScore`,description:`an earned score no greater than its points`})),tb=H({state:R(`unavailable`),points:Ry,reason:G([`source-unavailable`,`evaluation-errored`,`not-applicable`])});function nb(e){return e.matched+e.mismatched+e.unavailable!==e.examined||e.knownTotal!==null&&e.examined>e.knownTotal||e.complete&&e.knownTotal===null?!1:!e.exhaustive||e.knownTotal!==null&&e.examined===e.knownTotal}var rb=H({examined:Fy,matched:Fy,mismatched:Fy,unavailable:Fy,knownTotal:K(Fy),complete:V,exhaustive:V,decisive:V}).check(J(nb,{identifier:`AssertionCollectionReceipt`,description:`a collection receipt whose counts and completion boundary agree`})),ib=yv(()=>W([H({kind:R(`unavailable`),reason:G([`not-recorded`,`not-declared`,`source-unavailable`])}),H({kind:R(`value`),value:W([sv,V,Dv,jy])}),H({kind:R(`text`),text:jy}),H({kind:R(`list`),items:U(ib)}),H({kind:R(`fields`),fields:U(H({label:jy,value:ib}))})])),ab=W([H({state:R(`exact`)}),H({state:R(`unavailable`),reason:G([`historical-not-recorded`,`source-unavailable`,`ambiguous`])})]),ob=W([H({kind:R(`tool-occurrence`),toolOccurrenceId:Ny,relation:ab}),H({kind:R(`event`),eventId:Ny,toolOccurrenceId:I(Ny),relation:ab})]),sb=U(H({locator:ob,result:G([`matched`,`mismatched`,`unavailable`,`not-evaluated`]),difference:I(ib)})).check(J(e=>e.length<=8,{identifier:`MatcherRetainedRows`,description:`at most eight representative matcher rows`})),cb=H({step:Iy,summary:ib}),lb=H({family:R(`niceeval.agent-turns`),schemaVersion:Iy}),ub=G([`complete`,`partial`,`unavailable`]),db=H({scope:R(`turn`),sessionId:Ny,turnId:Ny,scopeId:Ny,throughSessionSequence:Fy,source:lb,collectionAtCut:ub}),fb=H({scope:R(`session`),sessionId:Ny,scopeId:Ny,throughSessionSequence:Fy,source:lb,collectionAtCut:ub}),pb=W([db,fb,H({scope:R(`attempt`),scopeId:Ny,sessions:U(H({sessionId:Ny,throughSessionSequence:Fy})).check(J(e=>e.every((t,n)=>n===0||e[n-1].sessionId<t.sessionId),{identifier:`MatcherAttemptVectorCut`,description:`a unique vector cut in canonical session identity order`})),source:lb,collectionAtCut:ub})]),mb=H({sourceRows:Fy,comparisons:Fy,unavailableComparisons:Fy,definitePrefixLength:Fy,possiblePrefixLength:Fy,stepReceipts:U(H({step:Iy,comparisons:Fy,matched:Fy,mismatched:Fy,unavailable:Fy}).check(J(e=>e.matched+e.mismatched+e.unavailable===e.comparisons,{identifier:`MatcherOrderStepReceipt`,description:`an order step receipt whose result counts equal its comparisons`}))),complete:V,exhaustive:V,decisive:V}),hb=H({step:Iy,locator:ob,sessionId:Ny,sessionSequence:Iy,result:G([`matched`,`unavailable`])}),gb=H({longestDefinitePrefix:U(hb),longestPossiblePrefix:U(hb),firstBlockingStep:Iy,suffixChecked:rb,representatives:sb});function _b(e,t,n,r){if(e.length!==n)return!1;let i=0;for(let[n,a]of e.entries()){if(a.step!==n+1||a.sessionId!==t.sessionId||a.sessionSequence<=i||a.sessionSequence>t.throughSessionSequence||r===`matched`&&a.result!==`matched`||a.result===`matched`&&a.locator.relation.state!==`exact`)return!1;i=a.sessionSequence}return!0}function vb(e){let t=e.querySteps.length,n=e.receipt;if(e.querySteps.some((e,t)=>e.step!==t+1)||n.stepReceipts.length!==t||n.stepReceipts.some((e,t)=>e.step!==t+1)||n.definitePrefixLength>n.possiblePrefixLength||n.possiblePrefixLength>t||n.comparisons!==n.stepReceipts.reduce((e,t)=>e+t.comparisons,0)||n.unavailableComparisons!==n.stepReceipts.reduce((e,t)=>e+t.unavailable,0)||n.complete!==(e.sourceSnapshot.collectionAtCut===`complete`)||n.stepReceipts.some(e=>e.comparisons>n.sourceRows)||n.stepReceipts.some((e,t)=>t>0&&e.comparisons!==n.stepReceipts[0].comparisons)||n.exhaustive&&n.stepReceipts.some(e=>e.comparisons!==n.sourceRows))return!1;switch(e.result.state){case`matched`:return n.definitePrefixLength===t&&n.possiblePrefixLength===t&&n.decisive&&_b(e.result.witnessPath,e.sourceSnapshot,t,`matched`);case`mismatched`:{let r=e.result.failureFrontier;return n.complete&&n.exhaustive&&n.decisive&&n.possiblePrefixLength<t&&r.firstBlockingStep===n.possiblePrefixLength+1&&r.suffixChecked.complete&&r.suffixChecked.exhaustive&&r.suffixChecked.decisive&&r.suffixChecked.knownTotal===r.suffixChecked.examined&&r.suffixChecked.matched===0&&r.suffixChecked.unavailable===0&&_b(r.longestDefinitePrefix,e.sourceSnapshot,n.definitePrefixLength,`matched`)&&_b(r.longestPossiblePrefix,e.sourceSnapshot,n.possiblePrefixLength,`possible`)}case`unavailable`:return e.result.reason.length>0&&!n.decisive}}var yb=H({kind:R(`collection-filter`),sourceSnapshot:pb,query:cb,receipt:rb,retainedRows:sb}).check(J(e=>e.query.step===1&&e.receipt.knownTotal!==null&&e.receipt.complete===(e.sourceSnapshot.collectionAtCut===`complete`),{identifier:`MatcherCollectionFilterArtifact`,description:`a collection matcher artifact with one query and a matching source cut`})),bb=W([H({state:R(`matched`),witnessPath:U(hb)}),H({state:R(`mismatched`),failureFrontier:gb}),H({state:R(`unavailable`),reason:Ny})]),xb=H({kind:R(`ordered-sequence`),sourceSnapshot:W([db,fb]),querySteps:U(cb).check(J(e=>e.length>=2&&e.length<=64,{identifier:`MatcherOrderQuerySteps`,description:`between two and 64 ordered matcher query steps`})),receipt:mb,result:bb,retainedRows:sb}).check(J(vb,{identifier:`MatcherOrderedSequenceArtifact`,description:`an ordered matcher artifact with consistent receipts, paths, and cut`}));function Sb(e){try{return _y(JSON.stringify(e))<=fy}catch{return!1}}var Cb=W([yb,xb]).check(J(Sb,{identifier:`MatcherQueryArtifactSize`,description:`a matcher query artifact no larger than 64 KiB`})),wb=W([H({kind:R(`boolean`),expected:R(!0)}),H({kind:R(`at-least`),threshold:Ry}),H({kind:R(`record-only`)})]),Tb=H({requirement:W([H({state:R(`available`),value:G([`required`,`optional`])}),H({state:R(`unavailable`),reason:R(`not-recorded`)})]),condition:W([H({state:R(`available`),value:wb}),H({state:R(`unavailable`),reason:R(`not-recorded`)})])});W([H({state:R(`matched`),gate:G([`not-gate`,`satisfied`]),score:W([$y,eb]),diagnostic:I(Gy),receipt:I(rb)}),H({state:R(`mismatched`),reason:R(`condition-not-met`),gate:G([`not-gate`,`failed`]),score:W([$y,eb]),diagnostic:I(Gy),receipt:I(rb)}),H({state:R(`unavailable`),reason:G([`evidence-unavailable`,`source-unavailable`,`redacted`]),gate:G([`not-gate`,`unavailable`]),score:W([$y,tb]),diagnostic:I(Gy),receipt:I(rb)}),H({state:R(`errored`),reason:G([`evaluator-failed`,`producer-interrupted`,`invalid-subject`]),gate:G([`not-gate`,`unavailable`]),score:W([$y,tb]),diagnostic:I(Gy),receipt:I(rb)}),H({state:R(`not-applicable`),reason:R(`coverage-not-applicable`),gate:G([`not-gate`,`not-applicable`]),score:W([$y,tb]),diagnostic:I(Gy),receipt:I(rb)})]);function Eb(e){let t=U(e),n=U(L(Qy)),r=H({source:e,evidence:t,coverage:L(Zy),limitations:n}).check(J(e=>Ay(e),{identifier:`AssertionCoverageLimitations`,description:`coverage and limitations with a consistent sealed relationship`})),i=H({observed:L(ib),receipt:I(L(rb))}),a=W([H({kind:R(`ordinary`),observed:L(ib),receipt:I(L(rb))}),H({kind:R(`matcher-current`),observed:L(ib),artifact:L(Cb),receipt:I(ov)}),H({kind:R(`matcher-legacy`),observed:L(ib),reason:R(`historical-not-recorded`),legacyDiagnostic:I(L(ib)),receipt:I(ov)})]),o=H({result:G([`matched`,`mismatched`,`unavailable`,`errored`,`not-applicable`]),reason:K(G([`condition-not-met`,`evidence-unavailable`,`source-unavailable`,`redacted`,`evaluator-failed`,`producer-interrupted`,`invalid-subject`,`coverage-not-applicable`])),gate:G([`not-gate`,`satisfied`,`failed`,`unavailable`,`not-applicable`])}),s=W([H({state:R(`retained`),value:L(ib)}),H({state:R(`unavailable`),reason:R(`not-recorded`)})]),c=H({entryId:L(Ky),display:L(qy),criterion:W([H({state:R(`available`),value:L(Gy)}),H({state:R(`unavailable`),reason:R(`not-recorded`)})]),materials:r,evaluation:i,decision:o,policy:L(Tb),contribution:W([L($y),L(eb),L(tb)]),explanationRetention:s}),l=H({entryId:L(Ky),display:L(qy),criterion:W([H({state:R(`available`),value:L(Gy)}),H({state:R(`unavailable`),reason:R(`not-recorded`)})]),materials:r,evaluation:a,decision:o,policy:L(Tb),contribution:W([L($y),L(eb),L(tb)]),explanationRetention:s}).check(J(e=>e.evaluation.kind===`ordinary`||e.explanationRetention.state===`unavailable`,{identifier:`MatcherExplanationOwnership`,description:`matcher artifacts and legacy diagnostics are not duplicated in explanation retention`})),u=U(c).check(J(e=>e.length<=cy.entries,{identifier:`AssertionsEntryCount`,description:`at most 4,096 assertion entries`})),d=U(l).check(J(e=>e.length<=cy.entries,{identifier:`AssertionsEntryCount`,description:`at most 4,096 assertion entries`})),f=H({entries:d}).check(J(ky,{identifier:`AssertionsUniqueEntryIds`,description:`unique attachment-local assertion entry IDs`}),J(Oy,{identifier:`AssertionsDocumentSize`,description:`a JSON document no larger than 4 MiB`})),p=H({entryId:L(Ky),display:L(qy),criterion:W([H({state:R(`available`),value:L(Xy)}),H({state:R(`unavailable`),reason:R(`not-recorded`)})]),materials:r,evaluation:a,decision:o,policy:L(Tb),contribution:W([L($y),L(eb),L(tb)]),explanationRetention:s}),m=H({entries:U(p).check(J(e=>e.length<=cy.entries,{identifier:`AssertionsEntryCount`,description:`at most 4,096 assertion entries`}))}).check(J(ky,{identifier:`AssertionsUniqueEntryIds`,description:`unique attachment-local assertion entry IDs`}),J(Oy,{identifier:`AssertionsDocumentSize`,description:`a JSON document no larger than 4 MiB`}));return Object.freeze({material:e,entry:p,entries:d,historicalV2Entries:u,outerDocument:f,document:m})}Object.freeze({code:`assertions-document-invalid`});var Db=/^@1[0-9A-HJKMNP-TV-Z]{12}$/;z.pipe(bv(e=>Db.test(e),{identifier:`AttemptLocator`,description:`a canonical @-prefixed Attempt locator`})),new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);var Ob=`@niceeval/record/RecordId`,kb=`@niceeval/record/RunId`,Ab=`@niceeval/record/SlotId`,jb=`@niceeval/record/AttemptId`,Mb=`@niceeval/record/UtcMillis`,Nb=`@niceeval/record/RecordAttachmentName`,Pb=`@niceeval/record/RecordAttachmentSchemaId`,Fb=`@niceeval/record/RecordFormatId`,Ib=`@niceeval/record/ExperimentId`,Lb=`@niceeval/record/EvalId`,Rb=`@niceeval/record/ExecutionIdentityDigest`,zb=`@niceeval/record/Sha256Digest`,Bb=`@niceeval/record/SourceItemId`,Vb=`@niceeval/record/FileChangeId`,Hb=`@niceeval/record/ArtifactId`,Ub=`@niceeval/record/RecordBlobKey`,Wb=`@niceeval/record/SourceSegmentId`,Gb=`@niceeval/record/CanonicalRunRelativePath`,Kb=`@niceeval/record/CanonicalProjectRelativePath`,qb=`niceeval.record.attachments`,Jb=/^[A-Za-z0-9](?:[A-Za-z0-9._-]{0,253}[A-Za-z0-9])?$/,Yb=/^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\..*)?$/i,Xb=`[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?`,Zb=RegExp(`^(?:${Xb}\\.)+${Xb}$`),Qb=/^niceeval\.record\.attachments$/,$b=/^[a-f0-9]{64}$/;function ex(e){return Jb.test(e)&&!Yb.test(e)}function tx(e,t){return e===t?0:e<t?-1:1}function nx(e){return Number.isSafeInteger(e)&&e>=0}function rx(e){return e.length>0&&e.length<=1024&&!/[\u0000-\u001f\u007f]/.test(e)}function ix(e){return $b.test(e)}function ax(e){return ex(e)}function ox(e){return/^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$/.test(e)}function sx(e){return e.length>0&&e.length<=4096&&!e.startsWith(`/`)&&!e.startsWith(`\\`)&&!e.includes(`\\`)&&e.split(`/`).every(ex)}function cx(e){return e.length>0&&e.length<=4096&&!e.startsWith(`/`)&&!e.startsWith(`\\`)&&!e.includes(`\\`)&&!/[\u0000-\u001f\u007f]/.test(e)&&e.split(`/`).every(e=>e.length>0&&e!==`.`&&e!==`..`)}function lx(e){return e.length<=255&&ex(e)&&Zb.test(e)}function ux(e){return lx(e)?{name:e,version:`1`}:void 0}function dx(e){let t=ux(e);return t!==void 0&&lx(t.name)}function fx(e){return Qb.test(e)}var px=z.check(J(ex,{identifier:`RecordPortableSegment`,description:`an ASCII portable file-name segment without path separators or reserved device names`})),mx=px.pipe(xv(Ob)),hx=px.pipe(xv(kb)),gx=px.pipe(xv(Ab)),_x=px.pipe(xv(jb)),vx=z.check(J(rx,{identifier:`RecordDomainIdentity`,description:`a bounded durable identity without control characters`})),yx=vx.pipe(xv(Ib)),bx=vx.pipe(xv(Lb)),xx=z.check(J(ix,{identifier:`ExecutionIdentityDigest`,description:`a lowercase hexadecimal SHA-256 execution identity digest`})).pipe(xv(Rb)),Sx=z.check(J(ix,{identifier:`Sha256Digest`,description:`a lowercase hexadecimal SHA-256 digest`})).pipe(xv(zb)),Cx=px.pipe(xv(Bb)),wx=px.pipe(xv(Vb)),Tx=px.pipe(xv(Hb)),Ex=z.check(J(ax,{identifier:`RecordBlobKey`,description:`an opaque portable Attachment blob key`})).pipe(xv(Ub));z.check(J(ox,{identifier:`SourceSegmentId`,description:`a bounded opaque source receipt segment identity`})).pipe(xv(Wb)),z.check(J(sx,{identifier:`CanonicalRunRelativePath`,description:`a slash-separated portable path inside one sealed Run`})).pipe(xv(Gb));var Dx=z.check(J(cx,{identifier:`CanonicalProjectRelativePath`,description:`a slash-separated project-relative path without dot segments`})).pipe(xv(Kb)),Ox=B.check(J(nx,{identifier:`UtcMillis`,description:`a non-negative JSON-safe Unix-epoch millisecond value`})).pipe(xv(Mb));z.check(J(lx,{identifier:`RecordAttachmentName`,description:`a lowercase reverse-domain portable Attachment name`})).pipe(xv(Nb)),z.check(J(dx,{identifier:`RecordAttachmentSchemaId`,description:`a RecordAttachment name followed by /vN`})).pipe(xv(Pb)),z.check(J(fx,{identifier:`RecordFormatId`,description:`the current generic Attachment Record format identity`})).pipe(xv(Fb));var kx=G([qb]).pipe(xv(Fb)),Ax=new TextEncoder,jx=Object.freeze({"$niceeval.record.blob-ref":!0});function Mx(e,t,n){e.failure===void 0&&(e.failure=Object.freeze({code:t,path:Object.freeze([...n])}))}function Nx(e,t){if(e===t)return 0;let n=Ax.encode(e),r=Ax.encode(t),i=Math.min(n.byteLength,r.byteLength);for(let e=0;e<i;e+=1){let t=n[e]-r[e];if(t!==0)return t}return n.byteLength-r.byteLength}function Px(e){for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n>=55296&&n<=56319){let n=e.charCodeAt(t+1);if(t+1>=e.length||n<56320||n>57343)return!1;t+=1}else if(n>=56320&&n<=57343)return!1}return!0}function Fx(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Ix(e,t){let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0&&`value`in n&&n.enumerable===!0)return Object.freeze({value:n.value})}function Lx(e,t){let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0&&`value`in n)return Object.freeze({value:n.value})}function Rx(e,t,n,r,i){if(t>r.maximumDepth||(i.nodes+=1,i.nodes>r.maximumNodes))return Mx(i,`record-json-limit-exceeded`,n),!1;if(typeof e==`string`){if(!Px(e))return Mx(i,`record-json-invalid`,n),!1;if(Ax.encode(e).byteLength>r.maximumStringUtf8Bytes)return Mx(i,`record-json-limit-exceeded`,n),!1}return!0}function zx(e,t,n,r){let i=Reflect.ownKeys(e);if(i.some(e=>typeof e!=`string`))return Mx(r,`record-json-invalid`,t);if(i.length>n.maximumObjectKeys)return Mx(r,`record-json-limit-exceeded`,t);let a=i;for(let e of a){if(!Px(e))return Mx(r,`record-json-invalid`,[...t,e]);if(e.length===0||Ax.encode(e).byteLength>n.maximumKeyUtf8Bytes)return Mx(r,`record-json-limit-exceeded`,[...t,e])}return Object.freeze([...a].sort(Nx))}function Bx(e){let t=Object.create(null);for(let[n,r]of e)Object.defineProperty(t,n,{configurable:!1,enumerable:!0,value:r,writable:!1});return Object.freeze(t)}function Vx(e,t,n,r,i,a){if(e.length>r.maximumArrayItems)return Mx(a,`record-json-limit-exceeded`,n);let o=new Set([`length`]);for(let t=0;t<e.length;t+=1)o.add(String(t));let s=Reflect.ownKeys(e);if(s.length!==o.size||s.some(e=>typeof e!=`string`||!o.has(e)))return Mx(a,`record-json-invalid`,n);let c=Lx(e,`length`);if(c===void 0||c.value!==e.length)return Mx(a,`record-json-invalid`,n);let l=[];for(let o=0;o<e.length;o+=1){let s=Ix(e,String(o));if(s===void 0)return Mx(a,`record-json-invalid`,[...n,String(o)]);let c=Ux(s.value,t+1,[...n,String(o)],r,i,a);if(c===void 0)return;l.push(c)}return Object.freeze(l)}function Hx(e,t,n,r,i,a){let o=zx(e,n,r,a);if(o===void 0)return;let s=[];for(let c of o){let o=Ix(e,c);if(o===void 0)return Mx(a,`record-json-invalid`,[...n,c]);let l=Ux(o.value,t+1,[...n,c],r,i,a);if(l===void 0)return;s.push([c,l])}return Bx(s)}function Ux(e,t,n,r,i,a){if(Rx(e,t,n,r,a)){if(e===null||typeof e==`boolean`||typeof e==`string`)return e;if(typeof e==`number`)return Number.isFinite(e)&&!Object.is(e,-0)?e:Mx(a,`record-json-invalid`,n);if(typeof e!=`object`)return Mx(a,`record-json-invalid`,n);try{if(i.isBlobRef?.(e))return e;if(a.ancestors.has(e))return Mx(a,`record-json-invalid`,n);a.ancestors.add(e);try{return Array.isArray(e)?Vx(e,t,n,r,i,a):Fx(e)?Hx(e,t,n,r,i,a):Mx(a,`record-json-invalid`,n)}finally{a.ancestors.delete(e)}}catch{return Mx(a,`record-json-invalid`,n)}}}function Wx(e,t){if(e===null||typeof e==`boolean`||typeof e==`number`||typeof e==`string`)return e;if(typeof e!=`object`)return;if(t.isBlobRef?.(e))return jx;if(Array.isArray(e)){let n=[];for(let r of e){let e=Wx(r,t);if(e===void 0)return;n.push(e)}return Object.freeze(n)}if(!Fx(e))return;let n=[];for(let r of Object.keys(e).sort(Nx)){let i=Wx(e[r],t);if(i===void 0)return;n.push([r,i])}return Bx(n)}function Gx(e){let t=JSON.stringify(e);return t===void 0?void 0:Ax.encode(t).byteLength}function Kx(e,t,n={}){let r={nodes:0,ancestors:new WeakSet,failure:void 0},i=Ux(e,0,[],t,n,r);if(i===void 0)return id(r.failure??Object.freeze({code:`record-json-invalid`,path:Object.freeze([])}));let a=Wx(i,n),o=a===void 0?void 0:Gx(a);return o===void 0||o>t.maximumJsonBytes?id(Object.freeze({code:`record-json-limit-exceeded`,path:Object.freeze([])})):rd(i)}var qx=Object.freeze({errors:`all`,exact:!0,onExcessProperty:`error`}),Jx=Object.freeze({kind:`schema`,issues:Object.freeze([])});function Yx(e){try{let t=Im()(e.issue).issues.map(e=>Object.freeze({path:Object.freeze((e.path??[]).map(e=>typeof e==`object`&&e&&`key`in e?e.key:e)),message:e.message}));return Object.freeze({kind:`schema`,issues:Object.freeze(t)})}catch{return Jx}}function Xx(e){if(e.cause.reasons.length===1){let[t]=e.cause.reasons;if(t!==void 0&&Pp(t)&&X_(t.error))return Yx(t.error)}throw e.cause}function Zx(e){return Object.freeze({kind:`canonical`,failure:e})}function Qx(e){for(let[t,n]of Object.entries(e))if(!Number.isSafeInteger(n)||n<=0)throw TypeError(`Record schema limit ${t} must be a positive safe integer`);return Object.freeze({...e})}function $x(e){return e===null||typeof e==`boolean`||typeof e==`string`||typeof e==`number`&&Number.isFinite(e)&&!Object.is(e,-0)}function eS(e,t){if(e.context?.isOptional!==!0)return rS(e,t);if(e._tag===`Never`)return!0;if(e._tag!==`Union`)return rS(e,t);let n=!1;for(let r of e.types){if(r._tag===`Undefined`||r._tag===`Never`){n=!0;continue}if(!rS(r,t))return!1}return n}function tS(e,t){return e.propertySignatures.every(e=>typeof e.name==`string`&&e.name.length>0&&eS(e.type,t))&&e.indexSignatures.every(e=>e.parameter._tag===`String`&&eS(e.type,t))}function nS(e,t){if(e.encoding===void 0)return!0;if(e._tag!==`Objects`||e.encoding.length!==1)return!1;let n=e.encoding[0];return n.transformation._tag!==`Transformation`||n.to._tag!==`Objects`||e.propertySignatures.length!==n.to.propertySignatures.length||e.indexSignatures.length!==n.to.indexSignatures.length?!1:tS(n.to,t)}function rS(e,t){let n=t.states.get(e);if(n===`allowed`||n===`pending`)return!0;if(n===`rejected`)return!1;t.states.set(e,`pending`);let r;try{switch(e._tag){case`Literal`:r=$x(e.literal);break;case`Null`:case`String`:case`Number`:case`Boolean`:r=!0;break;case`Objects`:r=tS(e,t);break;case`Arrays`:r=e.elements.every(e=>rS(e,t))&&e.rest.every(e=>rS(e,t));break;case`Union`:r=e.types.every(e=>rS(e,t));break;case`Suspend`:r=rS(e.thunk(),t);break;case`Declaration`:r=t.declarations.has(e)||t.getAttachmentDeclaration?.(e)!==void 0;break;default:r=!1}}catch{r=!1}return r&&=nS(e,t),!r&&t.failure===void 0&&(t.failure=e._tag),t.states.set(e,r?`allowed`:`rejected`),r}function iS(e){let t=[...e.attachmentDeclarations??[],...e.blobRef===void 0?[]:[{schema:e.blobRef.schema,isValue:e.blobRef.isBlobRef}]];if(t.some(e=>e.schema.ast._tag!==`Declaration`))throw TypeError(`Record Attachment opaque values must be Effect Schema Declarations`);let n={declarations:new Set(t.map(e=>e.schema.ast)),getAttachmentDeclaration:e.getAttachmentDeclaration,states:new WeakMap,failure:void 0};if(!rS(e.schema.ast,n))throw TypeError(`Record schema may contain only canonical JSON nodes, Schema.encodeKeys transformations, and its minted Attachment BlobRef (rejected ${n.failure??`AST`})`)}function aS(e,t,n,r=new WeakSet){if(r.has(e))return;r.add(e);let i=t.attachmentDeclarations?.find(t=>t.schema.ast===e)?.metadata,a=t.getAttachmentDeclaration?.(e);if(i!==void 0||a!==void 0){n.push(i??a?.metadata);return}switch(e._tag){case`Objects`:for(let i of e.propertySignatures)aS(i.type,t,n,r);for(let i of e.indexSignatures)aS(i.type,t,n,r);break;case`Arrays`:for(let i of e.elements)aS(i,t,n,r);for(let i of e.rest)aS(i,t,n,r);break;case`Union`:for(let i of e.types)aS(i,t,n,r);break;case`Suspend`:aS(e.thunk(),t,n,r)}}function oS(e,t,n=new WeakSet){if(typeof e!=`object`||!e||t?.(e)===!0||n.has(e))return e;n.add(e);for(let r of Object.values(Object.getOwnPropertyDescriptors(e)))`value`in r&&oS(r.value,t,n);return Object.freeze(e),e}function sS(e){iS(e);let t=Qx(e.limits),n=[...e.attachmentDeclarations??[],...e.blobRef===void 0?[]:[{schema:e.blobRef.schema,isValue:e.blobRef.isBlobRef}]],r=n.length===0?{}:{isBlobRef:t=>n.some(e=>e.isValue(t))||e.isAttachmentOpaque?.(t)!==void 0},i=Q_(e.schema,qx),a=tv(e.schema,qx),o=Q_(L(e.schema),qx),s=[];aS(e.schema.ast,e,s);let c=e=>{let n=Kx(e,t,r);return ad(n)?id(Zx(n.failure)):rd(n.success)},l=(t,r,i)=>{let a=t=>{let r=n.find(e=>e.schema.ast===t);return r===void 0?e.getAttachmentDeclaration?.(t):{metadata:`metadata`in r?r.metadata:void 0}},o=new WeakMap,s=(e,t)=>{let n=a(e);if(n!==void 0){let e=r(t,n.metadata);return e._tag===`matched`?{matched:!0,value:e.value}:{matched:!1,value:t}}if(typeof t!=`object`||!t)return{matched:!1,value:t};let i=o.get(t)?.get(e);if(i!==void 0)return{matched:!1,value:i};switch(e._tag){case`Suspend`:return s(e.thunk(),t);case`Objects`:{let n={...t},r=o.get(t)??new WeakMap;r.set(e,n),o.set(t,r);let i=!1;for(let r of e.propertySignatures){if(typeof r.name!=`string`)continue;let e=Object.getOwnPropertyDescriptor(t,r.name);if(e!==void 0&&`value`in e){let t=s(r.type,e.value);i||=t.matched,n[r.name]=t.value}}return i?{matched:!0,value:n}:{matched:!1,value:t}}case`Arrays`:{if(!Array.isArray(t))return{matched:!1,value:t};let n=[...t],r=o.get(t)??new WeakMap;r.set(e,n),o.set(t,r);let i=!1;for(let r=0;r<e.elements.length;r+=1){let a=s(e.elements[r],t[r]);i||=a.matched,n[r]=a.value}if(e.rest.length>0)for(let r=e.elements.length;r<t.length;r+=1){let a=s(e.rest[0],t[r]);i||=a.matched,n[r]=a.value}return i?{matched:!0,value:n}:{matched:!1,value:t}}case`Union`:for(let n of e.types){let e=s(n,t);if(e.matched)return e}return{matched:!1,value:t};default:return{matched:!1,value:t}}};return s(i===`type`?e.schema.ast:e_(e.schema.ast),t).value};return Object.freeze({schema:e.schema,limits:t,opaqueDeclarationMetadata:Object.freeze(s),decode:e=>{let t=c(e);if(ad(t))return id(t.failure);let n=i(t.success);if(Vp(n))return id(Xx(n));let a=o(n.value);if(Vp(a))return id(Xx(a));let s=c(a.value);if(ad(s))return id(s.failure);let l=o(s.success);return Vp(l)?id(Xx(l)):rd(oS(l.value,r.isBlobRef))},enumerateOpaque:t=>{let r=[],i=new WeakMap,a=t=>{let r=n.find(e=>e.schema.ast===t);return r===void 0?e.getAttachmentDeclaration?.(t):{metadata:`metadata`in r?r.metadata:void 0,accepts:r.isValue}},o=(e,t)=>{let n=a(e);if(n!==void 0){typeof t==`object`&&t&&n.accepts(t)&&r.push(Object.freeze({value:t,metadata:n.metadata}));return}if(typeof t!=`object`||!t)return;let s=i.get(t)??new WeakSet;if(!s.has(e))switch(s.add(e),i.set(t,s),e._tag){case`Suspend`:o(e.thunk(),t);return;case`Objects`:for(let n of e.propertySignatures){if(typeof n.name!=`string`)continue;let e=Object.getOwnPropertyDescriptor(t,n.name);e!==void 0&&`value`in e&&o(n.type,e.value)}return;case`Arrays`:if(!Array.isArray(t))return;for(let n=0;n<e.elements.length;n+=1)o(e.elements[n],t[n]);if(e.rest.length>0)for(let n=e.elements.length;n<t.length;n+=1)o(e.rest[0],t[n]);return;case`Union`:for(let n of e.types)o(n,t);return}};return o(e.schema.ast,t),Object.freeze(r)},mapOpaque:(e,t)=>l(e,t,`type`),mapOpaqueEncoded:(e,t)=>l(e,t,`encoded`),encode:e=>{let t=c(e);if(ad(t))return id(t.failure);let n=a(t.success);return Vp(n)?id(Xx(n)):c(n.value)}})}var cS=G([`record-attachment-owner-invalid`,`record-attachment-schema-id-mismatch`,`record-attachment-schema-invalid`,`record-attachment-payload-invalid`,`record-attachment-json-invalid`,`record-attachment-blob-refs-invalid`,`record-attachment-blob-ref-illegal`,`record-attachment-blob-ref-missing`,`record-attachment-blob-ref-extra`,`record-attachment-blob-ref-duplicate`,`record-attachment-closure-mismatch`,`record-attachment-snapshot-bytes-invalid`,`record-attachment-blob-budget-exceeded`,`record-attachment-materialized-invalid`,`record-attachment-family-invalid`]);function lS(e,t=[]){return Object.freeze({code:e,path:Object.freeze([...t])})}var uS=class extends Error{code;cause;constructor(e=`invalid-family-definition`,t){super(e===`migration-chain-invalid`?`Invalid Record Attachment migration chain`:`Invalid Record Attachment family definition`,{cause:t}),this.code=e,this.cause=t,this.name=`RecordAttachmentSpiDefinitionError`}},dS=Symbol(`@niceeval/record/RecordAttachmentDefinition`),fS=Symbol(`@niceeval/record/RecordAttachmentPersistence`),pS=new WeakMap,mS=new WeakMap,hS=new WeakSet,gS=new WeakMap,_S=new WeakMap,vS=new WeakMap,yS=Object.freeze({maximumJsonBytes:1048576,maximumDepth:64,maximumNodes:1e5,maximumObjectKeys:1e4,maximumArrayItems:1e5,maximumKeyUtf8Bytes:16384,maximumStringUtf8Bytes:1048576});function bS(e){let t=_S.get(e);if(t!==void 0||!fh(e)||!ph(e))return t;if(!(e.typeParameters.length!==0||e.checks!==void 0||e.encoding!==void 0||e.context!==void 0||e.encodingChecks!==void 0||e.encodingRun!==void 0&&e.encodingRun!==e.run))return vS.get(e.run)}function xS(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0}function SS(e){return e===`run`||e===`attempt`}function CS(e){throw new uS(`invalid-family-definition`,e)}function wS(e){return e.ast.context===void 0}function TS(e){(!SS(e.owner)||!lx(e.family)||!wS(e.schema)||e.validate!==void 0&&typeof e.validate!=`function`)&&CS();let t=yS,n=Object.freeze({owner:e.owner,family:e.family,schema:e.schema,validate:e.validate,[dS]:()=>({owner:e.owner,family:e.family})});try{pS.set(n,Object.freeze({codec:sS({schema:e.schema,limits:t,attachmentDeclarations:[{schema:ty,isValue:oy,metadata:iy(ty)},{schema:ny,isValue:sy,metadata:iy(ny)}],getAttachmentDeclaration:e=>{let t=AS(e);if(t!==void 0)return t;let n=iy(e);return n===void 0?void 0:Object.freeze({metadata:n,accepts:n.kind===`text`?oy:sy})},isAttachmentOpaque:e=>kS(e)?{category:`reference`}:ay(e)?{category:`content`}:void 0})}))}catch(e){CS(e)}return n}function ES(e){(!DS(e.attachment)||!xS(e.revision))&&CS();let t=Object.freeze({attachment:e.attachment,revision:e.revision,[fS]:()=>({attachment:e.attachment,revision:e.revision})});return hS.add(t),t}Object.freeze({to(e,t){let n=OS(e);n===void 0&&CS();let r=q_(e=>{let r=kS(e)?gS.get(e):void 0;return r!==void 0&&r.definition===n&&(t===void 0||!ad(ev(t)(r.value)))},{identifier:`RecordAttachmentReference<${n.owner}:${n.family}>`});return _S.set(r,Object.freeze({definition:n,valueSchema:t})),_S.set(r.ast,Object.freeze({definition:n,valueSchema:t})),vS.set(r.ast.run,Object.freeze({definition:n,valueSchema:t})),r}});function DS(e){return typeof e==`object`&&!!e&&pS.has(e)}function OS(e){return DS(e)?e:typeof e==`object`&&e||typeof e==`function`?mS.get(e):void 0}function kS(e){return typeof e==`object`&&!!e&&gS.has(e)}function AS(e){let t=bS(e);return t===void 0?void 0:Object.freeze({metadata:Object.freeze({category:`reference`,definition:t.definition,valueSchema:t.valueSchema}),accepts:e=>kS(e)&&gS.get(e)?.definition===t.definition&&(t.valueSchema===void 0||!ad(ev(t.valueSchema)(gS.get(e)?.value)))})}var jS=gv(H({code:G(`record-schema-invalid.record-run-time-order-invalid.record-run-context-invalid.record-run-context-size-exceeded.record-run-context-experiment-mismatch.record-run-order-invalid.record-expected-slot-order-invalid.record-expected-slot-duplicate.record-run-duplicate.record-member-slot-order-invalid.record-member-slot-duplicate.record-member-slot-unexpected.record-member-slot-missing.record-member-action-invalid.record-attempt-order-invalid.record-attempt-duplicate.record-attempt-owner-invalid.record-attempt-slot-unexpected.record-attempt-slot-mismatch.record-attempt-eval-mismatch.record-attempt-digest-mismatch.record-attempt-reference-missing.record-origin-member-missing.record-origin-member-duplicate.record-attachment-schema-id-mismatch.record-fixed-family-owner-invalid`.split(`.`)),path:U(z)}));function MS(e,t=[]){return Object.freeze({code:e,path:Object.freeze([...t])})}function NS(e){let[t,...n]=e;if(t===void 0)return;let r=[t,...n];return Object.freeze(r)}var PS=G([`record`,`run`,`member`,`attempt`,`attachment-envelope`,`record-core`]),FS=G([`record-schema-invalid`,`record-invariant-invalid`]);Yv()(`RecordCodecError`,{code:FS,document:PS,issues:jS}),Yv()(`RecordCoreInvalid`,{code:R(`record-core-invalid`),issues:jS}),Yv()(`RecordReferenceInvalid`,{code:R(`record-reference-invalid`)}),Yv()(`RecordAttachmentEnvelopeInvalid`,{code:R(`record-attachment-envelope-invalid`),issues:jS});function IS(e){let t=sS({schema:e.schema,limits:e.limits});return Object.freeze({...t,kind:`core`})}var LS=[`completed`,`errored`,`cancelled`,`interrupted`],RS=[`executed`,`carried`,`accepted`,`not-dispatched`,`interrupted`],zS=[`executed`,`carried`,`accepted`],BS=[`not-dispatched`,`interrupted`],VS=`niceeval.record-attachment`,HS=[`run`,`attempt`];function US(e){return`${e.originRunId}\u0000${e.attemptId}`}var WS=`niceeval.run/v1`,GS=B.pipe(q(J(e=>Number.isSafeInteger(e)&&e>=0))),KS=G([`active`,`completed`,`interrupted`,`failed`]),qS=G([`early-exit-satisfied`,`budget-exhausted`,`stopped-by-failure`,`interrupted-before-publication`,`dispatch-failed`]),JS=H({state:R(`pending`)}),YS=H({state:R(`published`),action:G([`executed`,`carried`,`accepted`]),attemptId:z,attemptLocator:z,originRunId:z,originSlotId:z}),XS=H({state:R(`absent`),reason:qS}),ZS=H({slotId:z,evalId:z,attemptOrdinal:GS,executionIdentityDigest:z,publication:W([JS,YS,XS])}),QS=H({published:GS,expected:GS,missing:GS}),$S=H({runId:z,invocationId:z,experimentId:z,state:KS,startedAt:z,completedAt:I(z),coverage:QS}),eC=$S.pipe(uv({slots:U(ZS)}));H({identity:z,revision:GS}),W([H({protocol:R(WS),operation:R(`run.list`),runs:U($S),continuation:I(z)}),H({protocol:R(WS),operation:R(`run.get`),run:eC})]);var tC=z.check(Ev(/\S/u)),nC=z.check(Ev(/^[A-Za-z][A-Za-z0-9_-]{0,63}$(?![\s\S])/u));pv(nC,H({model:tC,reasoningEffort:iv(tC)})).check(J(e=>Object.keys(e).length>0&&Object.keys(e).length<=64));var rC=pv(nC,H({model:K(tC),reasoningEffort:K(tC)})).check(J(e=>Object.keys(e).length<=64)),iC=Dv.check(Lv(),Iv({minimum:1,maximum:3e5})),aC=Object.freeze({maximumJsonBytes:262144,maximumDepth:8,maximumNodes:4096,maximumObjectKeys:64,maximumArrayItems:256,maximumKeyUtf8Bytes:256,maximumStringUtf8Bytes:8192}),oC=yv(()=>W([sv,V,B,z,U(oC),pv(z,oC)])),sC=pv(z,oC),cC=z.pipe(q(Rv(1))),lC=H({name:cC,contract:cC,behaviorRevision:K(cC),cleanupTimeoutMs:iv(iC)}),uC=H({name:cC,key:cC,identity:sC}),dC=IS({schema:H({experimentId:yx,execution:H({plugins:iv(U(uC)),models:iv(rC),adapter:lC,model:K(z),reasoningEffort:K(z),flags:sC,experimentHooks:iv(H({version:R(1),setup:G([`absent`,`opaque`]),teardown:G([`absent`,`opaque`])}))}).check(J(e=>e.models===void 0||e.model===(e.models.default?.model??null)&&e.reasoningEffort===(e.models.default?.reasoningEffort??null))),labels:pv(z,z)}),limits:aC}),fC=dC.schema;function pC(e){let t=NS([e.kind===`canonical`?MS(e.failure.code===`record-json-limit-exceeded`?`record-run-context-size-exceeded`:`record-run-context-invalid`,e.failure.path):MS(`record-run-context-invalid`)]);if(t===void 0)throw Error(`Run context failure must contain one issue`);return t}function mC(e){let t=dC.decode(e);return ad(t)?id(pC(t.failure)):rd(t.success)}function hC(e){let t=mC(e);return ad(t)?t.failure:Object.freeze([])}function gC(e,t,n){for(let r of n)e.push(MS(r.code,[...t,...r.path]))}function _C(e,t){return e===void 0||tx(e,t)<0}function vC(e){let t=[],n=new Set,r=new Set,i;for(let[a,o]of e.entries()){let e=[`expectedSlots`,String(a),`slotId`];_C(i,o.slotId)||t.push(MS(i===o.slotId?`record-expected-slot-duplicate`:`record-expected-slot-order-invalid`,e)),n.has(o.slotId)&&i!==o.slotId&&t.push(MS(`record-expected-slot-duplicate`,e));let s=`${o.evalId}\u0000${String(o.attemptOrdinal)}`;r.has(s)&&t.push(MS(`record-expected-slot-duplicate`,[`expectedSlots`,String(a),`attemptOrdinal`])),n.add(o.slotId),r.add(s),i=o.slotId}return Object.freeze(t)}function yC(e){let t=[];e.completedAt<e.startedAt&&t.push(MS(`record-run-time-order-invalid`,[`completedAt`])),gC(t,[`context`],hC(e.context));let n=mC(e.context);return od(n)&&n.success.experimentId!==e.experimentId&&t.push(MS(`record-run-context-experiment-mismatch`,[`context`,`experimentId`])),gC(t,[],vC(e.expectedSlots)),Object.freeze(t)}function bC(e){return(e.action===`executed`||e.action===`carried`||e.action===`accepted`)==(e.attempt!==null)?Object.freeze([]):Object.freeze([MS(`record-member-action-invalid`,[`attempt`])])}function xC(e){return Object.freeze([])}function SC(e){return[`runs`,String(e)]}function CC(e,t){return[...SC(e),`members`,String(t)]}function wC(e,t){return[...SC(e),`attempts`,String(t)]}function TC(e){return US(e)}function EC(e){return new Map(e.expectedSlots.map(e=>[e.slotId,e]))}function DC(e,t){return e.slotId===t.slotId&&e.evalId===t.evalId&&e.attemptOrdinal===t.attemptOrdinal&&e.executionIdentityDigest===t.executionIdentityDigest}function OC(e,t,n){let r=EC(e.run),i=new Set,a;for(let[o,s]of e.members.entries()){let e=CC(t,o);gC(n,e,bC(s)),_C(a,s.slotId)||n.push(MS(a===s.slotId?`record-member-slot-duplicate`:`record-member-slot-order-invalid`,[...e,`slotId`])),i.has(s.slotId)&&a!==s.slotId&&n.push(MS(`record-member-slot-duplicate`,[...e,`slotId`])),r.has(s.slotId)||n.push(MS(`record-member-slot-unexpected`,[...e,`slotId`])),i.add(s.slotId),a=s.slotId}for(let[r,a]of e.run.expectedSlots.entries())i.has(a.slotId)||n.push(MS(`record-member-slot-missing`,[...SC(t),`run`,`expectedSlots`,String(r),`slotId`]))}function kC(e){let t=[],n=new Map,r=new Map,i;for(let[a,o]of e.runs.entries()){let e=o.run.runId,s=SC(a);_C(i,e)||t.push(MS(i===e?`record-run-duplicate`:`record-run-order-invalid`,[...s,`run`,`runId`])),n.has(e)&&i!==e&&t.push(MS(`record-run-duplicate`,[...s,`run`,`runId`])),n.set(e,a),i=e,gC(t,[...s,`run`],yC(o.run)),OC(o,a,t);let c=EC(o.run),l;for(let[n,i]of o.attempts.entries()){let o=wC(a,n);if(gC(t,o,xC(i)),_C(l,i.attemptId)||t.push(MS(l===i.attemptId?`record-attempt-duplicate`:`record-attempt-order-invalid`,[...o,`attemptId`])),l=i.attemptId,i.originRunId!==e){t.push(MS(`record-attempt-owner-invalid`,[...o,`originRunId`]));continue}let s=c.get(i.slotId);s===void 0?t.push(MS(`record-attempt-slot-unexpected`,[...o,`slotId`])):(s.evalId!==i.evalId&&t.push(MS(`record-attempt-eval-mismatch`,[...o,`evalId`])),s.executionIdentityDigest!==i.executionIdentityDigest&&t.push(MS(`record-attempt-digest-mismatch`,[...o,`executionIdentityDigest`])));let u=TC({originRunId:e,attemptId:i.attemptId});r.has(u)?t.push(MS(`record-attempt-duplicate`,[...o,`attemptId`])):r.set(u,{runIndex:a,attemptIndex:n,attempt:i})}}let a=new Map;for(let[n,i]of e.runs.entries())for(let[o,s]of i.members.entries()){if(s.attempt===null)continue;let c=CC(n,o),l=r.get(TC(s.attempt));if(l===void 0){t.push(MS(`record-attempt-reference-missing`,[...c,`attempt`]));continue}if(s.action!==`accepted`){let n=EC(i.run).get(s.slotId),r=EC(e.runs[l.runIndex].run).get(l.attempt.slotId);(n===void 0||r===void 0||!DC(n,r))&&t.push(MS(`record-attempt-slot-mismatch`,[...c,`attempt`]))}if(s.action===`executed`){if(s.attempt.originRunId!==i.run.runId){t.push(MS(`record-member-action-invalid`,[...c,`action`]));continue}let e=TC(s.attempt);a.set(e,(a.get(e)??0)+1)}else s.attempt.originRunId===i.run.runId&&t.push(MS(`record-member-action-invalid`,[...c,`action`]))}for(let[e,n]of r.entries()){let r=a.get(e)??0,i=wC(n.runIndex,n.attemptIndex);r===0?t.push(MS(`record-origin-member-missing`,i)):r>1&&t.push(MS(`record-origin-member-duplicate`,i))}return Object.freeze(t)}var AC=Object.freeze({maximumJsonBytes:1048576,maximumDepth:8,maximumNodes:4096,maximumObjectKeys:64,maximumArrayItems:256,maximumKeyUtf8Bytes:256,maximumStringUtf8Bytes:8192}),jC=Object.freeze({...AC,maximumJsonBytes:8388608,maximumNodes:32768,maximumArrayItems:4096});function MC(e){return e.length===0?void 0:e.map(e=>({path:e.path,issue:e.code}))}var NC=G(LS),PC=B.pipe(q(J(e=>Number.isSafeInteger(e)&&e>=0,{identifier:`RecordAttemptOrdinal`,description:`a zero-based non-negative JSON-safe attempt ordinal`}))),FC=IS({schema:H({originRunId:hx,attemptId:_x}),limits:AC}).schema,IC=IS({schema:H({slotId:gx,evalId:bx,attemptOrdinal:PC,executionIdentityDigest:xx}),limits:AC}).schema,LC=IS({schema:H({format:kx,recordId:mx}),limits:AC}).schema,RC=IS({schema:H({runId:hx,experimentId:yx,context:fC,startedAt:Ox,completedAt:Ox,expectedSlots:U(IC)}).pipe(q(J(e=>MC(yC(e)),{identifier:`RecordRunDocumentInvariant`,description:`a Run document with valid chronology, context, and expected Slots`}))),limits:AC}).schema,zC=IS({schema:W([H({slotId:gx,action:G(zS),attempt:FC}),H({slotId:gx,action:G(BS),attempt:sv,absenceReason:qS})]).pipe(q(J(e=>MC(bC(e)),{identifier:`RecordMemberDocumentInvariant`,description:`a Member action paired with its required Attempt reference`}))),limits:AC}).schema,BC=IS({schema:H({attemptId:_x,originRunId:hx,slotId:gx,evalId:bx,executionIdentityDigest:xx,outcome:NC}).pipe(q(J(e=>MC(xC(e)),{identifier:`RecordAttemptDocumentInvariant`,description:`an Attempt document satisfying its local invariant`}))),limits:AC}).schema,VC=IS({schema:H({run:RC,members:U(zC),attempts:U(BC)}),limits:jC}).schema;IS({schema:H({record:LC,runs:U(VC)}).pipe(q(J(e=>MC(kC(e)),{identifier:`RecordCoreInvariant`,description:`a complete Record Core with consistent Run, Member, and Attempt documents`}))),limits:jC}).schema;var HC=qx,UC=IC,WC=RC,GC=zC,KC=BC;ev(W([H({format:R(`niceeval.attempt-publication-closure/v1`),originRun:WC}),H({originRun:WC})]),{errors:`all`,onExcessProperty:`error`}),G(RS);var qC=B.pipe(q(J(e=>Number.isSafeInteger(e)&&e>=0))),JC=B.pipe(q(J(e=>Number.isSafeInteger(e)&&e>0))),YC=H({sha256:Sx,byteLength:qC}),XC=H({key:Ex,sha256:Sx,byteLength:qC}),ZC=H({owner:G(HS),family:z.pipe(q(J(lx)))});function QC(e){let t;for(let n of e.contents){if(t!==void 0&&t>=n.key)return!1;t=n.key}let n;for(let t of e.references){let e=`${t.owner}\u0000${t.family}`;if(n!==void 0&&n>=e)return!1;n=e}return!0}H({format:G([VS]),ownerKind:G(HS),family:z.pipe(q(J(lx))),schemaVersion:JC,payload:YC,contents:U(XC),references:U(ZC)}).pipe(q(J(QC)));var $C=Object.freeze({run:`run`,attempt:`attempt`});Object.freeze({maximumJsonBytes:16777216,maximumDepth:32,maximumNodes:2e5,maximumObjectKeys:5e4,maximumArrayItems:1e5,maximumKeyUtf8Bytes:256,maximumStringUtf8Bytes:1048576});var Y=B.pipe(q(J(e=>Number.isSafeInteger(e)&&e>=0,{identifier:`RecordNonNegativeSafeInteger`,description:`a non-negative JSON-safe integer`}))),ew=B.pipe(q(J(e=>Number.isSafeInteger(e)&&e>0,{identifier:`RecordPositiveSafeInteger`,description:`a positive JSON-safe integer`}))),tw=B.pipe(q(J(e=>Number.isFinite(e)&&e>=0,{identifier:`RecordFiniteNonNegativeNumber`,description:`a finite non-negative JSON number`}))),nw=z.pipe(q(J(e=>new TextEncoder().encode(e).byteLength<=16384&&!/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/.test(e),{identifier:`RecordSafeText`,description:`bounded text without NUL or unsafe control characters`}))),rw=z.pipe(q(J(e=>/^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$/.test(e),{identifier:`RecordSafeIdentifier`,description:`a bounded ASCII identifier`}))),iw=z.pipe(q(J(e=>e.length>0&&e.length<=255&&/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+(?:;[!#$%&'*+.^_`|~0-9A-Za-z-]+=[!#$%&'*+.^_`|~0-9A-Za-z-]+)*$/.test(e),{identifier:`RecordMediaType`,description:`a bounded MIME media type without free-form parameters`}))),aw=W([H({code:G([`capture-failed`,`capture-interrupted`]),stage:rw}),H({code:G([`collection-cap-reached`,`unsupported-input`]),omittedAtLeast:ew})]),ow=hv([]).pipe(q(J(e=>e.length===0,{identifier:`RecordEmptyArray`,description:`an exact empty array`}))),sw=W([H({state:R(`complete`),limitations:ow}),H({state:R(`partial`),limitations:gv(aw)})]);function cw(e){let t,n=new Set;for(let r of e){if(n.has(r)||t!==void 0&&t>=r)return!1;n.add(r),t=r}return!0}var lw=Object.freeze({maximumArtifacts:4e3,maximumContentBytes:1073741824}),uw=H({artifactId:Tx,mediaType:L(iw),label:L(nw),byteLength:Y,sha256:Sx,content:ny.pipe(ry.maximumBytes(lw.maximumContentBytes))}),dw=H({collection:L(sw),artifacts:U(uw)}).pipe(fv({collection:`collection-data`,artifacts:`artifacts-data`}));function fw(e){return lS(`record-attachment-schema-invalid`,e)}function pw(e){let t=[];e.artifacts.length>lw.maximumArtifacts&&t.push(fw([`artifacts`])),cw(e.artifacts.map(e=>e.artifactId))||t.push(fw([`artifacts`,`artifactId`]));for(let[n,r]of e.artifacts.entries())r.byteLength>lw.maximumContentBytes&&t.push(fw([`artifacts`,String(n),`byteLength`]));return Object.freeze(t)}var mw=TS({owner:$C.attempt,family:`niceeval.artifacts`,schema:dw,validate:pw}),hw=TS({owner:$C.run,family:`niceeval.artifacts`,schema:dw,validate:pw});ES({attachment:mw,revision:2}),ES({attachment:hw,revision:2});var gw=class{#e=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);#t=new Uint8Array(64);#n=new Uint32Array(64);#r=0;#i=0;#a=!1;update(e){if(this.#a)throw Error(`SHA-256 digest is already finalized`);this.#i+=e.byteLength;let t=0;for(;t<e.byteLength;){let n=Math.min(64-this.#r,e.byteLength-t);this.#t.set(e.subarray(t,t+n),this.#r),this.#r+=n,t+=n,this.#r===64&&(this.#o(this.#t),this.#r=0)}return this}digestHex(){if(this.#a)throw Error(`SHA-256 digest is already finalized`);this.#a=!0;let e=BigInt(this.#i)*8n;this.#t[this.#r++]=128,this.#r>56&&(this.#t.fill(0,this.#r),this.#o(this.#t),this.#r=0),this.#t.fill(0,this.#r,56);for(let t=0;t<8;t+=1)this.#t[63-t]=Number(e>>BigInt(t*8)&255n);return this.#o(this.#t),[...this.#e].map(e=>e.toString(16).padStart(8,`0`)).join(``)}#o(e){let t=this.#n;for(let n=0;n<16;n+=1){let r=n*4;t[n]=(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])>>>0}for(let e=16;e<64;e+=1){let n=t[e-15],r=t[e-2],i=_w(n,7)^_w(n,18)^n>>>3,a=_w(r,17)^_w(r,19)^r>>>10;t[e]=t[e-16]+i+t[e-7]+a>>>0}let[n,r,i,a,o,s,c,l]=this.#e;for(let e=0;e<64;e+=1){let u=_w(o,6)^_w(o,11)^_w(o,25),d=o&s^~o&c,f=l+u+d+vw[e]+t[e]>>>0,p=(_w(n,2)^_w(n,13)^_w(n,22))+(n&r^n&i^r&i)>>>0;l=c,c=s,s=o,o=a+f>>>0,a=i,i=r,r=n,n=f+p>>>0}this.#e[0]=this.#e[0]+n>>>0,this.#e[1]=this.#e[1]+r>>>0,this.#e[2]=this.#e[2]+i>>>0,this.#e[3]=this.#e[3]+a>>>0,this.#e[4]=this.#e[4]+o>>>0,this.#e[5]=this.#e[5]+s>>>0,this.#e[6]=this.#e[6]+c>>>0,this.#e[7]=this.#e[7]+l>>>0}};function _w(e,t){return e>>>t|e<<32-t}var vw=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function yw(e){return new TextEncoder().encode(e).byteLength}var bw=Object.freeze({defaultBytes:65536,maximumBytes:262144}),xw=Y,Sw=Y.pipe(q(J(e=>e>0&&e<=bw.maximumBytes))),Cw=H({artifactId:Tx,offset:I(xw),limit:I(Sw)}),ww=W([H({state:R(`not-found`),artifactId:Tx}),H({state:R(`available`),artifactId:Tx,name:L(nw),mediaType:L(iw),byteLength:Y,sha256:Sx,offset:xw,base64:z.pipe(q(J(e=>e.length<=Math.ceil(bw.maximumBytes/3)*4&&e.length%4==0&&/^[A-Za-z0-9+/]*={0,2}$/.test(e)))),nextOffset:K(xw)})]);xf(`InspectionArtifactError`),ev(Cw,HC),ev(H({"$niceeval.record.content":z}),HC);var{slotId:Tw,...Ew}=UC.fields,Dw=H({plannedAttemptId:Tw,...Ew}),{slotId:Ow,...kw}=KC.fields,Aw=H({plannedAttemptId:Ow,...kw}).check(J(({plannedAttemptId:e,...t})=>Z_(KC)({...t,slotId:e}))),{expectedSlots:jw,...Mw}=WC.fields,Nw=H({...Mw,plannedAttempts:U(Dw)}).check(J(({plannedAttempts:e,...t})=>Z_(WC)({...t,expectedSlots:e.map(({plannedAttemptId:e,...t})=>({...t,slotId:e}))}))),Pw=W(GC.members.map(e=>{let{slotId:t,...n}=e.fields;return H({plannedAttemptId:t,...n})})).check(J(({plannedAttemptId:e,...t})=>Z_(GC)({...t,slotId:e}))),{originSlotId:Fw,...Iw}=YS.fields,Lw=H({...Iw,originPlannedAttemptId:Fw}),Rw=W([JS,Lw,XS]),{content:zw,...Bw}=uw.fields,Vw=Y.pipe(q(J(e=>e>0&&e<=128))),Hw=H(Bw),Uw=H({collection:L(sw),artifacts:U(Hw)});ev(H({"$niceeval.record.content":z}),HC),Object.freeze({conversation:Object.freeze({maxPayloadBytes:2097152,maxItems:2048,maxTurns:256,maxClosureBytes:0}),commands:Object.freeze({maxPayloadBytes:2097152,maxItems:256,maxClosureBytes:33554432}),usage:Object.freeze({maxPayloadBytes:1048576,maxItems:2048,maxClosureBytes:0}),timing:Object.freeze({maxPayloadBytes:1048576,maxItems:4096,maxClosureBytes:0}),diagnostics:Object.freeze({maxPayloadBytes:524288,maxItems:512,maxClosureBytes:0})});var Ww=`@niceeval/o11y/NonNegativeSafeInteger`,Gw=`@niceeval/o11y/PositiveSafeInteger`,Kw=`@niceeval/o11y/SafeIdentifier`,qw=`@niceeval/o11y/SourceNativeToolName`,Jw=`@niceeval/o11y/StableLabel`,Yw=`@niceeval/o11y/SafeText`,Xw=`@niceeval/o11y/CanonicalDecimal`,Zw=`@niceeval/o11y/CurrencyCode`,Qw=new TextEncoder,$w=/^[a-z][a-z0-9.-]{0,63}$/,eT=/^(?:0|[1-9][0-9]*)(?:\.[0-9]*[1-9])?$/,tT=/^[A-Z]{3}$/,nT=/[\u0000-\u0009\u000B-\u001F]/u;function rT(e){return Qw.encode(e).byteLength}function iT(e){for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n>=55296&&n<=56319){let n=e.charCodeAt(t+1);if(n<56320||n>57343)return!1;t+=1}else if(n>=56320&&n<=57343)return!1}return!0}function aT(e){return Number.isSafeInteger(e)&&e>=0}function oT(e){return Number.isSafeInteger(e)&&e>0}function sT(e){return aT(e)?e:void 0}function cT(e){return oT(e)?e:void 0}function lT(e){return rT(e)<=64&&$w.test(e)}function uT(e){return rT(e)<=64&&$w.test(e)}function dT(e){return e.length>0&&!e.includes(`
18
+ `)&&pT(e,256)}function fT(e){return iT(e)&&!nT.test(e)}function pT(e,t){return Number.isSafeInteger(t)&&t>=0&&fT(e)&&rT(e)<=t}function mT(e){return rT(e)<=64&&eT.test(e)}function hT(e){return tT.test(e)}var gT=`@niceeval/o11y/TurnId`,_T=`@niceeval/o11y/ItemId`,vT=`@niceeval/o11y/CallId`,yT=`@niceeval/o11y/EventId`,bT=`@niceeval/o11y/ToolOccurrenceId`,xT=`@niceeval/o11y/SessionScopeId`,ST=`@niceeval/o11y/LegacySourceLocalCallId`,CT=`@niceeval/o11y/CommandId`,wT=`@niceeval/o11y/UsageObservationId`,TT=`@niceeval/o11y/IntervalId`,ET=`@niceeval/o11y/DiagnosticId`;Object.freeze([`turn`,`item`,`call`,`event`,`tool-occurrence`,`session-scope`,`command`,`usage-observation`,`interval`,`diagnostic`]);var DT=`[0123456789abcdefghjkmnpqrstvwxyz]`,OT=Object.freeze({turn:`turn_`,item:`item_`,call:`call_`,event:`event_`,"tool-occurrence":`tool_`,"session-scope":`session_`,command:`command_`,"usage-observation":`usage_`,interval:`interval_`,diagnostic:`diagnostic_`});function kT(e){return RegExp(`^${e}${DT}{26}$`)}var AT=kT(OT.turn),jT=kT(OT.item),MT=kT(OT.call),NT=kT(OT.event),PT=kT(OT[`tool-occurrence`]),FT=kT(OT[`session-scope`]),IT=kT(OT.command),LT=kT(OT[`usage-observation`]),RT=kT(OT.interval),zT=kT(OT.diagnostic);function BT(e){return AT.test(e)}function VT(e){return jT.test(e)}function HT(e){return MT.test(e)}function UT(e){return NT.test(e)}function WT(e){return PT.test(e)}function GT(e){return FT.test(e)}function KT(e){return MT.test(e)}function qT(e){return IT.test(e)}function JT(e){return LT.test(e)}function YT(e){return RT.test(e)}function XT(e){return zT.test(e)}Object.freeze([`niceeval.agent-turns`,`niceeval.sandbox-commands`,`niceeval.runner-activities`,`niceeval.runner-diagnostics`]),Object.freeze([`niceeval.runner-activities`,`niceeval.runner-diagnostics`]);function ZT(e){return typeof e==`object`&&!!e}function QT(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&`value`in n?n.value:void 0}function $T(e){if(!ZT(e))return!1;let t=QT(e,`family`),n=QT(e,`kind`),r=QT(e,`id`);return typeof t==`string`&&typeof n==`string`&&typeof r==`string`}function eE(e){if(!$T(e))return!1;switch(e.kind){case`turn`:return e.family===`niceeval.agent-turns`&&BT(e.id);case`item`:return e.family===`niceeval.agent-turns`&&VT(e.id);case`call`:return e.family===`niceeval.agent-turns`&&HT(e.id);case`event`:return e.family===`niceeval.agent-turns`&&UT(e.id);case`tool-occurrence`:return e.family===`niceeval.agent-turns`&&WT(e.id);case`session-scope`:return e.family===`niceeval.agent-turns`&&GT(e.id);case`command`:return e.family===`niceeval.sandbox-commands`&&qT(e.id);case`usage-observation`:return e.family===`niceeval.agent-turns`&&JT(e.id);case`interval`:return e.family===`niceeval.runner-activities`&&YT(e.id);case`diagnostic`:return e.family===`niceeval.runner-diagnostics`&&XT(e.id);default:return!1}}function tE(e){return $T(e)?e.family===`niceeval.runner-activities`&&e.kind===`interval`&&YT(e.id)||e.family===`niceeval.runner-diagnostics`&&e.kind===`diagnostic`&&XT(e.id):!1}function nE(e,t){return e===t?0:e<t?-1:1}function rE(e,t){let n=nE(e.family,t.family);if(n!==0)return n;let r=nE(e.kind,t.kind);return r===0?nE(e.id,t.id):r}function iE(e,t){if(e.length>16)return!1;let n;for(let t of e){if(!eE(t)||n!==void 0&&rE(n,t)>=0)return!1;n=t}return!0}function aE(e,t){if(e.length>16)return!1;let n;for(let t of e){if(!tE(t)||n!==void 0&&rE(n,t)>=0)return!1;n=t}return!0}var oE=Object.freeze([`conversation-item`,`conversation-text`,`command-manifest`,`command-stdout`,`command-stderr`,`usage-observation`,`timing-interval`,`diagnostic`]),sE=Object.freeze([`adapter`,`command-capture`,`usage-capture`,`timing-capture`,`diagnostic-capture`,`attempt-finalizer`,`run-teardown`]);function cE(e,t){return e.some(e=>e===t)}function lE(e){return cE(oE,e)}function uE(e){return cE(sE,e)}function dE(e){switch(e.code){case`stream-truncated`:case`invalid-utf8-replaced`:case`unsafe-control-stripped`:return e.stream===`stdout`?`command-stdout`:`command-stderr`;default:return e.target}}function fE(e){switch(e.code){case`text-truncated`:return e.target===`conversation-text`?e.itemId:e.target===`command-manifest`?e.commandId:e.diagnosticId;case`stream-truncated`:case`invalid-utf8-replaced`:case`unsafe-control-stripped`:return e.commandId;default:return``}}function pE(e){return e.code===`capture-failed`||e.code===`capture-interrupted`?e.stage:``}function mE(e){return[e.code,dE(e),fE(e),pE(e)].join(`\0`)}function hE(e,t){let n=nE(e.code,t.code);if(n!==0)return n;let r=nE(dE(e),dE(t));if(r!==0)return r;let i=nE(fE(e),fE(t));return i===0?nE(pE(e),pE(t)):i}function gE(e){return e===`stdout`||e===`stderr`}function _E(e){switch(e.code){case`capture-failed`:case`capture-interrupted`:return uE(e.stage)&&lE(e.target);case`collection-cap-reached`:return lE(e.target)&&aT(e.retained)&&oT(e.omittedAtLeast);case`unsupported-input`:return lE(e.target)&&oT(e.omittedAtLeast);case`text-truncated`:return aT(e.retainedBytes)&&oT(e.omittedBytes)&&(e.target===`conversation-text`&&VT(e.itemId)||e.target===`command-manifest`&&qT(e.commandId)||e.target===`diagnostic`&&XT(e.diagnosticId));case`stream-truncated`:return qT(e.commandId)&&gE(e.stream)&&aT(e.retainedBytes)&&oT(e.omittedBytes);case`invalid-utf8-replaced`:return qT(e.commandId)&&gE(e.stream)&&oT(e.replacementCount);case`unsafe-control-stripped`:return qT(e.commandId)&&gE(e.stream)&&oT(e.strippedCount);case`redacted`:return lE(e.target)&&oT(e.replacementCount)}}function vE(e){let t=[];(e.state===`complete`&&e.limitations.length!==0||e.state===`partial`&&e.limitations.length===0)&&t.push(Object.freeze({code:`observability-collection-state-invalid`}));let n,r=new Set;for(let[i,a]of e.limitations.entries()){let e=sT(i);if(e===void 0)throw Error(`Array index must be a safe integer`);if(!_E(a)){t.push(Object.freeze({code:`observability-limitation-invalid`,index:e}));continue}if(n!==void 0&&hE(n,a)>=0){let e=cT(i);if(e===void 0)throw Error(`Non-first array index must be positive`);t.push(Object.freeze({code:`observability-limitation-order-invalid`,index:e}))}let o=mE(a);if(r.has(o)){let e=cT(i);if(e===void 0)throw Error(`Duplicate cannot be at index zero`);t.push(Object.freeze({code:`observability-limitation-duplicate`,index:e}))}r.add(o),n=a}return Object.freeze(t)}var yE=`niceeval.query/v2`,bE=`2.0.0`;function xE(e,t=new Set){if(e===null||typeof e==`string`||typeof e==`boolean`)return!0;if(typeof e==`number`)return Number.isFinite(e);if(typeof e!=`object`||t.has(e))return!1;let n=new Set(t);if(n.add(e),Array.isArray(e))return e.every(e=>xE(e,n));let r=Object.getPrototypeOf(e);return r!==Object.prototype&&r!==null?!1:Object.values(e).every(e=>xE(e,n))}var SE=H({state:R(`available`),byteLength:B,sha256:z,base64:z}),CE=H({state:R(`available`),byteLength:B,sha256:z}),wE=W([H({kind:R(`unavailable`),reason:R(`not-recorded`)}),H({kind:R(`content`),content:W([SE,CE]),encoding:G([`json`,`utf-8`,`binary`]),byteLength:B,preview:K(z)})]),TE=W([H({state:R(`available`),request:z}),H({state:R(`invalid`)}),H({state:R(`unsupported`),schemaVersion:B})]),EE=H({state:G([`unavailable`,`errored`]),code:z,message:z}),DE=H({ordinal:B,transport:R(`attempted`),result:W([H({state:R(`returned`),response:z}),H({state:R(`failed`),code:z,message:z}),H({state:R(`interrupted`)})])}),OE=q_(xE),kE=W([H({ordinal:B,operation:G([`score`,`classify`,`extract`,`batchClassify`]),state:R(`rejected`),transport:R(`not-sent`),failure:EE}),H({ordinal:B,operation:G([`score`,`classify`,`extract`,`batchClassify`]),state:R(`admitted`),request:z,attempts:U(DE),result:W([H({state:R(`completed`),output:z}),EE,H({state:R(`interrupted`)})])})]),AE=H({schemaVersion:R(1),protocol:R(`niceeval.score-match-audit/v1`),definition:H({name:z,version:z,config:z,digest:z,limits:H({maxCalls:B,maxMaterialBytes:B,maxAuditBytes:B})}),input:z,calls:U(kE),result:W([H({state:R(`measured`),value:B}),EE,H({state:R(`interrupted`)})])}),jE=H({rubric:z,anchors:U(H({measurement:B,description:z})),material:OE}),ME=H({rubric:z,choices:U(z),material:OE}),NE=H({rubric:z,choices:U(z),items:U(H({id:z,text:z})),material:OE}),PE=W([H({operation:R(`score`),input:jE}),H({operation:R(`classify`),input:ME}),H({operation:R(`batchClassify`),input:NE})]),FE=W([H({ordinal:B,operation:G([`score`,`classify`,`extract`,`batchClassify`]),state:R(`rejected`),transport:R(`not-sent`),failure:EE}),H({ordinal:B,operation:G([`score`,`classify`,`batchClassify`]),state:R(`admitted`),request:z,attempts:U(DE),mapping:PE,result:W([H({state:R(`completed`),output:z}),EE,H({state:R(`interrupted`)})])})]),IE=H({schemaVersion:R(2),protocol:R(`niceeval.score-match-audit/v2`),definition:H({name:z,version:z,config:z,digest:z,limits:H({maxCalls:B,maxMaterialBytes:B,maxAuditBytes:B})}),input:z,calls:U(FE),result:W([H({state:R(`measured`),value:B}),EE,H({state:R(`interrupted`)})])}),LE=H({schemaVersion:R(3),protocol:R(`niceeval.score-match-audit/v3`),definition:H({name:z,version:z,config:z,digest:z,limits:H({maxCalls:B,maxMaterialBytes:B,maxAuditBytes:B})}),input:z,images:U(H({imageId:z,evidenceIndex:B,mediaType:G([`image/png`,`image/jpeg`]),byteLength:B,sha256:z,paths:U(z)})),calls:U(W([H({ordinal:B,operation:G([`score`,`classify`,`extract`,`batchClassify`]),state:R(`rejected`),transport:R(`not-sent`),failure:EE}),H({ordinal:B,operation:G([`score`,`classify`,`extract`,`batchClassify`]),state:R(`admitted`),requestTemplate:z,wireBody:H({byteLength:B,sha256:z}),attempts:U(DE),result:kE.members[1].fields.result})])),result:W([H({state:R(`measured`),value:B}),EE,H({state:R(`interrupted`)})])}),RE=W([H({state:R(`available`),audit:W([AE,IE,LE])}),H({state:R(`invalid`)}),H({state:R(`unsupported`),schemaVersion:B})]),zE=Eb(wE).entry,BE=H({...zE.fields,judgeMaterial:I(TE),scoreMatchAudit:I(RE)}),VE=H({entryId:Ky,sourceOrder:B,role:G([`declaration`,`threshold`,`score`,`gate`,`optional`,`stop`]),source:H({sourceItemId:z,sha256:z}),start:H({line:B,column:B}),end:H({line:B,column:B})}),HE=W([ib,wb]),UE=G([`condition-not-met`,`evidence-unavailable`,`source-unavailable`,`redacted`,`evaluator-failed`,`producer-interrupted`,`invalid-subject`,`coverage-not-applicable`,`not-recorded`,`not-declared`]),WE=yv(()=>H({label:z,state:z,expected:K(HE),observed:K(ib),reason:K(UE),anchor:K(ib),children:U(WE)})),GE=G([`historical-not-recorded`,`source-unavailable`,`ambiguous`]),KE=W([H({state:R(`exact`),turnId:z,eventId:z,anchor:z}),H({state:R(`unavailable`),reason:GE})]),qE=W([H({kind:R(`tool-occurrence`),toolOccurrenceId:z}),H({kind:R(`event`),eventId:z})]),JE=H({kind:G([`tool`,`event`,`legacy-source-row`]),rowId:z,number:z,phase:G([`at-evaluation`,`outside-evaluation-snapshot`,`historical`]),summary:z,detail:ib,locator:I(qE),evaluation:H({result:G([`matched`,`mismatched`,`unavailable`,`not-evaluated`,`not-retained`,`outside-snapshot`,`legacy`]),difference:I(ib)}),conversationTarget:KE}),YE=W([H({state:R(`unavailable`),reason:GE,rows:hv([]),limitations:hv([])}),H({state:G([`complete`,`partial`]),rows:U(JE),limitations:U(ib)})]),XE=W([H({kind:R(`collection-filter`),summary:ib}),H({kind:R(`ordered-sequence`),summaries:U(ib)})]),ZE=H({step:B,summary:ib,state:G([`matched`,`possible`,`blocked`,`not-reached`]),sourceRow:I(z),conversationTarget:I(KE)}),QE=W([H({state:R(`legacy`),subject:G([`tool`,`event`,`source-row`]),query:H({state:R(`unavailable`),reason:R(`historical-not-recorded`)}),source:H({final:YE,atEvaluation:YE}),identityRelation:H({state:R(`unavailable`),reason:R(`historical-not-recorded`)}),overlayRetention:R(`unavailable`),steps:hv([]),legacyDiagnostic:I(ib)}),H({state:R(`current`),subject:G([`tool`,`event`,`source-row`]),query:XE,receipt:W([rb,mb]),source:H({final:YE,atEvaluation:YE}),identityRelation:W([H({state:R(`exact`)}),H({state:R(`unavailable`),reason:G([`source-unavailable`,`ambiguous`])})]),overlayRetention:G([`complete`,`partial`,`unavailable`]),steps:U(ZE)})]),$E=H({state:R(`unavailable`),reason:R(`not-recorded`)}),eD=H({state:R(`missing`),sourceState:G([`not-recorded`,`invalid`]),comparator:sv,sourceLedger:sv,receipt:sv,result:sv,targets:hv([]),debugger:sv,sandboxCommandJoin:$E}),tD=W([eD,H({state:R(`ordinary`),sourceState:sv,comparator:sv,sourceLedger:K(rb),receipt:K(rb),result:sv,targets:hv([]),debugger:sv,sandboxCommandJoin:$E}),H({state:R(`legacy`),sourceState:R(`unavailable`),comparator:sv,sourceLedger:sv,receipt:sv,result:sv,targets:hv([]),reason:R(`historical-not-recorded`),debugger:QE,sandboxCommandJoin:$E}),H({state:R(`available`),sourceState:G([`complete`,`partial`,`unavailable`]),comparator:K(W([cb,U(cb)])),sourceLedger:H({sourceSnapshot:pb,receipt:W([rb,mb])}),receipt:W([rb,mb]),result:K(bb),targets:U(H({state:G([`matched`,`mismatched`,`unavailable`,`not-evaluated`]),anchor:qE,difference:K(ib)})),debugger:QE,sandboxCommandJoin:$E})]),nD=L(W([H({entryId:z,state:G([`not-recorded`,`invalid`]),issues:I(U(H({code:cS,path:U(z)}))),sourceSites:hv([]),check:WE,matcher:eD}),H({entryId:Ky,display:L(qy),entry:L(BE),sourceSites:U(VE),check:WE,matcher:tD})]));function rD(e){return e.replace(/\.setup$/,`.before`).replace(/\.teardown$/,`.after`)}var iD=Object.freeze({maximumEntries:64,maximumJsonBytes:65536}),aD=yv(()=>W([sv,V,Dv,z,U(aD),pv(z,aD)])),oD=H({label:z,sequence:Y,value:aD,unit:I(G([`ms`,`seconds`,`tokens`,`usd`,`ratio`,`count`,`bytes`]))}),sD=U(oD).check(J(e=>e.length<=iD.maximumEntries&&new Set(e.map(e=>e.label)).size===e.length&&e.every((e,t)=>e.sequence===t&&(e.unit===void 0||typeof e.value==`number`)&&new TextEncoder().encode(JSON.stringify(e)).byteLength<=iD.maximumJsonBytes))),cD=G([`usage-not-recorded`,`source-invalid`,`adapter-usage-required`,`collection-incomplete`,`call-status-unknown`,`no-calls`,`cache-read-missing`,`input-total-missing`,`zero-input-total`,`unsafe-token-total`]),lD={rate:W([H({state:R(`exact`),value:B.check(J(e=>Number.isFinite(e)&&e>=0&&e<=1))}),H({state:R(`unavailable`),reason:cD})]),recordedCalls:Y,coveredCalls:Y,missingCacheReadCalls:Y,missingInputTotalCalls:Y,unknownStatusCalls:Y,collectionComplete:V,reasons:U(cD)},uD=e=>{let t=e.recordedCalls;return t<=4e3&&e.coveredCalls<=t&&e.unknownStatusCalls<=t&&e.missingCacheReadCalls<=t&&e.missingInputTotalCalls<=t&&e.coveredCalls<=t-Math.max(e.missingCacheReadCalls,e.missingInputTotalCalls)&&e.coveredCalls>=t-e.missingCacheReadCalls-e.missingInputTotalCalls&&new Set(e.reasons).size===e.reasons.length&&(e.rate.state===`exact`?e.reasons.length===0&&e.collectionComplete&&t>0&&e.coveredCalls===t&&e.unknownStatusCalls===0:e.rate.reason===e.reasons[0])},dD=H({total:H(lD).check(J(uD)),roles:U(H({modelRole:K(z),...lD}).check(J(uD))),models:U(H({modelRole:K(z),provider:K(z),model:K(z),...lD}).check(J(uD)))}).check(J(e=>e.roles.length<=65&&e.models.length<=4e3));Object.freeze({errors:`all`,onExcessProperty:`error`});var fD=B.pipe(q(J(aT,{identifier:`ObservabilityNonNegativeSafeInteger`,description:`a JSON-safe non-negative integer`})),xv(Ww)),pD=B.pipe(q(J(oT,{identifier:`ObservabilityPositiveSafeInteger`,description:`a positive JSON-safe integer`})),xv(Gw)),mD=z.pipe(q(J(lT,{identifier:`ObservabilitySafeIdentifier`,description:`a lowercase ASCII identifier no longer than 64 bytes`})),xv(Kw));z.pipe(q(J(uT,{identifier:`ObservabilityStableLabel`,description:`a provider-neutral lowercase ASCII label no longer than 64 bytes`})),xv(Jw));var hD=z.pipe(q(J(fT,{identifier:`ObservabilitySafeText`,description:`strict UTF-8 text without NUL or C0 controls other than LF`})),xv(Yw)),gD=z.pipe(q(J(dT,{identifier:`ObservabilitySourceNativeToolName`,description:`a non-empty source-native tool name no longer than 256 UTF-8 bytes`})),xv(qw)),_D=z.pipe(q(J(mT,{identifier:`ObservabilityCanonicalDecimal`,description:`a non-negative canonical decimal string no longer than 64 bytes`})),xv(Xw)),vD=z.pipe(q(J(hT,{identifier:`ObservabilityCurrencyCode`,description:`an uppercase three-letter currency code`})),xv(Zw)),yD=z.pipe(q(J(BT,{identifier:`ObservabilityTurnId`,description:`a turn_ identifier with 26 lowercase Crockford base-32 characters`})),xv(gT)),bD=z.pipe(q(J(VT,{identifier:`ObservabilityItemId`,description:`an item_ identifier with 26 lowercase Crockford base-32 characters`})),xv(_T)),xD=z.pipe(q(J(HT,{identifier:`ObservabilityCallId`,description:`a call_ identifier with 26 lowercase Crockford base-32 characters`})),xv(vT)),SD=z.pipe(q(J(KT,{identifier:`ObservabilityLegacySourceLocalCallId`,description:`a v1 source-local call identifier`})),xv(ST)),CD=z.pipe(q(J(UT,{identifier:`ObservabilityEventId`,description:`an event_ identifier with 26 lowercase Crockford base-32 characters`})),xv(yT)),wD=z.pipe(q(J(WT,{identifier:`ObservabilityToolOccurrenceId`,description:`a tool_ identifier with 26 lowercase Crockford base-32 characters`})),xv(bT)),TD=z.pipe(q(J(GT,{identifier:`ObservabilitySessionScopeId`,description:`a session_ identifier with 26 lowercase Crockford base-32 characters`})),xv(xT)),ED=z.pipe(q(J(qT,{identifier:`ObservabilityCommandId`,description:`a command_ identifier with 26 lowercase Crockford base-32 characters`})),xv(CT)),DD=z.pipe(q(J(JT,{identifier:`ObservabilityUsageObservationId`,description:`a usage_ identifier with 26 lowercase Crockford base-32 characters`})),xv(wT)),OD=z.pipe(q(J(YT,{identifier:`ObservabilityIntervalId`,description:`an interval_ identifier with 26 lowercase Crockford base-32 characters`})),xv(TT)),kD=z.pipe(q(J(XT,{identifier:`ObservabilityDiagnosticId`,description:`a diagnostic_ identifier with 26 lowercase Crockford base-32 characters`})),xv(ET)),AD=G([`conversation-item`,`conversation-text`,`command-manifest`,`command-stdout`,`command-stderr`,`usage-observation`,`timing-interval`,`diagnostic`]).pipe(q(J(lE,{identifier:`ObservabilityCollectionTarget`,description:`a closed Observability collection target`}))),jD=G([`adapter`,`command-capture`,`usage-capture`,`timing-capture`,`diagnostic-capture`,`attempt-finalizer`,`run-teardown`]).pipe(q(J(uE,{identifier:`ObservabilityCollectionStage`,description:`a closed Observability capture stage`}))),MD=W([H({code:R(`capture-failed`),stage:jD,target:AD}),H({code:R(`capture-interrupted`),stage:jD,target:AD}),H({code:R(`collection-cap-reached`),target:AD,retained:fD,omittedAtLeast:pD}),H({code:R(`unsupported-input`),target:AD,omittedAtLeast:pD}),H({code:R(`text-truncated`),target:R(`conversation-text`),itemId:bD,retainedBytes:fD,omittedBytes:pD}),H({code:R(`text-truncated`),target:R(`command-manifest`),commandId:ED,retainedBytes:fD,omittedBytes:pD}),H({code:R(`text-truncated`),target:R(`diagnostic`),diagnosticId:kD,retainedBytes:fD,omittedBytes:pD}),H({code:R(`stream-truncated`),commandId:ED,stream:G([`stdout`,`stderr`]),retainedBytes:fD,omittedBytes:pD}),H({code:R(`invalid-utf8-replaced`),commandId:ED,stream:G([`stdout`,`stderr`]),replacementCount:pD}),H({code:R(`unsafe-control-stripped`),commandId:ED,stream:G([`stdout`,`stderr`]),strippedCount:pD}),H({code:R(`redacted`),target:AD,replacementCount:pD})]).pipe(q(J(_E,{identifier:`ObservabilityLimitation`,description:`a semantically valid closed Observability limitation`})));W([H({state:R(`complete`),limitations:hv([])}),H({state:R(`partial`),limitations:gv(MD)})]).pipe(q(J(e=>vE(e).length===0,{identifier:`ObservabilityCollection`,description:`a complete empty or partial canonically ordered limitation collection`})));var ND=H({family:R(`niceeval.agent-turns`),kind:R(`turn`),id:yD}),PD=H({family:R(`niceeval.agent-turns`),kind:R(`item`),id:bD}),FD=H({family:R(`niceeval.agent-turns`),kind:R(`call`),id:xD}),ID=H({family:R(`niceeval.agent-turns`),kind:R(`event`),id:CD}),LD=H({family:R(`niceeval.agent-turns`),kind:R(`tool-occurrence`),id:wD}),RD=H({family:R(`niceeval.agent-turns`),kind:R(`session-scope`),id:TD}),zD=H({family:R(`niceeval.sandbox-commands`),kind:R(`command`),id:ED}),BD=H({family:R(`niceeval.agent-turns`),kind:R(`usage-observation`),id:DD}),VD=H({family:R(`niceeval.runner-activities`),kind:R(`interval`),id:OD}),HD=H({family:R(`niceeval.runner-diagnostics`),kind:R(`diagnostic`),id:kD}),UD=W([ND,PD,FD,ID,LD,RD,zD,BD,VD,HD]),WD=W([VD,HD]);U(UD).pipe(q(J(e=>e.length<=16&&iE(e,`niceeval.agent-turns`)))),U(UD).pipe(q(J(e=>e.length<=16&&iE(e,`niceeval.sandbox-commands`)))),U(UD).pipe(q(J(e=>e.length<=16&&iE(e,`niceeval.agent-turns`)))),U(UD).pipe(q(J(e=>e.length<=16&&iE(e,`niceeval.runner-activities`)))),U(UD).pipe(q(J(e=>e.length<=16&&iE(e,`niceeval.runner-diagnostics`)))),U(WD).pipe(q(J(e=>e.length<=16&&aE(e,`niceeval.runner-activities`)))),U(WD).pipe(q(J(e=>e.length<=16&&aE(e,`niceeval.runner-diagnostics`))));var GD=Object.freeze([`input`,`output`,`cache-read`,`cache-write`]);function KD(e){let[t,n=``]=e.split(`.`);return Object.freeze({digits:BigInt(`${t}${n}`),scale:n.length})}function qD(e){if(e.digits===0n)return`0`;if(e.scale===0)return e.digits.toString();let t=e.digits.toString().padStart(e.scale+1,`0`),n=t.slice(0,-e.scale),r=t.slice(-e.scale).replace(/0+$/u,``);return r.length===0?n:`${n}.${r}`}function JD(e){if(!Number.isFinite(e)||e<0)return;let t=e.toString().toLowerCase();if(!t.includes(`e`))return t.includes(`.`)?t.replace(/\.?0+$/u,``):t;let[n,r]=t.split(`e`),i=Number(r);if(n===void 0||!Number.isSafeInteger(i))return;let[a,o=``]=n.split(`.`),s=`${a}${o}`,c=a.length+i;return c<=0?qD({digits:BigInt(s),scale:s.length-c}):c>=s.length?`${s}${`0`.repeat(c-s.length)}`:qD({digits:BigInt(s),scale:s.length-c})}function YD(e,t){let n=KD(e);return qD({digits:n.digits*BigInt(t),scale:n.scale+6})}function XD(e){if(e.length===0)return`0`;let t=e.map(KD),n=Math.max(...t.map(e=>e.scale));return qD({digits:t.reduce((e,t)=>e+t.digits*10n**BigInt(n-t.scale),0n),scale:n})}function ZD(e){let t=new TextEncoder().encode(JSON.stringify(e));return`sha256:${new gw().update(t).digestHex()}`}var QD=z.pipe(q(J(e=>e.trim().length>0&&new TextEncoder().encode(e).byteLength<=256&&!/[\u0000-\u001f\u007f]/u.test(e)))),$D=K(Y),eO=H({callId:QD,retryOf:K(QD),provider:K(QD),model:K(QD),status:G([`succeeded`,`failed`,`cancelled`,`unknown`]),inputTokens:$D,inputTotalTokens:$D,outputTokens:$D,cacheReadTokens:$D,cacheWriteTokens:$D}),tO=H({transportProvider:K(QD),endpointId:K(QD)}),nO=H({amount:_D,currency:vD,source:H({kind:R(`reported`),id:QD})}),rO=z.pipe(q(J(e=>/^sha256:[0-9a-f]{64}$/u.test(e)))),iO=K(_D),aO=H({input:iO,output:iO,cacheRead:iO,cacheWrite:iO}),oO=H({kind:R(`configured-profile`),id:QD,asOf:K(ew),profileDigest:rO}),sO=H({basis:R(`catalog-reference`),currency:R(`USD`),source:oO,requestModel:QD,selector:QD,match:G([`exact`,`provider-wildcard`]),ratesPerMTok:aO}),cO=H({bucket:G(GD),tokens:Y,ratePerMTok:iO,amount:_D}),lO=H({bucket:G(GD),reason:G([`tokens-unknown`,`rate-unknown`])}),uO=H({kind:R(`adapter-call-price-estimate`),callId:QD,state:G([`complete`,`partial`]),amount:_D,currency:R(`USD`),source:H({kind:R(`estimated`),id:QD}),pricing:sO,charges:gv(cO),missing:U(lO)}),dO=z.check(Ev(/^[A-Za-z][A-Za-z0-9_-]{0,63}$(?![\s\S])/u)),fO=H({...eO.fields,route:tO,cost:K(nO)}),pO=H({...fO.fields,modelSlot:K(dO)});Object.freeze({maximumCalls:4e3}),H({collection:sw,calls:U(eO)}),H({collection:sw,calls:U(fO),priceReceipts:U(uO)}),H({collection:sw,calls:U(pO),priceReceipts:U(uO)});var mO=Object.freeze({maximumCalls:4e3,maximumModelBytes:8192,maximumReceiptBytes:32768,maximumReceiptFields:24}),hO=new TextEncoder;function gO(e){return z.check(J(t=>t.trim().length>0&&!/[\ud800-\udfff]/u.test(t)&&hO.encode(t).byteLength<=e&&!/[\u0000-\u001f\u007f]/u.test(t)))}var _O=gO(256),vO=gO(mO.maximumModelBytes),yO=z.check(Ev(/^sha256:[0-9a-f]{64}$/u)),bO=K(Y),xO=K(_D),SO=H({path:G(Object.freeze([`model`,`provider`,`usage.completion_tokens`,`usage.cost`,`usage.input_tokens`,`usage.output_tokens`,`usage.prompt_tokens`,`usage.prompt_tokens_details.cache_write_tokens`,`usage.prompt_tokens_details.cached_tokens`,`usage.total_tokens`])),value:W([z.check(J(e=>!/[\ud800-\udfff]/u.test(e)&&hO.encode(e).byteLength<=mO.maximumModelBytes&&!/[\u0000-\u001f\u007f]/u.test(e))),tw.check(J(e=>!Object.is(e,-0))),sv])}),CO=H({state:G([`available`,`unavailable`]),reason:K(G([`response-unavailable`,`cancelled`,`response-too-large`,`invalid-json`,`usage-not-reported`,`invalid-usage`,`response-model-too-large`])),responseDigest:K(yO),fields:U(SO)}).check(J(e=>e.fields.length>mO.maximumReceiptFields||hO.encode(JSON.stringify(e)).byteLength>mO.maximumReceiptBytes||e.fields.some((t,n)=>n>0&&e.fields[n-1].path>=t.path)?!1:e.state===`available`?e.fields.some(e=>e.value!==null)&&e.responseDigest!==null&&(e.reason===null||e.reason===`invalid-usage`||e.reason===`usage-not-reported`||e.reason===`response-model-too-large`):e.fields.length===0&&e.reason!==null&&(e.reason===`invalid-json`||e.reason===`invalid-usage`||e.reason===`usage-not-reported`||e.reason===`response-model-too-large`?e.responseDigest!==null:e.responseDigest===null))),wO=H({callId:_O,entryIndex:Y,entryId:Ky,logicalOrdinal:ew,transmissionOrdinal:ew,operation:G([`score`,`classify`,`extract`,`batchClassify`]),requestModel:vO,transportProvider:G([`openai`,`vercel`,`openrouter`,`typesafe`]),provider:K(_O),model:K(vO),status:G([`succeeded`,`failed`,`cancelled`,`unknown`]),httpStatus:K(Y.check(J(e=>e>=100&&e<=599))),inputTokens:bO,inputTotalTokens:bO,outputTokens:bO,cacheReadTokens:bO,cacheWriteTokens:bO,cost:K(H({amount:_D,currency:vD,source:H({kind:R(`reported`),id:_O})})),receipt:CO}).check(J(e=>EO(e))),TO=H({kind:R(`judge-call-price-estimate`),callId:_O,state:G([`complete`,`partial`]),amount:_D,currency:R(`USD`),source:H({kind:R(`estimated`),id:_O}),pricing:H({basis:R(`catalog-reference`),currency:R(`USD`),source:H({kind:R(`configured-profile`),id:_O,asOf:K(ew),profileDigest:yO}),requestModel:vO,selector:vO,match:G([`exact`,`provider-wildcard`]),ratesPerMTok:H({input:xO,output:xO,cacheRead:xO,cacheWrite:xO})}),charges:gv(H({bucket:G(GD),tokens:Y,ratePerMTok:xO,amount:_D})),missing:U(H({bucket:G(GD),reason:G([`tokens-unknown`,`rate-unknown`])}))}).check(J(e=>DO(e)));H({collection:sw,calls:U(wO),priceReceipts:U(TO)}).check(J(e=>AO(e).length===0));function EO(e){if(e.callId!==`judge:${e.entryIndex}:${e.logicalOrdinal}:${e.transmissionOrdinal}`)return!1;let t=[e.inputTokens,e.cacheReadTokens,e.cacheWriteTokens],n=t.filter(e=>e!==null),r=n.reduce((e,t)=>e+t,0);if(!Number.isSafeInteger(r)||e.inputTotalTokens!==null&&(r>e.inputTotalTokens||n.length===3&&r!==e.inputTotalTokens)||e.inputTotalTokens!==null&&e.outputTokens!==null&&!Number.isSafeInteger(e.inputTotalTokens+e.outputTokens))return!1;let i=new Map(e.receipt.fields.map(e=>[e.path,e.value]));for(let t of e.receipt.fields)if(t.value!==null){if(t.path===`model`){if(typeof t.value!=`string`||!Z_(vO)(t.value))return!1}else if(t.path===`provider`){if(e.transportProvider!==`openrouter`||typeof t.value!=`string`||!Z_(_O)(t.value))return!1}else if(t.path===`usage.cost`){let n=typeof t.value==`number`?JD(t.value):t.value;if(e.transportProvider!==`openrouter`||n===void 0||!Z_(_D)(n))return!1}else if(typeof t.value!=`number`||!Z_(Y)(t.value)||(e.transportProvider===`typesafe`?![`usage.input_tokens`,`usage.output_tokens`,`usage.total_tokens`].includes(t.path):[`usage.input_tokens`,`usage.output_tokens`].includes(t.path))||t.path===`usage.prompt_tokens_details.cache_write_tokens`&&e.transportProvider!==`openrouter`)return!1}if((i.get(`model`)??null)!==e.model||(i.get(`provider`)??null)!==e.provider)return!1;let a=e.transportProvider===`typesafe`?`usage.input_tokens`:`usage.prompt_tokens`,o=e.transportProvider===`typesafe`?`usage.output_tokens`:`usage.completion_tokens`;if(e.inputTotalTokens!==null&&i.get(a)!==e.inputTotalTokens||e.outputTokens!==null&&i.get(o)!==e.outputTokens||e.receipt.reason!==`invalid-usage`&&(typeof i.get(a)==`number`&&e.inputTotalTokens===null||typeof i.get(o)==`number`&&e.outputTokens===null||typeof i.get(`usage.prompt_tokens_details.cached_tokens`)==`number`&&e.cacheReadTokens===null||typeof i.get(`usage.prompt_tokens_details.cache_write_tokens`)==`number`&&e.cacheWriteTokens===null))return!1;let s=i.get(`usage.total_tokens`);if(typeof s==`number`&&(e.inputTotalTokens!==null&&e.inputTotalTokens>s||e.outputTokens!==null&&e.outputTokens>s||e.inputTotalTokens!==null&&e.outputTokens!==null&&e.inputTotalTokens+e.outputTokens!==s)||e.transportProvider===`typesafe`&&t.some(e=>e!==null)||e.transportProvider!==`typesafe`&&e.inputTotalTokens===0&&t.some(e=>e!==0)||e.cacheReadTokens!==null&&i.get(`usage.prompt_tokens_details.cached_tokens`)!==e.cacheReadTokens&&(e.inputTotalTokens!==0||e.cacheReadTokens!==0||i.has(`usage.prompt_tokens_details.cached_tokens`))||e.cacheWriteTokens!==null&&i.get(`usage.prompt_tokens_details.cache_write_tokens`)!==e.cacheWriteTokens&&(e.inputTotalTokens!==0||e.cacheWriteTokens!==0||i.has(`usage.prompt_tokens_details.cache_write_tokens`))||e.inputTokens!==null&&(e.inputTotalTokens===null||e.cacheReadTokens===null||e.cacheWriteTokens===null||e.inputTokens!==e.inputTotalTokens-e.cacheReadTokens-e.cacheWriteTokens)||e.inputTotalTokens!==null&&e.cacheReadTokens!==null&&e.cacheWriteTokens!==null&&e.inputTokens===null)return!1;let c=i.get(`usage.cost`);if(c!=null&&e.cost===null)return!1;if(e.cost!==null){let t=c,n=typeof t==`number`?JD(t):t;if(e.transportProvider!==`openrouter`||e.cost.currency!==`USD`||e.cost.source.id!==`openrouter.usage.cost`||e.cost.amount!==n)return!1}return!0}function DO(e){let t=e.pricing,n=t.match===`exact`?t.requestModel:t.requestModel.includes(`/`)?`${t.requestModel.slice(0,t.requestModel.indexOf(`/`))}/*`:void 0;if(t.selector!==n||e.source.id!==t.source.id||t.source.profileDigest!==ZD({basis:t.basis,currency:t.currency,source:{kind:t.source.kind,id:t.source.id,asOf:t.source.asOf},requestModel:t.requestModel,selector:t.selector,match:t.match,ratesPerMTok:{input:t.ratesPerMTok.input,output:t.ratesPerMTok.output,cacheRead:t.ratesPerMTok.cacheRead,cacheWrite:t.ratesPerMTok.cacheWrite}}))return!1;let r=new Map(e.charges.map(e=>[e.bucket,e])),i=new Map(e.missing.map(e=>[e.bucket,e]));if(r.size!==e.charges.length||i.size!==e.missing.length||GD.some(e=>Number(r.has(e))+Number(i.has(e))!==1))return!1;for(let n of e.charges){let e=OO(t.ratesPerMTok,n.bucket);if(n.ratePerMTok!==e||n.tokens>0&&e===null||n.amount!==(e===null?`0`:YD(e,n.tokens)))return!1}return e.state===(i.size===0?`complete`:`partial`)&&e.amount===XD(e.charges.map(e=>e.amount))}function OO(e,t){switch(t){case`input`:return e.input;case`output`:return e.output;case`cache-read`:return e.cacheRead;case`cache-write`:return e.cacheWrite}}function kO(e,t){switch(t){case`input`:return e.inputTokens;case`output`:return e.outputTokens;case`cache-read`:return e.cacheReadTokens;case`cache-write`:return e.cacheWriteTokens}}function AO(e){let t=e=>[lS(`record-attachment-schema-invalid`,e)];if(e.calls.length>mO.maximumCalls)return t([`calls`]);let n=new Map,r=new Map,i=new Map,a=new Map;for(let o of e.calls){if(!EO(o)||n.has(o.callId)||r.has(o.entryIndex)&&r.get(o.entryIndex)!==o.entryId||i.has(o.entryId)&&i.get(o.entryId)!==o.entryIndex)return t([`calls`,`callId`]);n.set(o.callId,o),r.set(o.entryIndex,o.entryId),i.set(o.entryId,o.entryIndex);let e=`${o.entryIndex}:${o.logicalOrdinal}`,s=a.get(e);if(s===void 0&&(s={operation:o.operation,model:o.requestModel,provider:o.transportProvider,ordinals:new Set},a.set(e,s)),s.operation!==o.operation||s.model!==o.requestModel||s.provider!==o.transportProvider)return t([`calls`,`logicalOrdinal`]);s.ordinals.add(o.transmissionOrdinal)}for(let e of a.values())for(let n=1;n<=e.ordinals.size;n++)if(!e.ordinals.has(n))return t([`calls`,`transmissionOrdinal`]);let o=new Set;for(let r of e.priceReceipts){let e=n.get(r.callId);if(e===void 0||o.has(r.callId)||e.cost!==null||r.pricing.requestModel!==e.requestModel||!DO(r))return t([`priceReceipts`,`callId`]);o.add(r.callId);let i=new Map(r.charges.map(e=>[e.bucket,e])),a=new Map(r.missing.map(e=>[e.bucket,e]));for(let n of GD){let o=kO(e,n),s=OO(r.pricing.ratesPerMTok,n),c=i.get(n);if(o===null?c!==void 0||a.get(n)?.reason!==`tokens-unknown`:o===0||s!==null?c?.tokens!==o:c!==void 0||a.get(n)?.reason!==`rate-unknown`)return t([`priceReceipts`,`charges`])}}return[]}function jO(e,t){for(let n of[`modelRole`,`provider`,`model`]){let r=e[n],i=t[n];if(r!==i)return r===null?-1:i===null?1:r<i?-1:1}return 0}function MO(e,t){return e.entryIndex-t.entryIndex||e.logicalOrdinal-t.logicalOrdinal||e.transmissionOrdinal-t.transmissionOrdinal}var NO=Object.freeze({completed:`completed`,failed:`failed`,cancelled:`cancelled`,interrupted:`interrupted`}),PO=[NO.completed,NO.failed,NO.cancelled,NO.interrupted],FO=Object.freeze({attemptSetup:`attempt.setup`,sandboxPrepare:`sandbox.prepare`,agentEnsure:`agent.ensure`,evalRun:`eval.run`,agentSend:`agent.send`,sandboxCommand:`sandbox.command`,assertionEvaluate:`assertion.evaluate`,verdictFold:`verdict.fold`,attemptTeardown:`attempt.teardown`,runSetup:`run.setup`,runDiscovery:`run.discovery`,runPlan:`run.plan`,runDispatch:`run.dispatch`,runTeardown:`run.teardown`,collection:`collection`}),IO=[FO.attemptSetup,FO.sandboxPrepare,FO.agentEnsure,FO.evalRun,FO.agentSend,FO.sandboxCommand,FO.assertionEvaluate,FO.verdictFold,FO.attemptTeardown];FO.attemptSetup,FO.sandboxPrepare,FO.agentEnsure,FO.evalRun,FO.sandboxCommand,FO.assertionEvaluate,FO.verdictFold,FO.attemptTeardown;var LO=[FO.runSetup,FO.runDiscovery,FO.runPlan,FO.runDispatch,FO.runTeardown],RO=[FO.collection];[...IO,...RO],[...LO,...RO];var zO=[FO.attemptSetup,FO.sandboxPrepare,FO.agentEnsure,FO.evalRun,FO.sandboxCommand,FO.attemptTeardown],BO=Object.freeze({...NO,unknown:`unknown`}),VO=[BO.completed,BO.failed,BO.cancelled,BO.interrupted,BO.unknown],HO=Object.freeze({timeout:`timeout`,cancelled:`cancelled`,transportLost:`transport-lost`}),UO=[HO.timeout,HO.cancelled,HO.transportLost],WO=Object.freeze({spawnFailed:`spawn-failed`,cancelledBeforeStart:`cancelled-before-start`}),GO=[WO.spawnFailed,WO.cancelledBeforeStart],KO=rw,qO=G([`adapter`,`session-manager`,`sandbox-wrapper`,`runner-clock`,`runner-diagnostic-sink`,`attempt-finalizer`,`run-teardown`]),JO=G([`turn`,`turn-item`,`usage-observation`,`turn-context`,`command`,`stdout`,`stderr`,`activity`,`diagnostic`,`diagnostic-cause`,`value-byte`,`content-byte`]),YO=W([H({code:G([`capture-failed`,`capture-interrupted`]),stage:qO,target:JO}),H({code:G([`collection-cap-reached`,`unsupported-input`]),target:JO,omittedAtLeast:ew}),H({code:G([`text-truncated`,`redacted`,`invalid-utf8-replaced`,`unsafe-control-stripped`]),target:JO,replacementOrOmittedCount:ew})]);function XO(e){switch(e.code){case`capture-failed`:case`capture-interrupted`:return[e.code,e.stage,e.target].join(`\0`);case`collection-cap-reached`:case`unsupported-input`:return[e.code,e.target,String(e.omittedAtLeast)].join(`\0`);case`text-truncated`:case`redacted`:case`invalid-utf8-replaced`:case`unsafe-control-stripped`:return[e.code,e.target,String(e.replacementOrOmittedCount)].join(`\0`)}}function ZO(e){let t,n=new Set;for(let r of e){let e=XO(r);if(n.has(e)||t!==void 0&&t>=e)return!1;n.add(e),t=e}return!0}var QO=W([H({state:R(`complete`),limitations:ow}),H({state:R(`partial`),limitations:gv(YO).pipe(q(J(ZO)))})]);Object.freeze({maximumBlobs:1,maximumBlobBytes:1,maximumTotalBytes:1});var $O={itemId:bD,eventId:CD,sessionSequence:pD},ek=W([H({state:R(`exact`),toolOccurrenceId:wD}),H({state:R(`unavailable`),reason:G([`orphan-finish`,`ambiguous-operation`])})]),tk=W([H({...$O,kind:R(`message`),role:G([`user`,`assistant`]),text:hD}),H({...$O,kind:R(`tool-start`),toolOccurrenceId:wD,tool:gD,inputSummary:hD}),H({...$O,kind:R(`tool-finish`),occurrence:ek,outcome:G([`completed`,`rejected`,`failed`,`cancelled`]),outputSummary:hD}),H({...$O,kind:G([`thinking-summary`,`compaction`,`context-injection`]),summary:hD}),H({...$O,kind:R(`subagent`),state:G([`started`,`completed`,`failed`]),label:mD,summary:hD}),H({...$O,kind:R(`input-request`),state:G([`requested`,`answered`,`cancelled`]),promptSummary:hD,responseSummary:K(hD)}),H({...$O,kind:G([`skill-load`,`conversation-error`]),code:mD,summary:hD})]),nk={itemId:bD,sequence:ew},rk=W([H({...nk,kind:R(`message`),role:G([`user`,`assistant`]),text:hD}),H({...nk,kind:R(`tool-call`),callId:SD,tool:gD,inputSummary:hD}),H({...nk,kind:R(`tool-result`),callId:SD,outcome:G([`completed`,`rejected`,`failed`,`cancelled`]),outputSummary:hD}),H({...nk,kind:G([`thinking-summary`,`compaction`,`context-injection`]),summary:hD}),H({...nk,kind:R(`subagent`),state:G([`started`,`completed`,`failed`]),label:mD,summary:hD}),H({...nk,kind:R(`input-request`),state:G([`requested`,`answered`,`cancelled`]),promptSummary:hD,responseSummary:K(hD)}),H({...nk,kind:G([`skill-load`,`conversation-error`]),code:mD,summary:hD})]),ik=W([H({usageObservationId:DD,kind:R(`token-bucket`),provider:mD,bucket:G([`input`,`output`,`cache-read`,`cache-write`,`reasoning`,`other`]),tokens:fD}),H({usageObservationId:DD,kind:R(`request`),provider:mD,requestKind:G([`model`,`tool`])}),H({usageObservationId:DD,kind:R(`provider-cost`),provider:mD,amount:z.pipe(q(J(e=>/^(?:0|[1-9][0-9]*)(?:\.[0-9]*[1-9])?$/u.test(e)))),currency:vD})]),ak=G([`complete`,`partial`,`unavailable`]),ok=z.pipe(q(J(e=>e.trim().length>0&&!!pT(e,16384),{identifier:`AgentTurnEvidenceCoverageReason`,description:`non-empty durable coverage reason within the conversation text limit`}))),sk=W([H({status:R(`complete`)}),H({status:G([`partial`,`unavailable`]),reason:ok})]),ck=H({events:sk,actions:sk,messages:sk,usage:sk,status:sk,data:sk}),lk=W([H({state:R(`recorded`),status:G([`completed`,`failed`,`waiting`]),evidenceCoverage:H({events:ak,actions:ak,messages:ak,usage:ak,status:ak,data:ak})}),H({state:R(`unavailable`),reason:G([`send-failed`,`send-interrupted`])})]),uk=W([H({state:R(`recorded`),status:G([`completed`,`failed`,`waiting`]),evidenceCoverage:ck}),H({state:R(`unavailable`),reason:G([`send-failed`,`send-interrupted`])})]),dk={segmentId:KO,turnId:yD,sequence:ew,outcome:G(PO),usage:U(ik)},fk=H({...dk,sessionId:TD,terminal:uk,items:U(tk)}),pk=H({...dk,terminal:uk,items:U(rk)}),mk=H({...dk,sessionId:TD,terminal:lk,items:U(tk)}),hk=H({...dk,terminal:lk,items:U(rk)});H({collection:QO,segments:U(hk)}).pipe(fv({collection:`collection-data`,segments:`segments-data`})),W([H({state:R(`current`),collection:QO,segments:U(mk)}).pipe(fv({collection:`collection-data`,segments:`segments-data`})),H({state:R(`legacy`),collection:QO,segments:U(hk)}).pipe(fv({collection:`collection-data`,segments:`segments-data`}))]),W([H({state:R(`current`),collection:QO,segments:U(fk)}).pipe(fv({collection:`collection-data`,segments:`segments-data`})),H({state:R(`legacy`),collection:QO,segments:U(pk)}).pipe(fv({collection:`collection-data`,segments:`segments-data`}))]);var gk=z.pipe(q(J(e=>new TextEncoder().encode(e).byteLength>0&&new TextEncoder().encode(e).byteLength<=256,{identifier:`ExecutionTraceIdentifier`}))),_k=z.pipe(q(J(e=>new TextEncoder().encode(e).byteLength<=512,{identifier:`ExecutionTraceSummary`}))),vk=B.pipe(q(J(e=>Number.isSafeInteger(e)&&e>=0,{identifier:`ExecutionTraceNonNegativeSafeInteger`})));B.pipe(q(J(e=>Number.isSafeInteger(e)&&e>0,{identifier:`ExecutionTracePositiveSafeInteger`})));var yk=B.pipe(q(J(Number.isFinite,{identifier:`ExecutionTraceFiniteNumber`}))),bk=z.pipe(q(J(e=>/^[0-9a-f]{64}$/u.test(e),{identifier:`ExecutionTraceSha256`}))),xk=yv(()=>W([sv,V,yk,z,U(xk),pv(z,xk)])),Sk=W([H({state:R(`complete`),limitations:hv([])}),H({state:R(`partial`),limitations:gv(H({code:gk,message:z}))})]),Ck=H({scopeId:gk,label:z,boundary:xk}),wk=W([H({relation:gk,targetKey:gk}),H({relation:gk,unresolved:H({sourceEventId:gk,reason:z})})]),Tk=G([`user`,`assistant`,`system`,`other`]),Ek=U(H({label:z,value:W([z,yk,V,sv])})),Dk=W([H({kind:R(`text`),text:z}),H({kind:R(`message`),role:Tk,speaker:I(z),text:z}),H({kind:R(`fields`),fields:Ek}),H({kind:R(`code`),language:I(z),text:z}),H({kind:R(`image`),artifactId:gk,alt:z})]),Ok=W([H({kind:R(`text`),text:z}),H({kind:R(`message`),role:Tk,speaker:I(z),text:z}),H({kind:R(`fields`),fields:Ek}),H({kind:R(`code`),language:I(z),text:z}),H({kind:R(`image`),artifactId:gk,alt:z,mediaType:G([`image/png`,`image/jpeg`,`image/webp`,`image/gif`]),byteLength:vk,sha256:bk})]),kk=H({key:gk,label:z,artifactId:gk,pointer:z}),Ak=H({key:gk,type:gk,source:H({id:gk,eventId:I(gk),sequence:I(vk)}),actor:I(H({id:gk,label:I(z)})),time:I(H({clockId:gk,value:yk,unit:gk})),summary:_k,payload:I(xk),links:I(U(wk)),evidence:I(U(kk)),scopeMemberships:I(U(H({scopeId:gk,state:G([`included`,`excluded`,`unknown`])}))),display:I(U(Dk))});H({traceId:gk,schema:H({id:gk}),collection:Sk,scopes:U(Ck),events:U(Ak)});var jk=H({kind:R(`trace-header`),traceId:gk,sourceTraceId:gk,schema:H({id:gk,revision:I(vk)}),collection:Sk,scopes:U(Ck)}),Mk=H({kind:R(`event`),traceId:gk,eventId:gk,ordinal:vk,key:gk,type:gk,source:H({id:gk,eventId:I(gk),sequence:I(vk)}),actor:I(H({id:gk,label:I(z)})),time:I(H({clockId:gk,value:yk,unit:gk})),summary:_k,payload:I(xk),links:U(wk),evidence:U(H({key:gk,label:z,artifactId:gk,pointer:z,evidenceId:gk,artifactSha256:bk,targetSha256:bk,targetByteLength:vk})),scopeMemberships:U(H({scopeId:gk,state:G([`included`,`excluded`,`unknown`])})),display:I(gv(Ok))});W([jk,Mk]),Object.freeze({maximumTraces:32,maximumEvents:1e5,maximumCanonicalInputBytes:67108864,maximumPayloadBytes:16384,maximumSummaryBytes:512,maximumLinksPerEvent:32,maximumEvidencePerEvent:8,maximumScopesPerEvent:8,maximumJsonDepth:32,maximumIdentifierBytes:256,maximumEvidenceSourceBytes:268435456,maximumEvidenceTargetBytes:134217728,maximumDetailPreviewBytes:2048,maximumDetailBytes:524288,maximumOutlineEvents:32,maximumOutlineBytes:65536,maximumDisplayBlocksPerEvent:4,maximumDisplayBytesPerEvent:8192,maximumDisplayFields:16,maximumDisplayLabelBytes:128,maximumDisplayAltBytes:512,maximumDisplayPreviewBytes:1024,maximumOutlineEventBytes:8192,maximumDisplayInlineImageBytes:16777216});var Nk=Object.freeze({maximumWindows:256,maximumChangesPerWindow:1e4,maximumRetainedChanges:1e4,maximumTextRevisionBytes:1048576,maximumContents:2e4,maximumContentBytes:1048576,maximumTotalContentBytes:134217728,maximumPayloadJsonBytes:16777216,maximumPolicyEntries:256,maximumPolicyEntryUtf8Bytes:4096}),Pk=new TextEncoder;function Fk(e){return Pk.encode(e).byteLength}function Ik(e){let t,n=new Set;for(let r of e){if(n.has(r)||t!==void 0&&tx(t,r)>=0)return!1;n.add(r),t=r}return!0}function Lk(e){return Ik(e.map(Uk))}var Rk=z.pipe(q(J(e=>/^(?:turn[1-9][0-9]*|session[1-9][0-9]*\/turn[1-9][0-9]*)$/.test(e),{identifier:`FileChangesWindowId`,description:`a canonical agent send-window id`}))),zk=U(z.pipe(q(J(e=>Fk(e)<=Nk.maximumPolicyEntryUtf8Bytes,{identifier:`FileChangesPolicyEntry`,description:`a File Changes include or ignore entry within its UTF-8 budget`})))).pipe(q(J(e=>e.length<=Nk.maximumPolicyEntries&&Ik(e),{identifier:`FileChangesPolicyEntries`,description:`an ASCII-canonical, deduplicated bounded policy entry sequence`}))),Bk=H({kind:R(`agent-send-window-endpoints`),policy:H({defaultPolicy:R(`niceeval.sandbox-ledger/default-excludes/v1`),include:zk,ignore:zk})}),Vk=G([`checkpoint`,`export`,`finalizer-export`,`normalize`]),Hk=W([H({code:G([`capture-failed`,`capture-interrupted`]),stage:Vk,atWindowId:K(Rk)}),H({code:R(`collection-cap-reached`),target:G([`window`,`change`,`content`,`value`,`content-byte`]),omittedAtLeast:ew,atWindowId:K(Rk)}),H({code:R(`unsupported-input`),target:R(`endpoint-metadata`),omittedAtLeast:ew})]);function Uk(e){switch(e.code){case`capture-failed`:case`capture-interrupted`:return[e.code,e.stage,e.atWindowId??``].join(`\0`);case`collection-cap-reached`:return[e.code,e.target,e.atWindowId??``,String(e.omittedAtLeast)].join(`\0`);case`unsupported-input`:return[e.code,e.target,String(e.omittedAtLeast)].join(`\0`)}}var Wk=W([H({state:R(`complete`),limitations:ow}),H({state:R(`partial`),limitations:gv(Hk).pipe(q(J(Lk,{identifier:`FileChangesPartialLimitations`,description:`a deterministic deduplicated File Changes limitation sequence`})))})]),Gk=W([H({kind:R(`text`),sha256:Sx,byteLength:Y.pipe(q(J(e=>e<=Nk.maximumTextRevisionBytes,{identifier:`FileChangesTextRevisionByteLength`,description:`a retained text revision within the File Changes text budget`}))),content:W([H({state:R(`available`),content:ty.pipe(ry.maximumBytes(Nk.maximumContentBytes))}),H({state:R(`omitted`),reason:R(`collection-cap`)})])}),H({kind:R(`elided`),reason:G([`binary`,`oversized-text`]),byteLength:Y}),H({kind:R(`unavailable`),reason:G([`unsupported-input`,`capture-failed`,`capture-interrupted`])})]),Kk=W([H({state:R(`absent`)}),H({state:R(`present`),revision:Gk})]);H({attribution:Bk,collection:Wk,windows:U(H({windowId:Rk,sequence:ew,changes:U(H({changeId:wx,path:Dx,kind:G([`created`,`modified`,`deleted`]),before:Kk,after:Kk}).pipe(q(J(e=>{switch(e.kind){case`created`:return e.before.state===`absent`&&e.after.state===`present`;case`modified`:return e.before.state===`present`&&e.after.state===`present`;case`deleted`:return e.before.state===`present`&&e.after.state===`absent`}},{identifier:`FileChange`,description:`a coherent created, modified, or deleted endpoint transition`})))).pipe(q(J(e=>e.length<=Nk.maximumChangesPerWindow&&Ik(e.map(e=>e.path)),{identifier:`FileChangesWindowChanges`,description:`a bounded ASCII-path-canonical unique window change sequence`})))}))}).pipe(fv({attribution:`attribution-data`,collection:`collection-data`,windows:`windows-data`}));var qk=G([`available`,`partial`,`unavailable`,`empty`,`unsupported`,`failed`]),Jk=z.pipe(q(J(VT))),Yk=z.pipe(q(J(WT))),Xk=z.pipe(q(J(qT))),Zk=W([H({kind:R(`redacted`),fieldCount:B}),H({kind:R(`sampled`),captured:B,knownTotal:I(B)}),H({kind:R(`truncated`),omittedBytes:B}),H({kind:R(`provider-limited`)}),H({kind:R(`capacity-limited`),capturedItems:B,knownTotalItems:B,omittedBytes:K(B)})]),Qk=W([H({code:G([`assertions-not-recorded`,`assertions-revision-unsupported`,`assertions-current-invalid`]),locator:z}),H({code:G([`attempt-origin-missing`,`attempt-not-observed`]),runId:z,plannedAttemptId:z,evalId:z,attemptOrdinal:B}),H({code:R(`score-contribution-unavailable`),locator:z,entryId:z,reason:G([`source-unavailable`,`evaluation-errored`,`not-applicable`])}),H({code:R(`score-partial`),locator:K(z)})]),$k=H({identity:H({kind:R(`attempt`),locator:z})}),eA=H({state:qk,value:K(B),samples:B,total:B,basis:G([`planned-attempt`,`eval`]),issues:U(Qk),refs:U($k),unit:I(G([`points`,`USD`,`ms`,`tokens`])),bounds:I(H({min:B,max:B}))}),tA=H({...eA.fields,source:K(G([`reported`,`estimated`,`mixed`]))}),nA=W([H({identity:H({kind:R(`attempt`),locator:z}),state:G([`not-recorded`,`unsupported`,`failed`])}),H({identity:H({kind:R(`attempt`),locator:z}),entryId:z,groupPath:U(z),state:G([`complete`,`partial`,`unavailable`,`not-applicable`]),reason:I(G([`sampled`,`truncated`,`redacted`,`provider-limited`,`capacity-limited`,`not-collected`,`source-unavailable`,`producer-failed`,`optional-material`,`unsupported-subject`])),limitations:U(Zk)})]),rA={evaluationKind:G([`pass`,`points`,`mixed`]),denominator:H({expected:B,observed:B,classified:B,missing:B}),verdict:H({tally:H({passed:B,failed:B,errored:B,skipped:B}),passRate:eA}),score:eA,costUSD:tA,durationMs:eA,tokens:eA,coverage:U(nA),issues:U(Qk)},iA=H({...Lw.fields,verdict:K(G([`passed`,`failed`,`errored`,`skipped`])),score:eA,costUSD:tA,durationMs:eA,tokens:eA}),aA=W([H({state:R(`available`),value:z}),H({state:R(`mixed`)}),H({state:R(`unavailable`)})]),oA=pv(z,aA),sA=H({runId:z,plannedAttemptId:z,evalId:z,attemptOrdinal:B,labels:oA,publication:W([JS,iA,XS])}),cA=H({groupPath:U(z),...rA}),lA=H({plugins:yv(()=>U(uC)),experimentId:z,adapter:W([H({state:R(`available`),value:lC}),H({state:R(`mixed`)})]),model:aA,labels:oA,groups:U(cA),...rA}),uA=H({experimentId:z,evalId:z,groupPath:U(z),members:U(sA),...rA}),dA=H({totals:H(rA),experiments:U(lA),cells:U(uA)}),fA=H({notes:U(H({label:z,unit:oD.fields.unit,count:Y,min:Dv,median:Dv,p90:Dv,max:Dv})),costSummary:yv(()=>xj),modelUsage:H({attempts:U(H({locator:z,originRunId:z,usage:yv(()=>H({state:kj.fields.state,configuredModels:kj.fields.configuredModels,modelGroups:kj.fields.modelGroups,judgeUsage:Ej,totalCosts:kj.fields.totalCosts,totals:kj.fields.totals}))})),totalAttemptCount:Y,omittedAttemptCount:Y,unresolvedAttemptCount:Y}).check(J(e=>e.attempts.length<=64&&e.totalAttemptCount===e.attempts.length+e.omittedAttemptCount&&e.attempts.every((t,n)=>n===0||e.attempts[n-1].originRunId<t.originRunId||e.attempts[n-1].originRunId===t.originRunId&&e.attempts[n-1].locator<t.locator))),experiment:lA,cells:U(uA)}),pA=H({runId:hx,experimentId:yx,state:KS,context:I(fC),startedAt:Ox,completedAt:I(Ox),plannedAttempts:U(Dw)}),mA=U($S),hA=W([H({state:R(`not-scored`)}),H({state:R(`complete`),earned:B,possible:B}),H({state:R(`unavailable`),earned:B,possible:B,unavailable:B})]),gA=K(G([`passed`,`failed`,`errored`,`skipped`])),_A=H({channel:G([`events`,`actions`,`messages`,`usage`,`status`,`data`]),status:G([`complete`,`partial`,`unavailable`]),reason:I(z)}),vA=W([_A,H({owner:R(`assertion-material`),state:R(`partial`),reason:G([`sampled`,`truncated`,`redacted`,`provider-limited`,`capacity-limited`]),limitations:U(Zk)}),H({owner:R(`assertion-material`),state:R(`unavailable`),reason:G([`not-collected`,`source-unavailable`,`producer-failed`]),limitations:U(Zk)}),H({owner:R(`assertion-material`),state:R(`not-applicable`),reason:G([`optional-material`,`unsupported-subject`]),limitations:U(Zk)})]),yA=H({state:G([`available`,`not-recorded`,`partial`,`unavailable`])}),bA=H({assertions:yA,trace:yA,sources:yA,diff:yA,artifacts:yA,timing:yA,usage:yA,conversation:yA,commands:yA,diagnostics:yA}),xA=H({state:G([`available`,`not-recorded`,`invalid`]),entries:U(H({entryId:z,display:H({label:I(z),key:I(z),groupPath:U(z)})}))}),SA=W([H({state:R(`not-recorded`),entryCount:R(0)}),H({state:R(`available`),entryCount:B,sourceSiteCount:B}),H({state:G([`unsupported`,`failed`,`invalid`]),entryCount:R(0)})]),CA=H({notes:sD,core:Aw,locator:z,originRun:Nw,targets:U(H({runId:z,member:Pw})),evidence:SA,assertions:xA,sections:bA,verdict:gA,score:hA,evidenceCoverage:U(_A),limitations:U(vA)}),wA=W([H({state:R(`available`),text:z}),H({state:R(`omitted`),reason:R(`inspection-result-byte-limit`),byteLength:B,byteLimit:B})]),TA=W([H({state:R(`mapped`),sourceItemId:z,sha256:z}),H({state:R(`unmapped`),reason:G([`source-snapshot-not-recorded`,`position-unrepresentable`])})]),EA=H({entryId:z,sourceOrder:B,role:G([`declaration`,`threshold`,`score`,`gate`,`optional`,`stop`]),start:H({line:B,column:B}),end:H({line:B,column:B}),source:TA}),DA=W([H({state:G([`not-recorded`,`invalid`]),sourceSites:hv([]),hasMoreSourceSites:R(!1),omittedSourceSiteCount:R(0)}),H({state:R(`available`),sourceSites:U(EA),hasMoreSourceSites:V,omittedSourceSiteCount:B})]),OA=H({state:G([`available`,`not-recorded`,`invalid`]),items:U(H({sourceItemId:z,path:z,byteLength:B,sha256:z,content:wA})),hasMore:V,omittedItemCount:B,assertions:DA}),kA=G([`complete`,`partial`,`not-recorded`,`invalid`]),AA=W([YO,H({issue:z}),H({source:R(`agent-turns`),turnId:yD,channel:G([`conversation`,`events`,`actions`,`messages`,`status`,`data`]),state:G([`partial`,`unavailable`]),reason:z}),H({source:R(`turn-contexts`),state:G([`partial`,`not-recorded`,`invalid`]),limitations:U(W([YO,H({issue:z})]))})]),jA=G(PO),MA=W([H({state:R(`not-recorded`)}),H({state:R(`unmapped`),reason:G([`location-not-captured`,`source-snapshot-not-recorded`,`position-unrepresentable`]),sessionIndex:B,turnIndex:B,sourceOrder:K(B)}),H({state:R(`mapped`),sourceItemId:Cx,sha256:Sx,start:H({line:B,column:B}),end:H({line:B,column:B}),sessionIndex:B,turnIndex:B,sourceOrder:B})]),NA=W([H({state:R(`complete`)}),H({state:G([`partial`,`unavailable`]),reason:z})]),PA=W([H({state:R(`recorded`),status:G([`completed`,`failed`,`waiting`]),coverage:H({events:NA,actions:NA,messages:NA,status:NA,data:NA})}),H({state:R(`unavailable`),reason:G([`send-failed`,`send-interrupted`]),coverage:H({state:R(`unavailable`),reason:G([`send-failed`,`send-interrupted`])})})]),FA=W([YO,H({issue:z})]),IA=H({sourceItemId:Cx,sha256:Sx,start:H({line:B,column:B}),end:H({line:B,column:B})}),LA=H({state:kA,limitations:U(FA),limitationsTruncated:V,omittedLimitationCount:B,items:U(H({diagnosticId:z,sequence:B,turnId:K(z),phase:G([`attempt.before`,`sandbox.prepare`,`agent.ensure`,`eval.run`,`agent.send`,`sandbox.command`,`assertion.evaluate`,`verdict.fold`,`attempt.after`]),kind:G([`advisory`,`execution-error`]),code:z,summary:z,summaryTruncated:V,causes:U(H({code:z,summary:z,summaryTruncated:V})),causesTruncated:V,omittedCauseCount:B,redaction:W([H({state:R(`none`)}),H({state:R(`applied`),replacements:B})]),sourceFrame:K(IA)})),hasMore:V,omittedDiagnosticCount:B}),RA=H({preview:z,omittedBytes:B}),zA=G([`user`,`assistant`,`system`,`other`]),BA=W([H({state:R(`absent`)}),H({state:R(`present`),blocks:U(W([H({kind:R(`text`),text:RA}),H({kind:R(`message`),role:zA,speaker:I(z),text:RA}),H({kind:R(`fields`),fields:U(H({label:z,value:W([RA,B,V,sv])}))}),H({kind:R(`code`),language:I(z),text:RA}),H({kind:R(`image`),artifactId:z,alt:z,mediaType:z,byteLength:B,sha256:z})]))})]),VA={itemId:Jk,turnId:z,sequence:B},HA=W([H({...VA,kind:R(`message`),role:G([`user`,`assistant`]),text:z,textTruncated:V}),H({...VA,kind:R(`tool-call`),tool:z,input:z,inputTruncated:V,toolOccurrenceId:I(Yk)}),H({...VA,kind:R(`tool-result`),outcome:G([`completed`,`rejected`,`failed`,`cancelled`]),output:z,outputTruncated:V,toolOccurrenceId:I(Yk)}),H({...VA,kind:G([`thinking-summary`,`compaction`,`context-injection`]),summary:z,summaryTruncated:V}),H({...VA,kind:R(`subagent`),state:G([`started`,`completed`,`failed`]),label:z,summary:z,summaryTruncated:V}),H({...VA,kind:R(`input-request`),state:G([`requested`,`answered`,`cancelled`]),prompt:z,promptTruncated:V,response:K(z),responseTruncated:V}),H({...VA,kind:G([`skill-load`,`conversation-error`]),code:z,summary:z,summaryTruncated:V})]),UA=W([H({kind:R(`exited`),exitCode:B}),H({kind:R(`terminated`),reason:G(UO)}),H({kind:R(`not-started`),reason:G(GO)})]),WA=H({execution:H({state:kA,limitations:U(W([H({code:R(`capture-failed`),stage:R(`adapter`)}),H({code:R(`capture-interrupted`),stage:R(`attempt-finalizer`)}),H({code:R(`collection-cap-reached`),omittedAtLeast:B}),H({code:R(`legacy-source-state`),state:G([`partial`,`invalid`]),message:z})])),traces:U(jk.pipe(uv({eventCount:B}))),events:U(H({traceId:z,eventId:z,origin:W([H({kind:R(`execution-event`),eventId:z}),H({kind:R(`agent-item`),itemId:Jk})]),ordinal:B,type:z,source:Mk.fields.source,actor:Mk.fields.actor,time:Mk.fields.time,summary:z,links:Mk.fields.links,evidence:U(H({evidenceId:z,key:z,label:z})),scopeMemberships:Mk.fields.scopeMemberships,display:BA})),identityIndex:H({traceIds:U(z),omittedTraceIdCount:B,eventIds:U(z),omittedEventIdCount:B,evidenceIds:U(z),omittedEvidenceIdCount:B}),hasMore:V,omittedEventCount:B,continuation:I(z)}),conversation:H({state:kA,limitations:U(AA),limitationsTruncated:V,omittedLimitationCount:B,turns:U(H({turnId:z,sequence:B,sessionId:I(TD),outcome:jA,terminal:PA,context:MA})),turnsTruncated:V,omittedTurnCount:B,items:U(HA),itemsTruncated:V,omittedItemCount:B}),commands:H({state:kA,limitations:U(AA),limitationsTruncated:V,omittedLimitationCount:B,items:U(H({commandId:Xk,phase:G(zO.map(rD)),outcome:UA})),hasMore:V,omittedCommandCount:B}),diagnostics:LA,identityIndex:H({itemIds:U(Jk),omittedItemIdCount:B,toolOccurrenceIds:H({ids:U(Yk),omittedIdCount:B}),commandIds:U(Xk),omittedCommandIdCount:B})}),GA={itemId:Jk,turnId:z,turnSequence:B,turnOutcome:jA,sessionId:I(z),eventId:I(z),sequence:I(B)},KA=W([H({...GA,kind:R(`message`),role:G([`user`,`assistant`]),text:z}),H({...GA,kind:R(`tool-call`),toolOccurrenceId:I(Yk),tool:z,input:z}),H({...GA,kind:R(`tool-result`),toolOccurrenceId:I(Yk),outcome:G([`completed`,`rejected`,`failed`,`cancelled`]),output:z}),H({...GA,kind:G([`thinking-summary`,`compaction`,`context-injection`]),summary:z}),H({...GA,kind:R(`subagent`),state:G([`started`,`completed`,`failed`]),label:z,summary:z}),H({...GA,kind:R(`input-request`),state:G([`requested`,`answered`,`cancelled`]),prompt:z,response:K(z)}),H({...GA,kind:G([`skill-load`,`conversation-error`]),code:z,summary:z})]),qA=H({turnId:z,sequence:B,outcome:jA}),JA=W([H({kind:R(`shell`),command:z}),H({kind:R(`argv`),executable:z,arguments:U(z)})]),YA=W([H({kind:R(`sandbox-default`)}),H({kind:R(`project-relative`),path:z}),H({kind:R(`redacted`)})]),XA=H({text:z,retainedBytes:B,totalSafeUtf8Bytes:B,sha256:z,truncation:H({state:G([`not-truncated`,`truncated`]),omittedSafeUtf8Bytes:B})}),ZA=W([H({kind:R(`execution-event`),event:Mk,evidence:U(H({evidenceId:z,key:z,label:z,artifactId:z,pointer:z,targetSha256:z,targetByteLength:B,offset:R(0),base64:z,nextOffset:K(B),truncated:V}))}),H({kind:R(`execution-evidence`),evidenceId:z,eventId:z,traceId:z,key:z,label:z,artifactId:z,pointer:z,artifactSha256:z,targetSha256:z,targetByteLength:B,offset:B,base64:z,nextOffset:K(B)}),H({kind:R(`item`),itemId:Jk,item:KA}),H({kind:R(`tool-occurrence`),toolOccurrenceId:Yk,call:K(KA),result:K(KA),turn:H({call:K(qA),result:K(qA)})}),H({kind:R(`command`),commandId:Xk,invocation:JA,workingDirectory:YA,outcome:UA,turnId:K(z),phase:G([`attempt.before`,`sandbox.prepare`,`agent.ensure`,`eval.run`,`sandbox.command`,`attempt.after`]),sequence:B,stdout:XA,stderr:XA})]),QA=W([YO,H({issue:z})]),$A=W([H({state:R(`complete`)}),H({state:G([`partial`,`unavailable`]),reason:z})]),ej=W([QA,H({source:R(`agent-turns`),turnId:z,channel:R(`usage`),state:G([`partial`,`unavailable`]),reason:z})]),[tj,nj,rj]=ik.members,ij=W([H({turnId:yD,...tj.fields}),H({turnId:yD,...nj.fields}),H({turnId:yD,...rj.fields})]),aj=H({state:G([`available`,`partial`,`unavailable`]),value:K(B),observationCount:B}),oj=H({currency:z,value:z,observationCount:B}),sj=Z_(vD),cj=z.check(Ev(/^(?:0|[1-9][0-9]*)(?:\.[0-9]*[1-9])?$(?![\s\S])/u)),lj=z.check(J(e=>sj(e))),uj=H({amount:cj,currency:lj,source:H({kind:G([`reported`,`estimated`]),id:z}),state:G([`complete`,`partial`])}),{modelSlot:dj,...fj}=pO.fields,pj=H({...fj,modelRole:dj,effectiveCost:K(uj)}),mj=H({state:G([`complete`,`partial`,`unavailable`]),source:K(G([`reported`,`estimated`,`mixed`])),values:U(H({currency:lj,value:cj,source:G([`reported`,`estimated`,`mixed`]),coveredCalls:Y,reportedCalls:Y,estimatedCalls:Y})),totalCalls:Y}),hj=Y.check(Fv(4e3)),gj=H({state:G([`available`,`partial`,`unavailable`]),value:K(Y),observationCount:hj}).check(J(e=>e.state===`unavailable`==(e.value===null))),_j=W([H({state:R(`not-recorded`)}),H({state:R(`available`),bindings:U(H({modelRole:dO,model:K(z.check(Ev(/\S/u))),reasoningEffort:K(z.check(Ev(/\S/u))),recordedCalls:K(hj)})).check(J(e=>e.length<=64&&e.every((t,n)=>n===0||e[n-1].modelRole<t.modelRole)))})]),vj=H({modelRole:K(dO),provider:pO.fields.provider,model:pO.fields.model,recordedCalls:hj.check(Nv(0)),tokens:H({inputTotalTokens:gj,outputTokens:gj,totalTokens:gj}),costs:mj}).check(J(e=>e.costs.totalCalls===e.recordedCalls&&Object.values(e.tokens).every(t=>t.observationCount<=e.recordedCalls))),yj=W([H({state:R(`available`),basis:R(`recorded-calls`),groups:U(vj).check(J(e=>e.length<=64&&e.every((t,n)=>n===0||jO(e[n-1],t)<0))),totalGroupCount:hj,groupsTruncated:V,omittedGroupCount:hj}).check(J(e=>e.totalGroupCount===e.groups.length+e.omittedGroupCount&&e.groups.length===Math.min(e.totalGroupCount,64)&&e.groupsTruncated===e.omittedGroupCount>0)),H({state:R(`unavailable`),basis:G([`recorded-calls`,`reported-sends`,`unavailable`]),reason:G([`source-invalid`,`usage-not-recorded`,`physical-call-identity-not-recorded`]),groups:hv([]),totalGroupCount:sv,groupsTruncated:R(!1),omittedGroupCount:R(0)})]),bj=H({state:G([`complete`,`partial`,`unavailable`]),values:U(H({currency:lj,value:cj,source:G([`reported`,`estimated`,`mixed`])})),missingSources:U(G([`application`,`judge`])).check(J(e=>e.length<=2&&e.every((t,n)=>n===0||e[n-1]===`application`&&t===`judge`)))}).check(J(e=>e.state===(e.missingSources.length===0?`complete`:e.values.length===0?`unavailable`:`partial`)&&e.values.every((t,n)=>n===0||e.values[n-1].currency<t.currency))),xj=H({scope:R(`latest-recorded-attempts`),totalCosts:bj,coverage:H({plannedAttemptCount:Y,recordedAttemptCount:Y,originAttemptCount:Y,completeAttemptCount:Y,partialAttemptCount:Y,unavailableAttemptCount:Y,missingAttemptCount:Y}).check(J(e=>e.plannedAttemptCount===e.recordedAttemptCount+e.missingAttemptCount&&e.originAttemptCount<=e.recordedAttemptCount&&e.originAttemptCount===e.completeAttemptCount+e.partialAttemptCount+e.unavailableAttemptCount))}),Sj=mj.check(J(e=>e.totalCalls<=4e3&&e.source===null==(e.values.length===0)&&e.values.every((t,n)=>t.coveredCalls<=t.reportedCalls+t.estimatedCalls&&t.reportedCalls+t.estimatedCalls<=e.totalCalls&&t.source===(t.reportedCalls===0?`estimated`:t.estimatedCalls===0?`reported`:`mixed`)&&(n===0||e.values[n-1].currency<t.currency))&&e.values.reduce((e,t)=>e+t.reportedCalls+t.estimatedCalls,0)<=e.totalCalls&&(e.state!==`unavailable`||e.values.length===0)&&(e.state!==`complete`||e.values.reduce((e,t)=>e+t.coveredCalls,0)===e.totalCalls))),Cj=W([H({state:R(`unavailable`),reason:R(`judge-usage-not-recorded`)}),H({state:R(`invalid`),reason:R(`judge-usage-source-invalid`)})]),wj={state:G([`complete`,`partial`]),coverage:R(`physical-transmissions`),collection:sw,totals:H({requests:gj,inputTotalTokens:gj,outputTokens:gj,totalTokens:gj,costs:Sj})},Tj=H(wj).check(J(e=>{let t=e.totals.requests;return e.state===e.collection.state&&t.value===t.observationCount&&t.state===(e.state===`complete`?`available`:`partial`)&&e.totals.costs.totalCalls===t.value&&(e.state===`complete`||e.totals.costs.state!==`complete`)&&[e.totals.inputTotalTokens,e.totals.outputTokens,e.totals.totalTokens].every(n=>n.observationCount<=t.observationCount&&(n.state!==`available`||e.state===`complete`&&n.observationCount===t.observationCount))&&(t.value!==0||e.state!==`complete`||[e.totals.inputTotalTokens,e.totals.outputTokens,e.totals.totalTokens].every(e=>e.state===`available`&&e.value===0)&&e.totals.costs.state===`complete`)})),Ej=W([Cj,Tj]),Dj=W([Cj,H({...wj,calls:U(wO),callsTruncated:V,omittedCallCount:hj,priceReceipts:U(TO)}).check(J(e=>Z_(Tj)({state:e.state,coverage:e.coverage,collection:e.collection,totals:e.totals})&&e.calls.length<=128&&e.calls.length+e.omittedCallCount===e.totals.requests.value&&e.callsTruncated===e.omittedCallCount>0&&e.calls.every((t,n)=>n===0||MO(e.calls[n-1],t)<0)&&yw(JSON.stringify({calls:e.calls,priceReceipts:e.priceReceipts}))<=131072&&AO({collection:e.collection,calls:e.calls,priceReceipts:e.priceReceipts}).length===0))]),Oj=H({inputTotalTokens:I(aj),inputTokens:aj,outputTokens:aj,requests:aj,providerCosts:I(H({state:G([`available`,`partial`,`unavailable`]),values:U(oj),observationCount:B})),costs:I(mj)}),kj=H({cacheRead:dD,configuredModels:_j,modelGroups:yj,judgeUsage:Dj,totalCosts:bj,source:I(R(`adapter`)),coverage:I(R(`recorded-calls`)),calls:I(U(pj)),priceReceipts:I(K(U(uO))),callsTruncated:I(V),omittedCallCount:I(B),state:kA,limitations:U(ej),limitationsTruncated:V,omittedLimitationCount:B,turns:U(H({turnId:z,coverage:$A})),turnsTruncated:V,omittedTurnCount:B,observations:U(ij),totals:Oj,hasMore:V,omittedObservationCount:B}),Aj=G([`complete`,`partial`,`not-recorded`,`invalid`,`unavailable`]),jj=H({state:Aj,facts:U(_A),limitations:U(vA)}),Mj=H({state:Aj,summary:K(H({turnCount:B,observationCount:B})),totals:Oj,limitations:U(ej),limitationsTruncated:V,omittedLimitationCount:B}),Nj=W([H({kind:R(`member-not-observed`),state:G([`pending`,`not-dispatched`,`interrupted`])}),H({kind:R(`attempt-unresolved`),originRunId:z,attemptId:z}),H({kind:R(`coverage`),detail:vA}),H({kind:R(`usage`),detail:ej})]),Pj=H({...Dw.fields,publication:Rw,state:G([`executed`,`carried`,`accepted`,`not-dispatched`,`interrupted`,`pending`]),locator:K(z),relation:K(G([`origin`,`reference`])),outcome:K(G([`completed`,`errored`,`cancelled`,`interrupted`])),verdict:gA,score:K(hA),coverage:jj,usage:Mj,limitations:U(Nj)}),Fj=H({plannedAttemptId:z,locator:K(z),limitation:Nj}),Ij=H({value:pA,members:U(Pw),attempts:U(Aw),denominator:H({expected:B,published:B,missing:B}),plannedAttempts:U(Pj),coverage:H({state:Aj,expectedMemberCount:B,observedMemberCount:B,completeMemberCount:B,factCount:B,limitations:U(Fj)}),usage:H({state:Aj,expectedMemberCount:B,observedMemberCount:B,recordedAttemptCount:B,totals:Oj,limitations:U(Fj)}),limitations:U(Fj)}),Lj=H({state:kA,limitations:U(QA),limitationsTruncated:V,omittedLimitationCount:B,activities:U(H({activityId:z,sequence:B,parentActivityId:K(z),turnId:K(z),phase:z,label:z,startOffsetMs:B,durationMs:B,outcome:G(VO)})),hasMore:V,omittedActivityCount:B}),Rj=W([H({kind:R(`text`),sha256:z,byteLength:B,content:G([`available`,`omitted`])}),H({kind:R(`elided`),reason:G([`binary`,`oversized-text`]),byteLength:B}),H({kind:R(`unavailable`),reason:G([`unsupported-input`,`capture-failed`,`capture-interrupted`])})]),zj=W([H({state:R(`absent`)}),H({state:R(`present`),revision:Rj})]),Bj=H({windowId:z,sequence:B,changes:U(H({changeId:z,path:z,kind:G([`created`,`modified`,`deleted`]),before:zj,after:zj}))}),Vj=W([H({state:R(`not-recorded`),windows:hv([])}),H({state:R(`invalid`),issues:U(z),windows:hv([])}),H({state:G([`complete`,`partial`]),limitations:U(Hk),windows:U(Bj)})]),Hj=z.check(J(e=>Db.test(e))),Uj={experimentId:yx,evalId:bx,attemptOrdinal:Y},Wj=H({sourceRunId:hx,locator:Hj}),Gj=yv(()=>W([sv,V,B,z,U(Gj),pv(z,Gj)])),Kj=G([`no-result`,`pending`,`not-published`,`identity-mismatch`,`outcome-ineligible`,`score-incomplete`,`evidence-unavailable`,`timeout-exceeded`,`adoption-unproven`]),qj=W([H({...Uj,state:R(`reuse`),sourceRunId:hx,locator:Hj,relation:G([`origin`,`reference`]),action:G([`executed`,`carried`,`accepted`])}),H({...Uj,state:R(`gap`),reason:Kj,issues:U(Gj),sourceRunId:K(hx),previous:K(Wj)})]),Jj=H({targetIdentity:Bv,coverage:H({expected:Y,covered:Y,gaps:Y}),plannedAttempts:U(qj),...dA.fields,history:U(H({...Uj,sourceRunId:hx,locator:K(Hj)}))}).check(J(e=>e.coverage.covered+e.coverage.gaps===e.coverage.expected&&e.plannedAttempts.length===e.coverage.expected&&e.plannedAttempts.filter(e=>e.state===`reuse`).length===e.coverage.covered)),Yj=z.pipe(bv(e=>Db.test(e),{identifier:`AttemptLocator`,description:`a canonical @-prefixed Attempt locator`})),Xj=z.pipe(q(J(VT))),Zj=z.pipe(q(J(WT))),Qj=z.pipe(q(J(qT))),$j=U(hx),eM=U(yx).check(J(e=>e.length>0&&new Set(e).size===e.length)),tM=(e,t)=>H({kind:R(e),...t}),nM=H({kind:G([`project-record`,`external-record`]),publicationCutoffIdentity:z}),rM=H({storeGeneration:z,revision:B.check(Lv(),Pv(0))}),iM=H({requestedRunIds:U(z),selectedRunIds:U(z),missingRunIds:U(z)}),aM=H({protocol:R(yE),outcome:R(`success`),behaviorVersion:R(bE),source:nM,publicationCutoff:rM,selection:iM,issues:hv([]),evidence:H({refs:U(z)})}),oM=H({protocol:R(yE),outcome:R(`success`),behaviorVersion:R(bE),source:nM,publicationCutoff:rM,selection:H({requestedRunIds:U(z),selectedRunIds:U(z),missingRunIds:U(z),returnedRunCount:B,truncated:V}),issues:hv([]),evidence:H({refs:U(z)})}),sM=W([H({code:R(`selection-run-missing`),side:G([`left`,`right`]),runId:z}),H({code:R(`comparison-member-set-mismatch`)})]),cM=aM.pipe(uv({issues:U(sM)})),lM=W([H({state:R(`not-recorded`)}),H({state:R(`available`),value:Uw,collection:H({state:G([`complete-page`,`bounded-page`]),items:U(Hw),hasMore:V,nextOffset:K(xw),total:xw}),contents:U(H({logicalHandle:z,byteLength:B,digest:z})),contentsTruncated:V})]),uM=H({key:z,runId:z,plannedAttemptId:z,evalId:z,attemptOrdinal:B,locator:z}),dM=H({mode:G([`side-by-side`,`exact`,`paired`]),left:H({runs:U(Nw),members:U(uM)}),right:H({runs:U(Nw),members:U(uM)}),exactMemberSet:V,pairs:U(H({key:z,left:uM,right:uM}))}),fM=e=>Object.freeze(e),pM=Object.freeze({"project.get":fM({request:tM(`project.get`,{experimentIds:I(eM)}),result:{project:Jj},factKinds:[`current-project`,`core`,`assertions`,`attempt-cost`]}),"overview.get":fM({request:tM(`overview.get`,{runIds:I($j)}),result:{overview:dA},factKinds:[`core`,`assertions`,`attempt-cost`]}),"experiment.get":fM({request:tM(`experiment.get`,{experimentId:yx}),result:{experiment:fA},factKinds:[`core`,`attempt-note`,`assertions`,`attempt-cost`,`agent-turns`,`adapter-usage`,`judge-usage`]}),"run.list":fM({request:tM(`run.list`,{continuation:I(z)}),result:{runs:mA,continuation:I(z)},factKinds:[`core`]}),"run.get":fM({request:tM(`run.get`,{runId:hx}),result:{run:Ij},factKinds:[`core`,`assertions`,`agent-turns`,`adapter-usage`,`judge-usage`]}),"attempt.get":fM({request:tM(`attempt.get`,{locator:Yj}),result:{attempt:CA},factKinds:[`core`,`assertions`,`attempt-note`]}),"attempt.assertion.detail":fM({request:tM(`attempt.assertion.detail`,{locator:Yj,entryId:Ky}),result:{assertion:nD},factKinds:[`assertions`,`agent-turns`,`sources`]}),"attempt.assertion.image":fM({request:tM(`attempt.assertion.image`,{locator:Yj,entryId:Ky,imageId:z,offset:I(xw),limit:I(Sw)}),result:{image:W([H({state:R(`available`),imageId:z,mediaType:G([`image/png`,`image/jpeg`]),byteLength:B,sha256:z,offset:B,base64:z,nextOffset:K(B)}),H({state:R(`invalid`)}),H({state:R(`not-recorded`)})])},factKinds:[`assertions`]}),"attempt.trace":fM({request:tM(`attempt.trace`,{locator:Yj,traceId:I(z),sourceId:I(z),actorId:I(z),eventType:I(z),continuation:I(z)}),result:{trace:WA},factKinds:[`execution-traces`,`agent-turns`,`turn-contexts`,`sandbox-commands`,`runner-activities`,`runner-diagnostics`]}),"attempt.trace.detail":fM({request:tM(`attempt.trace.detail`,{locator:Yj,selector:W([tM(`execution-event`,{eventId:z}),tM(`execution-evidence`,{evidenceId:z,offset:I(xw),limit:I(Sw)}),tM(`item`,{itemId:Xj}),tM(`tool-occurrence`,{toolOccurrenceId:Zj}),tM(`command`,{commandId:Qj})])}),result:{detail:ZA},factKinds:[`execution-traces`,`agent-turns`,`sandbox-commands`,`artifacts`]}),"attempt.timing":fM({request:tM(`attempt.timing`,{locator:Yj}),result:{timing:Lj},factKinds:[`runner-activities`]}),"attempt.usage":fM({request:tM(`attempt.usage`,{locator:Yj}),result:{usage:kj},factKinds:[`agent-turns`,`adapter-usage`,`judge-usage`]}),"attempt.diff":fM({request:tM(`attempt.diff`,{locator:Yj}),result:{diff:Vj},factKinds:[`file-changes`]}),"attempt.sources":fM({request:tM(`attempt.sources`,{locator:Yj}),result:{sources:OA},factKinds:[`assertions`,`sources`]}),"attempt.artifacts":fM({request:tM(`attempt.artifacts`,{locator:Yj,offset:I(xw),limit:I(Vw)}),result:{artifacts:lM},factKinds:[`artifacts`]}),"attempt.artifact":fM({request:tM(`attempt.artifact`,{locator:Yj,artifactId:Tx,offset:I(xw),limit:I(Sw)}),result:{artifact:ww},factKinds:[`artifacts`]}),"runs.compare":fM({request:tM(`runs.compare`,{mode:G([`side-by-side`,`exact`,`paired`]),leftRunIds:$j,rightRunIds:$j}),result:{comparison:dM},factKinds:[`core`]})}),mM=G(Object.freeze(Object.keys(pM))),hM=Object.entries(pM),gM=H({protocol:R(yE),operation:W(hM.map(([,e])=>e.request))}),_M=(e,t)=>{let n=uv({operation:R(e),...t.result});return e===`run.list`?oM.pipe(n):e===`runs.compare`?cM.pipe(n):aM.pipe(n)},vM=W(hM.map(([e,t])=>_M(e,t))),yM=(e,t)=>{let n=uv({outcome:R(`explanation`),operation:R(e),factKinds:hv(t.factKinds.map(e=>R(e)))});return e===`run.list`?oM.pipe(n):aM.pipe(n)},bM=W(hM.map(([e,t])=>yM(e,t))),xM=W(hM.map(([e])=>H({id:R(e)}))),SM=W([H({protocol:R(yE),outcome:R(`discovery`),operations:U(xM)}),vM,bM,H({protocol:R(yE),outcome:R(`failure`),operation:K(mM),failure:H({code:G([`inspection-request-invalid`,`inspection-selection-missing`,`inspection-source-invalid`,`inspection-record-integrity-failure`,`inspection-operation-failed`,`inspection-result-invalid`,`evidence-budget-exceeded`,`restart-required`,`current-target-unavailable`]),reason:z,identity:I(H({runId:z})),correction:G([`fix-request`,`choose-existing-selection`,`fix-record-source`,`retry`,`upgrade-or-report`,`restart`])})})]);function CM(e){let t=ev(SM,{errors:`all`,onExcessProperty:`error`})(e);return od(t)?{success:!0,value:e}:{success:!1,reason:String(t.failure)}}function wM(e,t){return e.outcome===`success`&&e.operation===t?{success:!0,value:e}:{success:!1,reason:`expected success ${t}, received ${e.outcome}${`operation`in e?` ${e.operation}`:``}`}}var TM=new WeakSet;ev(gM,{onExcessProperty:`error`});function EM(e){let t=new Set,n=(e,r)=>{if(e===null||typeof e==`string`||typeof e==`boolean`)return e;if(typeof e==`number`)return Number.isFinite(e)?e:DM(r,`numbers must be finite`);if(Array.isArray(e)){if(t.has(e))return DM(r,`cyclic arrays are not encodable`);t.add(e);let i=[];for(let[t,a]of e.entries()){let e=n(a,[...r,String(t)]);if(kM(e))return e;i.push(e)}return t.delete(e),Object.freeze(i)}if(typeof e!=`object`||!e)return DM(r,`unsupported ${typeof e} value`);if(t.has(e))return DM(r,`cyclic objects are not encodable`);let i=Object.getPrototypeOf(e);if(i!==Object.prototype&&i!==null)return DM(r,`only plain objects may cross Inspection delivery`);t.add(e);let a=Object.create(null);for(let t of Object.keys(e).sort(jM)){let i=n(Reflect.get(e,t),[...r,t]);if(kM(i))return i;a[t]=i}return t.delete(e),Object.freeze(a)};return n(e,[])}function DM(e,t){let n=Object.freeze({code:`inspection-result-invalid`,reason:`${e.length===0?`$`:e.join(`.`)}: ${t}`});return TM.add(n),n}function OM(e){return AM(e)&&TM.has(e)}var kM=OM;function AM(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function jM(e,t){return e<t?-1:+(e>t)}function MM(e){let t=EM(e);return OM(t)?id(t):rd(`${NM(t)}\n`)}function NM(e){if(e===null||typeof e==`boolean`||typeof e==`number`||typeof e==`string`)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(NM).join(`,`)}]`;let t=e;return`{${Object.keys(t).sort(PM).map(e=>`${JSON.stringify(e)}:${NM(t[e])}`).join(`,`)}}`}function PM(e,t){return e<t?-1:+(e>t)}function FM(e,t){let n=MM(t);if(ad(n))throw Error(`Inspection operation query key is invalid: ${n.failure.reason}`);return[`inspection`,e,`${t.kind}:${n.success}`]}function IM(e,t){return fc({queryKey:FM(e.identity,t),queryFn:()=>e.inspectRepository(t)})}var LM=(0,v.createContext)(null);function RM({runtime:e,children:t}){let n=(0,v.useSyncExternalStore)(t=>e.subscribe(t),()=>e.current,()=>e.current);if(n===void 0)throw Error(`No View generation has been committed.`);return(0,M.jsx)(LM.Provider,{value:n.binding,children:(0,M.jsx)(Uo,{client:e.queryClient,children:t})})}function zM(){let e=(0,v.useContext)(LM);if(e===null)throw Error(`useCurrentGeneration must be used inside InspectionRuntimeProvider.`);return e}function BM(e,t={}){let n=(0,v.useContext)(LM);if(n===null)throw Error(`useInspectionQuery must be used inside InspectionRuntimeProvider.`);let r=(t.enabled??!0)&&e!==null;if(e===null)return uc({queryKey:[`inspection`,n.identity,`disabled`],queryFn:fs,enabled:!1});let i=IM(n,e);return uc({queryKey:i.queryKey,queryFn:i.queryFn,enabled:r,...t.select===void 0?{}:{select:t.select}})}var VM=class{generation;#e=!1;constructor(e){this.generation=e}get identity(){return this.generation.identity}inspect(e){return this.#e?Promise.reject(Error(`Generation lease is released.`)):this.generation.queryClient.fetchQuery(IM(this.generation,e))}release(){this.#e||(this.#e=!0,this.generation.releaseLease())}},HM=class{repository;queryClient;onClosed;identity;#e=`preparing`;#t=0;#n=0;#r;binding;constructor(e,t,n){this.repository=e,this.queryClient=t,this.onClosed=n,this.identity=e.generationId;let r=this;this.binding=Object.freeze({identity:this.identity,queryClient:this.queryClient,get snapshot(){return r.snapshot},inspectRepository(e){return r.inspectRepository(e)}})}get status(){return this.#e}get snapshot(){if(this.#r===void 0)throw Error(`View generation snapshot is not ready.`);return this.#r}attachSnapshot(e){if(this.#e!==`preparing`||this.#r!==void 0)throw Error(`A View generation snapshot can only be attached once while preparing.`);this.#r=e}acquire(){if(this.#e===`retiring`||this.#e===`closed`)throw Error(`View generation is ${this.#e}.`);return this.#t+=1,new VM(this)}inspectRepository(e){if(this.#e===`retiring`||this.#e===`closed`)return Promise.reject(Error(`View generation is ${this.#e}.`));this.#n+=1;let t;try{t=this.repository.inspect(e)}catch(e){return this.#i(),Promise.reject(e)}return t.finally(()=>this.#i())}publish(){if(this.#e!==`preparing`)throw Error(`Only a preparing generation can be published.`);this.#e=`current`}drain(){this.#e!==`retiring`&&this.#e!==`closed`&&(this.#e=`retiring`,this.#s(),this.#a())}close(){this.#t=0,this.#o()}releaseLease(){this.#t>0&&--this.#t,this.#a()}#i(){this.#n>0&&--this.#n,this.#a()}#a(){this.#e===`retiring`&&this.#t===0&&this.#n===0&&this.#o()}#o(){this.#e!==`closed`&&(this.#e=`closed`,this.#s(),this.repository.close(),this.onClosed())}#s(){this.queryClient.removeQueries({type:`inactive`,predicate:e=>e.queryKey[1]===this.identity})}},UM=class{#e;#t=new Set;#n=new Map;#r=new Set;#i=!1;queryClient=new Ys({defaultOptions:{queries:{gcTime:3e5,retry:1,staleTime:1/0,refetchOnMount:!1,refetchOnReconnect:!1,refetchOnWindowFocus:!1}}});get current(){return this.#e}acquireCurrent(){this.#a();let e=this.#e;if(e===void 0)throw Error(`No View generation has been committed.`);return e.acquire()}subscribe(e){return this.#a(),this.#r.add(e),()=>this.#r.delete(e)}prepare(e){if(this.#i)throw e.close(),Error(`View runtime is disposed.`);let t=this.#n.get(e.generationId);if(t!==void 0)throw t.repository!==e&&e.close(),Error(`View generation ${e.generationId} already has an owner.`);let n;n=new HM(e,this.queryClient,()=>{this.#n.get(n.identity)===n&&this.#n.delete(n.identity)});try{let e={generation:n,lease:n.acquire()};return this.#n.set(n.identity,n),this.#t.add(n),e}catch(e){throw n.close(),e}}attachSnapshot(e,t){if(this.#a(),!this.#t.has(e.generation)||this.#n.get(e.generation.identity)!==e.generation)throw Error(`Only a prepared View generation can receive a snapshot.`);e.generation.attachSnapshot(t)}commit(e){if(this.#a(),!this.#t.has(e.generation)||this.#n.get(e.generation.identity)!==e.generation||e.generation.status!==`preparing`)throw Error(`Only an open View generation can be committed.`);e.generation.snapshot,this.#t.delete(e.generation);let t=this.#e;e.generation.publish(),this.#e=e.generation,e.lease.release();for(let e of this.#r)e();return t}retire(e){e!==void 0&&e!==this.#e&&this.#n.get(e.identity)===e&&e.drain()}reject(e){this.#t.has(e.generation)&&this.#n.get(e.generation.identity)===e.generation&&e.generation.status===`preparing`&&(this.#t.delete(e.generation),e.lease.release(),e.generation.close())}dispose(){if(!this.#i){this.#i=!0,this.#r.clear(),this.#e=void 0,this.#t.clear();for(let e of[...this.#n.values()])e.close();this.#n.clear(),this.queryClient.clear()}}#a(){if(this.#i)throw Error(`View runtime is disposed.`)}},WM=ev(gM,{onExcessProperty:`error`});function GM(e){let t=WM({protocol:yE,operation:e});return ad(t)?id(Object.freeze({classification:`protocol/query`,code:`inspection-request-invalid`,reason:String(t.failure)})):rd(t.success.operation)}new TextEncoder;var KM=class extends Error{classification=`route-input`;translationKey=`report.unableToLoad`},qM=class extends Error{classification=`selection`;translationKey=`report.unableToLoad`};function JM(e){let t=GM(e);if(ad(t))throw new KM(`Invalid Insight route input.`);return t.success}function YM(e=[]){let t=JM({kind:`overview.get`,...e.length===0?{}:{runIds:e}});if(t.kind!==`overview.get`)throw new KM(`Invalid overview operation.`);return t}function XM(e){let t=JM({kind:`project.get`,...e===void 0?{}:{experimentIds:e}});if(t.kind!==`project.get`)throw new KM(`Invalid current project operation.`);return t}function ZM(e){let t=JM({kind:`run.get`,runId:e});if(t.kind!==`run.get`)throw new KM(`Invalid run route.`);return t}function QM(e){let t=JM({kind:`attempt.get`,locator:e}),n=JM({kind:`attempt.trace`,locator:e});if(t.kind!==`attempt.get`||n.kind!==`attempt.trace`)throw new KM(`Invalid attempt route.`);return[t,n]}function $M(e){let t=JM(e);switch(t.kind){case`attempt.assertion.detail`:case`attempt.trace.detail`:case`attempt.timing`:case`attempt.usage`:case`attempt.sources`:case`attempt.diff`:case`attempt.artifacts`:return t;default:throw new KM(`Invalid Attempt detail operation.`)}}function eN(e){return Object.freeze({state:`available`,value:e})}function tN(){return Object.freeze({state:`unavailable`})}function nN(e,t){let n=e.attempt.originRun.plannedAttempts.find(({plannedAttemptId:t})=>t===e.attempt.core.plannedAttemptId),r=e.attempt.score,i=r.state===`complete`?r.earned:void 0;return Object.freeze({locator:e.attempt.locator,runId:e.attempt.originRun.runId,experimentId:e.attempt.originRun.experimentId,evalId:e.attempt.core.evalId,summary:Object.freeze({experimentId:e.attempt.originRun.experimentId,adapter:e.attempt.originRun.context.execution.adapter,identity:Object.freeze({runId:e.attempt.originRun.runId,evalId:e.attempt.core.evalId,attempt:n===void 0?tN():eN(n.attemptOrdinal)}),verdict:e.attempt.verdict??`unknown`,startedAt:new Date(e.attempt.originRun.startedAt).toISOString(),durationMs:tN(),capabilities:Object.freeze({source:e.attempt.sections.sources.state,execution:e.attempt.sections.trace.state,timing:e.attempt.sections.timing.state,diff:e.attempt.sections.diff.state}),...i===void 0?{}:{totalScore:i}}),assertionEntryIds:Object.freeze(e.attempt.assertions.entries.map(({entryId:e})=>e)),traceItemIds:Object.freeze([...t.trace.identityIndex.itemIds]),toolOccurrenceIds:Object.freeze([...t.trace.identityIndex.toolOccurrenceIds.ids]),commandIds:Object.freeze([...t.trace.identityIndex.commandIds])})}function rN(e,t){let[n,r]=QM(t);return fc({queryKey:[`insight-attempt`,e.identity,t],queryFn:async()=>{let[t,i]=await Promise.all([e.queryClient.fetchQuery(IM(e,n)),e.queryClient.fetchQuery(IM(e,r))]);return nN(t,i)}})}function iN(e,t,n,r,i,a){return fc({queryKey:[`insight-results`,e.identity,r,i??null,a??null],queryFn:async()=>{let o=t.groups.find(({identity:e})=>e.kind===i&&(e.kind===`named`?e.groupId===a:e.experimentId===a));if(o===void 0&&t.groups.length>0)throw new qM(`Results selection is unavailable.`);let s=o?.members??[];if(s.length===1)return e.queryClient.fetchQuery(aN(e,n,r,s[0]));let c=r===`current`?(await e.queryClient.fetchQuery(IM(e,s.length===0?XM():XM(s)))).project:void 0,l=c===void 0?void 0:(await e.queryClient.fetchQuery(IM(e,XM()))).project.history;return Object.freeze({overview:n,selectedExperiments:s,selectionTitle:o?.label??`Results`,targetMode:r,...c===void 0?{}:{current:c},...l===void 0?{}:{currentHistory:l}})}})}function aN(e,t,n,r){return fc({queryKey:[`insight-experiment`,e.identity,n,r],queryFn:async()=>{if(!t.catalog.experiments.includes(r))throw new qM(`Experiment selection is unavailable.`);let i=[r];if(n===`current`){let a=(await e.queryClient.fetchQuery(IM(e,XM(i)))).project,o=(await e.queryClient.fetchQuery(IM(e,XM()))).project.history;return Object.freeze({overview:t,selectedExperiments:i,selectionTitle:r,current:a,currentHistory:o,targetMode:n})}if(n===`unavailable`)return Object.freeze({overview:t,selectedExperiments:i,selectionTitle:r,targetMode:n});let a=GM({kind:`experiment.get`,experimentId:r});if(ad(a)||a.success.kind!==`experiment.get`)throw new KM(`Invalid experiment route.`);let o=await e.queryClient.fetchQuery(IM(e,a.success));return Object.freeze({overview:t,selectedExperiments:Object.freeze(i),selectionTitle:i[0]??`Results`,targetMode:n,costSummary:o.experiment.costSummary})}})}function oN(e){return e.experiments.map(t=>{let n=e.plannedAttempts.filter(e=>e.experimentId===t.experimentId),r=n.filter(e=>e.state===`reuse`).length;return Object.freeze({experiment:t,slots:n,covered:r,gaps:n.length-r})})}function sN(e){let t=e.overview.cells.map(e=>Object.freeze({experimentId:e.experimentId,evalId:e.evalId,evaluationKind:e.evaluationKind,passRate:cN(e.verdict.passRate),score:cN(e.score),costUSD:cN(e.costUSD),durationMs:cN(e.durationMs),tokens:cN(e.tokens),tally:Object.freeze({...e.verdict.tally}),members:Object.freeze(e.members.map(e=>Object.freeze({runId:e.runId,attemptOrdinal:e.attemptOrdinal,publication:e.publication.state===`published`?Object.freeze({state:`published`,locator:e.publication.attemptLocator,score:cN(e.publication.score),costUSD:cN(e.publication.costUSD),durationMs:cN(e.publication.durationMs),tokens:cN(e.publication.tokens)}):e.publication})))})),n=e.overview.experiments.map(e=>Object.freeze({experimentId:e.experimentId,evaluationKind:e.evaluationKind,passRate:cN(e.verdict.passRate),score:cN(e.score),costUSD:cN(e.costUSD),durationMs:cN(e.durationMs),tokens:cN(e.tokens),adapter:e.adapter,plugins:e.plugins,model:e.model,groups:Object.freeze(e.groups.map(e=>Object.freeze({groupPath:Object.freeze([...e.groupPath]),evaluationKind:e.evaluationKind,passRate:cN(e.verdict.passRate),score:cN(e.score),costUSD:cN(e.costUSD),durationMs:cN(e.durationMs),tokens:cN(e.tokens)})))})),r=n.map(({experimentId:e})=>e),i=pN(t.flatMap(e=>e.members.map(t=>({runId:t.runId,experimentId:e.experimentId}))),({runId:e})=>e),a=pN(t.flatMap(e=>e.members.flatMap(t=>t.publication.state===`published`?[{locator:t.publication.locator,experimentId:e.experimentId}]:[])),({locator:e})=>e);return Object.freeze({cells:Object.freeze(t),experiments:Object.freeze(n),catalog:Object.freeze({experiments:Object.freeze(r),runExperiments:Object.freeze(i),attemptExperiments:Object.freeze(a)})})}function cN(e){return Object.freeze({value:e.value,state:e.state,samples:e.samples,total:e.total,basis:e.basis===`planned-attempt`?`slot`:e.basis,issues:Object.freeze(e.issues),refs:Object.freeze(e.refs.map(e=>Object.freeze({identity:Object.freeze({kind:e.identity.kind,locator:e.identity.locator})}))),...e.unit===void 0?{}:{unit:e.unit},...`source`in e&&(e.source===`reported`||e.source===`estimated`||e.source===`mixed`||e.source===null)?{source:e.source}:{},...e.bounds===void 0?{}:{bounds:Object.freeze({...e.bounds})}})}function lN(e,t){let n=new Set(t),r=e.cells.filter(({experimentId:e})=>n.has(e)),i=[...new Set(r.map(({evalId:e})=>e))];return t.flatMap(t=>{let n=e.experiments.find(e=>e.experimentId===t);if(n===void 0)return[];let a=r.filter(e=>e.experimentId===t);if(a.length===0)return[];let o=a.map(uN),s=n.evaluationKind,c=i.filter(e=>!a.some(t=>t.evalId===e));return[Object.freeze({experimentId:t,adapter:n.adapter,plugins:n.plugins,model:n.model,flags:null,evaluationKind:s,score:n.score,costUSD:n.costUSD,durationMs:n.durationMs,tokens:n.tokens,endToEndPassRate:n.passRate,missingEvalIds:Object.freeze(c),groupMetrics:dN(n.groups),evalRows:Object.freeze(o),href:`#/experiment/${encodeURIComponent(t)}`})]})}function uN(e){let t=e.members.flatMap(t=>{if(t.publication.state!==`published`)return[];let n=e.members.length===1?fN(e.tally):null;return[Object.freeze({locator:t.publication.locator,experimentId:e.experimentId,evalId:e.evalId,attemptOrdinal:t.attemptOrdinal,verdict:n,failureSummary:null,evaluationKind:e.evaluationKind===`pass`?`pass`:`points`,score:t.publication.score,costUSD:t.publication.costUSD,durationMs:t.publication.durationMs,tokens:t.publication.tokens,startedAt:null,href:`#/attempt/${t.publication.locator.startsWith(`@`)?t.publication.locator.slice(1):t.publication.locator}`})]});return Object.freeze({evalId:e.evalId,evaluationKind:e.evaluationKind===`pass`?`pass`:`points`,score:e.score,costUSD:e.costUSD,durationMs:e.durationMs,tokens:e.tokens,endToEndPassRate:e.passRate,attempts:Object.freeze(t)})}function dN(e){return new Map(e.map(e=>[e.groupPath.join(`/`),Object.freeze({passRate:e.passRate,score:e.score,costUSD:e.costUSD,durationMs:e.durationMs,tokens:e.tokens})]))}function fN(e){return e.passed===1&&e.failed===0&&e.errored===0&&e.skipped===0?`passed`:e.passed===0&&e.failed===1&&e.errored===0&&e.skipped===0?`failed`:e.passed===0&&e.failed===0&&e.errored===1&&e.skipped===0?`errored`:e.passed===0&&e.failed===0&&e.errored===0&&e.skipped===1?`skipped`:null}function pN(e,t){let n=new Map;for(let r of e)n.set(t(r),r);return Object.freeze([...n.values()])}function mN(e){return Object.freeze({runId:e.run.value.runId,experimentId:e.run.value.experimentId,adapter:e.run.value.context?.execution.adapter??null,members:Object.freeze(e.run.plannedAttempts.map((e,t)=>Object.freeze({key:`${e.plannedAttemptId}:${t}`,plannedAttemptId:e.plannedAttemptId,evalId:e.evalId,attemptOrdinal:e.attemptOrdinal,state:e.state,locator:e.locator,outcome:e.outcome,verdict:e.verdict,...e.score===null?{}:{score:e.score}})))})}function hN(e,t){let n=ZM(t);return fc({queryKey:[`insight-run`,e.identity,t],queryFn:async()=>mN(await e.queryClient.fetchQuery(IM(e,n)))})}var gN=Object.defineProperty,_N=(e,t)=>gN(e,`name`,{value:t,configurable:!0}),vN=!!(typeof window<`u`&&window.document&&window.document.createElement);function yN(e,t,{checkForDefaultPrevented:n=!0}={}){return _N(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}_N(yN,`composeEventHandlers`);function bN(e){if(!vN)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}_N(bN,`getOwnerWindow`);function xN(e){if(!vN)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}_N(xN,`getOwnerDocument`);function SN(e,t=!1){let{activeElement:n}=xN(e);if(!n?.nodeName)return null;if(CN(n)&&n.contentDocument)return SN(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=xN(n).getElementById(e);if(t)return t}}return n}_N(SN,`getActiveElement`);function CN(e){return e.tagName===`IFRAME`}_N(CN,`isFrame`);var wN=Object.defineProperty,TN=(e,t)=>wN(e,`name`,{value:t,configurable:!0});function EN(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}TN(EN,`setRef`);function DN(...e){return t=>{let n=!1,r=e.map(e=>{let r=EN(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():EN(e[t],null)}}}}TN(DN,`composeRefs`);function ON(...e){return v.useCallback(DN(...e),e)}TN(ON,`useComposedRefs`);var kN=Object.defineProperty,AN=(e,t)=>kN(e,`name`,{value:t,configurable:!0});function jN(e,t){let n=v.createContext(t);n.displayName=e+`Context`;let r=AN(e=>{let{children:t,...r}=e,i=v.useMemo(()=>r,Object.values(r));return(0,M.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=v.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return AN(i,`useContext`),[r,i]}AN(jN,`createContext`);function MN(e,t=[]){let n=[];function r(t,r){let i=v.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=AN(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=v.useMemo(()=>o,Object.values(o));return(0,M.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=v.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return AN(s,`useContext`),[o,s]}AN(r,`createContext`);let i=AN(()=>{let t=n.map(e=>v.createContext(e));return AN(function(n){let r=n?.[e]||t;return v.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,NN(i,...t)]}AN(MN,`createContextScope`);function NN(...e){let t=e[0];if(e.length===1)return t;let n=AN(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return AN(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}AN(NN,`composeContextScopes`);var PN=globalThis?.document?v.useLayoutEffect:()=>{},FN=Object.defineProperty,IN=(e,t)=>FN(e,`name`,{value:t,configurable:!0}),LN=v.useId||(()=>void 0),RN=0;function zN(e){let[t,n]=v.useState(LN());return PN(()=>{e||n(e=>e??String(RN++))},[e]),e||(t?`radix-${t}`:``)}IN(zN,`useId`);var BN=Object.defineProperty,VN=(e,t)=>BN(e,`name`,{value:t,configurable:!0}),HN=v.useEffectEvent,UN=v.useInsertionEffect;function WN(e){if(typeof HN==`function`)return HN(e);let t=v.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof UN==`function`?UN(()=>{t.current=e}):PN(()=>{t.current=e}),v.useMemo(()=>((...e)=>t.current?.(...e)),[])}VN(WN,`useEffectEvent`);var GN=Object.defineProperty,KN=(e,t)=>GN(e,`name`,{value:t,configurable:!0}),qN=v.useInsertionEffect||PN;function JN({prop:e,defaultProp:t,onChange:n=KN(()=>{},`onChange`),caller:r}){let[i,a,o]=YN({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,v.useCallback(t=>{if(s){let n=XN(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}KN(JN,`useControllableState`);function YN({defaultProp:e,onChange:t}){let[n,r]=v.useState(e),i=v.useRef(n),a=v.useRef(t);return qN(()=>{a.current=t},[t]),v.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}KN(YN,`useUncontrolledState`);function XN(e){return typeof e==`function`}KN(XN,`isFunction`);var ZN=Symbol(`RADIX:SYNC_STATE`);function QN(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=WN(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=v.useReducer((t,n)=>{if(n.type===ZN)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=v.useRef(p);v.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=v.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return v.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:ZN,state:i})},[i,d.state,c]),[h,f]}KN(QN,`useControllableStateReducer`);var $N=Object.defineProperty,eP=(e,t)=>$N(e,`name`,{value:t,configurable:!0});function tP(e){let t=v.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];lP(r)&&typeof pP==`function`&&(r=pP(r._payload)),v.Children.forEach(r,e=>{if(sP(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;lP(n)&&typeof pP==`function`&&(n=pP(n._payload)),a=iP(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=v.cloneElement(a,void 0,s):!o&&v.Children.count(r)===1&&v.isValidElement(r)&&(a=r);let c=a?oP(a):void 0,l=ON(n,c);if(!a){if(r||r===0)throw Error(o?fP(e):dP(e));return r}let u=aP(i,a.props??{});return a.type!==v.Fragment&&(u.ref=n?l:c),v.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}eP(tP,`createSlot`);var nP=Symbol.for(`radix.slottable`);function rP(e){let t=eP(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=nP,t}eP(rP,`createSlottable`);var iP=eP((e,t)=>{if(`child`in e.props){let t=e.props.child;return v.isValidElement(t)?v.cloneElement(t,void 0,e.props.children(t.props.children)):null}return v.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function aP(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}eP(aP,`mergeProps`);function oP(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}eP(oP,`getElementRef`);function sP(e){return v.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===nP}eP(sP,`isSlottable`);var cP=Symbol.for(`react.lazy`);function lP(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===cP&&`_payload`in e&&uP(e._payload)}eP(lP,`isLazyComponent`);function uP(e){return typeof e==`object`&&!!e&&`then`in e}eP(uP,`isPromiseLike`);var dP=eP(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),fP=eP(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),pP=v.use,mP=Object.defineProperty,hP=(e,t)=>mP(e,`name`,{value:t,configurable:!0}),gP=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=tP(`Primitive.${t}`),r=v.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,M.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function _P(e,t){e&&y.flushSync(()=>e.dispatchEvent(t))}hP(_P,`dispatchDiscreteCustomEvent`);var vP=Object.defineProperty,yP=(e,t)=>vP(e,`name`,{value:t,configurable:!0});function bP(e){let t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>((...e)=>t.current?.(...e)),[])}yP(bP,`useCallbackRef`);var xP=Object.defineProperty,SP=(e,t)=>xP(e,`name`,{value:t,configurable:!0}),CP=`dismissableLayer.update`,wP=`dismissableLayer.pointerDownOutside`,TP=`dismissableLayer.focusOutside`,EP,DP=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),OP=v.forwardRef(SP(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=v.useContext(DP),[d,f]=v.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=v.useState({}),h=ON(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=_?g.indexOf(_):-1,b=d?g.indexOf(d):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=y,C=v.useRef(!1),w=jP(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:v.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return S&&!t},[u.branches,S])}),T=MP(e=>{if(r&&C.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),E=d?b===g.length-1:!1,D=bP(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return v.useEffect(()=>{if(E)return p.addEventListener(`keydown`,D,{capture:!0}),()=>p.removeEventListener(`keydown`,D,{capture:!0})},[p,E,D]),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(EP=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),NP(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=EP))}},[d,p,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),NP())},[d,u]),v.useEffect(()=>{let e=SP(()=>m({}),`handleUpdate`);return document.addEventListener(CP,e),()=>document.removeEventListener(CP,e)},[]),(0,M.jsx)(gP.div,{...l,ref:h,style:{pointerEvents:x?S?`auto`:`none`:void 0,...e.style},onFocusCapture:yN(e.onFocusCapture,T.onFocusCapture),onBlurCapture:yN(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:yN(e.onPointerDownCapture,w.onPointerDownCapture)})},`DismissableLayer`));function kP(){let e=v.useContext(DP),[t,n]=v.useState(null);return v.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}SP(kP,`useDismissableLayerSurface`);var AP=SP(()=>!0,`IS_TRUE`);function jP(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=AP}=t,s=bP(e),c=v.useRef(!1),l=v.useRef(!1),u=v.useRef(new Map),d=v.useRef(()=>{});return v.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}SP(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}SP(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}SP(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}SP(p,`handleInteractionBubble`);let m=SP(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||PP(wP,s,p,{discrete:!0})};if(SP(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:SP(()=>c.current=!0,`onPointerDownCapture`)}}SP(jP,`usePointerDownOutside`);function MP(e,t=globalThis?.document){let n=bP(e),r=v.useRef(!1);return v.useEffect(()=>{let e=SP(e=>{e.target&&!r.current&&PP(TP,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:SP(()=>r.current=!0,`onFocusCapture`),onBlurCapture:SP(()=>r.current=!1,`onBlurCapture`)}}SP(MP,`useFocusOutside`);function NP(){let e=new CustomEvent(CP);document.dispatchEvent(e)}SP(NP,`dispatchUpdate`);function PP(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?_P(i,a):i.dispatchEvent(a)}SP(PP,`handleAndDispatchCustomEvent`);var FP=Object.defineProperty,IP=(e,t)=>FP(e,`name`,{value:t,configurable:!0}),LP=`focusScope.autoFocusOnMount`,RP=`focusScope.autoFocusOnUnmount`,zP={bubbles:!1,cancelable:!0},BP=v.forwardRef(IP(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=v.useState(null),l=bP(i),u=bP(a),d=v.useRef(null),f=ON(t,c),p=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:qP(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||qP(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&qP(s)};IP(e,`handleFocusIn`),IP(t,`handleFocusOut`),IP(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),v.useEffect(()=>{if(s){JP.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(LP,zP);s.addEventListener(LP,l),s.dispatchEvent(t),t.defaultPrevented||(VP(ZP(UP(s)),{select:!0}),document.activeElement===e&&qP(s))}return()=>{s.removeEventListener(LP,l),setTimeout(()=>{let t=new CustomEvent(RP,zP);s.addEventListener(RP,u),s.dispatchEvent(t),t.defaultPrevented||qP(e??document.body,{select:!0}),s.removeEventListener(RP,u),JP.remove(p)},0)}}},[s,l,u,p]);let m=v.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=HP(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&qP(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&qP(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,M.jsx)(gP.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function VP(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(qP(r,{select:t}),document.activeElement!==n)return}IP(VP,`focusFirst`);function HP(e){let t=UP(e);return[WP(t,e),WP(t.reverse(),e)]}IP(HP,`getTabbableEdges`);function UP(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:IP(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}IP(UP,`getTabbableCandidates`);function WP(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):GP(r,{upTo:t})))return r}IP(WP,`findVisible`);function GP(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}IP(GP,`isHidden`);function KP(e){return e instanceof HTMLInputElement&&`select`in e}IP(KP,`isSelectableInput`);function qP(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&KP(e)&&t&&e.select()}}IP(qP,`focus`);var JP=YP();function YP(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=XP(e,t),e.unshift(t)},remove(t){e=XP(e,t),e[0]?.resume()}}}IP(YP,`createFocusScopesStack`);function XP(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}IP(XP,`arrayRemove`);function ZP(e){return e.filter(e=>e.tagName!==`A`)}IP(ZP,`removeLinks`);var QP=Object.defineProperty,$P=v.forwardRef(((e,t)=>QP(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=v.useState(!1);PN(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?y.createPortal((0,M.jsx)(gP.div,{...r,ref:t}),o):null},`Portal`)),eF=Object.defineProperty,tF=(e,t)=>eF(e,`name`,{value:t,configurable:!0});function nF(e,t){return v.useReducer((e,n)=>t[e][n]??e,e)}tF(nF,`useStateMachine`);var rF=tF(e=>{let{present:t,children:n}=e,r=iF(t),i=typeof n==`function`?n({present:r.isPresent}):v.Children.only(n),a=oF(r.ref,cF(i));return typeof n==`function`||r.isPresent?v.cloneElement(i,{ref:a}):null},`Presence`);function iF(e){let[t,n]=v.useState(),r=v.useRef(null),i=v.useRef(e),a=v.useRef(`none`),o=v.useRef(void 0),[s,c]=nF(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return v.useEffect(()=>{s===`mounted`?(a.current=o.current??sF(r.current),o.current=void 0):a.current=`none`},[s]),PN(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=sF(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),PN(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=tF(a=>{let o=sF(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=tF(e=>{e.target===t&&(a.current=sF(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:v.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=sF(t)}else r.current=null;n(e)},[])}}tF(iF,`usePresence`);function aF(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}tF(aF,`setRef`);function oF(...e){let t=v.useRef(e);return t.current=e,v.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=aF(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():aF(n[e],null)}}},[])}tF(oF,`useStableComposedRefs`);function sF(e){return e?.animationName||`none`}tF(sF,`getAnimationName`);function cF(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}tF(cF,`getElementRef`);var lF=Object.defineProperty,uF=(e,t)=>lF(e,`name`,{value:t,configurable:!0}),dF=0,fF=null;function pF(e){return mF(),e.children}uF(pF,`FocusGuards`);function mF(){v.useEffect(()=>{fF||={start:hF(),end:hF()};let{start:e,end:t}=fF;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),dF++,()=>{dF===1&&(fF?.start.remove(),fF?.end.remove(),fF=null),dF=Math.max(0,dF-1)}},[])}uF(mF,`useFocusGuards`);function hF(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}uF(hF,`createFocusGuard`);var gF=function(){return gF=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},gF.apply(this,arguments)};function _F(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function vF(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var yF=`right-scroll-bar-position`,bF=`width-before-scroll-bar`,xF=`with-scroll-bars-hidden`,SF=`--removed-body-scroll-bar-size`;function CF(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function wF(e,t){var n=(0,v.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var TF=typeof window<`u`?v.useLayoutEffect:v.useEffect,EF=new WeakMap;function DF(e,t){var n=wF(t||null,function(t){return e.forEach(function(e){return CF(e,t)})});return TF(function(){var t=EF.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||CF(e,null)}),i.forEach(function(e){r.has(e)||CF(e,a)})}EF.set(n,e)},[e]),n}function OF(e){return e}function kF(e,t){t===void 0&&(t=OF);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function AF(e){e===void 0&&(e={});var t=kF(null);return t.options=gF({async:!0,ssr:!1},e),t}var jF=function(e){var t=e.sideCar,n=_F(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return v.createElement(r,gF({},n))};jF.isSideCarExport=!0;function MF(e,t){return e.useMedium(t),jF}var NF=AF(),PF=function(){},FF=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:PF,onWheelCapture:PF,onTouchMoveCapture:PF}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,y=_===void 0?`div`:_,b=e.gapMode,x=_F(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=f,C=DF([n,t]),w=gF(gF({},x),i);return v.createElement(v.Fragment,null,u&&v.createElement(S,{sideCar:NF,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:b}),o?v.cloneElement(v.Children.only(s),gF(gF({},w),{ref:C})):v.createElement(y,gF({},w,{className:c,ref:C}),s))});FF.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},FF.classNames={fullWidth:bF,zeroRight:yF};var IF=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function LF(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=IF();return t&&e.setAttribute(`nonce`,t),e}function RF(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function zF(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var BF=function(){var e=0,t=null;return{add:function(n){e==0&&(t=LF())&&(RF(t,n),zF(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},VF=function(){var e=BF();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},HF=function(){var e=VF();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},UF={left:0,top:0,right:0,gap:0},WF=function(e){return parseInt(e||``,10)||0},GF=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[WF(n),WF(r),WF(i)]},KF=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return UF;var t=GF(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},qF=HF(),JF=`data-scroll-locked`,YF=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
19
+ .${xF} {
20
20
  overflow: hidden ${r};
21
21
  padding-right: ${s}px ${r};
22
22
  }
23
- body[${EF}] {
23
+ body[${JF}] {
24
24
  overflow: hidden ${r};
25
25
  overscroll-behavior: contain;
26
26
  ${[t&&`position: relative ${r};`,n===`margin`&&`
@@ -33,31 +33,31 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
33
33
  `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
34
34
  }
35
35
 
36
- .${ZP} {
36
+ .${yF} {
37
37
  right: ${s}px ${r};
38
38
  }
39
39
 
40
- .${QP} {
40
+ .${bF} {
41
41
  margin-right: ${s}px ${r};
42
42
  }
43
43
 
44
- .${ZP} .${ZP} {
44
+ .${yF} .${yF} {
45
45
  right: 0 ${r};
46
46
  }
47
47
 
48
- .${QP} .${QP} {
48
+ .${bF} .${bF} {
49
49
  margin-right: 0 ${r};
50
50
  }
51
51
 
52
- body[${EF}] {
53
- ${eF}: ${s}px;
52
+ body[${JF}] {
53
+ ${SF}: ${s}px;
54
54
  }
55
- `},OF=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},kF=function(){v.useEffect(function(){return document.body.setAttribute(EF,(OF()+1).toString()),function(){var e=OF()-1;e<=0?document.body.removeAttribute(EF):document.body.setAttribute(EF,e.toString())}},[])},AF=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;kF();var a=v.useMemo(function(){return wF(i)},[i]);return v.createElement(TF,{styles:DF(a,!t,i,n?``:`!important`)})},jF=!1;if(typeof window<`u`)try{var MF=Object.defineProperty({},"passive",{get:function(){return jF=!0,!0}});window.addEventListener(`test`,MF,MF),window.removeEventListener(`test`,MF,MF)}catch{jF=!1}var NF=jF?{passive:!1}:!1,PF=function(e){return e.tagName===`TEXTAREA`},FF=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!PF(e)&&n[t]===`visible`)},IF=function(e){return FF(e,`overflowY`)},LF=function(e){return FF(e,`overflowX`)},RF=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),VF(e,r)){var i=HF(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},zF=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},BF=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},VF=function(e,t){return e===`v`?IF(t):LF(t)},HF=function(e,t){return e===`v`?zF(t):BF(t)},UF=function(e,t){return e===`h`&&t===`rtl`?-1:1},WF=function(e,t,n,r,i){var a=UF(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=HF(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&VF(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},GF=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},KF=function(e){return[e.deltaX,e.deltaY]},qF=function(e){return e&&`current`in e?e.current:e},JF=function(e,t){return e[0]===t[0]&&e[1]===t[1]},YF=function(e){return`
55
+ `},XF=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},ZF=function(){v.useEffect(function(){return document.body.setAttribute(JF,(XF()+1).toString()),function(){var e=XF()-1;e<=0?document.body.removeAttribute(JF):document.body.setAttribute(JF,e.toString())}},[])},QF=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;ZF();var a=v.useMemo(function(){return KF(i)},[i]);return v.createElement(qF,{styles:YF(a,!t,i,n?``:`!important`)})},$F=!1;if(typeof window<`u`)try{var eI=Object.defineProperty({},"passive",{get:function(){return $F=!0,!0}});window.addEventListener(`test`,eI,eI),window.removeEventListener(`test`,eI,eI)}catch{$F=!1}var tI=$F?{passive:!1}:!1,nI=function(e){return e.tagName===`TEXTAREA`},rI=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!nI(e)&&n[t]===`visible`)},iI=function(e){return rI(e,`overflowY`)},aI=function(e){return rI(e,`overflowX`)},oI=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),lI(e,r)){var i=uI(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},sI=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},cI=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},lI=function(e,t){return e===`v`?iI(t):aI(t)},uI=function(e,t){return e===`v`?sI(t):cI(t)},dI=function(e,t){return e===`h`&&t===`rtl`?-1:1},fI=function(e,t,n,r,i){var a=dI(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=uI(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&lI(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},pI=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},mI=function(e){return[e.deltaX,e.deltaY]},hI=function(e){return e&&`current`in e?e.current:e},gI=function(e,t){return e[0]===t[0]&&e[1]===t[1]},_I=function(e){return`
56
56
  .block-interactivity-${e} {pointer-events: none;}
57
57
  .allow-interactivity-${e} {pointer-events: all;}
58
- `},XF=0,ZF=[];function QF(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(XF++)[0],a=v.useState(bF)[0],o=v.useRef(e);v.useEffect(function(){o.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=XP([e.lockRef.current],(e.shards||[]).map(qF),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=v.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=GF(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=RF(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=RF(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return WF(h,t,e,h===`h`?s:c,!0)},[]),c=v.useCallback(function(e){var n=e;if(ZF.length&&ZF[ZF.length-1]===a){var r=`deltaY`in n?KF(n):GF(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&JF(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(qF).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=v.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:$F(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=v.useCallback(function(e){n.current=GF(e),r.current=void 0},[]),d=v.useCallback(function(t){l(t.type,KF(t),t.target,s(t,e.lockRef.current))},[]),f=v.useCallback(function(t){l(t.type,GF(t),t.target,s(t,e.lockRef.current))},[]);v.useEffect(function(){return ZF.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,NF),document.addEventListener(`touchmove`,c,NF),document.addEventListener(`touchstart`,u,NF),function(){ZF=ZF.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,NF),document.removeEventListener(`touchmove`,c,NF),document.removeEventListener(`touchstart`,u,NF)}},[]);var p=e.removeScrollBar,m=e.inert;return v.createElement(v.Fragment,null,m?v.createElement(a,{styles:YF(i)}):null,p?v.createElement(AF,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function $F(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var eI=uF(dF,QF),tI=v.forwardRef(function(e,t){return v.createElement(pF,JP({},e,{ref:t,sideCar:eI}))});tI.classNames=pF.classNames;var nI=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},rI=new WeakMap,iI=new WeakMap,aI={},oI=0,sI=function(e){return e&&(e.host||sI(e.parentNode))},cI=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=sI(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},lI=function(e,t,n,r){var i=cI(t,Array.isArray(e)?e:[e]);aI[n]||(aI[n]=new WeakMap);var a=aI[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(rI.get(e)||0)+1,l=(a.get(e)||0)+1;rI.set(e,c),a.set(e,l),o.push(e),c===1&&i&&iI.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),oI++,function(){o.forEach(function(e){var t=rI.get(e)-1,i=a.get(e)-1;rI.set(e,t),a.set(e,i),t||(iI.has(e)||e.removeAttribute(r),iI.delete(e)),i||e.removeAttribute(n)}),oI--,oI||(rI=new WeakMap,rI=new WeakMap,iI=new WeakMap,aI={})}},uI=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||nI(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),lI(r,i,n,`aria-hidden`)):function(){return null}},dI=Object.defineProperty,fI=(e,t)=>dI(e,`name`,{value:t,configurable:!0}),pI=`Dialog`,[mI,hI]=uN(pI),[gI,_I]=mI(pI),vI=fI(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=v.useRef(null),c=v.useRef(null),[l,u]=EN({prop:r,defaultProp:i??!1,onChange:a,caller:pI}),[d,f]=v.useState(0),[p,m]=v.useState(0);return(0,M.jsx)(gI,{scope:t,triggerRef:s,contentRef:c,contentId:_N(),titleId:_N(),descriptionId:_N(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:v.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),yI=`DialogPortal`,[bI,xI]=mI(yI,{forceMount:void 0}),SI=fI(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=_I(yI,t);return(0,M.jsx)(bI,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,M.jsx)(FP,{present:n||a.open,children:(0,M.jsx)(jP,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),CI=`DialogOverlay`,wI=v.forwardRef(fI(function(e,t){let n=xI(CI,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=_I(CI,e.__scopeDialog);return a.modal?(0,M.jsx)(FP,{present:r||a.open,children:(0,M.jsx)(EI,{...i,ref:t})}):null},`DialogOverlay`)),TI=NN(`DialogOverlay.RemoveScroll`),EI=v.forwardRef(fI(function(e,t){let{__scopeDialog:n,...r}=e,i=_I(CI,n),a=oN(t,sP());return(0,M.jsx)(tI,{as:TI,allowPinchZoom:!0,shards:[i.contentRef],children:(0,M.jsx)(JN.div,{"data-state":II(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),DI=`DialogContent`,OI=v.forwardRef(fI(function(e,t){let n=xI(DI,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=_I(DI,e.__scopeDialog);return(0,M.jsx)(FP,{present:r||a.open,children:a.modal?(0,M.jsx)(kI,{...i,ref:t}):(0,M.jsx)(AI,{...i,ref:t})})},`DialogContent`)),kI=v.forwardRef(fI(function(e,t){let n=_I(DI,e.__scopeDialog),r=v.useRef(null),i=oN(t,n.contentRef,r);return v.useEffect(()=>{let e=r.current;if(e)return uI(e)},[]),(0,M.jsx)(jI,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:ZM(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:ZM(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:ZM(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),AI=v.forwardRef(fI(function(e,t){let n=_I(DI,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,M.jsx)(jI,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),jI=v.forwardRef(fI(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=_I(DI,n);return KP(),(0,M.jsx)(M.Fragment,{children:(0,M.jsx)(vP,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,M.jsx)(oP,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":II(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),MI=`DialogTitle`,NI=v.forwardRef(fI(function(e,t){let{__scopeDialog:n,...r}=e,i=_I(MI,n),{setTitleCount:a}=i;return fN(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,M.jsx)(JN.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),PI=`DialogClose`,FI=v.forwardRef(fI(function(e,t){let{__scopeDialog:n,...r}=e,i=_I(PI,n);return(0,M.jsx)(JN.button,{type:`button`,...r,ref:t,onClick:ZM(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function II(e){return e?`open`:`closed`}fI(II,`getState`);var LI=(0,v.createContext)(!1);function RI({locked:e,children:t}){return(0,M.jsx)(LI.Provider,{value:e,children:t})}function zI(){return(0,v.useContext)(LI)}function BI(){let e=Ar(),[t,n]=(0,v.useState)(`idle`),r=(0,v.useRef)(!0),i=(0,v.useRef)(0),a=(0,v.useRef)(!1),o=(0,v.useRef)(void 0),s=(0,v.useRef)(void 0),c=(0,v.useRef)([]),l=(0,v.useRef)([]),u=t!==`idle`,d=(0,v.useCallback)(({nextLocation:e})=>{let t=o.current;if(!u||t===void 0||!t.active||t.signal.aborted||!r.current)return!1;let n={sequence:++i.current,source:a.current?`fallback`:`user`,location:e};t.latestIntent=n;let s=c.current.filter(e=>e.session===t&&e.intent.sequence<n.sequence);c.current=c.current.filter(e=>e.session!==t||e.intent.sequence>=n.sequence);for(let e of s)e.resolve(void 0);return!0},[u]),f=Yr(d),p=(0,v.useRef)(f);p.current=f;let m=(0,v.useCallback)(e=>{if(!r.current||!e.active)throw Error(`View refresh navigation lock owner is no longer active.`);if(e.signal.aborted)throw e.signal.reason},[]),h=(0,v.useCallback)((e,t)=>{m(e);let n=p.current;return VI(n,t)?Promise.resolve(n):new Promise((n,r)=>{c.current.push({session:e,intent:t,resolve:n,reject:r})})},[m]),g=(0,v.useCallback)(e=>(m(e),p.current.state===`unblocked`?Promise.resolve():new Promise((t,n)=>l.current.push({session:e,resolve:t,reject:n}))),[m]),_=(0,v.useCallback)((e,t)=>{if(!e.active)return;e.active=!1,e.removeAbortListener(),o.current===e&&(o.current=void 0);let n=s.current;n?.session===e&&(s.current=void 0,n.reject(t));let r=c.current.filter(t=>t.session===e);c.current=c.current.filter(t=>t.session!==e);for(let e of r)e.reject(t);let i=l.current.filter(t=>t.session===e);l.current=l.current.filter(t=>t.session!==e);for(let e of i)e.reject(t)},[]),y=(0,v.useCallback)(e=>{if(e.aborted)return Promise.reject(e.reason);if(!r.current||s.current!==void 0||o.current!==void 0||t!==`idle`)return Promise.reject(Error(`A View refresh navigation lock is already active.`));let i,a=()=>_(i,e.reason);return i={signal:e,active:!0,removeAbortListener:()=>e.removeEventListener(`abort`,a)},o.current=i,e.addEventListener(`abort`,a,{once:!0}),n(`locked`),new Promise((e,t)=>{s.current={session:i,resolve:e,reject:t}})},[_,t]),b=(0,v.useRef)(void 0);return b.current===void 0&&(b.current={hasUserIntent:()=>o.current?.latestIntent?.source===`user`,enqueueFallback:async t=>{let n=o.current;if(n===void 0)throw Error(`View refresh navigation lock is not active.`);if(m(n),n.latestIntent?.source!==`user`){a.current=!0;try{await e(t,{replace:!0,state:null})}finally{a.current=!1}if(n.latestIntent===void 0)throw Error(`View refresh fallback navigation was not blocked.`);m(n)}},release:async()=>{let e=o.current;if(e===void 0)throw Error(`View refresh navigation lock is not active.`);return e.release===void 0&&(e.release=(async()=>{m(e);let t;for(;e.latestIntent!==void 0;){let n=e.latestIntent,r=await h(e,n);if(m(e),e.latestIntent?.sequence!==n.sequence)continue;let i=p.current;if(r!==void 0&&VI(i,n)&&i===r){t=n.source,i.proceed();break}}return m(e),await g(e),m(e),n(`idle`),e.active=!1,e.removeAbortListener(),o.current===e&&(o.current=void 0),t})()),e.release},recover:()=>{let e=o.current;if(e===void 0)throw Error(`View refresh navigation lock is not active.`);m(e),n(`recovery`)}}),(0,v.useEffect)(()=>{if(t!==`locked`||s.current===void 0)return;let e=s.current;m(e.session),s.current=void 0,e.resolve(b.current)},[t,m,d]),(0,v.useEffect)(()=>{if(f.state!==`blocked`)return;let e=c.current.filter(e=>VI(f,e.intent));c.current=c.current.filter(e=>!VI(f,e.intent));for(let t of e)try{m(t.session),t.resolve(f)}catch(e){t.reject(e)}},[f,m]),(0,v.useEffect)(()=>{if(f.state!==`unblocked`)return;let e=l.current.splice(0);for(let t of e)try{m(t.session),t.resolve()}catch(e){t.reject(e)}},[f,m]),(0,v.useEffect)(()=>(r.current=!0,()=>{r.current=!1;let e=o.current;e!==void 0&&_(e,Error(`View refresh navigation lock owner was unmounted.`))}),[_]),{acquire:y,interactionLocked:u,recoveryRequired:t===`recovery`}}function VI(e,t){return e.state===`blocked`&&e.location===t.location&&HI(e.location,t.location)}function HI(e,t){return e.key===t.key&&e.pathname===t.pathname&&e.search===t.search&&e.hash===t.hash}function UI({title:e,children:t,onClose:n}){let{t:r}=Fo(),i=zI();return(0,M.jsx)(vI,{open:!0,onOpenChange:e=>{e||n()},children:(0,M.jsxs)(SI,{children:[(0,M.jsx)(wI,{className:`niceeval-view-dialog-overlay`,inert:i?!0:void 0}),(0,M.jsxs)(OI,{className:`niceeval-view-dialog`,inert:i?!0:void 0,onEscapeKeyDown:e=>{i&&e.preventDefault()},onPointerDownOutside:e=>{i&&e.preventDefault()},children:[(0,M.jsxs)(`div`,{className:`niceeval-view-dialog-head`,children:[(0,M.jsx)(NI,{className:`niceeval-view-dialog-title`,children:e}),(0,M.jsx)(FI,{disabled:i,className:`niceeval-view-dialog-close`,"aria-label":r(`report.close`),children:`×`})]}),(0,M.jsx)(`div`,{className:`niceeval-view-dialog-body niceeval-view-report-slot`,children:t})]})]})})}function WI(e,t){return typeof e==`string`?e:e[t]??e.en??Object.values(e).find(e=>typeof e==`string`)??``}function GI(...e){return e.filter(Boolean).join(` `)}function KI(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function qI(e){return typeof e==`string`||KI(e)&&Object.values(e).every(e=>typeof e==`string`)}function JI(e,t,n,r){return Error(`<${e}> received invalid ${n} from ${t}: ${r}.`)}function YI(e){return e.replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g,``)}function XI(e){let t=/^turn[-_ ]?(\d+)$/i.exec(e);return t===null?e:`Turn ${t[1]}`}function ZI(e){if(e<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function QI(e,t=`en`){return new Intl.NumberFormat(t===`zh-CN`?`zh-CN`:`en-US`,{maximumFractionDigits:12,maximumSignificantDigits:12}).format(e)}function $I(e,t=`en`){return`${QI(e,t)} ${e===1?`pt`:`pts`}`}function eL(e,t){let n=new Date(e);return Number.isNaN(n.valueOf())?e:n.toLocaleString(t===`zh-CN`?`zh-CN`:`en-US`)}function tL(e){let t=Math.abs(e);if(t!==0&&t<1e-9)return`$${e.toExponential(4)}`;let n=t===0||t>=1?6:Math.min(12,Math.max(2,Math.ceil(-Math.log10(t))+5));return`$${e.toFixed(n).replace(/(?:\.0+|(?:(\.[0-9]*?)0+))$/,`$1`)}`}var nL={error:3,warning:2,info:1};function rL(e){return e.length===0||aL(e)===0}function iL(e){let t=[];for(let n of e){let e=n.groups;if(n.items.length===0&&e?.length===1){t.push(e[0]);continue}t.push(n)}return t}function aL(e){let t=0,n=e=>{for(let r of e)t+=r.items.length,r.groups&&n(r.groups)};return n(e),t}function oL(e){let t=`info`,n=e=>{for(let r of e){for(let e of r.items)nL[e.level]>nL[t]&&(t=e.level);r.groups&&n(r.groups)}};return n(e),t}function sL(e){return[...new Set(e.map(e=>e.command).filter(e=>e!==void 0))]}function cL(e){let t=sL(e.items);return t.length>1?null:t.length===1?t[0]:e.command??null}function lL(e,t){return t===`zh-CN`?e===`error`?`错误`:e===`warning`?`警告`:`提示`:e===`error`?`errors`:e===`warning`?`warnings`:`notices`}function uL(e,t){let n=iL(e),r=aL(e),i=lL(oL(e),t);if(n.length===1){let e=WI(n[0].title,t);return t===`zh-CN`?`${e} · ${r} 条${i}`:`${e} · ${r} ${i}`}return t===`zh-CN`?`${n.length} 组 · ${r} 条${i}`:`${n.length} groups · ${r} ${i}`}function dL(e,t){return e===`zh-CN`?`${t} 条明细`:t===1?`1 detail`:`${t} details`}function fL(e,t){let n=WI(e.message,t),r=e.count??1;return r<=1?n:`${n} ×${r}`}function pL({text:e,className:t,children:n}){let[r,i]=(0,v.useState)(!1),a=async()=>{try{if(navigator.clipboard===void 0)throw Error(`Clipboard API unavailable`);await navigator.clipboard.writeText(e),i(!0),window.setTimeout(()=>i(!1),1500)}catch{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.append(t),t.select();let n=document.execCommand(`copy`);t.remove(),n&&(i(!0),window.setTimeout(()=>i(!1),1500))}};return(0,M.jsxs)(`button`,{type:`button`,className:t,onClick:()=>void a(),children:[n,r?` ✓`:``]})}function mL(...e){return e.filter(Boolean).join(` `)}function hL(e,t){return KI(e)?e.level!==`error`&&e.level!==`warning`&&e.level!==`info`?`"${t}.level" must be error | warning | info`:qI(e.message)?null:`"${t}.message" must be a LocalizedText`:`"${t}" must be an object`}function gL(e,t){if(!KI(e))return`"${t}" must be an object`;if(!qI(e.title))return`"${t}.title" must be a LocalizedText`;if(!Array.isArray(e.items))return`"${t}.items" must be an array`;for(let n=0;n<e.items.length;n++){let r=hL(e.items[n],`${t}.items[${n}]`);if(r!==null)return r}return null}function _L(e){if(!Array.isArray(e))throw JI(`Callouts`,`toSampleNotices`,`CalloutGroup[]`,`"items" must be an array`);for(let t=0;t<e.length;t++){let n=gL(e[t],`items[${t}]`);if(n!==null)throw JI(`Callouts`,`toSampleNotices`,`CalloutGroup[]`,n)}return e}function vL({command:e}){return(0,M.jsx)(pL,{className:`niceeval-callout-command`,text:e,children:(0,M.jsx)(`code`,{children:e})})}function yL({group:e,locale:t,detailsOpen:n}){let r=cL(e),i=e.groups;return(0,M.jsxs)(`li`,{className:`niceeval-callout-group`,children:[(0,M.jsxs)(`div`,{className:mL(`niceeval-callout-head`,`niceeval-callout-head--${oL([e])}`),children:[(0,M.jsx)(`span`,{className:`niceeval-callout-title`,children:WI(e.title,t)}),e.badges?.map((e,n)=>(0,M.jsx)(`span`,{className:`niceeval-callout-badge`,children:WI(e,t)},n)),r===null?null:(0,M.jsx)(vL,{command:r})]}),e.items.length>0?(0,M.jsxs)(`details`,{className:`niceeval-callout-details`,open:n||void 0,children:[(0,M.jsx)(`summary`,{children:dL(t,e.items.length)}),(0,M.jsx)(`ul`,{className:`niceeval-callout-items`,children:e.items.map((e,n)=>(0,M.jsxs)(`li`,{className:mL(`niceeval-callout-item`,`niceeval-callout-item--${e.level}`),children:[(0,M.jsx)(`span`,{className:`niceeval-callout-message`,children:fL(e,t)}),r===null&&e.command!==void 0?(0,M.jsx)(vL,{command:e.command}):null]},n))})]}):null,i&&i.length>0?(0,M.jsx)(`ul`,{className:`niceeval-callout-nested`,children:iL(i).map((e,r)=>(0,M.jsx)(yL,{group:e,locale:t,detailsOpen:n},r))}):null]})}function bL(e,t,n){if(rL(e))return null;let r=iL(e),i=aL(e)<=3,a=oL(e);return(0,M.jsx)(`div`,{className:mL(`niceeval-report`,`niceeval-callouts`,n),children:(0,M.jsxs)(`details`,{className:`niceeval-callouts-root`,children:[(0,M.jsx)(`summary`,{className:mL(`niceeval-callouts-summary`,`niceeval-callouts-summary--${a}`),children:uL(e,t)}),(0,M.jsx)(`ul`,{className:`niceeval-callout-groups`,children:r.map((e,n)=>(0,M.jsx)(yL,{group:e,locale:t,detailsOpen:i},n))})]})})}function xL({items:e,locale:t,className:n}){return bL(_L(e??[]),t,n)}function SL(...e){return e.filter(Boolean).join(` `)}function CL(e,t,n){return e===`zh-CN`?n:t}function wL(e){try{return JSON.parse(e)}catch{return}}function TL(e){return KI(e)?e:void 0}function EL(e,t){for(let n of t){let t=e[n];if(typeof t==`string`)return t}}function DL(e,t){for(let n of t){let t=e[n];if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)return t}}function OL(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>!t.has(e)))}function kL({children:e,tone:t}){return(0,M.jsx)(`pre`,{className:SL(`niceeval-tool-evidence-code`,t===`error`&&`niceeval-tool-evidence-code--error`),children:e})}function AL({label:e,children:t}){return(0,M.jsxs)(`section`,{className:`niceeval-tool-evidence-section`,children:[(0,M.jsx)(`h5`,{children:e}),t]})}function jL(e,t){let n=EL(e,[`command`,`cmd`,`script`]);if(n===void 0)return;let r=EL(e,[`cwd`,`workdir`]),i=OL(e,new Set([`command`,`cmd`,`script`,`cwd`,`workdir`]));return(0,M.jsxs)(`div`,{className:`niceeval-tool-evidence`,"data-tool-evidence-kind":`command`,children:[r===void 0?null:(0,M.jsxs)(`div`,{className:`niceeval-tool-evidence-context`,children:[(0,M.jsx)(`span`,{children:CL(t,`Working directory`,`工作目录`)}),(0,M.jsx)(`code`,{children:r})]}),(0,M.jsx)(AL,{label:CL(t,`Command`,`命令`),children:(0,M.jsx)(kL,{children:n})}),Object.keys(i).length===0?null:(0,M.jsx)(AL,{label:CL(t,`Additional input`,`其他输入`),children:(0,M.jsx)(kL,{children:JSON.stringify(i,null,2)})})]})}function ML(e,t){let n=EL(e,[`output`,`stdout`]),r=EL(e,[`stderr`]),i=DL(e,[`exit_code`,`exitCode`]),a=DL(e,[`signal`]);if(n===void 0&&r===void 0&&i===void 0&&a===void 0)return;let o=OL(e,new Set([`output`,`stdout`,`stderr`,`exit_code`,`exitCode`,`signal`]));return(0,M.jsxs)(`div`,{className:`niceeval-tool-evidence`,"data-tool-evidence-kind":`terminal`,children:[(0,M.jsxs)(`div`,{className:`niceeval-tool-evidence-context`,children:[i===void 0?null:(0,M.jsxs)(`span`,{children:[CL(t,`Exit`,`退出码`),` `,(0,M.jsx)(`strong`,{"data-failed":Number(i)!==0||void 0,children:String(i)})]}),a===void 0?null:(0,M.jsxs)(`span`,{children:[CL(t,`Signal`,`信号`),` `,(0,M.jsx)(`strong`,{children:String(a)})]})]}),n===void 0?null:(0,M.jsx)(AL,{label:CL(t,`Output`,`输出`),children:(0,M.jsx)(kL,{children:n||CL(t,`No output`,`无输出`)})}),r===void 0||r===``?null:(0,M.jsx)(AL,{label:`stderr`,children:(0,M.jsx)(kL,{tone:`error`,children:r})}),Object.keys(o).length===0?null:(0,M.jsx)(AL,{label:CL(t,`Additional result`,`其他结果`),children:(0,M.jsx)(kL,{children:JSON.stringify(o,null,2)})})]})}function NL(e,t){let n=e.phase===`finished`?e.outputSummary??``:e.inputSummary,r=wL(n),i=TL(r),a=i===void 0?void 0:e.phase===`started`?jL(i,t):ML(i,t);if(a!==void 0)return a;let o=r===void 0?n:typeof r==`string`?r:JSON.stringify(r,null,2);return(0,M.jsx)(`div`,{className:`niceeval-tool-evidence`,"data-tool-evidence-kind":r===void 0?`text`:`json`,children:(0,M.jsx)(AL,{label:r===void 0?CL(t,`Text`,`文本`):`JSON`,children:(0,M.jsx)(kL,{tone:e.outcome===`failed`||e.outcome===`rejected`?`error`:void 0,children:o})})})}function PL({content:e,locale:t}){return NL(e,t)}function FL(...e){return e.filter(Boolean).join(` `)}function IL(e,t){return e.kind===`tool-evidence`?(0,M.jsx)(PL,{content:e.content,locale:t}):e.kind===`text`?(0,M.jsx)(`div`,{className:FL(`niceeval-report`,`niceeval-text`,e.className),children:e.text}):e.items.map((e,n)=>(0,M.jsx)(v.Fragment,{children:IL(e,t)},n))}function LL(e,t,n=140){let r=YI(WI(e,t)).replace(/\s+/g,` `).trim();return r.length>n?`${r.slice(0,n)}…`:r}function RL(e){let t=e.classification===`succeeded`?`COMMAND`:e.classification===`failed`?`FAILED COMMAND`:`NON-ZERO COMMAND · observed`,n=e.exitCode===void 0?typeof e.outcome==`string`?e.outcome:JSON.stringify(e.outcome):`exit ${e.exitCode}`;return`${t} · ${e.phase} · ${n}${e.durationMs===void 0?``:` · ${e.durationMs}ms`}`}function zL({command:e}){return(0,M.jsxs)(`article`,{className:FL(`niceeval-command-evidence-card`,`niceeval-command-evidence--${e.classification}`),children:[(0,M.jsx)(`header`,{className:`niceeval-conversation-turn-head`,children:(0,M.jsx)(`span`,{className:`niceeval-conversation-turn-label`,children:RL(e)})}),(0,M.jsx)(`div`,{className:`niceeval-command-evidence-display`,children:e.display}),e.stdout?(0,M.jsxs)(`details`,{className:`niceeval-conversation-entry niceeval-conversation-entry--expandable`,children:[(0,M.jsx)(`summary`,{className:`niceeval-conversation-entry-summary`,children:`stdout`}),(0,M.jsx)(`pre`,{className:`niceeval-conversation-io`,children:e.stdout})]}):null,e.stderr?(0,M.jsxs)(`details`,{className:`niceeval-conversation-entry niceeval-conversation-entry--expandable`,open:!0,children:[(0,M.jsx)(`summary`,{className:`niceeval-conversation-entry-summary`,children:`stderr`}),(0,M.jsx)(`pre`,{className:`niceeval-conversation-io`,children:e.stderr})]}):null]})}function BL(e){if(e==null)return null;if(!KI(e)||!Array.isArray(e.commands))throw JI(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands" must be an array`);for(let[t,n]of e.commands.entries()){if(!KI(n))throw JI(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}]" must be an object`);if(typeof n.commandId!=`string`)throw JI(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}].commandId" must be a string`);if(typeof n.phase!=`string`)throw JI(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}].phase" must be a string`);if(typeof n.display!=`string`)throw JI(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}].display" must be a string`);if(n.exitCode!==void 0&&typeof n.exitCode!=`number`)throw JI(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}].exitCode" must be a number`);if(n.outcome===void 0)throw JI(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}].outcome" must be present`);if(n.classification!==`succeeded`&&n.classification!==`observed`&&n.classification!==`failed`)throw JI(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}].classification" must be succeeded | observed | failed`);if(n.durationMs!==void 0&&typeof n.durationMs!=`number`)throw JI(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}].durationMs" must be a number`);if(n.stdout!==void 0&&typeof n.stdout!=`string`)throw JI(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}].stdout" must be a string`);if(n.stderr!==void 0&&typeof n.stderr!=`string`)throw JI(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}].stderr" must be a string`)}return e}function VL({data:e,className:t,locale:n}){let r=BL(e);return r===null||r.commands.length===0?null:(0,M.jsx)(`section`,{className:FL(`niceeval-report`,`niceeval-command-evidence`,t),children:(0,M.jsxs)(`details`,{className:`niceeval-command-evidence-region`,children:[(0,M.jsx)(`summary`,{className:`niceeval-command-evidence-summary`,children:WI({en:`Commands · ${r.commands.length}`,"zh-CN":`命令证据 · ${r.commands.length}`},n)}),(0,M.jsx)(`div`,{className:`niceeval-command-evidence-cards`,children:r.commands.map(e=>(0,M.jsx)(zL,{command:e},e.commandId))})]})})}function HL(e){return e===`added`?`A`:e===`deleted`?`D`:`M`}function UL(e){return e===`binary`?`binary`:`oversized text`}function WL(e){return[...e].sort((e,t)=>e.path.localeCompare(t.path))}var GL=new TextEncoder;function KL(e){let t=0;for(let n of e.windows)n.patch!==void 0&&(t+=GL.encode(n.patch).length);return t}function qL(e){let t=new Set,n=0;for(let r of WL(e)){if(r.elided)continue;let e=KL(r);e===0||e>65536||n+e>524288||(n+=e,t.add(r.path))}return t}function JL(e,t){return{name:e,path:t,dirs:new Map,files:[]}}function YL(e){let t=JL(``,``);for(let n of WL(e)){let e=n.path.split(`/`),r=t;for(let t=0;t<e.length-1;t++){let n=e[t],i=r.path===``?n:`${r.path}/${n}`,a=r.dirs.get(n);a===void 0&&(a=JL(n,i),r.dirs.set(n,a)),r=a}r.files.push(n)}return XL(t)}function XL(e){let t=e;for(;t.files.length===0&&t.dirs.size===1&&t.path!==``;){let e=[...t.dirs.values()][0];t={name:`${t.name}/${e.name}`,path:e.path,dirs:e.dirs,files:e.files}}let n=[...t.dirs.values()].map(XL).sort((e,t)=>e.path.localeCompare(t.path)),r=t.files,i=r.length,a=0,o=0;for(let e of r)a+=e.added,o+=e.removed;for(let e of n)i+=e.fileCount,a+=e.added,o+=e.removed;return{name:t.name,path:t.path,dirs:n,files:r,fileCount:i,added:a,removed:o}}function ZL(e,t){if(!KI(e))return`"${t}" must be a DiffFile object`;if(typeof e.path!=`string`)return`"${t}.path" must be a string`;if(e.change!==`added`&&e.change!==`modified`&&e.change!==`deleted`)return`"${t}.change" must be added | modified | deleted`;if(typeof e.added!=`number`)return`"${t}.added" must be a number`;if(typeof e.removed!=`number`)return`"${t}.removed" must be a number`;if(!Array.isArray(e.windows))return`"${t}.windows" must be an array of DiffFileWindow`;for(let n=0;n<e.windows.length;n++){let r=e.windows[n];if(!KI(r)||typeof r.window!=`string`)return`"${t}.windows[${n}].window" must be a string`;if(r.patch!==void 0&&typeof r.patch!=`string`)return`"${t}.windows[${n}].patch" must be a string`}return null}function QL(e){if(e==null)return null;if(!Array.isArray(e))throw JI(`DiffView`,`diffViewFiles`,`DiffContent`,`"files" must be an array or null`);for(let t=0;t<e.length;t++){let n=ZL(e[t],`files[${t}]`);if(n!==null)throw JI(`DiffView`,`diffViewFiles`,`DiffContent`,n)}return e}function $L(e){let t=[],n=1,r=1;for(let i of e.split(`
59
- `)){if(i.startsWith(`@@`)){t.push({kind:`meta`,oldNo:null,newNo:null,text:i});let e=i.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);e&&(n=Number(e[1]),r=Number(e[2]));continue}if(i.startsWith(`+++`)||i.startsWith(`---`)){t.push({kind:`meta`,oldNo:null,newNo:null,text:i});continue}if(i.startsWith(`+`)){t.push({kind:`add`,oldNo:null,newNo:r,text:i.slice(1)}),r+=1;continue}if(i.startsWith(`-`)){t.push({kind:`remove`,oldNo:n,newNo:null,text:i.slice(1)}),n+=1;continue}let e=i.startsWith(` `)?i.slice(1):i;t.push({kind:`context`,oldNo:n,newNo:r,text:e}),n+=1,r+=1}return t}function eR({patch:e}){let t=$L(e);return(0,M.jsx)(`pre`,{className:`niceeval-diff-patch`,children:t.map((e,t)=>(0,M.jsxs)(`div`,{className:GI(`niceeval-diff-patch-line`,e.kind===`add`&&`niceeval-diff-patch-line--add`,e.kind===`remove`&&`niceeval-diff-patch-line--remove`,e.kind===`meta`&&`niceeval-diff-patch-line--meta`),children:[(0,M.jsx)(`span`,{className:`niceeval-diff-patch-ln niceeval-diff-patch-ln-old`,children:e.oldNo===null?``:e.oldNo}),(0,M.jsx)(`span`,{className:`niceeval-diff-patch-ln niceeval-diff-patch-ln-new`,children:e.newNo===null?``:e.newNo}),(0,M.jsx)(`span`,{className:`niceeval-diff-patch-text`,children:e.text})]},t))})}function tR({windows:e}){let t=e.filter(e=>e.patch!==void 0&&e.patch.length>0);return t.length===0?(0,M.jsx)(`p`,{className:`niceeval-diff-patch-missing`,children:`Patch unavailable for this file.`}):(0,M.jsx)(M.Fragment,{children:t.map(e=>(0,M.jsxs)(`section`,{className:`niceeval-diff-window`,children:[(0,M.jsxs)(`h4`,{className:`niceeval-diff-window-title`,children:[`window `,XI(e.window)]}),(0,M.jsx)(eR,{patch:e.patch})]},e.window))})}function nR(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function rR({added:e,removed:t}){return(0,M.jsxs)(`span`,{className:`niceeval-diff-lines`,children:[(0,M.jsxs)(`span`,{className:`niceeval-diff-lines-added`,children:[`+`,e]}),` / `,(0,M.jsxs)(`span`,{className:`niceeval-diff-lines-removed`,children:[`-`,t]})]})}function iR({file:e}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`niceeval-diff-change`,"data-change":e.change,children:HL(e.change)}),(0,M.jsx)(`span`,{className:`niceeval-diff-path`,children:nR(e.path)}),e.elided?(0,M.jsxs)(`span`,{className:`niceeval-diff-bytes`,children:[UL(e.elided.reason),` `,e.elided.beforeBytes??0,` → `,e.elided.afterBytes??0,` bytes`]}):(0,M.jsx)(rR,{added:e.added,removed:e.removed})]})}function aR({file:e,inlined:t,drillCommand:n}){let r=GI(`niceeval-diff-file`,`niceeval-diff-${e.change}`);if(!t){let t=e.elided;return(0,M.jsxs)(`li`,{className:r,"data-inlined":`false`,children:[(0,M.jsx)(`div`,{className:`niceeval-diff-file-summary`,children:(0,M.jsx)(iR,{file:e})}),(0,M.jsxs)(`p`,{className:`niceeval-diff-patch-omitted`,children:[t?`${UL(t.reason)} file · content elided from the diff export`:`patch over inline budget`,t===void 0&&n!==void 0?(0,M.jsxs)(M.Fragment,{children:[` · `,(0,M.jsx)(`code`,{children:`${n}=${e.path}`})]}):null]})]})}return(0,M.jsx)(`li`,{className:r,"data-inlined":`true`,children:(0,M.jsxs)(`details`,{children:[(0,M.jsx)(`summary`,{className:`niceeval-diff-file-summary`,children:(0,M.jsx)(iR,{file:e})}),(0,M.jsx)(tR,{windows:e.windows})]})})}function oR({node:e,inlined:t,drillCommand:n}){return(0,M.jsxs)(`ul`,{className:`niceeval-diff-tree`,children:[e.dirs.map(e=>(0,M.jsx)(`li`,{className:`niceeval-diff-dir`,children:(0,M.jsxs)(`details`,{open:!0,children:[(0,M.jsxs)(`summary`,{className:`niceeval-diff-dir-summary`,children:[(0,M.jsxs)(`span`,{className:`niceeval-diff-dir-name`,children:[e.name,`/`]}),(0,M.jsxs)(`span`,{className:`niceeval-diff-dir-count`,children:[e.fileCount,` `,e.fileCount===1?`file`:`files`]}),(0,M.jsx)(rR,{added:e.added,removed:e.removed})]}),(0,M.jsx)(oR,{node:e,inlined:t,drillCommand:n})]})},e.path)),e.files.map(e=>(0,M.jsx)(aR,{file:e,inlined:t.has(e.path),drillCommand:n},e.path))]})}function sR({files:e,className:t,drillCommand:n}){let r=QL(e);return r===null||r.length===0?null:(0,M.jsx)(`div`,{className:GI(`niceeval-report`,`niceeval-diff-view`,t),children:(0,M.jsx)(oR,{node:YL(r),inlined:qL(r),drillCommand:n})})}function X(e,t,n){return e===`zh-CN`?n:t}function cR(e,t){switch(e){case`requirement`:return X(t,`Requirement`,`目标`);case`observed`:return X(t,`Observed`,`结果`);case`examined`:return X(t,`Examined`,`检查范围`);case`coverage`:return X(t,`Source`,`记录完整度`)}}function lR(e,t){switch(e){case`matched`:return X(t,`Match`,`命中`);case`mismatched`:return X(t,`No match`,`未命中`);case`unavailable`:return X(t,`Unknown`,`无法判断`);case`not-evaluated`:return X(t,`Not evaluated`,`未参与判断`);case`not-retained`:return X(t,`Checked`,`已检查`);case`outside-snapshot`:return X(t,`After evaluation`,`评估后出现`);case`legacy`:return X(t,`Recorded`,`已记录`)}}function uR(e,t){switch(e){case`tool`:return X(t,`Tool call`,`工具调用`);case`event`:return X(t,`Event`,`事件`);case`legacy-source-row`:return X(t,`Record`,`记录`)}}function dR(e,t){return e===void 0?null:e===`matched`?X(t,`match`,`命中`):e===`mismatched`?X(t,`different`,`不匹配`):X(t,`unknown`,`无法判断`)}function fR({fields:e,locale:t}){return e.length===0?null:(0,M.jsx)(`dl`,{className:`niceeval-filter-row-fields`,children:e.map((e,n)=>{let r=dR(e.state,t);return(0,M.jsxs)(`div`,{"data-field-state":e.state,children:[(0,M.jsx)(`dt`,{children:e.label}),(0,M.jsx)(`dd`,{children:(0,M.jsx)(`pre`,{children:e.value})}),r===null?null:(0,M.jsx)(`span`,{children:r})]},`${e.label}:${n}`)})})}function pR({anchor:e,locale:t}){return(0,M.jsxs)(`button`,{type:`button`,className:`niceeval-filter-row-target`,onClick:()=>{let t=document.getElementById(`conversation-${e}`)??document.getElementById(`trace-${e}`),n=t?.closest(`details`);n instanceof HTMLDetailsElement&&(n.open=!0),t?.scrollIntoView({behavior:`smooth`,block:`center`}),t instanceof HTMLElement&&t.focus()},children:[X(t,`View in conversation`,`在会话中查看`),(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`↗`})]})}function mR({row:e,locale:t}){let n=`${uR(e.kind,t)} ${e.number}`,r=e.fields.length>0||(e.difference?.length??0)>0||e.note!==void 0||e.conversationTarget!==void 0,i=(0,M.jsxs)(`span`,{className:`niceeval-filter-row-summary`,children:[(0,M.jsx)(`span`,{className:`niceeval-filter-row-number`,children:n}),(0,M.jsx)(`strong`,{children:e.summary}),(0,M.jsx)(`span`,{className:`niceeval-filter-row-state`,"data-state":e.state,children:lR(e.state,t)})]});return r?(0,M.jsxs)(`details`,{className:`niceeval-filter-row`,"data-state":e.state,children:[(0,M.jsx)(`summary`,{children:i}),(0,M.jsxs)(`div`,{className:`niceeval-filter-row-detail`,children:[e.note===void 0?null:(0,M.jsx)(`p`,{className:`niceeval-filter-row-note`,children:e.note}),e.difference===void 0||e.difference.length===0?null:(0,M.jsxs)(`section`,{children:[(0,M.jsx)(`h6`,{children:X(t,`Filter comparison`,`Filter 对比`)}),(0,M.jsx)(fR,{fields:e.difference,locale:t})]}),e.fields.length===0?null:(0,M.jsxs)(`section`,{children:[(0,M.jsx)(`h6`,{children:X(t,`Recorded detail`,`调用详情`)}),(0,M.jsx)(fR,{fields:e.fields,locale:t})]}),e.conversationTarget===void 0?null:(0,M.jsx)(pR,{anchor:e.conversationTarget.anchor,locale:t})]})]}):(0,M.jsx)(`div`,{className:`niceeval-filter-row`,"data-state":e.state,children:i})}function hR(e,t){switch(e){case`matched`:return X(t,`Matched`,`已匹配`);case`possible`:return X(t,`Possible`,`可能匹配`);case`blocked`:return X(t,`Blocked here`,`阻塞于此`);case`not-reached`:return X(t,`Not reached`,`尚未到达`)}}function gR({steps:e,locale:t}){return e.length===0?null:(0,M.jsxs)(`section`,{className:`niceeval-filter-steps`,children:[(0,M.jsx)(`h5`,{children:X(t,`Sequence path`,`顺序匹配路径`)}),(0,M.jsx)(`ol`,{children:e.map(e=>(0,M.jsxs)(`li`,{"data-state":e.state,children:[(0,M.jsx)(`span`,{className:`niceeval-filter-step-index`,children:e.step}),(0,M.jsx)(`code`,{children:e.summary}),e.sourceRow===void 0?null:(0,M.jsx)(`span`,{children:e.sourceRow}),(0,M.jsx)(`span`,{className:`niceeval-filter-step-state`,children:hR(e.state,t)}),e.conversationTarget===void 0?null:(0,M.jsx)(pR,{anchor:e.conversationTarget.anchor,locale:t})]},e.step))})]})}function _R(e,t){return e===`tool`?X(t,`tool calls`,`工具调用`):e===`event`?X(t,`events`,`事件`):X(t,`records`,`记录`)}function vR(e,t){switch(e){case`historical-not-recorded`:return X(t,`This historical Record did not retain this Matcher query or its row-by-row relation. Rerun it to inspect match reasons and paths.`,`此历史 Record 未保存本次 Matcher 查询与逐行关联,重跑后可查看命中原因/匹配路径。`);case`source-unavailable`:return X(t,`The source records were not retained.`,`没有保存可用的来源记录。`);case`ambiguous-relation`:return X(t,`The stored identities cannot prove a unique assertion-to-row relation.`,`已保存的身份无法证明断言与记录之间唯一对应。`);case`source-partial`:return X(t,`The source records may be incomplete; missing rows are not treated as mismatches.`,`来源记录可能不完整;缺失记录不会被当作未命中。`);case`overlay-partial`:return X(t,`Only bounded representative comparisons were retained; other examined rows are marked as checked.`,`只保留了有界的代表性对比;其余参与评估的记录标记为“已检查”。`)}}function yR(e,t){return e.queryKind===`ordered-sequence`?X(t,`Event order`,`事件顺序`):e.subject===`tool`?X(t,`Tool call filter`,`工具调用筛选`):X(t,`Event filter`,`事件筛选`)}function bR(e){return typeof e==`object`&&e&&!Array.isArray(e)&&`kind`in e&&typeof e.kind==`string`?e.kind:void 0}function xR(e){let t=e.comparator;return typeof t==`object`&&t&&!Array.isArray(t)&&`display`in t&&typeof t.display==`string`?t.display:t==null?e.querySummary:JSON.stringify(t)}function SR(e,t,n){let r=e.atEvaluation.rows.length;return n===`zh-CN`?e.state===`legacy`?`查看已记录的 ${r} 条${t}`:`查看评估时的 ${r} 条${t}`:e.state===`legacy`?`View ${r} recorded ${t}`:`View the ${r} ${t} at evaluation`}function CR({content:e,locale:t}){let n=_R(e.subject,t),r=e.state===`legacy`;return(0,M.jsxs)(`section`,{className:`niceeval-filter-debugger`,"aria-label":yR(e,t),"data-state":e.state,"data-source-state":e.atEvaluation.state,"data-comparator":bR(e.comparator),children:[r?null:(0,M.jsxs)(`header`,{className:`niceeval-filter-debugger-head`,children:[(0,M.jsx)(`span`,{children:yR(e,t)}),(0,M.jsx)(`code`,{children:xR(e)}),e.retainedTarget?.state===`available`?(0,M.jsx)(pR,{anchor:e.retainedTarget.anchor,locale:t}):null]}),e.facts.length===0?null:(0,M.jsx)(`dl`,{className:`niceeval-filter-facts`,children:e.facts.map(e=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:cR(e.kind,t)}),(0,M.jsx)(`dd`,{children:WI(e.value,t)})]},e.kind))}),(0,M.jsx)(gR,{steps:e.steps??[],locale:t}),e.relationNotice===void 0?null:(0,M.jsx)(`p`,{className:`niceeval-filter-notice`,children:vR(e.relationNotice,t)}),e.retainedTarget?.state===`unavailable`?(0,M.jsx)(`p`,{className:`niceeval-filter-notice`,children:e.retainedTarget.reason}):null,e.commandMatch?.state===`unavailable`?(0,M.jsx)(`p`,{className:`niceeval-filter-notice`,children:e.commandMatch.reason}):null,(e.atEvaluation.notices??[]).map(e=>(0,M.jsx)(`p`,{className:`niceeval-filter-notice`,children:vR(e,t)},e)),(0,M.jsxs)(`details`,{className:`niceeval-filter-ledger`,children:[(0,M.jsxs)(`summary`,{children:[(0,M.jsx)(`span`,{children:SR(e,n,t)}),r&&e.atEvaluation.state===`partial`?(0,M.jsx)(`small`,{children:X(t,`Records may be incomplete`,`记录可能不完整`)}):null]}),(0,M.jsxs)(`div`,{className:`niceeval-filter-ledger-content`,children:[(0,M.jsx)(`p`,{children:r?X(t,`Open a row to inspect its recorded detail.`,`展开任一行可查看已记录详情。`):X(t,`Open a row to inspect its captured detail and filter comparison.`,`展开任一行可查看已记录详情和 Filter 对比。`)}),e.atEvaluation.rows.length===0?null:(0,M.jsx)(`div`,{className:`niceeval-filter-rows`,children:e.atEvaluation.rows.map(e=>(0,M.jsx)(mR,{row:e,locale:t},e.key))}),e.atEvaluation.rows.length===0&&(r||e.atEvaluation.state!==`unavailable`)?(0,M.jsx)(`p`,{className:`niceeval-filter-empty`,children:e.atEvaluation.state===`unavailable`?X(t,`Source rows were not recorded.`,`没有记录可用的来源行。`):X(t,`No ${n} were in this evaluation snapshot.`,`这个评估快照里没有${n}。`)}):null]})]}),e.afterEvaluation.length===0?null:(0,M.jsxs)(`details`,{className:`niceeval-filter-later`,children:[(0,M.jsxs)(`summary`,{children:[X(t,`Context recorded after evaluation`,`评估后记录的上下文`),(0,M.jsx)(`span`,{children:e.afterEvaluation.length})]}),(0,M.jsx)(`p`,{children:X(t,`These rows are visible for context and did not affect the sealed result.`,`这些行只用于查看上下文,不影响已经封口的判断结果。`)}),(0,M.jsx)(`div`,{className:`niceeval-filter-rows`,children:e.afterEvaluation.map(e=>(0,M.jsx)(mR,{row:e,locale:t},e.key))})]})]})}var wR=240,TR=120;function Z(e,t,n){return e===`zh-CN`?n:t}function ER(e){return typeof e==`string`?JSON.stringify(e):String(e)}function DR(e){return Array.from(e)}function OR(e,t){let n=DR(e),r=n.slice(0,TR).join(``),i=Z(t,n.length===1?`character`:`characters`,`字符`);return`${n.length} ${i} · ${JSON.stringify(r)}…`}function Q(e,t){return e?.kind===`fields`?e.fields.find(e=>e.label===t)?.value:void 0}function kR(e){return e?.kind===`value`&&typeof e.value==`string`?e.value:void 0}function AR(e){if(e?.kind===`text`)return e.text;if(e?.kind===`unavailable`)return e.reason;if(e?.kind===`value`)return typeof e.value==`string`?e.value:String(e.value)}function jR(e){return e?.kind===`value`&&typeof e.value==`number`?e.value:void 0}function MR(e){let t=Q(e,`data`);if(FR(e)===`numeric-comparison/v1`){let e=kR(Q(t,`comparator`)),n=jR(Q(t,`threshold`));if(e!==void 0&&n!==void 0){let t=e===`less-than`?`lessThan`:e===`at-most`?`atMost`:e===`greater-than`?`greaterThan`:e===`at-least`?`atLeast`:void 0;if(t!==void 0)return`${t}(${n})`}}let n=kR(Q(Q(t,`matcher`),`name`));if(n!==void 0)return n;if(FR(e)!==`occurrence/v1`&&FR(e)!==`occurrence/v2`||kR(Q(t,`occurrence`))!==`tool`)return;let r=kR(Q(t,`matcher`));if(r===void 0)return;let i=kR(Q(t,`assertion`));if(i===`order`)return r;let a=Q(t,`quantifier`),o=kR(Q(a,`kind`)),s=jR(Q(a,`count`));if(i===`absent`||o===`absent`)return`notCalledTool(${r})`;if(o===`at-least`&&s===1)return`calledTool(${r})`;let c=o===`at-least`?`atLeast`:o===`less-than`?`lessThan`:o===`at-most`?`atMost`:o===`greater-than`?`greaterThan`:o===`exact`?`exactly`:void 0;return c!==void 0&&s!==void 0?`${r}.${c}(${s})`:`calledTool(${r})`}function NR(e){let t=kR(e);return t===`matched`||t===`mismatched`||t===`unavailable`?t:void 0}function PR(e){if(e?.kind!==`fields`)return null;let t=Q(e,`children`),n=t?.kind===`list`?t.items.flatMap((e,t)=>{let n=NR(Q(e,`state`));return n===void 0?[]:[{index:jR(Q(e,`index`))??t,label:kR(Q(e,`label`))??`matcher ${t+1}`,state:n,diagnostic:PR(Q(e,`diagnostic`))}]}):[];return{code:kR(Q(e,`code`)),expected:Q(e,`expected`),received:Q(e,`received`),reason:kR(Q(e,`reason`)),locator:kR(Q(Q(e,`locator`),`id`)),children:n}}function FR(e){return kR(Q(e,`id`))}function IR(e){return(FR(e)===`occurrence/v1`||FR(e)===`occurrence/v2`)&&kR(Q(Q(e,`data`),`occurrence`))===`tool`}function LR(e){return e===`less-than`||e===`at-most`||e===`greater-than`||e===`at-least`?e:void 0}function RR(e){return e===`exact`||e===`lower-bound`||e===`unavailable`?e:void 0}function zR(e,t){if(FR(e)!==`numeric-comparison/v1`)return;let n=Q(e,`data`),r=LR(kR(Q(n,`comparator`))),i=jR(Q(n,`threshold`)),a=Q(n,`subject`),o=kR(Q(a,`kind`)),s=Q(t,`input`),c=RR(kR(Q(s,`state`)));if(r===void 0||i===void 0||c===void 0||o!==`explicit-value`&&o!==`scope-metric`&&o!==`collection-cardinality`)return;let l=kR(Q(a,`metric`)),u=kR(Q(a,`scope`)),d=kR(Q(a,`unit`));return{comparator:r,threshold:i,subject:{kind:o,...l===`tokens`||l===`cost`?{metric:l}:{},...u===`turn`||u===`session`||u===`attempt`?{scope:u}:{},...d===`tokens`||d===`usd`?{unit:d}:{}},material:{state:c,...jR(Q(s,`value`))===void 0?{}:{value:jR(Q(s,`value`))},...kR(Q(s,`reason`))===void 0?{}:{reason:kR(Q(s,`reason`))},...Q(s,`derivation`)===void 0?{}:{derivation:Q(s,`derivation`)}}}}function BR(e){if(kR(Q(e,`kind`))!==`pricing-estimate`)return;let t=kR(Q(e,`model`)),n=Q(e,`priceSource`),r=kR(Q(n,`kind`)),i=kR(Q(n,`selector`)),a=jR(Q(e,`amountUSD`)),o=Q(e,`charges`);if(!(t===void 0||i===void 0||a===void 0||r!==`configured-override`&&r!==`builtin`||o?.kind!==`list`))return{model:t,sourceKind:r,sourceSelector:i,charges:o.items.flatMap(e=>{let t=kR(Q(e,`bucket`)),n=jR(Q(e,`tokens`)),r=jR(Q(e,`rateUSDPerMTok`)),i=jR(Q(e,`amountUSD`));return t!==`input`&&t!==`output`&&t!==`cache-read`&&t!==`cache-write`||n===void 0||r===void 0||i===void 0?[]:[{bucket:t,tokens:n,rateUSDPerMTok:r,amountUSD:i}]}),amountUSD:a}}function VR(e){let t=kR(Q(e,`kind`));if(t===`at-least`){let t=jR(Q(e,`threshold`));return t===void 0?void 0:{kind:`text`,text:`≥ ${t}`}}return t===void 0?e:void 0}function HR(e){return Q(e,`value`)??e}function UR({value:e,locale:t,quoted:n}){return(0,M.jsxs)(`details`,{className:`niceeval-assertion-evidence-long-value`,children:[(0,M.jsx)(`summary`,{children:OR(e,t)}),(0,M.jsx)(`pre`,{className:`niceeval-assertion-evidence-code`,children:n?JSON.stringify(e):e})]})}function WR({value:e,locale:t}){switch(e.kind){case`text`:return DR(e.text).length>wR?(0,M.jsx)(UR,{value:e.text,locale:t,quoted:!1}):(0,M.jsx)(`p`,{children:e.text});case`value`:return typeof e.value==`string`&&DR(e.value).length>wR?(0,M.jsx)(UR,{value:e.value,locale:t,quoted:!0}):(0,M.jsx)(`pre`,{className:`niceeval-assertion-evidence-code`,children:ER(e.value)});case`unavailable`:return(0,M.jsxs)(`p`,{className:`niceeval-assertion-evidence-state`,children:[(0,M.jsx)(`code`,{children:`unavailable`}),(0,M.jsx)(`span`,{children:e.reason})]});case`fields`:return(0,M.jsx)(`dl`,{className:`niceeval-assertion-evidence-fields`,children:e.fields.map((e,n)=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:e.label}),(0,M.jsx)(`dd`,{children:(0,M.jsx)(WR,{value:e.value,locale:t})})]},`${e.label}:${n}`))});case`list`:return(0,M.jsxs)(`details`,{className:`niceeval-assertion-evidence-collection`,children:[(0,M.jsx)(`summary`,{children:(0,M.jsx)(`code`,{children:`Array(${e.items.length})`})}),(0,M.jsx)(`ol`,{className:`niceeval-assertion-evidence-list`,children:e.items.map((e,n)=>(0,M.jsx)(`li`,{children:(0,M.jsx)(WR,{value:e,locale:t})},n))})]})}}function GR({heading:e,value:t,locale:n}){return(0,M.jsxs)(`section`,{className:`niceeval-assertion-evidence-section`,children:[(0,M.jsx)(`h5`,{children:e}),(0,M.jsx)(WR,{value:t,locale:n})]})}function KR({rows:e}){return(0,M.jsx)(`dl`,{className:`niceeval-match-facts`,children:e.map(e=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:e.label}),(0,M.jsx)(`dd`,{children:e.value})]},e.label))})}function qR({diagnostic:e,locale:t}){let n=[...e.expected===void 0?[]:[{label:Z(t,`Expected`,`预期`),value:e.expected}],...e.received===void 0?[]:[{label:Z(t,`Observed`,`实际`),value:e.received}],...e.locator===void 0?[]:[{label:Z(t,`Call`,`调用`),value:e.locator}],...e.reason===void 0?[]:[{label:Z(t,`Reason`,`原因`),value:e.reason}]];return n.length===0?null:(0,M.jsx)(`dl`,{className:`niceeval-match-facts`,children:n.map(e=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:e.label}),(0,M.jsx)(`dd`,{children:typeof e.value==`string`?e.value:(0,M.jsx)(WR,{value:e.value,locale:t})})]},e.label))})}function JR({input:e,diagnostic:t,locale:n}){let r=kR(Q(e,`command`)),i=jR(Q(e,`exitCode`)),a=AR(t?.expected),o=[...r===void 0?[]:[{label:Z(n,`Command`,`命令`),value:r}],...i===void 0?[]:[{label:Z(n,`Result`,`结果`),value:Z(n,`Exit code ${i}`,`退出码 ${i}`)}],...a===void 0?[]:[{label:Z(n,`Expected`,`预期`),value:a}]];return(0,M.jsxs)(`section`,{className:`niceeval-assertion-evidence-section`,children:[(0,M.jsx)(`h5`,{children:Z(n,`Command result`,`命令结果`)}),(0,M.jsx)(KR,{rows:o})]})}function YR({observed:e,diagnostic:t,locale:n}){let r=jR(Q(Q(e,`receipt`),`examined`));return(0,M.jsxs)(`div`,{className:`niceeval-match-evidence-grid`,children:[t?.received===void 0?null:(0,M.jsx)(GR,{heading:Z(n,`Observed`,`实际结果`),value:t.received,locale:n}),t?.expected===void 0?null:(0,M.jsx)(GR,{heading:Z(n,`Expected`,`预期结果`),value:t.expected,locale:n}),r===void 0?null:(0,M.jsxs)(`section`,{className:`niceeval-assertion-evidence-section`,children:[(0,M.jsx)(`h5`,{children:Z(n,`Tool calls`,`工具调用`)}),(0,M.jsx)(KR,{rows:[{label:Z(n,`Examined`,`已检查`),value:Z(n,`${r} tool call${r===1?``:`s`}`,`${r} 次工具调用`)}]})]})]})}function XR(e,t){return new Intl.NumberFormat(t===`zh-CN`?`zh-CN`:`en-US`,{maximumFractionDigits:12,maximumSignificantDigits:12}).format(e)}function ZR(e){let t=Math.abs(e);if(t!==0&&t<1e-9)return`$${e.toExponential(4)}`;let n=t===0||t>=1?6:Math.min(12,Math.max(2,Math.ceil(-Math.log10(t))+5));return`$${e.toFixed(n).replace(/(?:\.0+|(?:(\.[0-9]*?)0+))$/,`$1`)}`}function QR(e){return e===`less-than`?`<`:e===`at-most`?`≤`:e===`greater-than`?`>`:`≥`}function $R(e){return e===`less-than`?`≥`:e===`at-most`?`>`:e===`greater-than`?`≤`:`<`}function ez(e,t){return t===`zh-CN`?e===`turn`?`本轮`:e===`session`?`本次会话`:`本次 Attempt`:e===`turn`?`Turn`:e===`session`?`Session`:`Attempt`}function tz(e,t){if(e.subject.kind===`explicit-value`)return Z(t,`Number comparison`,`数值比较`);let n=ez(e.subject.scope,t);return e.subject.kind===`collection-cardinality`?Z(t,`${n} tool calls`,`${n}工具调用`):e.subject.metric===`cost`?Z(t,`${n} estimated cost`,`${n}估算费用`):Z(t,`${n} token usage`,`${n} token 用量`)}function nz(e,t,n){if(e.subject.metric===`cost`)return ZR(t);let r=XR(t,n);return e.subject.metric===`tokens`?`${r} tokens`:r}function rz(e,t){let n=nz(e,e.threshold,t);return e.subject.metric===`tokens`||e.subject.metric===`cost`?Z(t,`limit ${n}`,`上限 ${n}`):n}function iz(e,t){switch(e){case`model-not-recorded`:return Z(t,`The model was not recorded, so its price cannot be selected.`,`没有记录模型,无法选择对应价格。`);case`price-source-not-found`:return Z(t,`No configured or built-in price was found for this model.`,`没有找到该模型的配置价格或内置价格。`);case`pricing-input-invalid`:return Z(t,`The recorded pricing input is invalid.`,`记录的计价输入无效。`);case`usage-not-recorded`:return Z(t,`Usage was not recorded.`,`没有记录用量。`);case`usage-input-invalid`:return Z(t,`The recorded token usage is invalid.`,`记录的 token 用量无效。`);case`non-finite-number`:case`numeric-value-non-finite`:return Z(t,`The compared number is not finite.`,`被比较的数值不是有限数。`);default:return Z(t,`The compared value is unavailable.`,`没有可用于比较的数值。`)}}function az(e,t,n){let r=e.material.value;if(e.material.state===`unavailable`||r===void 0)return iz(e.material.reason,n);let i=nz(e,r,n),a=rz(e,n);if(e.material.state===`lower-bound`&&t===`unavailable`)return e.subject.kind===`collection-cardinality`?Z(n,`At least ${i} tool calls were recorded, but the collection is incomplete, so NiceEval cannot determine whether it is ${QR(e.comparator)} ${a}.`,`目前至少已有 ${i} 次工具调用,但集合不完整,无法判断是否 ${QR(e.comparator)} ${a}。`):Z(n,`At least ${i} was recorded, but usage is incomplete, so NiceEval cannot determine whether it is ${QR(e.comparator)} ${a}.`,`目前至少记录了 ${i},但用量记录不完整,无法判断是否 ${QR(e.comparator)} ${a}。`);let o=t===`mismatched`?$R(e.comparator):QR(e.comparator),s=e.material.state===`lower-bound`?Z(n,`Known minimum`,`已知至少`):e.subject.kind===`collection-cardinality`?Z(n,`Tool calls`,`工具调用`):e.subject.metric===`cost`?Z(n,`Estimated`,`估算`):e.subject.metric===`tokens`?Z(n,`Used`,`已用`):Z(n,`Observed`,`实际`),c=t===`matched`?Z(n,`so it passes.`,`所以通过。`):t===`mismatched`?Z(n,`so it does not pass.`,`所以未通过。`):Z(n,`so the result is unavailable.`,`所以无法判断。`);return`${s} ${i} ${o} ${a}${n===`zh-CN`?`,`:`, `}${c}`}function oz(e,t){return e===`input`?Z(t,`Input`,`输入`):e===`output`?Z(t,`Output`,`输出`):e===`cache-read`?Z(t,`Cache read`,`缓存读取`):Z(t,`Cache write`,`缓存写入`)}function sz({receipt:e,locale:t}){let n=e.sourceKind===`builtin`?Z(t,`Built-in price`,`内置价格`):Z(t,`Configured override`,`配置覆盖价格`);return(0,M.jsxs)(`details`,{className:`niceeval-numeric-pricing`,children:[(0,M.jsxs)(`summary`,{children:[(0,M.jsx)(`span`,{children:Z(t,`View estimate basis`,`查看估算依据`)}),(0,M.jsx)(`code`,{children:e.model}),(0,M.jsxs)(`small`,{children:[n,` · `,e.sourceSelector]})]}),(0,M.jsxs)(`dl`,{children:[e.charges.map(e=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:oz(e.bucket,t)}),(0,M.jsxs)(`dd`,{children:[(0,M.jsxs)(`code`,{children:[XR(e.tokens,t),` tokens`]}),(0,M.jsx)(`span`,{children:`×`}),(0,M.jsxs)(`code`,{children:[ZR(e.rateUSDPerMTok),`/M`]}),(0,M.jsx)(`span`,{children:`=`}),(0,M.jsx)(`strong`,{children:ZR(e.amountUSD)})]})]},e.bucket)),(0,M.jsxs)(`div`,{className:`niceeval-numeric-pricing-total`,children:[(0,M.jsx)(`dt`,{children:Z(t,`Estimated total`,`估算合计`)}),(0,M.jsx)(`dd`,{children:(0,M.jsx)(`strong`,{children:ZR(e.amountUSD)})})]})]})]})}function cz({view:e,state:t,locale:n}){let r=e.material.value,i=t===`mismatched`?$R(e.comparator):QR(e.comparator),a=e.subject.metric===`cost`?BR(e.material.derivation):void 0;return(0,M.jsxs)(`section`,{className:`niceeval-numeric-evidence`,"data-state":t,children:[(0,M.jsx)(`span`,{className:`niceeval-numeric-evidence-label`,children:tz(e,n)}),r===void 0?(0,M.jsx)(`p`,{className:`niceeval-numeric-evidence-unavailable`,children:Z(n,`No comparable value`,`没有可比较的数值`)}):e.material.state===`lower-bound`&&t===`unavailable`?(0,M.jsxs)(`p`,{className:`niceeval-numeric-evidence-formula`,children:[(0,M.jsx)(`small`,{children:Z(n,`Known minimum`,`已知至少`)}),(0,M.jsx)(`strong`,{children:nz(e,r,n)}),(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,M.jsx)(`small`,{children:rz(e,n)})]}):(0,M.jsxs)(`p`,{className:`niceeval-numeric-evidence-formula`,children:[e.material.state===`lower-bound`?(0,M.jsx)(`small`,{children:Z(n,`Known minimum`,`已知至少`)}):null,(0,M.jsx)(`strong`,{children:nz(e,r,n)}),(0,M.jsx)(`span`,{className:`niceeval-numeric-evidence-operator`,children:i}),(0,M.jsx)(`strong`,{children:rz(e,n)})]}),(0,M.jsx)(`p`,{className:`niceeval-numeric-evidence-conclusion`,children:az(e,t,n)}),a===void 0?null:(0,M.jsx)(sz,{receipt:a,locale:n})]})}function lz({content:e,input:t,diagnostic:n,locale:r}){let i=n?.expected===void 0?VR(e.expected):n.expected,a=n?.received===void 0?HR(e.observed):n.received;return(0,M.jsxs)(`div`,{className:`niceeval-match-evidence-grid`,children:[(0,M.jsx)(GR,{heading:Z(r,`Input`,`输入`),value:t,locale:r}),a===void 0?null:(0,M.jsx)(GR,{heading:Z(r,`Observed`,`实际结果`),value:a,locale:r}),i===void 0?null:(0,M.jsx)(GR,{heading:Z(r,`Expected`,`预期结果`),value:i,locale:r})]})}function uz({source:e,locale:t}){let n=Q(e,`coverage`),r=kR(Q(n,`state`));if(r===void 0||r===`complete`)return null;let i=kR(Q(n,`reason`)),a=Q(e,`limitations`),o=a?.kind===`list`?a.items.map(e=>jR(Q(e,`omittedBytes`))).find(e=>e!==void 0):void 0,s=[i,o===void 0?void 0:Z(t,`${o} bytes omitted`,`省略 ${o} 字节`)].filter(e=>e!==void 0).join(` · `);return(0,M.jsxs)(`p`,{className:`niceeval-match-coverage`,children:[Z(t,`Input evidence ${r}`,`输入证据${r===`partial`?`不完整`:`不可用`}`),s.length===0?``:` · ${s}`]})}function dz(e,t){return t===`zh-CN`?e===`matched`?`命中`:e===`mismatched`?`未命中`:`无法判断`:e}function fz(e){return e?.code===`tool-count-match`||e?.code===`tool-count-mismatch`||e?.code===`tool-count-exceeded`||e?.code===`tool-count-unavailable`||e?.code===`tool-absence-match`||e?.code===`tool-absence-mismatch`||e?.code===`tool-absence-unavailable`}function pz(e){if(e?.received!==void 0)return AR(e.received);let t=e?.children.find(e=>e.label===`name`);return t?.diagnostic?.received===void 0?t?.state===`matched`?AR(t.diagnostic?.expected):void 0:AR(t.diagnostic.received)}function mz(e,t,n,r){let i=t===`command-candidate`?Z(r,`Command`,`命令`):t===`tool-candidate`?Z(r,`Tool call`,`工具调用`):Z(r,`Candidate`,`候选`),a=pz(n),o=Z(r,`invocation details not recorded`,`调用详情未记录`);return`${i} ${e+1} · ${a??o}`}function hz(e,t){return t===`zh-CN`?e===`name`?`名称`:e===`input`?`输入`:e===`output`?`输出`:e===`command`?`命令`:e===`status`?`状态`:e:e}function gz(e,t){if(e===null||e.children.length>0)return[];let n=AR(e.expected),r=AR(e.received);return[...n===void 0?[]:[{label:Z(t,`Expected`,`预期`),value:n}],...r===void 0?[]:[{label:Z(t,`Observed`,`实际`),value:r}],...e.reason===void 0?[]:[{label:Z(t,`Reason`,`原因`),value:e.reason}]]}function _z({label:e,state:t,diagnostic:n,locale:r,root:i=!1,toolCandidateIndex:a,toolField:o=!1,children:s}){let c=a===void 0?o?hz(e,r):e:mz(a,e,n,r),l=dz(t,r),u=`${c}: ${l}`,d=gz(n,r),f=(0,M.jsxs)(`span`,{className:`niceeval-match-summary niceeval-match-summary--${t}`,children:[(0,M.jsxs)(`span`,{className:`niceeval-match-summary-main`,children:[(0,M.jsx)(`code`,{children:c}),d.length===0?null:(0,M.jsx)(`span`,{className:`niceeval-match-summary-facts`,children:d.map(e=>(0,M.jsxs)(`span`,{className:`niceeval-match-summary-fact`,children:[(0,M.jsx)(`span`,{children:e.label}),(0,M.jsx)(`code`,{children:e.value})]},e.label))})]}),(0,M.jsx)(`span`,{className:`niceeval-match-state`,children:l})]}),p=n?.children??[],m=fz(n),h=p.length>0||n?.locator!==void 0||s!==void 0?(0,M.jsxs)(`div`,{className:`niceeval-match-detail`,children:[p.length>0?(0,M.jsx)(`div`,{className:`niceeval-match-children`,children:p.map((e,t)=>(0,M.jsx)(_z,{label:e.label,state:e.state,diagnostic:e.diagnostic,locale:r,...m?{toolCandidateIndex:e.index}:{},...a===void 0?{}:{toolField:!0}},`${e.label}:${t}`))}):null,i||n===null||n.locator===void 0?null:(0,M.jsx)(qR,{diagnostic:n,locale:r}),s]}):null;return h===null?(0,M.jsx)(`div`,{className:`niceeval-match-node`,"aria-label":u,children:f}):(0,M.jsxs)(`details`,{className:`niceeval-match-node${i?` niceeval-match-node--root`:``}`,children:[(0,M.jsx)(`summary`,{"aria-label":u,children:f}),h]})}function vz(e,t,n,r){let i=PR(e.explanation),a=MR(e.check)??n??Z(t,`Match`,`检查`),o=Q(e.source,`input`)??e.source,s=i?.code,c=zR(e.check,e.source),l=c===void 0?s===`command-succeeded`||s===`command-failed`?(0,M.jsx)(JR,{input:o,diagnostic:i,locale:t}):IR(e.check)?(0,M.jsx)(YR,{observed:e.observed,diagnostic:i,locale:t}):(0,M.jsx)(lz,{content:e,input:o,diagnostic:i,locale:t}):(0,M.jsx)(cz,{view:c,state:r,locale:t});return(0,M.jsx)(`div`,{className:`niceeval-assertion-evidence`,children:(0,M.jsx)(_z,{label:a,state:r,diagnostic:c===void 0?i:null,locale:t,root:!0,children:(0,M.jsxs)(`div`,{className:`niceeval-match-body`,children:[e.matcherDebugger===void 0?l:(0,M.jsxs)(M.Fragment,{children:[l,(0,M.jsx)(CR,{content:e.matcherDebugger,locale:t})]}),(0,M.jsx)(uz,{source:e.source,locale:t}),(0,M.jsxs)(`details`,{className:`niceeval-match-raw`,children:[(0,M.jsx)(`summary`,{children:Z(t,`Raw assertion data`,`原始断言数据`)}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(GR,{heading:Z(t,`Source`,`来源`),value:e.source,locale:t}),(0,M.jsx)(GR,{heading:Z(t,`Check`,`检查条件`),value:e.check,locale:t}),(0,M.jsx)(GR,{heading:Z(t,`Explanation`,`解释`),value:e.explanation,locale:t})]})]})]})})})}function yz({content:e,label:t,state:n,locale:r}){return vz(e,r,t,n??`unavailable`)}var bz=(0,v.createContext)(null);function xz(){let e=(0,v.useContext)(bz);if(e===null)throw Error(`Trace interaction context is missing`);return e}function Sz(...e){return e.filter(Boolean).join(` `)}function $(e,t,n){return e===`zh-CN`?n:t}function Cz(e){if(e===void 0)return`Not recorded`;if(e<1e3)return`${Math.round(e)} ms`;let t=Math.round(e/1e3);return t<60?`${t} s`:`${Math.floor(t/60)} m ${t%60} s`}function wz(e){return e.durationMs!==void 0&&Number.isFinite(e.durationMs)?Math.max(0,e.durationMs):void 0}function Tz(e){switch(e.toLowerCase()){case`user`:case`input`:case`context`:return`input`;case`tool`:case`subagent`:case`skill`:return`tools`;default:return`model`}}function Ez(e){return Tz(e)===`tools`}function Dz(e){let t=e.filter(e=>e.entry.callPhase===`started`).length;return t===0?e.filter(e=>e.toolLike).length:t}function Oz(e,t){return e.callOutcome===`completed`?$(t,`Completed`,`已完成`):e.callOutcome===`failed`?$(t,`Failed`,`失败`):e.callOutcome===`rejected`?$(t,`Rejected`,`已拒绝`):e.callOutcome===`cancelled`?$(t,`Cancelled`,`已取消`):e.failed===!0?$(t,`Failed`,`失败`):e.callPhase===`started`?$(t,`Started`,`已开始`):e.callPhase===`finished`?$(t,`Completed`,`已完成`):$(t,`Captured`,`已捕获`)}function kz(e){return e.toolOccurrence?.state===`exact`?e.toolOccurrence.toolOccurrenceId:e.toolOccurrence===void 0?e.callId:void 0}function Az(e){let t=new Map;for(let[n,r]of e.entries.entries()){let e=kz(r);if(e===void 0||r.callPhase===void 0)continue;let i=t.get(e)??{started:[],finished:[]};i[r.callPhase].push(n),t.set(e,i)}let n=new Map,r=new Set;for(let i of t.values()){if(i.started.length!==1||i.finished.length!==1)continue;let t=i.started[0],a=i.finished[0];if(a<=t)continue;let o=e.entries[t],s=e.entries[a],c=[o.raw,s.raw].filter(e=>e!==void 0).join(`
60
- `),l=[o.detail,s.detail].filter(e=>e!==void 0);n.set(t,{id:o.id,kind:o.kind,preview:o.preview,...o.anchor===void 0?{}:{anchor:o.anchor},callId:kz(o),...o.toolOccurrence===void 0?{}:{toolOccurrence:o.toolOccurrence},callPhase:`finished`,...s.callOutcome===void 0?{}:{callOutcome:s.callOutcome},...o.failed===!0||s.failed===!0?{failed:!0}:{},...(s.commandMatch??o.commandMatch)===void 0?{}:{commandMatch:s.commandMatch??o.commandMatch},...c===``?{}:{raw:c},...l.length===0?{}:{detail:l.length===1?l[0]:{kind:`stack`,items:l}}}),r.add(a)}return e.entries.flatMap((e,t)=>r.has(t)?[]:[{entry:n.get(t)??e,entryIndex:t}])}function jz(e,t){return e.turns.flatMap((e,n)=>Az(e).map(({entry:r,entryIndex:i})=>{let a=r.raw??WI(r.preview,t);return{id:r.id,turn:e,turnIndex:n,entry:r,entryIndex:i,lane:Tz(r.kind),summary:LL(r.preview,t,180),raw:a,toolLike:Ez(r.kind)}}))}function Mz(e){return e.every(e=>e.entries.length===0||wz(e)!==void 0)}function Nz(e,t){let n=new Map;if(t.length===0)return n;let r=Mz(e),i=new Map;for(let n of e){let e=t.filter(e=>e.turn.key===n.key);if(e.length===0)continue;let a=wz(n),o=r&&a!==void 0?Math.max(1,a)/e.length:1;for(let t of e)i.set(t.id,o)}let a=t.length*1,o=t.reduce((e,t)=>e+(i.get(t.id)??1),0),s=0,c=0;for(let e of t){let t=i.get(e.id)??1;n.set(e.id,{sequenceLeft:s/a*100,sequenceWidth:1/a*100,durationLeft:c/o*100,durationWidth:t/o*100}),s+=1,c+=t}return n}function Pz(e){return e===`input`?7:e===`model`?21:35}function Fz(e,t){let n=WI(e.turn.label,t),r=wz(e.turn),i=r===void 0?$(t,`timing not recorded`,`未记录时长`):`${Cz(r)} ${$(t,`turn duration`,`轮次时长`)}`;return`${e.entry.kind} · ${n} · ${i}`}function Iz({content:e,events:t,locale:n}){let r=e.turns.flatMap(e=>{let t=wz(e);return t===void 0?[]:[t]}),i=r.length===0?$(n,`—`,`—`):Cz(r.reduce((e,t)=>e+t,0)),a=Dz(t),o=Mz(e.turns)&&t.length>0,s=xz();return(0,M.jsxs)(`header`,{className:`niceeval-trace-toolbar`,role:`toolbar`,"aria-label":$(n,`Trajectory controls`,`轨迹控制`),children:[(0,M.jsxs)(`div`,{className:`niceeval-trace-toolbar-main`,children:[(0,M.jsx)(`span`,{className:`niceeval-trace-toolbar-title`,children:$(n,`Session log`,`会话日志`)}),(0,M.jsxs)(`div`,{className:`niceeval-trace-toolbar-actions`,children:[(0,M.jsxs)(`button`,{type:`button`,className:`niceeval-trace-toolbar-button niceeval-trace-toolbar-button--duration`,onClick:()=>s.setDuration(!s.duration),"aria-pressed":s.duration,disabled:!o,title:o?$(n,`Use turn-duration projection`,`按轮次时长投影`):$(n,`Turn timing is incomplete; sequence stays equal-width`,`轮次时长不完整;保持等宽顺序`),children:[(0,M.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,M.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.25`}),(0,M.jsx)(`path`,{d:`M8 4.75V8l2.25 1.5`})]}),(0,M.jsx)(`span`,{children:$(n,`Duration`,`时长`)}),(0,M.jsx)(`b`,{children:i})]}),(0,M.jsxs)(`button`,{type:`button`,className:`niceeval-trace-toolbar-button`,onClick:()=>s.setTurnsCollapsed(!s.turnsCollapsed),"aria-pressed":s.turnsCollapsed,title:$(n,`Collapse turns`,`折叠轮次`),children:[(0,M.jsx)(`span`,{className:`niceeval-trace-toolbar-glyph`,"aria-hidden":`true`,children:`⊟`}),(0,M.jsx)(`span`,{children:$(n,`Turns`,`轮次`)}),(0,M.jsx)(`b`,{children:e.turns.length})]}),(0,M.jsxs)(`button`,{type:`button`,className:`niceeval-trace-toolbar-button`,onClick:()=>s.setCallsCollapsed(!s.callsCollapsed),"aria-pressed":s.callsCollapsed,title:$(n,`Collapse tool calls`,`折叠工具调用`),disabled:a===0,children:[(0,M.jsx)(`span`,{className:`niceeval-trace-toolbar-glyph`,"aria-hidden":`true`,children:`⊟`}),(0,M.jsx)(`span`,{children:$(n,`Calls`,`调用`)}),(0,M.jsx)(`b`,{children:a})]})]})]}),(0,M.jsxs)(`label`,{className:`niceeval-trace-search`,children:[(0,M.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,M.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.25`}),(0,M.jsx)(`path`,{d:`m10.25 10.25 3 3`})]}),(0,M.jsx)(`span`,{className:`niceeval-trace-visually-hidden`,children:$(n,`Search trajectory`,`搜索轨迹`)}),(0,M.jsx)(`input`,{type:`search`,value:s.query,onChange:e=>s.setQuery(e.target.value),placeholder:$(n,`Search`,`搜索`),"aria-label":$(n,`Search trajectory`,`搜索轨迹`)})]})]})}function Lz({content:e,events:t,locale:n}){let r=Nz(e.turns,t),i=Mz(e.turns),a=xz(),o=t.filter((e,n)=>n===0||t[n-1]?.turn.key!==e.turn.key);return(0,M.jsxs)(`section`,{className:`niceeval-trace-timeline`,"aria-label":$(n,`Trajectory timeline`,`轨迹时间线`),"data-timing-complete":i?`true`:void 0,children:[(0,M.jsxs)(`div`,{className:`niceeval-trace-timeline-plot`,children:[(0,M.jsxs)(`div`,{className:`niceeval-trace-timeline-labels`,"aria-hidden":`true`,children:[(0,M.jsx)(`span`,{children:$(n,`Input / User`,`输入 / 用户`)}),(0,M.jsx)(`span`,{children:$(n,`Model / Assistant`,`模型 / 助手`)}),(0,M.jsx)(`span`,{children:$(n,`Tools / Tool`,`工具 / 工具`)})]}),(0,M.jsxs)(`svg`,{className:`niceeval-trace-timeline-track`,viewBox:`0 0 100 50`,preserveAspectRatio:`none`,"aria-hidden":t.length===0?`true`:void 0,children:[t.length===0?(0,M.jsx)(`text`,{className:`niceeval-trace-timeline-empty`,x:`50`,y:`25`,textAnchor:`middle`,dominantBaseline:`middle`,children:$(n,`No captured events`,`没有已捕获事件`)}):null,(e=>(0,M.jsxs)(`g`,{className:`niceeval-trace-timeline-projection niceeval-trace-timeline-projection--${e}`,children:[o.map(t=>{let n=r.get(t.id);if(n===void 0)return null;let i=e===`sequence`?n.sequenceLeft:n.durationLeft;return(0,M.jsx)(`line`,{className:`niceeval-trace-timeline-boundary`,x1:i,x2:i,y1:`0`,y2:`50`,"aria-hidden":`true`},`${e}-boundary-${t.id}`)}),t.map(t=>{let i=r.get(t.id);if(i===void 0)return null;let o=e===`sequence`?i.sequenceLeft:i.durationLeft,s=e===`sequence`?i.sequenceWidth:i.durationWidth,c=Fz(t,n),l=t.entry.kind===`assistant`?`assistant: ${t.summary} · ${c}`:c;return(0,M.jsxs)(`g`,{className:`niceeval-trace-timeline-span`,role:`button`,tabIndex:0,onClick:()=>a.setSelected(a.selected===t.id?null:t.id),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&a.setSelected(a.selected===t.id?null:t.id)},"data-lane":t.lane,"data-failed":t.entry.failed?`true`:void 0,"aria-label":l,"aria-pressed":a.selected===t.id,children:[(0,M.jsx)(`title`,{children:l}),(0,M.jsx)(`rect`,{className:`niceeval-trace-timeline-span-geometry`,x:o,y:Pz(t.lane),width:s,height:`8`,rx:`1`})]},`${e}-event-${t.id}`)})]}))(a.duration?`duration`:`sequence`)]})]}),(0,M.jsx)(`p`,{className:`niceeval-trace-timeline-note`,children:i?$(n,`Duration projects captured turn durations; without per-event timestamps, events remain evenly sequenced within each turn.`,`时长模式投影已捕获的轮次时长;没有逐事件时间戳时,事件在轮次内保持等宽顺序。`):$(n,`Per-event timing was not captured, so the timeline uses equal-width sequence spans.`,`未捕获逐事件时长,因此时间线使用等宽顺序跨度。`)})]})}function Rz({event:e,locale:t}){let n=e.entry.detail===void 0?null:IL(e.entry.detail,t),r=wz(e.turn),i=xz(),[a,o]=(0,v.useState)(`preview`);return(0,M.jsxs)(`details`,{className:`niceeval-trace-evidence`,open:i.selected===e.id,children:[(0,M.jsx)(`summary`,{children:$(t,`Evidence`,`证据`)}),(0,M.jsxs)(`div`,{className:`niceeval-trace-evidence-body`,children:[(0,M.jsxs)(`dl`,{className:`niceeval-trace-evidence-meta`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:$(t,`Source`,`来源`)}),(0,M.jsx)(`dd`,{children:WI(e.turn.label,t)})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:$(t,`Status`,`状态`)}),(0,M.jsx)(`dd`,{children:Oz(e.entry,t)})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:$(t,`Total duration`,`总时长`)}),(0,M.jsx)(`dd`,{children:r===void 0?$(t,`Not recorded`,`未记录`):Cz(r)})]}),e.entry.callPhase===void 0?null:(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:$(t,`Call phase`,`调用阶段`)}),(0,M.jsx)(`dd`,{children:e.entry.callPhase})]}),e.entry.callId===void 0?null:(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:$(t,`Call ID`,`调用 ID`)}),(0,M.jsx)(`dd`,{children:e.entry.callId})]}),e.entry.toolOccurrence?.state===`unavailable`?(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:$(t,`Tool occurrence`,`工具调用身份`)}),(0,M.jsxs)(`dd`,{children:[$(t,`Unavailable`,`不可用`),` · `,e.entry.toolOccurrence.reason]})]}):null,e.entry.commandMatch===void 0?null:e.entry.commandMatch.state===`matched`?(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:$(t,`Command`,`命令`)}),(0,M.jsx)(`dd`,{children:e.entry.commandMatch.commandId})]}):(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:$(t,`Command`,`命令`)}),(0,M.jsxs)(`dd`,{children:[$(t,`Unavailable`,`不可用`),` · `,e.entry.commandMatch.reason]})]})]}),(0,M.jsxs)(`div`,{className:`niceeval-trace-evidence-tabs`,role:`tablist`,"aria-label":$(t,`Record detail tabs`,`记录详情标签`),children:[(0,M.jsx)(`button`,{type:`button`,role:`tab`,onClick:()=>o(`preview`),onKeyDown:Hz,"aria-selected":a===`preview`,children:$(t,`Preview`,`预览`)}),(0,M.jsx)(`button`,{type:`button`,role:`tab`,onClick:()=>o(`raw`),onKeyDown:Hz,"aria-selected":a===`raw`,children:$(t,`Raw`,`原始`)})]}),(0,M.jsxs)(`section`,{className:`niceeval-trace-evidence-panel`,hidden:a!==`preview`,role:`tabpanel`,"aria-label":$(t,`Preview`,`预览`),children:[(0,M.jsx)(`h4`,{children:$(t,`Preview`,`预览`)}),n===null?(0,M.jsx)(`pre`,{className:`niceeval-trace-evidence-raw`,children:e.raw}):(0,M.jsx)(`div`,{className:`niceeval-trace-evidence-detail`,children:n})]}),(0,M.jsxs)(`section`,{className:`niceeval-trace-evidence-panel`,hidden:a!==`raw`,role:`tabpanel`,"aria-label":$(t,`Raw`,`原始`),children:[(0,M.jsx)(`h4`,{children:$(t,`Raw`,`原始`)}),(0,M.jsx)(`pre`,{className:`niceeval-trace-evidence-raw`,children:e.raw})]})]})]})}function zz({event:e,locale:t}){let n=WI(e.turn.label,t),r=wz(e.turn),i=Oz(e.entry,t),a=xz(),o=a.callsCollapsed&&e.toolLike||a.query!==``&&!`${e.entry.kind} ${e.summary} ${e.raw}`.toLocaleLowerCase().includes(a.query.toLocaleLowerCase());return(0,M.jsxs)(`article`,{hidden:o,className:Sz(`niceeval-trace-event-row`,e.toolLike&&`niceeval-trace-event-row--tool`,e.entry.failed&&`niceeval-trace-event-row--failed`),id:`trace-${e.entry.anchor}`,"data-tool-row":e.toolLike?`true`:void 0,"data-call-outcome":e.entry.callOutcome,children:[(0,M.jsx)(`span`,{className:`niceeval-trace-event-turn-rail`,"aria-hidden":`true`}),(0,M.jsxs)(`button`,{type:`button`,className:`niceeval-trace-event-select`,onClick:()=>a.setSelected(a.selected===e.id?null:e.id),"aria-pressed":a.selected===e.id,"aria-expanded":a.selected===e.id,"aria-label":`${e.entry.kind}: ${e.summary||$(t,`captured event`,`已捕获事件`)}`,children:[(0,M.jsx)(`span`,{className:`niceeval-trace-event-kind`,"data-lane":e.lane,children:e.entry.kind}),(0,M.jsx)(`span`,{className:`niceeval-trace-event-summary`,children:e.summary||`—`}),(0,M.jsx)(`span`,{className:`niceeval-trace-event-meta`,title:r===void 0?$(t,`Turn timing not recorded`,`未记录轮次时长`):`${n} · ${Cz(r)}`,children:r===void 0?`—`:Cz(r)}),(0,M.jsx)(`span`,{className:`niceeval-trace-event-status`,"data-call-outcome":e.entry.callOutcome,children:i})]}),(0,M.jsx)(Rz,{event:e,locale:t})]})}function Bz({turn:e,events:t,locale:n}){let r=wz(e),i=Dz(t),a=t.some(e=>e.entry.failed===!0),o=xz(),[s,c]=(0,v.useState)(!1),l=o.turnsCollapsed||s;return(0,M.jsxs)(`section`,{className:Sz(`niceeval-trace-turn`,e.verdict&&`niceeval-trace-turn--${e.verdict}`,a&&`niceeval-trace-turn--failed-events`),"data-collapsed":l,children:[(0,M.jsx)(`header`,{className:`niceeval-trace-turn-head niceeval-conversation-turn-head`,children:(0,M.jsxs)(`button`,{type:`button`,className:`niceeval-trace-turn-toggle`,onClick:()=>c(!s),"aria-expanded":!l,title:$(n,`Collapse turn`,`折叠轮次`),children:[(0,M.jsx)(`span`,{className:`niceeval-trace-turn-chevron`,"aria-hidden":`true`,children:`⌄`}),(0,M.jsx)(`span`,{className:`niceeval-trace-turn-label`,children:WI(e.label,n)}),(0,M.jsxs)(`span`,{className:`niceeval-trace-turn-facts`,children:[r===void 0?$(n,`timing unavailable`,`时长不可用`):Cz(r),(0,M.jsxs)(`span`,{children:[t.length,` `,$(n,`events`,`事件`)]}),i>0?(0,M.jsxs)(`span`,{children:[i,` `,$(n,`calls`,`调用`)]}):null]}),e.verdict?(0,M.jsx)(`span`,{className:`niceeval-trace-turn-verdict`,children:e.verdict}):null]})}),(0,M.jsx)(`div`,{className:`niceeval-trace-turn-events`,hidden:l,children:t.length===0?(0,M.jsx)(`p`,{className:`niceeval-trace-empty-turn`,children:$(n,`No events captured for this turn.`,`此轮没有已捕获事件。`)}):t.map(e=>(0,M.jsx)(zz,{event:e,locale:n},e.id))})]})}function Vz({data:e,locale:t,className:n}){let[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(null);if(e===null||e.turns.length===0)return null;let p=jz(e,t),m={duration:r,setDuration:i,turnsCollapsed:a,setTurnsCollapsed:o,callsCollapsed:s,setCallsCollapsed:c,query:l,setQuery:u,selected:d,setSelected:f};return(0,M.jsx)(bz.Provider,{value:m,children:(0,M.jsxs)(`section`,{className:Sz(`niceeval-report`,`niceeval-turn-trace`,n),"data-duration-mode":r?`duration`:`sequence`,onKeyDown:e=>{e.key===`Escape`&&f(null)},children:[(0,M.jsx)(Iz,{content:e,events:p,locale:t}),(0,M.jsx)(Lz,{content:e,events:p,locale:t}),(0,M.jsx)(`div`,{className:`niceeval-trace-ledger`,children:e.turns.map((e,n)=>(0,M.jsx)(Bz,{turn:e,events:p.filter(e=>e.turnIndex===n),locale:t},e.key))})]})})}function Hz(e){if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;let t=[...e.currentTarget.parentElement?.querySelectorAll(`[role=tab]`)??[]],n=t.indexOf(e.currentTarget);n<0||t.length===0||(e.preventDefault(),t[(n+(e.key===`ArrowRight`?1:-1)+t.length)%t.length]?.focus())}var Uz=/(\/\/[^\n]*)|(\/\*[^]*?\*\/)|(`(?:\\.|[^`\\])*`|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')|\b(import|from|export|default|const|let|var|async|await|function|return|if|else|for|of|in|new|class|extends|typeof|void|true|false|null|undefined)\b|\b(\d[\d_.]*)\b|([A-Za-z_$][\w$]*)(?=\s*\()/g;function Wz(e){let t=[],n=0,r=0,i;for(Uz.lastIndex=0;i=Uz.exec(e);){i.index>n&&t.push(e.slice(n,i.index));let a=i[1]||i[2]?`tok-comment`:i[3]?`tok-str`:i[4]?`tok-kw`:i[5]?`tok-num`:`tok-fn`;t.push((0,M.jsx)(`span`,{className:a,children:i[0]},r++)),n=i.index+i[0].length,i[0].length===0&&Uz.lastIndex++}return n<e.length&&t.push(e.slice(n)),t}function Gz(e,t){return e.kind===`assertion`?(0,M.jsx)(yz,{content:e.content,label:e.label,state:e.state,locale:t}):e.kind===`turn-trace`?(0,M.jsx)(Vz,{data:e.data,locale:t}):(0,M.jsx)(`div`,{className:GI(`niceeval-report`,`niceeval-text`,e.className),children:e.text})}function Kz(e,t){if(!KI(e))return`"${t}" must be an object`;if(typeof e.sourceItemId!=`string`)return`"${t}.sourceItemId" must be a string`;if(typeof e.sha256!=`string`)return`"${t}.sha256" must be a string`;if(typeof e.path!=`string`)return`"${t}.path" must be a string`;if(!Array.isArray(e.lines))return`"${t}.lines" must be an array`;for(let n=0;n<e.lines.length;n++){let r=e.lines[n];if(!KI(r))return`"${t}.lines[${n}]" must be an object`;if(typeof r.number!=`number`)return`"${t}.lines[${n}].number" must be a number`;if(typeof r.text!=`string`)return`"${t}.lines[${n}].text" must be a string`;if(r.interaction!==void 0&&r.interaction!==`send`)return`"${t}.lines[${n}].interaction" must be send`;if(r.turnIds!==void 0&&(!Array.isArray(r.turnIds)||r.turnIds.some(e=>typeof e!=`string`)))return`"${t}.lines[${n}].turnIds" must be an array of strings`;if(r.pill!==void 0&&!qI(r.pill))return`"${t}.lines[${n}].pill" must be a LocalizedText`}return null}function qz(e){if(e==null)return null;if(!KI(e))throw JI(`SourceView`,`sourceViewData`,`SourceContent`,`"data" must be an object or null`);let t=Kz(e.spine,`data.spine`);if(t!==null)throw JI(`SourceView`,`sourceViewData`,`SourceContent`,t);if(!Array.isArray(e.detached))throw JI(`SourceView`,`sourceViewData`,`SourceContent`,`"data.detached" must be an array`);for(let t=0;t<e.detached.length;t++){let n=Kz(e.detached[t],`data.detached[${t}]`);if(n!==null)throw JI(`SourceView`,`sourceViewData`,`SourceContent`,n)}return e}function Jz(e){return e.aborted?`gate-fail`:e.tone}function Yz(e){if(e)return`niceeval-source-line--${e}`}var Xz={send:(0,M.jsx)(`path`,{d:`M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z`}),passed:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,M.jsx)(`path`,{d:`m9 12 2 2 4-4`})]}),"gate-fail":(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,M.jsx)(`path`,{d:`m15 9-6 6`}),(0,M.jsx)(`path`,{d:`m9 9 6 6`})]}),"soft-fail":(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,M.jsx)(`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`}),(0,M.jsx)(`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`})]}),unavailable:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,M.jsx)(`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}),(0,M.jsx)(`path`,{d:`M12 17h.01`})]})},Zz={send:`send`,passed:`passed`,"gate-fail":`failed`,"soft-fail":`mismatched`,unavailable:`unavailable`};function Qz({line:e}){let t=e.interaction===`send`?`send`:Jz(e);return t===void 0?(0,M.jsx)(`span`,{className:`niceeval-source-gutter`,children:e.number}):(0,M.jsx)(`span`,{className:`niceeval-source-gutter niceeval-source-gutter-mark`,role:`img`,"aria-label":Zz[t],title:Zz[t],children:(0,M.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:Xz[t]})})}function $z({line:e,locale:t}){return(0,M.jsxs)(`span`,{className:`niceeval-source-line-summary`,children:[(0,M.jsx)(Qz,{line:e}),(0,M.jsx)(`span`,{className:`niceeval-source-code`,children:Wz(e.text)}),(0,M.jsxs)(`span`,{className:`niceeval-source-meta`,children:[e.pill===void 0?null:(0,M.jsx)(`span`,{className:`niceeval-source-pill`,children:WI(e.pill,t)}),e.aborted?(0,M.jsx)(`span`,{className:`niceeval-source-abort-mark`,"aria-hidden":`true`,children:`⤓`}):null]})]})}function eB({calls:e,locale:t,renderChild:n}){return(0,M.jsx)(`div`,{className:`niceeval-source-calls`,children:e.map((e,r)=>(0,M.jsxs)(`details`,{className:GI(`niceeval-source-call`,e.tone&&`niceeval-source-call--${e.tone}`),open:e.open,children:[(0,M.jsx)(`summary`,{children:WI(e.summary,t)}),e.target.kind===`opaque`?(0,M.jsxs)(`div`,{className:`niceeval-source-opaque`,children:[(0,M.jsx)(`div`,{className:`niceeval-source-opaque-label`,children:WI(e.target.label,t)}),e.target.calls?(0,M.jsx)(eB,{calls:e.target.calls,locale:t,renderChild:n}):null]}):(0,M.jsx)(tB,{block:e.target.block,locale:t,renderChild:n,nested:!0})]},r))})}function tB({block:e,locale:t,renderChild:n,nested:r=!1}){let i=e.lines.find(e=>e.tone===`gate-fail`||e.tone===`soft-fail`||e.tone===`unavailable`)?.number,a=!1;return(0,M.jsxs)(`div`,{className:GI(`niceeval-source-block`,r&&`niceeval-source-block--nested`),children:[(0,M.jsx)(`div`,{className:`niceeval-source-block-path`,children:e.path}),(0,M.jsx)(`div`,{className:`niceeval-source-lines`,children:e.lines.map(e=>{let r=a;e.aborted&&(a=!0);let o=e.details!==void 0&&e.details.length>0||e.calls!==void 0&&e.calls.length>0,s=GI(`niceeval-source-line`,e.interaction===`send`&&`niceeval-source-line--send`,Yz(Jz(e)),r&&`niceeval-source-line-unreached`);return o?(0,M.jsxs)(`details`,{className:s,open:e.interaction!==`send`&&e.number===i,children:[(0,M.jsx)(`summary`,{children:(0,M.jsx)($z,{line:e,locale:t})}),(0,M.jsxs)(`div`,{className:`niceeval-source-line-detail`,children:[e.details?.map((e,t)=>(0,M.jsx)(`div`,{children:n(e)},t)),e.calls?(0,M.jsx)(eB,{calls:e.calls,locale:t,renderChild:n}):null]})]},e.number):(0,M.jsx)(`div`,{className:s,children:(0,M.jsx)($z,{line:e,locale:t})},e.number)})})]})}function nB({data:e,locale:t,className:n}){let r=qz(e??null);if(r===null)return null;let i=e=>Gz(e,t);return(0,M.jsxs)(`div`,{className:GI(`niceeval-report`,`niceeval-source-view`,n),children:[(0,M.jsx)(tB,{block:r.spine,locale:t,renderChild:i}),r.detached.map(e=>(0,M.jsx)(tB,{block:e,locale:t,renderChild:i},e.path)),r.unmapped&&r.unmapped.length>0?(0,M.jsx)(`div`,{className:`niceeval-source-unmapped`,children:r.unmapped.map((e,t)=>(0,M.jsx)(`div`,{children:i(e)},t))}):null]})}var rB=`—`;function iB(e){return e===null?rB:ZI(e)}function aB(e,t,n){let r=Math.max(n,1),i=Math.min(r,Math.max(0,e));return{x:i,width:Math.min(r-i,Math.max(t,r/1e3))}}function oB(e){return e.reduce((e,t)=>e+1+oB(t.children??[]),0)}function sB(e,t=[]){for(let n of e){let e=n.children??[];e.length===0?t.push(n):sB(e,t)}return t}var cB=5;function lB(e){let t=0;for(let n=0;n<e.length;n++)t=Math.imul(t,31)+e.charCodeAt(n)>>>0;return t%cB}function uB(e){return e.reduce((e,t)=>e+ +!!t.failed+uB(t.children??[]),0)}var dB=.01,fB=3,pB=2;function mB(e,t){return!!e.failed||!!e.open||e.durationMs===null||e.durationMs>=t*dB}function hB(e){return!e.failed&&!e.open&&e.durationMs!==null}function gB(e,t){if(t===null||t<=0)return e.map(e=>({kind:`node`,node:e}));let n=[];for(let r of e){if(mB(r,t)){n.push({kind:`node`,node:r});continue}let e=n[n.length-1];e!==void 0&&e.kind===`fold`?e.nodes.push(r):n.push({kind:`fold`,nodes:[r]})}return n.map(e=>e.kind===`fold`&&e.nodes.length<pB?{kind:`node`,node:e.nodes[0]}:e)}function _B(e,t){let n=[],r=[],i=null,a=()=>{if(r.length>=fB)n.push({kind:`repeat`,nodes:r});else for(let e of r)n.push({kind:`node`,node:e});r=[],i=null};for(let o of e){if(o.kind===`node`&&hB(o.node)){let e=`${o.node.kind}\u0000${WI(o.node.label,t)}`;e!==i&&a(),i=e,r.push(o.node);continue}a(),n.push(o)}return a(),n}function vB(e,t,n){return _B(gB(e,t),n)}function yB(e){let t=new Map;for(let n of e)t.set(n.kind,(t.get(n.kind)??0)+1);return[...t.entries()].map(([e,t])=>`${e} ×${t}`).join(` · `)}function bB(e,t){return`${WI(e[0].label,t)} ×${e.length}`}function xB(e,t){let n=e.reduce((e,t)=>e+(t.durationMs??0),0);return t===`zh-CN`?`合计 ${ZI(n)}`:`total ${ZI(n)}`}function SB(e,t,n){return e===`zh-CN`?t===`nodes`?`${n} 个节点`:`${n} 个失败节点`:`${n} ${t===`nodes`?`node`:`failed node`}${n===1?``:`s`}`}function CB({nodes:e,locale:t,rowDurationMs:n,className:r=`niceeval-waterfall-nodes`}){return(0,M.jsx)(`ul`,{className:r,children:vB(e,n,t).map(e=>e.kind===`node`?(0,M.jsx)(wB,{node:e.node,locale:t,rowDurationMs:n},e.node.key):(0,M.jsx)(`li`,{children:(0,M.jsxs)(`details`,{className:`niceeval-waterfall-fold`,children:[(0,M.jsxs)(`summary`,{className:`niceeval-waterfall-node niceeval-waterfall-fold-summary`,children:[(0,M.jsx)(`span`,{className:`niceeval-waterfall-node-name`,children:e.kind===`fold`?yB(e.nodes):bB(e.nodes,t)}),(0,M.jsx)(`span`,{className:`niceeval-waterfall-node-dur`,children:xB(e.nodes,t)})]}),(0,M.jsx)(`ul`,{className:`niceeval-waterfall-node-children`,children:e.nodes.map(e=>(0,M.jsx)(wB,{node:e,locale:t,rowDurationMs:n},e.key))})]})},`${e.kind}:${e.nodes[0].key}`))})}function wB({node:e,locale:t,rowDurationMs:n}){let r=WI(e.label,t),i=e.children??[],a=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`niceeval-waterfall-node-kind`,children:e.kind}),(0,M.jsx)(`span`,{className:`niceeval-waterfall-node-name`,title:r,children:r}),e.failed?(0,M.jsx)(`span`,{className:`niceeval-waterfall-node-failed`,children:`✗`}):null,(0,M.jsx)(`span`,{className:`niceeval-waterfall-node-dur`,children:iB(e.durationMs)})]});return i.length===0?(0,M.jsx)(`li`,{className:GI(`niceeval-waterfall-node`,e.failed&&`niceeval-waterfall-node--failed`),children:a}):(0,M.jsx)(`li`,{children:(0,M.jsxs)(`details`,{open:!!e.failed||!!e.open,children:[(0,M.jsx)(`summary`,{className:GI(`niceeval-waterfall-node`,e.failed&&`niceeval-waterfall-node--failed`),children:a}),(0,M.jsx)(CB,{nodes:i,locale:t,rowDurationMs:n,className:`niceeval-waterfall-node-children`})]})})}function TB(e,t,n,r){return(0,M.jsxs)(`section`,{className:GI(`niceeval-report`,`niceeval-waterfall`,r),children:[n===void 0?null:(0,M.jsx)(`div`,{className:`niceeval-waterfall-title`,children:WI(n,t)}),(0,M.jsx)(`ul`,{className:`niceeval-waterfall-list`,children:e.map(e=>{let n=oB(e.nodes),r=uB(e.nodes),i=sB(e.nodes),a=WI(e.label,t),o=e.locator!==void 0&&a===String(e.locator);return(0,M.jsxs)(`li`,{className:`niceeval-waterfall-row`,children:[(0,M.jsxs)(`div`,{className:`niceeval-waterfall-head`,children:[e.locator===void 0?null:e.href===void 0?(0,M.jsx)(`span`,{className:`niceeval-locator`,children:e.locator}):(0,M.jsx)(`a`,{className:`niceeval-locator`,href:e.href,children:e.locator}),o?null:(0,M.jsx)(`span`,{className:`niceeval-waterfall-label`,children:a}),(0,M.jsx)(`span`,{className:`niceeval-waterfall-duration`,children:iB(e.durationMs)}),(0,M.jsx)(`span`,{className:`niceeval-waterfall-count`,children:SB(t,`nodes`,n)}),r>0?(0,M.jsxs)(`span`,{className:`niceeval-waterfall-failed`,children:[`✗ `,SB(t,`failed`,r)]}):null]}),e.durationMs!==null&&i.some(e=>e.durationMs!==null)?(0,M.jsx)(`svg`,{className:`niceeval-waterfall-track`,viewBox:`0 0 ${Math.max(e.durationMs,1)} 1`,preserveAspectRatio:`none`,children:i.map(n=>{if(n.durationMs===null)return null;let r=aB(n.startOffsetMs,n.durationMs,e.durationMs);return(0,M.jsx)(`rect`,{className:GI(`niceeval-waterfall-bar`,`niceeval-span-kind-${lB(n.kind)}`,n.failed&&`niceeval-span-failed`),x:r.x,y:.15,width:r.width,height:.7,children:(0,M.jsx)(`title`,{children:`${WI(n.label,t)} · ${ZI(n.durationMs)}${n.failed?` · ✗`:``}`})},n.key)})}):null,e.nodes.length>0?(0,M.jsx)(CB,{nodes:e.nodes,locale:t,rowDurationMs:e.durationMs}):null]},e.key)})})]})}function EB({nodes:e,locale:t,title:n,className:r}){let i=e??null;return i===null||i.length===0?null:TB(i,t,n,r)}function DB({children:e,className:t}){return(0,M.jsx)(`div`,{className:GI(`niceeval-report`,`niceeval-col`,t),children:v.Children.toArray(e)})}function OB({children:e,className:t}){let n=v.Children.toArray(e);return(0,M.jsx)(`div`,{className:`niceeval-report niceeval-grid-fit`,children:(0,M.jsx)(`div`,{className:GI(`niceeval-report`,`niceeval-grid`,t),"data-cells":n.length,children:n.map((e,t)=>(0,M.jsx)(`div`,{className:`niceeval-grid-cell`,children:e},t))})})}function kB({cell:e}){return e===void 0||e.kind===`notApplicable`?`—`:e.kind===`verdict`?(0,M.jsx)(`span`,{className:GI(`niceeval-verdict-pill`,`niceeval-verdict-${e.verdict}`),children:e.verdict}):e.text}function AB({data:e,locale:t,className:n}){return e===null||e.rows.length===0||e.columns.length===0?null:(0,M.jsxs)(`table`,{className:GI(`niceeval-report`,`niceeval-table`,n),children:[(0,M.jsx)(`thead`,{children:(0,M.jsx)(`tr`,{children:e.columns.map(e=>(0,M.jsx)(`th`,{scope:`col`,children:WI(e.header,t)},e.key))})}),(0,M.jsx)(`tbody`,{children:e.rows.map(t=>(0,M.jsx)(`tr`,{children:e.columns.map(e=>(0,M.jsx)(`td`,{children:(0,M.jsx)(kB,{cell:t.cells[e.key]})},e.key))},t.key))})]})}function jB(e){return zB(e.map(e=>BV(e,`assertion`))).slice}function MB(e,t,n){return yV(BV(e,`trace`),t,n)}function NB(e,t,n){return CV(BV(e,`trace`),t,n)}function PB(e){return wV(BV(e,`trace`))}function FB(e,t){return xV(BV(e,`timing`),t).slice}function IB(e,t){return SV(BV(t,`trace`),BV(e,`usage`))}function LB(e,t,n){return TV(BV(e,`sources`),BV(t,`trace`),n).slice}function RB(e){return EV(BV(e,`diff`))}function zB(e){let t=e.flatMap(e=>{try{return[BB(e)]}catch{return[]}}),n=t.filter(e=>e.display.outcome!==`passed`||e.score!==void 0),r=t.filter(e=>e.display.outcome===`passed`&&e.score===void 0),i=new Map;for(let e of r){let t=e.display.groupPath.join(` > `)||`Passed checks`,n=i.get(t)??[];n.push(e),i.set(t,n)}let a=t.flatMap(({score:e})=>e===void 0?[]:[e]),o=Object.freeze({attention:Object.freeze(n),passedGroups:Object.freeze([...i].map(([e,t])=>Object.freeze({group:e,items:Object.freeze(t)}))),evaluationKind:a.length===0?`pass`:`points`});return Object.freeze({data:o,slice:Object.freeze({state:`available`,data:o})})}function BB(e){let t=BV(e,`entry`),n=BV(e,`display`),r=BV(t,`decision`),i=BV(t,`evaluation`),a=HV(t.contribution)??HV(r.contribution),o=BV(t,`criterion`),s=BV(t,`materials`),c=HV(t.judgeMaterial),l=HV(t.scoreMatchAudit),u=HV(HV(t.policy)?.condition),d=kV(r.result),f=UV(e,`sourceSites`).flatMap(e=>{let t=HV(e),n=HV(t?.source),r=HV(t?.start),i=HV(t?.end);return t===void 0||n===void 0||r===void 0||i===void 0||typeof t.entryId!=`string`||typeof t.sourceOrder!=`number`||typeof t.role!=`string`||typeof n.sourceItemId!=`string`||typeof n.sha256!=`string`||typeof r.line!=`number`||typeof r.column!=`number`||typeof i.line!=`number`||typeof i.column!=`number`?[]:[Object.freeze({entryId:t.entryId,sourceOrder:t.sourceOrder,role:t.role,source:n,start:Object.freeze({line:r.line,column:r.column}),end:Object.freeze({line:i.line,column:i.column})})]}),p=f.map(e=>{let t=VV(e.source,`assertion.sourceSites[].source`);return Object.freeze({...e,target:Object.freeze({state:`exact`,sourceItemId:WV(t,`sourceItemId`),sha256:WV(t,`sha256`)})})}),m=VB(BV(e,`check`)),h=BV(e,`matcher`),g=vV(h),_=$B(h.debugger),v=HB(o),y=WB(i,g),b=UB(u),x=KB(t,m),S=GB(s,c,l),C=Object.freeze({entryId:WV(e,`entryId`),display:Object.freeze({...typeof n.key==`string`?{key:n.key}:{},...typeof n.label==`string`?{label:n.label}:{},groupPath:Object.freeze(GV(n.groupPath))}),entry:t,sourceSites:Object.freeze(f),check:m,matcher:g}),w=typeof n.label==`string`?n.label:typeof n.key==`string`?n.key:C.entryId,T=OV(a),E=r.gate,D=d===`matched`?`passed`:d===`mismatched`||d===`errored`?`failed`:`unavailable`;return Object.freeze({entryId:C.entryId,closed:C,display:Object.freeze({name:w,severity:E===`failed`||E===`unavailable`?`gate`:T===void 0?`recorded`:`scored`,outcome:D,groupPath:C.display.groupPath,detail:typeof r.reason==`string`?r.reason:``}),sourceSites:Object.freeze(p),check:v,decision:Object.freeze({result:d,observed:y,expected:b,diagnosticTree:x,...typeof r.reason==`string`?{reason:r.reason}:{}}),evidence:Object.freeze({source:S,check:v,observed:y,expected:b,explanation:x,..._===void 0?{}:{matcherDebugger:_}}),...T===void 0?{}:{score:T},retained:Object.freeze({matcher:g})})}function VB(e){return Object.freeze({label:WV(e,`label`),state:WV(e,`state`),expected:XV(e.expected),observed:XV(e.observed),reason:JV(e.reason),anchor:XV(e.anchor),children:Object.freeze(UV(e,`children`).map((e,t)=>VB(VV(e,`check.children[${t}]`))))})}function HB(e){return e.state===`available`?PV(e.value):Object.freeze({kind:`unavailable`,reason:`not-recorded`})}function UB(e){return e?.state===`available`?PV(e.value):Object.freeze({kind:`unavailable`,reason:`not-recorded`})}function WB(e,t){let n=NV(e.observed),r=e.kind===`ordinary`?e.receipt:e.kind===`matcher-current`&&!Array.isArray(t.comparator)?t.receipt:void 0;return MV([...n.kind===`fields`?n.fields:[{label:`value`,value:n}],...r==null?[]:[{label:`receipt`,value:PV(r)}]])}function GB(e,t,n){let r=ZB(BV(e,`source`)),i=UV(e,`evidence`).map((e,t)=>ZB(VV(e,`materials.evidence[${t}]`))),a=UV(e,`limitations`).map(PV);return MV([{label:`input`,value:r},...t===void 0?[]:[{label:`judge material`,value:PV(t)}],...n===void 0?[]:[{label:`model evaluation`,value:PV(n)}],...i.length===0?[]:[{label:`evidence`,value:Object.freeze({kind:`list`,items:Object.freeze(i)})}],{label:`coverage`,value:PV(e.coverage)},...a.length===0?[]:[{label:`limitations`,value:Object.freeze({kind:`list`,items:Object.freeze(a)})}]])}function KB(e,t){let n=BV(e,`explanationRetention`);if(n.state===`retained`){let e=JB(NV(n.value));if(e.kind!==`fields`)return YB(t);let r=new Set(e.fields.map(e=>e.label));return MV([...e.fields,...!r.has(`expected`)&&t.expected!==null?[{label:`expected`,value:qB(t.expected)}]:[],...!r.has(`received`)&&t.observed!==null?[{label:`received`,value:qB(t.observed)}]:[],...!r.has(`reason`)&&t.reason!==null?[{label:`reason`,value:jV(t.reason)}]:[]])}return YB(t)}function qB(e){let t=HV(e);return t!==void 0&&(t.kind===`unavailable`||t.kind===`value`||t.kind===`text`||t.kind===`list`||t.kind===`fields`)?NV(e):PV(e)}function JB(e){if(e.kind===`list`)return Object.freeze({kind:`list`,items:Object.freeze(e.items.map(JB))});if(e.kind!==`fields`)return e;let t=new Set(e.fields.map(e=>e.label));return MV(e.fields.map(e=>({label:e.label===`observed`&&!t.has(`received`)?`received`:e.label===`message`&&!t.has(`reason`)?`reason`:e.label,value:JB(e.value)})))}function YB(e){let t=HV(e.anchor),n=typeof t?.id==`string`?t.id:typeof t?.toolOccurrenceId==`string`?t.toolOccurrenceId:typeof t?.eventId==`string`?t.eventId:void 0;return MV([{label:`code`,value:jV(e.label)},...e.expected===null?[]:[{label:`expected`,value:qB(e.expected)}],...e.observed===null?[]:[{label:`received`,value:qB(e.observed)}],...e.reason===null?[]:[{label:`reason`,value:jV(e.reason)}],...n===void 0?[]:[{label:`locator`,value:MV([{label:`id`,value:jV(n)}])}],{label:`children`,value:Object.freeze({kind:`list`,items:Object.freeze(e.children.map((e,t)=>MV([{label:`index`,value:jV(t)},{label:`label`,value:jV(e.label)},{label:`state`,value:jV(XB(e.state))},{label:`diagnostic`,value:YB(e)}])))})}])}function XB(e){return e===`matched`||e===`mismatched`?e:`unavailable`}function ZB(e){if(e.kind===`snapshot`)return PV(e.value);if(e.kind===`unavailable`)return Object.freeze({kind:`unavailable`,reason:`not-recorded`});if(e.kind!==`content`)throw Error(`Assertion material kind is invalid`);let t=BV(e,`content`);if(t.state!==`available`||typeof t.base64!=`string`)throw Error(`Assertion material content is unavailable`);let n=QB(t.base64);return e.encoding===`json`?PV(JSON.parse(n)):e.encoding===`utf-8`?Object.freeze({kind:`text`,text:n}):PV({encoding:e.encoding,byteLength:e.byteLength,preview:e.preview})}function QB(e){let t=globalThis.atob(e),n=Uint8Array.from(t,e=>e.charCodeAt(0));return new TextDecoder(`utf-8`,{fatal:!0}).decode(n)}function $B(e){if(e==null)return;let t=VV(e,`matcher.debugger`),n=uV(t.state),r=dV(t.subject),i=BV(t,`source`),a=eV(BV(i,`final`));if(n===`legacy`)return Object.freeze({state:n,queryKind:`unavailable`,subject:r,querySummary:`Matcher query was not retained`,facts:Object.freeze([]),atEvaluation:Object.freeze({state:a.state,rows:Object.freeze(a.rows.map(e=>e.content))}),afterEvaluation:Object.freeze([]),relationNotice:`historical-not-recorded`});let o=BV(t,`query`),s=fV(o.kind),c=Object.freeze(s===`collection-filter`?[NV(o.summary)]:UV(o,`summaries`).map(NV)),l=s===`collection-filter`?iV(c[0]):c.map(aV).join(` → `),u=BV(t,`receipt`),d=eV(BV(i,`atEvaluation`)),f=lV(BV(t,`identityRelation`)),p=[...d.state===`partial`?[`source-partial`]:[],...t.overlayRetention===`partial`?[`overlay-partial`]:[],...d.state===`unavailable`?[`source-unavailable`]:[]].filter(e=>e!==f);return Object.freeze({state:n,queryKind:s,subject:r,querySummary:l,receipt:XV(u),sourceLedger:XV(i),facts:Object.freeze([Object.freeze({kind:`observed`,value:sV(s,c.length,u)}),Object.freeze({kind:`examined`,value:cV(s,u)})]),steps:Object.freeze(UV(t,`steps`).map(nV)),atEvaluation:Object.freeze({state:d.state,rows:Object.freeze(d.rows.map(e=>e.content)),...p.length===0?{}:{notices:Object.freeze(p)}}),afterEvaluation:Object.freeze(a.rows.filter(e=>e.phase===`outside-evaluation-snapshot`).map(e=>e.content)),...f===void 0?{}:{relationNotice:f}})}function eV(e){return Object.freeze({state:pV(e.state),rows:Object.freeze(UV(e,`rows`).map((e,t)=>tV(VV(e,`matcher.debugger.source.rows[${t}]`))))})}function tV(e){let t=BV(e,`evaluation`),n=hV(t.result),r=t.difference===void 0?void 0:rV(NV(t.difference)),i=HV(e.conversationTarget);return Object.freeze({phase:gV(e.phase),content:Object.freeze({key:WV(e,`rowId`),number:WV(e,`number`),kind:mV(e.kind),summary:WV(e,`summary`),state:n,fields:rV(NV(e.detail)),...r===void 0?{}:{difference:r},...i?.state===`exact`&&typeof i.anchor==`string`?{conversationTarget:Object.freeze({anchor:i.anchor})}:{}})})}function nV(e,t){let n=VV(e,`matcher.debugger.steps[${t}]`),r=HV(n.conversationTarget);return Object.freeze({step:qV(n,`step`),summary:FV(NV(n.summary)),state:_V(n.state),...typeof n.sourceRow==`string`?{sourceRow:n.sourceRow}:{},...r?.state===`exact`&&typeof r.anchor==`string`?{conversationTarget:Object.freeze({anchor:r.anchor})}:{}})}function rV(e){return e.kind===`fields`?Object.freeze(e.fields.map(e=>Object.freeze({label:e.label,value:FV(e.value)}))):e.kind===`list`?Object.freeze(e.items.map((e,t)=>Object.freeze({label:String(t+1),value:FV(e)}))):Object.freeze([Object.freeze({label:`value`,value:FV(e)})])}function iV(e){let t=oV(e,`matcher`),n=oV(e,`quantifier`),r=n===void 0?void 0:oV(n,`kind`),i=n===void 0?void 0:oV(n,`count`),a=t===void 0?void 0:FV(t);return a===void 0||a.length===0||r?.kind!==`value`||typeof r.value!=`string`?FV(e):r.value===`absent`?`none × ${a}`:i?.kind!==`value`||typeof i.value!=`number`?FV(e):r.value===`exact`?`exactly ${i.value} × ${a}`:r.value===`at-least`?`at least ${i.value} × ${a}`:r.value===`less-than`?`less than ${i.value} × ${a}`:r.value===`at-most`?`at most ${i.value} × ${a}`:r.value===`greater-than`?`greater than ${i.value} × ${a}`:FV(e)}function aV(e){let t=oV(e,`matcher`);if(t===void 0)return FV(e);let n=FV(t);return n.length===0?FV(e):n}function oV(e,t){return e.kind===`fields`?e.fields.find(e=>e.label===t)?.value:void 0}function sV(e,t,n){return e===`collection-filter`&&typeof n.matched==`number`&&typeof n.mismatched==`number`&&typeof n.unavailable==`number`?Object.freeze({en:`${n.matched} matched · ${n.mismatched} not matched · ${n.unavailable} unknown`,"zh-CN":`${n.matched} 条命中 · ${n.mismatched} 条未命中 · ${n.unavailable} 条无法判断`}):e===`ordered-sequence`&&typeof n.definitePrefixLength==`number`&&typeof n.possiblePrefixLength==`number`?Object.freeze({en:`${n.definitePrefixLength}/${t} definite · ${n.possiblePrefixLength}/${t} possible`,"zh-CN":`${n.definitePrefixLength}/${t} 步确定 · ${n.possiblePrefixLength}/${t} 步可能`}):Object.freeze({en:`unavailable`,"zh-CN":`不可用`})}function cV(e,t){if(e===`collection-filter`&&typeof t.examined==`number`){let e=typeof t.knownTotal==`number`?t.knownTotal:`?`;return Object.freeze({en:`${t.examined}/${e} rows`,"zh-CN":`${t.examined}/${e} 条记录`})}return e===`ordered-sequence`&&typeof t.sourceRows==`number`&&typeof t.comparisons==`number`?Object.freeze({en:`${t.sourceRows} rows · ${t.comparisons} comparisons`,"zh-CN":`${t.sourceRows} 条记录 · ${t.comparisons} 次比较`}):Object.freeze({en:`unavailable`,"zh-CN":`不可用`})}function lV(e){if(e.state!==`exact`)return e.reason===`ambiguous`?`ambiguous-relation`:`source-unavailable`}function uV(e){if(e===`current`||e===`legacy`)return e;throw Error(`matcher.debugger.state is invalid`)}function dV(e){if(e===`tool`||e===`event`||e===`source-row`)return e;throw Error(`matcher.debugger.subject is invalid`)}function fV(e){if(e===`collection-filter`||e===`ordered-sequence`)return e;throw Error(`matcher.debugger.query.kind is invalid`)}function pV(e){if(e===`complete`||e===`partial`||e===`unavailable`)return e;throw Error(`matcher.debugger source state is invalid`)}function mV(e){if(e===`tool`||e===`event`||e===`legacy-source-row`)return e;throw Error(`matcher.debugger row kind is invalid`)}function hV(e){if(e===`matched`||e===`mismatched`||e===`unavailable`||e===`not-evaluated`||e===`not-retained`||e===`outside-snapshot`||e===`legacy`)return e;throw Error(`matcher.debugger row state is invalid`)}function gV(e){if(e===`at-evaluation`||e===`outside-evaluation-snapshot`||e===`historical`)return e;throw Error(`matcher.debugger row phase is invalid`)}function _V(e){if(e===`matched`||e===`possible`||e===`blocked`||e===`not-reached`)return e;throw Error(`matcher.debugger step state is invalid`)}function vV(e){let t=UV(e,`targets`).flatMap(e=>{let t=HV(e),n=HV(t?.anchor);if(t===void 0||n===void 0||typeof t.state!=`string`)return[];let r;return n.kind===`tool-occurrence`&&typeof n.toolOccurrenceId==`string`?r={kind:`tool-occurrence`,toolOccurrenceId:n.toolOccurrenceId}:n.kind===`event`&&typeof n.eventId==`string`&&(r={kind:`event`,eventId:n.eventId}),r===void 0?[]:[Object.freeze({state:t.state,anchor:Object.freeze(r),difference:XV(t.difference),conversationAnchor:AV(r)})]}),n=HV(e.sandboxCommandJoin),r=n?.state===`matched`&&typeof n.commandId==`string`?{state:`matched`,commandId:n.commandId}:{state:`unavailable`,reason:typeof n?.reason==`string`?n.reason:`not-recorded`},i=e.state===`ordinary`||e.state===`legacy`||e.state===`available`||e.state===`missing`?e.state:`missing`;return Object.freeze({state:i,sourceState:typeof e.sourceState==`string`?e.sourceState:null,comparator:XV(e.comparator),sourceLedger:XV(e.sourceLedger),receipt:XV(e.receipt),result:XV(e.result),targets:Object.freeze(t),sandboxCommandJoin:r,commandMatch:r,...typeof e.reason==`string`?{reason:e.reason}:{}})}function yV(e,t,n){let r=BV(e,`conversation`),i=UV(r,`items`).map((e,t)=>VV(e,`trace.conversation.items[${t}]`)),a=new Map;for(let e of t){if(e.operation!==`attempt.trace.detail`)continue;let t=BV(e,`detail`);if(t.kind===`item`){let e=HV(t.item);e!==void 0&&typeof t.itemId==`string`&&a.set(t.itemId,e)}}let o=UV(r,`turns`).map((e,t)=>{let n=VV(e,`trace.conversation.turns[${t}]`),r=WV(n,`turnId`),o=i.filter(e=>e.turnId===r).map(e=>bV(a.get(WV(e,`itemId`))??e));return Object.freeze({key:r,label:`Turn ${qV(n,`sequence`)}`,verdict:zV(n.outcome),entries:Object.freeze(o)})}),s=Object.freeze({turns:Object.freeze(o),locator:n});return DV(r.state,s,`Closed observability`)}function bV(e){let t=WV(e,`itemId`),n=WV(e,`kind`),r=HV(e.occurrence),i=typeof e.toolOccurrenceId==`string`?e.toolOccurrenceId:r?.state===`exact`&&typeof r.toolOccurrenceId==`string`?r.toolOccurrenceId:void 0,a=typeof e.eventId==`string`?e.eventId:void 0,o=IV(e,n),s=typeof e.role==`string`?e.role:void 0,c=n===`message`?s===`user`?`user`:s===`assistant`?`assistant`:`message`:n===`tool-call`||n===`tool-result`?`tool`:n,l=typeof e.tool==`string`?e.tool:`tool`,u=typeof e.input==`string`?e.input:``,d=typeof e.output==`string`?e.output:void 0,f=n===`tool-call`?`started`:n===`tool-result`?`finished`:void 0,p=RV(e.outcome),m=i===void 0?a===void 0?void 0:AV({kind:`event`,eventId:a}):AV({kind:`tool-occurrence`,toolOccurrenceId:i}),h=f===void 0?{kind:`text`,text:o}:{kind:`tool-evidence`,content:{phase:f,tool:l,...i===void 0?{}:{callId:i},...r===void 0?{}:i===void 0?{toolOccurrence:{state:`unavailable`,reason:String(r.reason??`not-recorded`)}}:{toolOccurrence:{state:`exact`,toolOccurrenceId:i}},inputSummary:u,...d===void 0?{}:{outputSummary:d},...p===void 0?{}:{outcome:p}}};return Object.freeze({id:t,...a===void 0?{}:{eventId:a},...typeof e.sequence==`number`?{sequence:e.sequence}:{},kind:c,preview:o,...m===void 0?{}:{anchor:m},detail:h,raw:JSON.stringify(e),...p===`failed`||p===`rejected`?{failed:!0}:{},...f===void 0?{}:{callPhase:f},...i===void 0?{}:{callId:i},...r===void 0?{}:i===void 0?{toolOccurrence:{state:`unavailable`,reason:String(r.reason??`not-recorded`)}}:{toolOccurrence:{state:`exact`,toolOccurrenceId:i}},...p===void 0?{}:{callOutcome:p},commandMatch:{state:`unavailable`,reason:`not-recorded`}})}function xV(e,t){let n=UV(e,`activities`).map((e,t)=>VV(e,`timing.activities[${t}]`)),r=new Map;for(let e of n){let t=typeof e.parentActivityId==`string`?e.parentActivityId:null,n=r.get(t)??[];n.push(e),r.set(t,n)}let i=e=>{let t=WV(e,`activityId`),n=(r.get(t)??[]).map(i);return Object.freeze({key:t,label:WV(e,`label`),kind:WV(e,`phase`),startOffsetMs:KV(e,`startOffsetMs`),durationMs:YV(e.durationMs),...e.outcome===`failed`?{failed:!0}:{},...n.length===0?{}:{children:Object.freeze(n)}})},a=(r.get(null)??[]).map(i),o=n.reduce((e,t)=>{let n=KV(t,`startOffsetMs`),r=YV(t.durationMs);return r===null?e:Math.max(e??0,n+r)},null),s=n.length===0?Object.freeze([]):Object.freeze([{key:t,label:t,durationMs:o,nodes:Object.freeze(a),locator:t}]);return Object.freeze({data:s,slice:DV(e.state,s,`Execution timeline`)})}function SV(e,t){let n=[];for(let e of UV(t,`observations`)){let t=HV(e);if(t!==void 0&&typeof t.kind==`string`&&typeof t.turnId==`string`){if(t.kind===`token-bucket`&&typeof t.usageObservationId==`string`&&typeof t.provider==`string`&&typeof t.bucket==`string`&&typeof t.tokens==`number`){n.push({kind:`token-bucket`,usageObservationId:t.usageObservationId,turnId:t.turnId,provider:t.provider,bucket:t.bucket,tokens:t.tokens});continue}if(t.kind===`request`&&typeof t.usageObservationId==`string`&&typeof t.provider==`string`&&typeof t.requestKind==`string`){n.push({kind:`request`,usageObservationId:t.usageObservationId,turnId:t.turnId,provider:t.provider,requestKind:t.requestKind});continue}t.kind===`provider-cost`&&typeof t.usageObservationId==`string`&&typeof t.provider==`string`&&typeof t.amount==`string`&&typeof t.currency==`string`&&n.push({kind:`provider-cost`,usageObservationId:t.usageObservationId,turnId:t.turnId,provider:t.provider,amount:t.amount,currency:t.currency})}}let r=BV(e,`conversation`),i=Object.freeze({turns:UV(r,`turns`).length,toolCalls:UV(r,`items`).filter(e=>HV(e)?.kind===`tool-call`).length,observations:Object.freeze(n)});return DV(t.state,i,`Usage`)}function CV(e,t,n){let r=BV(e,`commands`),i=new Map;for(let e of t){if(e.operation!==`attempt.trace.detail`)continue;let t=BV(e,`detail`);t.kind===`command`&&typeof t.commandId==`string`&&i.set(t.commandId,t)}let a=UV(r,`items`).map((e,t)=>{let n=VV(e,`trace.commands.items[${t}]`),a=WV(n,`commandId`),o=i.get(a)??n,s=BV(o,`invocation`),c=BV(o,`outcome`),l=HV(o.stdout),u=HV(o.stderr),d=HV(l?.truncation),f=HV(u?.truncation),p=c.kind===`exited`&&typeof c.exitCode==`number`?c.exitCode:void 0;return Object.freeze({commandId:a,timingNodeId:a,phase:WV(o,`phase`),display:LV(s),...p===void 0?{}:{exitCode:p},invocation:s,...typeof o.workingDirectory==`string`?{workingDirectory:o.workingDirectory}:{},outcome:c,classification:p===0?`succeeded`:p===void 0?`observed`:`failed`,...typeof l?.text==`string`&&l.text.length>0?{stdout:l.text}:{},...typeof u?.text==`string`&&u.text.length>0?{stderr:u.text}:{},collectionState:r.state===`partial`?`partial`:`complete`,...l===void 0?{}:{stdoutState:l.textTruncated===!0||d?.state===`truncated`?`truncated`:`complete`,...typeof l.retainedBytes==`number`?{stdoutRetainedBytes:l.retainedBytes}:{},...typeof l.totalSafeUtf8Bytes==`number`?{stdoutTotalBytes:l.totalSafeUtf8Bytes}:{}},...u===void 0?{}:{stderrState:u.textTruncated===!0||f?.state===`truncated`?`truncated`:`complete`,...typeof u.retainedBytes==`number`?{stderrRetainedBytes:u.retainedBytes}:{},...typeof u.totalSafeUtf8Bytes==`number`?{stderrTotalBytes:u.totalSafeUtf8Bytes}:{}}})});return DV(r.state,Object.freeze({commands:Object.freeze(a),locator:n}),`Commands`)}function wV(e){let t=HV(e.diagnostics);if(t===void 0)return Object.freeze({state:`unavailable`,limitations:Object.freeze([{code:`diagnostics-projection-unavailable`,summary:`Diagnostics are not exposed by the fixed execution projection.`}])});let n=UV(t,`items`).map((e,t)=>{let n=VV(e,`trace.diagnostics.items[${t}]`),r=HV(n.redaction),i=WV(n,`kind`),a=r?.state===`applied`&&typeof r.replacements==`number`?{state:`applied`,replacements:r.replacements}:{state:`none`};return Object.freeze({diagnosticId:WV(n,`diagnosticId`),code:WV(n,`code`),kind:i,phase:WV(n,`phase`),summary:WV(n,`summary`),level:i===`execution-error`?`error`:`warning`,causes:Object.freeze(UV(n,`causes`).flatMap(e=>{let t=HV(e);return typeof t?.code==`string`&&typeof t.summary==`string`?[{code:t.code,summary:t.summary}]:[]})),redaction:a,...n.sourceFrame===null||n.sourceFrame===void 0?{}:{sourceFrame:XV(n.sourceFrame)}})}),r=new Map;for(let e of n){let t=r.get(e.phase)??[];t.push(e),r.set(e.phase,t)}let i=Object.freeze({groups:Object.freeze([...r].map(([e,t])=>Object.freeze({phase:e,items:Object.freeze(t)})))});return DV(t.state,i,`Diagnostics`)}function TV(e,t,n){let r=UV(BV(t,`conversation`),`turns`),i=UV(e,`items`).flatMap((e,t)=>{let n=HV(e),i=HV(n?.content);if(n===void 0||i?.state!==`available`||typeof n.sourceItemId!=`string`||typeof n.path!=`string`||typeof n.sha256!=`string`||typeof i.text!=`string`)return[];let a=r.flatMap(e=>{let t=HV(e),r=HV(t?.context);return r?.state===`mapped`&&r.sourceItemId===n.sourceItemId&&r.sha256===n.sha256&&typeof t?.turnId==`string`?[{turnId:t.turnId,start:HV(r.start),end:HV(r.end)}]:[]}),o=i.text.split(`
61
- `).map((e,t)=>{let n=t+1,r=a.flatMap(e=>typeof e.start?.line==`number`&&typeof e.end?.line==`number`&&n>=e.start.line&&n<=e.end.line?[e.turnId]:[]);return Object.freeze({number:n,text:e,...r.length===0?{}:{tone:`send`,turnIds:Object.freeze(r)}})});return[Object.freeze({sourceItemId:n.sourceItemId,sha256:n.sha256,path:n.path,lines:Object.freeze(o)})]});if(i.length===0)return Object.freeze({data:null,slice:DV(e.state,null,`Source navigation`)});let a=Object.freeze({spine:i[0],detached:Object.freeze(i.slice(1)),locator:n}),o=DV(e.state,a,`Source navigation`);return Object.freeze({data:a,slice:o})}function EV(e){return e.state===`not-recorded`||Object.keys(e).length===0?Object.freeze({state:`not-recorded`,limitations:Object.freeze([{code:`file-changes-not-recorded`,summary:`File changes collection was not recorded for this Attempt.`}])}):Object.freeze({state:`unavailable`,limitations:Object.freeze([{code:`file-changes-content-unavailable`,summary:`File changes collection has no display-safe patch projection.`}])})}function DV(e,t,n){if(e===`available`||e===`complete`)return Object.freeze({state:`available`,data:t});let r=Object.freeze([{code:String(e??`unavailable`),summary:`${n}: ${String(e??`unavailable`)}.`}]);return Object.freeze(e===`partial`?{state:`partial`,data:t,limitations:r}:e===`not-recorded`?{state:`not-recorded`,limitations:r}:{state:`unavailable`,limitations:r})}function OV(e){if(e!==void 0&&e.state!==`not-scored`&&typeof e.points==`number`)return e.state===`earned`&&typeof e.earned==`number`?Object.freeze({state:`earned`,points:e.points,earned:e.earned}):Object.freeze({state:`unavailable`,points:e.points})}function kV(e){return e===`matched`||e===`mismatched`||e===`unavailable`||e===`errored`||e===`not-applicable`?e:`unavailable`}function AV(e){return e.kind===`tool-occurrence`?`tool:${e.toolOccurrenceId}`:`event:${e.eventId}`}function jV(e){return Object.freeze({kind:`value`,value:e})}function MV(e){return Object.freeze({kind:`fields`,fields:Object.freeze(e.map(e=>Object.freeze(e)))})}function NV(e){let t=VV(e,`assertion fact`);if(t.kind===`unavailable`&&typeof t.reason==`string`)return Object.freeze({kind:`unavailable`,reason:t.reason});if(t.kind===`value`&&(t.value===null||typeof t.value==`string`||typeof t.value==`boolean`||typeof t.value==`number`&&Number.isFinite(t.value)))return jV(t.value);if(t.kind===`text`&&typeof t.text==`string`)return Object.freeze({kind:`text`,text:t.text});if(t.kind===`list`)return Object.freeze({kind:`list`,items:Object.freeze(UV(t,`items`).map(NV))});if(t.kind===`fields`)return MV(UV(t,`fields`).map((e,t)=>{let n=VV(e,`assertion fact.fields[${t}]`);return Object.freeze({label:WV(n,`label`),value:NV(n.value)})}));throw Error(`Assertion fact has an invalid closed shape`)}function PV(e){if(e===null||typeof e==`string`||typeof e==`boolean`)return jV(e);if(typeof e==`number`)return Number.isFinite(e)?jV(e):Object.freeze({kind:`unavailable`,reason:`source-unavailable`});if(Array.isArray(e))return Object.freeze({kind:`list`,items:Object.freeze(e.map(PV))});let t=HV(e);return t===void 0?Object.freeze({kind:`unavailable`,reason:`source-unavailable`}):MV(Object.entries(t).map(([e,t])=>({label:e,value:PV(t)})))}function FV(e){switch(e.kind){case`unavailable`:return e.reason;case`value`:return typeof e.value==`string`?e.value:String(e.value);case`text`:return e.text;case`list`:return e.items.map(FV).join(`, `);case`fields`:return e.fields.map(e=>`${e.label}: ${FV(e.value)}`).join(` · `)}}function IV(e,t){return t===`message`&&typeof e.text==`string`?e.text:t===`tool-call`?`${typeof e.tool==`string`?e.tool:`tool`} ${typeof e.input==`string`?e.input:``}`.trim():t===`tool-result`&&typeof e.output==`string`?e.output:typeof e.summary==`string`?e.summary:t===`input-request`&&typeof e.prompt==`string`?typeof e.response==`string`?`${e.prompt}\n${e.response}`:e.prompt:JSON.stringify(e)}function LV(e){return e.kind===`shell`&&typeof e.command==`string`?e.command:e.kind===`argv`&&typeof e.executable==`string`?[e.executable,...GV(e.arguments)].join(` `):JSON.stringify(e)}function RV(e){return e===`completed`||e===`rejected`||e===`failed`||e===`cancelled`?e:void 0}function zV(e){if(e===`completed`)return`passed`;if(e===`failed`)return`failed`;if(e===`cancelled`)return`skipped`;if(e===`interrupted`)return`errored`}function BV(e,t){return VV(Reflect.get(e,t),t)}function VV(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`${t} must be an object.`);return e}function HV(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function UV(e,t){let n=e[t];if(!Array.isArray(n))throw Error(`${t} must be an array.`);return n}function WV(e,t){let n=e[t];if(typeof n!=`string`)throw Error(`${t} must be a string.`);return n}function GV(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function KV(e,t){let n=e[t];if(typeof n!=`number`||!Number.isFinite(n))throw Error(`${t} must be a number.`);return n}function qV(e,t){let n=e[t];if(typeof n!=`number`||!Number.isSafeInteger(n))throw Error(`${t} must be an integer.`);return n}function JV(e){return typeof e==`string`?e:null}function YV(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function XV(e){if(e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e))return e;if(Array.isArray(e))return Object.freeze(e.map(XV));let t=HV(e);return t===void 0?null:Object.freeze(Object.fromEntries(Object.entries(t).map(([e,t])=>[e,XV(t)])))}function ZV(e){let t=e.display,n=e.score,r=n?.state===`earned`?n.earned??0:void 0,i=n===void 0?``:` · weight ${n.points} ${n.points===1?`pt`:`pts`} · earned ${r===void 0?`unavailable`:`${r} ${r===1?`pt`:`pts`}`}`;return[{kind:`text`,className:`niceeval-source-assertion ${e.decision.result===`matched`?`niceeval-tone-good`:e.decision.result===`mismatched`&&t.severity===`gate`?`niceeval-tone-bad`:e.decision.result===`mismatched`?`niceeval-tone-warn`:`niceeval-tone-na`}`,text:`${t.name} · ${t.severity} ${t.outcome}${i}`},{kind:`assertion`,entryId:e.entryId,content:e.evidence,label:t.name,state:e.decision.result===`matched`?`matched`:e.decision.result===`mismatched`?`mismatched`:`unavailable`}]}function QV(e){return e===null||e.attention.length===0&&e.passedGroups.length===0?null:{columns:[{key:`name`,header:{en:`Name`,"zh-CN":`名称`}},{key:`severity`,header:{en:`Severity`,"zh-CN":`级别`}},{key:`outcome`,header:{en:`Outcome`,"zh-CN":`结果`}},{key:`detail`,header:{en:`Detail`,"zh-CN":`详情`}}],rows:e.attention.map(e=>({key:e.entryId,cells:{name:{kind:`text`,text:e.display.name},severity:{kind:`text`,text:e.display.severity},outcome:{kind:`verdict`,verdict:e.display.outcome===`unavailable`?`skipped`:e.display.outcome},detail:e.display.detail.length>0?{kind:`text`,text:e.display.detail}:{kind:`notApplicable`}}}))}}function $V(e){if(e.some(e=>e.decision.result===`mismatched`&&e.display.severity===`gate`))return`gate-fail`;if(e.some(e=>e.decision.result===`mismatched`))return`soft-fail`;if(e.some(e=>e.decision.result===`unavailable`||e.decision.result===`errored`||e.decision.result===`not-applicable`))return`unavailable`;if(e.some(e=>e.decision.result===`matched`))return`passed`}function eH(e,t){let n={send:0,passed:1,unavailable:2,"soft-fail":3,"gate-fail":4};return t===void 0?e:e===void 0||n[t]>n[e]?t:e}function tH(e,t){if(e===null||t===null)return e;let n=[...t.attention,...t.passedGroups.flatMap(e=>e.items)],r=[e.spine,...e.detached],i=new Set(r.map(e=>`${e.sourceItemId}\u0000${e.sha256}`)),a=new Set,o=e=>({...e,lines:e.lines.map(t=>{let r=n.flatMap(n=>n.sourceSites.filter(n=>n.target.state===`exact`&&n.target.sourceItemId===e.sourceItemId&&n.target.sha256===e.sha256&&t.number>=n.start.line&&t.number<=n.end.line).map(e=>({entry:n,site:e})));for(let{entry:e}of r)a.add(e.entryId);let i=r.filter(({site:e})=>e.role!==`score`).map(({entry:e})=>e),o=r.filter(({site:e})=>e.role!==`score`&&e.start.line===t.number).map(({entry:e})=>e),s=new Set((t.details??[]).flatMap(e=>e.kind===`assertion`?[e.entryId]:[])),c=[...t.details??[],...o.filter(e=>!s.has(e.entryId)).flatMap(ZV)],l=r.filter(({site:e,entry:t})=>e.role===`score`&&t.score!==void 0),u=l.reduce((e,{entry:t})=>e+(t.score?.state===`earned`?t.score.earned??0:0),0),d=l.length===0?t.pill:`${u} ${u===1?`pt`:`pts`}`,f=eH(t.tone,$V(i));return{...t,...f===void 0?{}:{tone:f},...d===void 0?{}:{pill:d},...c.length===0?{}:{details:c}}})}),s=o(e.spine),c=e.detached.map(o);for(let e of n)e.sourceSites.some(e=>e.target.state===`exact`&&i.has(`${e.target.sourceItemId}\u0000${e.target.sha256}`))||a.delete(e.entryId);let l=[...e.unmapped??[],...n.filter(e=>!a.has(e.entryId)).flatMap(ZV)];return{...e,spine:s,detached:c,...l.length===0?{}:{unmapped:l}}}var nH=[{title:{en:`Execution evidence unavailable`,"zh-CN":`执行证据不可用`},items:[{level:`warning`,message:{en:`The events artifact is missing or was not published.`,"zh-CN":`事件证据缺失或未发布。`}}]}];function rH(e){return e===null?[]:e.groups.map(e=>({title:e.phase,items:e.items.map(e=>({level:e.level,message:`${e.code}: ${e.summary}`}))}))}function iH(e){return e.map(e=>({level:`warning`,message:`${e.code}: ${e.summary}`}))}function aH(e,t){if(t.state===`available`)return[];let n=iH(t.limitations);return[{title:e,items:n.length>0?n:[{level:`warning`,message:`Evidence state: ${t.state}.`}]}]}function oH(e){return e.state===`available`||e.state===`partial`?e.data:null}function sH(e,t){let n=t?.turns??[],r=new Map(n.map(e=>[e.key,e])),i=new Set,a=e=>{let n=(e.turnIds??[]).flatMap(e=>{let t=r.get(e);return t===void 0?[]:(i.add(e),[t])}),a=e.details===void 0&&n.length===0?void 0:[...e.details??[],...n.length===0?[]:[{kind:`turn-trace`,data:{turns:n,locator:t?.locator}}]];return{...e,...a===void 0?{}:{details:a}}},o=e=>({...e,lines:e.lines.map(a)}),s=e===null?null:{...e,spine:o(e.spine),detached:e.detached.map(o)},c=n.filter(e=>!i.has(e.key));return{source:s,conversation:t===null||c.length===0?null:{...t,turns:c}}}var cH=16777216;function lH({locator:e,block:t}){let{t:n}=Fo(),r=yM(),i=(0,v.useRef)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(),[l,u]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=new IntersectionObserver(t=>{t.some(e=>e.isIntersecting)&&(o(!0),e.disconnect())});return i.current!==null&&e.observe(i.current),()=>e.disconnect()},[]);let d=uc({queryKey:[`execution-display-image`,r.identity,e,t.artifactId],enabled:a&&t.byteLength<=cH,staleTime:1/0,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,queryFn:async()=>{let n=new Uint8Array(t.byteLength),i=0;do{let a=iM({kind:`attempt.artifact`,locator:e,artifactId:t.artifactId,offset:i,limit:262144});if(ad(a)||a.success.kind!==`attempt.artifact`)throw Error(`Image artifact request is invalid.`);let{artifact:o}=await r.inspectRepository(a.success);if(o.state!==`available`||o.byteLength!==t.byteLength||o.mediaType!==t.mediaType||o.sha256!==t.sha256||o.offset!==i)throw Error(`Image artifact does not match the sealed display descriptor.`);let s=Uint8Array.from(atob(o.base64),e=>e.charCodeAt(0));if(i+s.byteLength>n.byteLength||s.byteLength===0&&i<n.byteLength)throw Error(`Image artifact byte range is invalid.`);if(n.set(s,i),i+=s.byteLength,o.nextOffset===null){if(i!==n.byteLength)throw Error(`Image artifact is incomplete.`);break}if(o.nextOffset!==i||i>=n.byteLength)throw Error(`Image artifact continuation is invalid.`)}while(i<n.byteLength);let a=new Uint8Array(await crypto.subtle.digest(`SHA-256`,n));if(Array.from(a,e=>e.toString(16).padStart(2,`0`)).join(``)!==t.sha256)throw Error(`Image artifact bytes do not match the sealed digest.`);return n}});return(0,v.useEffect)(()=>{if(u(!1),c(void 0),d.data===void 0)return;let e=URL.createObjectURL(new Blob([d.data],{type:t.mediaType}));return c(e),()=>URL.revokeObjectURL(e)},[d.data,t.mediaType]),(0,M.jsxs)(`figure`,{ref:i,children:[s===void 0||l?(0,M.jsx)(`p`,{children:t.alt}):(0,M.jsx)(`img`,{src:s,alt:t.alt,style:{maxWidth:`100%`},onError:()=>u(!0)}),(0,M.jsxs)(`figcaption`,{children:[t.mediaType,` · `,t.byteLength,` bytes · `,(0,M.jsx)(`code`,{children:t.artifactId})]}),l?(0,M.jsx)(`p`,{children:n(`executionTrace.imageDecodeFailed`)}):null,d.isError?(0,M.jsx)(`p`,{role:`alert`,children:d.error.message}):null,t.byteLength>cH?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`p`,{children:n(`executionTrace.imageTooLarge`)}),(0,M.jsx)(`pre`,{children:JSON.stringify({protocol:`niceeval.query/v1`,operation:{kind:`attempt.artifact`,locator:e,artifactId:t.artifactId}},null,2)})]}):null]})}function uH({locator:e,block:t}){let{t:n}=Fo(),r=e=>(0,M.jsxs)(M.Fragment,{children:[typeof e==`string`?e:e.preview,typeof e==`string`||e.omittedBytes===0?null:(0,M.jsxs)(`span`,{children:[` `,n(`executionTrace.moreBytes`,{count:e.omittedBytes})]})]});switch(t.kind){case`text`:return(0,M.jsx)(`p`,{style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:r(t.text)});case`message`:return(0,M.jsxs)(`p`,{style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:[(0,M.jsxs)(`strong`,{children:[t.speaker??t.role,`: `]}),r(t.text)]});case`fields`:return(0,M.jsx)(`dl`,{children:t.fields.map((e,t)=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:e.label}),(0,M.jsx)(`dd`,{style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:typeof e.value==`object`&&e.value!==null?r(e.value):typeof e.value==`string`?e.value:JSON.stringify(e.value)})]},t))});case`code`:return(0,M.jsx)(`pre`,{style:{overflow:`auto`,whiteSpace:`pre`},children:(0,M.jsx)(`code`,{children:r(t.text)})});case`image`:return(0,M.jsx)(lH,{locator:e,block:t})}}function dH(e){return new TextDecoder().decode(Uint8Array.from(atob(e),e=>e.charCodeAt(0)))}function fH({locator:e,selector:t,select:n}){let{t:r}=Fo(),i=bM({kind:`attempt.trace.detail`,locator:e,selector:t});if(i.isPending)return(0,M.jsx)(`p`,{role:`status`,children:r(`report.loadingDetails`)});if(i.isError)return(0,M.jsxs)(`div`,{role:`alert`,children:[(0,M.jsx)(`p`,{children:i.error.message}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>void i.refetch(),children:r(`report.retry`)})]});let a=i.data.detail;return a.kind===`execution-evidence`?(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h4`,{children:a.label}),(0,M.jsxs)(`p`,{children:[(0,M.jsx)(`code`,{children:a.evidenceId}),` · `,(0,M.jsx)(`code`,{children:a.pointer})]}),(0,M.jsxs)(`p`,{children:[r(`executionTrace.byteRange`,{offset:a.offset,total:a.targetByteLength}),` · SHA-256 `,(0,M.jsx)(`code`,{children:a.targetSha256})]}),(0,M.jsx)(`pre`,{style:{maxHeight:`28rem`,overflow:`auto`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:dH(a.base64)}),a.nextOffset===null?null:(0,M.jsx)(`button`,{type:`button`,onClick:()=>n({kind:`execution-evidence`,evidenceId:a.evidenceId,offset:a.nextOffset,limit:65536}),children:r(`executionTrace.nextBytes`)})]}):a.kind===`execution-event`?(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h4`,{children:a.event.summary}),(a.event.display??[]).map((t,n)=>(0,M.jsx)(uH,{locator:e,block:t},n)),(0,M.jsx)(`pre`,{style:{maxHeight:`28rem`,overflow:`auto`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:JSON.stringify(a.event,null,2)}),a.evidence.map(e=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h5`,{children:e.label}),(0,M.jsxs)(`p`,{children:[(0,M.jsx)(`code`,{children:e.pointer}),` · `,(0,M.jsx)(`code`,{children:e.evidenceId}),e.truncated?` ${r(`attempt.truncated`)}`:``]}),(0,M.jsx)(`pre`,{style:{maxHeight:`16rem`,overflow:`auto`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:dH(e.base64)}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>n({kind:`execution-evidence`,evidenceId:e.evidenceId}),children:r(`executionTrace.openEvidence`)})]},e.evidenceId))]}):(0,M.jsx)(`pre`,{children:JSON.stringify(a,null,2)})}function pH({locator:e,initial:t}){let{t:n}=Fo(),[r,i]=(0,v.useState)(),[a,o]=(0,v.useState)(),[s,c]=(0,v.useState)(``),l=bM(r===void 0?null:{...AM(e)[1],continuation:r}),u=r===void 0?t:l.data?.trace.execution;return t.state===`not-recorded`?null:(0,M.jsxs)(`section`,{"aria-label":n(`executionTrace.title`),className:`niceeval-col`,children:[(0,M.jsx)(`h3`,{children:n(`executionTrace.title`)}),(0,M.jsx)(`p`,{children:t.state}),t.limitations.length===0?null:(0,M.jsx)(`pre`,{children:JSON.stringify(t.limitations,null,2)}),t.traces.map(e=>(0,M.jsxs)(`details`,{children:[(0,M.jsxs)(`summary`,{children:[e.sourceTraceId,` · `,e.collection.state,` · `,e.eventCount]}),(0,M.jsx)(`pre`,{style:{maxHeight:`16rem`,overflow:`auto`,whiteSpace:`pre-wrap`},children:JSON.stringify({schema:e.schema,collection:e.collection,scopes:e.scopes},null,2)})]},e.traceId)),(0,M.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),s.trim()&&o({kind:`execution-event`,eventId:s.trim()})},children:[(0,M.jsxs)(`label`,{children:[n(`executionTrace.stableId`),` `,(0,M.jsx)(`input`,{value:s,onChange:e=>c(e.target.value)})]}),` `,(0,M.jsx)(`button`,{type:`submit`,disabled:!s.trim(),children:n(`executionTrace.openEvent`)}),` `,(0,M.jsx)(`button`,{type:`button`,disabled:!s.trim(),onClick:()=>o({kind:`execution-evidence`,evidenceId:s.trim()}),children:n(`executionTrace.openEvidence`)})]}),r!==void 0&&l.isPending?(0,M.jsx)(`p`,{role:`status`,children:n(`report.loadingDetails`)}):null,l.isError?(0,M.jsxs)(`div`,{role:`alert`,children:[(0,M.jsx)(`p`,{children:l.error.message}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>void l.refetch(),children:n(`report.retry`)})]}):null,u===void 0?null:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`ol`,{children:u.events.map(t=>(0,M.jsxs)(`li`,{children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>o({kind:`execution-event`,eventId:t.eventId}),children:t.summary||t.type}),(0,M.jsxs)(`p`,{children:[(0,M.jsx)(`code`,{children:t.eventId}),` · `,t.actor?.label??t.actor?.id??t.source.id,` · `,t.type,t.time===void 0?``:` · ${t.time.clockId}: ${t.time.value} ${t.time.unit}`]}),t.display.state===`absent`?null:t.display.blocks.map((t,n)=>(0,M.jsx)(uH,{locator:e,block:t},n)),t.scopeMemberships.map(e=>(0,M.jsxs)(`span`,{children:[e.scopeId,`: `,e.state,` `]},e.scopeId))]},t.eventId))}),u.hasMore?(0,M.jsx)(`p`,{children:n(`executionTrace.omitted`,{count:u.omittedEventCount})}):null,u.continuation===void 0?null:(0,M.jsx)(`button`,{type:`button`,onClick:()=>i(u.continuation),children:n(`executionTrace.nextPage`)})]}),r===void 0?null:(0,M.jsx)(`button`,{type:`button`,onClick:()=>i(void 0),children:n(`executionTrace.firstPage`)}),a===void 0?null:(0,M.jsx)(fH,{locator:e,selector:a,select:o})]})}function mH({label:e,value:t}){return(0,M.jsxs)(`div`,{className:`niceeval-kpi`,children:[(0,M.jsx)(`span`,{className:`niceeval-kpi-label`,children:e}),(0,M.jsx)(`span`,{className:`niceeval-kpi-value`,children:t})]})}function hH({locator:e,data:t,locale:n}){let{t:r}=Fo(),i=t.verdict===`passed`&&t.totalScore!==void 0,a=`${t.adapter.name} · ${t.adapter.contract} · ${t.adapter.behaviorRevision===null?r(`attempt.adapterRevisionNotDeclared`):t.adapter.behaviorRevision}`;return(0,M.jsxs)(`div`,{className:`niceeval-attempt-summary`,children:[(0,M.jsxs)(`div`,{className:`niceeval-attempt-summary-head`,children:[(0,M.jsx)(`span`,{className:`niceeval-verdict-pill niceeval-verdict-${t.verdict}`,children:r(i?`attempt.scoreCompleted`:`attempt.verdict.${t.verdict}`)}),(0,M.jsx)(`span`,{className:`niceeval-attempt-summary-locator`,children:e})]}),(0,M.jsxs)(`div`,{className:`niceeval-grid niceeval-attempt-summary-kpis`,children:[(0,M.jsx)(mH,{label:r(`attempt.experiment`),value:t.experimentId}),(0,M.jsx)(mH,{label:r(`attempt.adapter`),value:a}),(0,M.jsx)(mH,{label:r(`attempt.eval`),value:t.identity.evalId}),(0,M.jsx)(mH,{label:r(`attempt.title`),value:t.identity.attempt.state===`available`?String(t.identity.attempt.value+1):`—`}),t.totalScore===void 0?null:(0,M.jsx)(mH,{label:r(`attempt.score`),value:$I(t.totalScore,n)}),t.startedAt===void 0?null:(0,M.jsx)(mH,{label:r(`attempt.started`),value:eL(t.startedAt,n)}),(0,M.jsx)(mH,{label:r(`attempt.duration`),value:t.durationMs.state===`available`?ZI(t.durationMs.value):`—`}),t.observedCostUSD===void 0?null:(0,M.jsx)(mH,{label:r(`attempt.cost`),value:tL(t.observedCostUSD)})]})]})}function gH(e,t){let n=jM(t);if(n.kind!==e)throw Error(`Expected ${e} operation.`);return n}function _H({data:e}){if(e===null)return null;let t=[];e.turns!==void 0&&t.push([`turns`,String(e.turns)]),e.toolCalls!==void 0&&t.push([`tool calls`,String(e.toolCalls)]);for(let n of e.observations)n.kind===`token-bucket`?t.push([`${n.provider} ${n.bucket}`,n.tokens.toLocaleString()]):n.kind===`request`?t.push([`${n.provider} ${n.requestKind}`,`1`]):t.push([`${n.provider} cost`,`${n.amount} ${n.currency}`]);return e.observedCostUSD!==void 0&&t.push([`observed cost`,`$${e.observedCostUSD.toFixed(4)}`]),t.length===0?null:(0,M.jsx)(OB,{className:`niceeval-usage-table`,children:t.map(([e,t],n)=>(0,M.jsx)(mH,{label:e,value:t},`${e}:${n}`))})}function vH({report:e}){let{t}=Fo(),n=[{label:t(`usage.cacheTotal`),summary:e.total},...e.modelSlots.map(e=>({label:`${t(`usage.slot`)}: ${e.modelSlot??t(`usage.notRecorded`)}`,summary:e}))],r=e=>(0,M.jsx)(`div`,{className:`niceeval-table-wrap`,style:{overflowX:`auto`},children:(0,M.jsxs)(`table`,{"aria-label":t(`usage.cacheReadRate`),children:[(0,M.jsx)(`thead`,{children:(0,M.jsx)(`tr`,{children:[`usage.cacheScope`,`usage.cacheReadRate`,`usage.cacheCoverage`,`usage.cacheCollection`,`usage.cacheReasons`].map(e=>(0,M.jsx)(`th`,{scope:`col`,children:t(e)},e))})}),(0,M.jsx)(`tbody`,{children:e.map(({label:e,summary:n},r)=>(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{scope:`row`,children:e}),(0,M.jsx)(`td`,{children:n.rate.state===`exact`?`${(n.rate.value*100).toFixed(2)}%`:t(`cell.metricUnavailable`)}),(0,M.jsxs)(`td`,{children:[n.coveredCalls,`/`,n.recordedCalls]}),(0,M.jsx)(`td`,{children:t(n.collectionComplete?`usage.cacheComplete`:`usage.cacheIncomplete`)}),(0,M.jsx)(`td`,{children:n.reasons.join(`, `)||`—`})]},r))})]})});return(0,M.jsxs)(`section`,{"aria-label":t(`usage.cacheReadRate`),children:[(0,M.jsx)(`h4`,{children:t(`usage.cacheReadRate`)}),r(n),(0,M.jsxs)(`details`,{children:[(0,M.jsx)(`summary`,{children:t(`usage.actualModels`)}),r(e.models.map(e=>({label:`${e.modelSlot??t(`usage.notRecorded`)} / ${e.provider??t(`usage.notRecorded`)} / ${e.model??t(`usage.notRecorded`)}`,summary:e})))]})]})}function yH({usage:e}){let{t}=Fo(),n=e.configuredModels,r=n.state===`available`&&n.bindings.length===1&&n.bindings[0].modelSlot==="default"?n.bindings[0]:null,i=e.modelGroups,a=e.totals.costs,o=`totals`in e.judgeUsage?e.judgeUsage.totals:void 0,s={maxHeight:`24rem`,overflow:`auto`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},c=e=>`${e.value??`—`} (${e.state})`,l=e=>t(e===`reported`?`cell.costReported`:e===`estimated`?`cell.costEstimated`:`cell.costMixed`),u=e=>e===null?`—`:e===0?`0 (${t(`usage.noRecordedCalls`)})`:String(e);return(0,M.jsxs)(`section`,{"aria-label":t(`usage.external`),children:[(0,M.jsx)(`h3`,{children:t(e.totalCosts.state===`complete`?`usage.totalCosts`:`usage.totalKnownSubtotal`)}),(0,M.jsx)(`p`,{children:t(e.totalCosts.state===`complete`?`usage.costComplete`:`usage.costIncomplete`)}),e.totalCosts.missingSources.length===0?null:(0,M.jsxs)(`p`,{children:[t(`usage.missingSources`),`: `,e.totalCosts.missingSources.map(e=>t(e===`judge`?`usage.judgeUsage`:`usage.applicationCost`)).join(`, `)]}),e.totalCosts.values.length===0?(0,M.jsx)(`p`,{children:t(e.totalCosts.state===`complete`?`usage.noRecordedCharges`:`cell.metricUnavailable`)}):e.totalCosts.values.map(e=>(0,M.jsxs)(`p`,{children:[e.value,` `,e.currency,` · `,l(e.source)]},e.currency)),(0,M.jsxs)(`details`,{children:[(0,M.jsx)(`summary`,{children:t(`usage.external`)}),(0,M.jsxs)(`p`,{children:[e.state,e.coverage===void 0?``:` · ${e.coverage}`]}),(0,M.jsx)(vH,{report:e.cacheRead}),(0,M.jsx)(`h4`,{children:t(`usage.configuredModels`)}),n.state===`available`?r===null?n.bindings.length===0?(0,M.jsx)(`p`,{children:t(`usage.configuredSlotCount`,{count:0})}):(0,M.jsx)(`div`,{className:`niceeval-table-wrap`,style:{overflowX:`auto`},children:(0,M.jsxs)(`table`,{"aria-label":t(`usage.configuredModels`),children:[(0,M.jsx)(`thead`,{children:(0,M.jsx)(`tr`,{children:[`usage.slot`,`usage.configuredModel`,`usage.effort`,`usage.recordedCalls`].map(e=>(0,M.jsx)(`th`,{scope:`col`,children:t(e)},e))})}),(0,M.jsx)(`tbody`,{children:n.bindings.map(e=>(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{scope:`row`,children:e.modelSlot}),(0,M.jsx)(`td`,{children:e.model??`—`}),(0,M.jsx)(`td`,{children:e.reasoningEffort??`—`}),(0,M.jsx)(`td`,{children:u(e.recordedCalls)})]},e.modelSlot))})]})}):(0,M.jsxs)(OB,{children:[(0,M.jsx)(mH,{label:`${t(`usage.configuredModel`)} (default)`,value:r.model??`—`}),r.reasoningEffort===null?null:(0,M.jsx)(mH,{label:t(`usage.effort`),value:r.reasoningEffort}),(0,M.jsx)(mH,{label:t(`usage.recordedCalls`),value:u(r.recordedCalls)})]}):(0,M.jsx)(`p`,{children:t(`usage.notRecorded`)}),(0,M.jsx)(`h4`,{children:t(`usage.actualModels`)}),(0,M.jsxs)(`p`,{children:[i.state,` · `,i.basis,` · `,t(`usage.groupPreview`,{shown:i.groups.length,total:i.totalGroupCount??`—`,omitted:i.omittedGroupCount}),i.groupsTruncated?` · ${t(`attempt.truncated`)}`:``]}),`reason`in i&&i.reason!==void 0?(0,M.jsx)(`p`,{children:i.reason}):null,i.state===`available`?(0,M.jsx)(`div`,{className:`niceeval-table-wrap`,style:{overflowX:`auto`},children:(0,M.jsxs)(`table`,{"aria-label":t(`usage.actualModels`),children:[(0,M.jsx)(`thead`,{children:(0,M.jsx)(`tr`,{children:[`usage.slot`,`usage.servingProvider`,`usage.actualModel`,`usage.recordedCalls`,`usage.tokens`,`usage.applicationCost`].map(e=>(0,M.jsx)(`th`,{scope:`col`,children:t(e)},e))})}),(0,M.jsx)(`tbody`,{children:i.groups.map(e=>(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{scope:`row`,children:e.modelSlot??t(`usage.notRecorded`)}),(0,M.jsx)(`td`,{children:e.provider??t(`usage.notRecorded`)}),(0,M.jsx)(`td`,{children:e.model??t(`usage.notRecorded`)}),(0,M.jsx)(`td`,{children:e.recordedCalls}),(0,M.jsxs)(`td`,{children:[t(`usage.inputTotal`),`: `,c(e.tokens.inputTotalTokens),(0,M.jsx)(`br`,{}),t(`usage.output`),`: `,c(e.tokens.outputTokens),(0,M.jsx)(`br`,{}),t(`usage.totalTokens`),`: `,c(e.tokens.totalTokens)]}),(0,M.jsx)(`td`,{children:e.costs.values.length===0?t(`cell.metricUnavailable`):e.costs.values.map(n=>(0,M.jsxs)(`div`,{children:[n.value,` `,n.currency,` · `,l(n.source),` · `,e.costs.state,e.costs.state===`partial`?` · ${t(`usage.knownSubtotal`)}`:``,(0,M.jsx)(`br`,{}),t(`usage.coverage`,{covered:n.coveredCalls,total:e.costs.totalCalls}),` · `,t(`usage.costOrigins`,{reported:n.reportedCalls,estimated:n.estimatedCalls})]},n.currency))})]},JSON.stringify([e.modelSlot,e.provider,e.model])))})]})}):(0,M.jsx)(`p`,{children:t(`cell.metricUnavailable`)}),(0,M.jsx)(`h4`,{children:t(`usage.judgeUsage`)}),o===void 0?(0,M.jsxs)(`p`,{children:[t(`cell.metricUnavailable`),` · `,`reason`in e.judgeUsage?e.judgeUsage.reason:``]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`p`,{children:o.requests.value===0&&o.requests.state===`available`?t(`usage.noJudgeCalls`):`${t(`usage.physicalCalls`)}: ${c(o.requests)}`}),(0,M.jsxs)(`p`,{children:[t(`usage.inputTotal`),`: `,c(o.inputTotalTokens),` · `,t(`usage.output`),`: `,c(o.outputTokens),` · `,t(`usage.totalTokens`),`: `,c(o.totalTokens)]}),(0,M.jsx)(`p`,{children:o.costs.state}),o.costs.values.map(e=>(0,M.jsxs)(`p`,{children:[e.value,` `,e.currency,` · `,l(e.source),` · `,t(`usage.coverage`,{covered:e.coveredCalls,total:o.costs.totalCalls})]},e.currency))]}),e.source===`adapter`?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`h4`,{children:t(`usage.applicationCost`)}),(0,M.jsx)(OB,{children:[[`usage.input`,e.totals.inputTokens],[`usage.output`,e.totals.outputTokens],[`usage.requests`,e.totals.requests]].map(([e,n])=>(0,M.jsx)(mH,{label:t(e),value:c(n)},e))}),a===void 0||a.values.length===0?(0,M.jsxs)(`p`,{children:[t(`usage.applicationCost`),`: `,t(`cell.metricUnavailable`)]}):null,a?.values.map(e=>(0,M.jsxs)(`p`,{children:[e.value,` `,e.currency,` · `,l(e.source),` · `,a.state,a.state===`partial`?` · ${t(`usage.knownSubtotal`)}`:``,` · `,t(`usage.coverage`,{covered:e.coveredCalls,total:a.totalCalls})]},e.currency)),(0,M.jsxs)(`details`,{children:[(0,M.jsxs)(`summary`,{children:[t(`usage.calls`),` (`,e.calls?.length??0,`; `,e.omittedCallCount??0,` `,t(`attempt.truncated`),`)`]}),(0,M.jsx)(`pre`,{style:s,children:JSON.stringify(e.calls??[],null,2)})]}),(0,M.jsxs)(`details`,{children:[(0,M.jsx)(`summary`,{children:t(`usage.prices`)}),(0,M.jsx)(`pre`,{style:s,children:JSON.stringify(e.priceReceipts??null,null,2)})]})]}):null,e.limitations.length===0?null:(0,M.jsx)(`pre`,{style:s,children:JSON.stringify(e.limitations,null,2)})]})]})}function bH({model:e,locale:t,className:n}){let{t:r}=Fo(),i=yM(),a=e.assertionEntryIds.map(t=>gH(`attempt.assertion.detail`,{kind:`attempt.assertion.detail`,locator:e.locator,entryId:t})),o=[...e.traceItemIds.map(t=>gH(`attempt.trace.detail`,{kind:`attempt.trace.detail`,locator:e.locator,selector:{kind:`item`,itemId:t}})),...e.toolOccurrenceIds.map(t=>gH(`attempt.trace.detail`,{kind:`attempt.trace.detail`,locator:e.locator,selector:{kind:`tool-occurrence`,toolOccurrenceId:t}})),...e.commandIds.map(t=>gH(`attempt.trace.detail`,{kind:`attempt.trace.detail`,locator:e.locator,selector:{kind:`command`,commandId:t}}))],s=cc({queries:a.map(e=>gM(i,e))}),c=cc({queries:o.map(e=>gM(i,e))}),l=bM(AM(e.locator)[1]),u=bM(gH(`attempt.timing`,{kind:`attempt.timing`,locator:e.locator}),{select:t=>FB(t,e.locator)}),d=bM(gH(`attempt.usage`,{kind:`attempt.usage`,locator:e.locator})),f=bM(gH(`attempt.sources`,{kind:`attempt.sources`,locator:e.locator})),p=bM(gH(`attempt.diff`,{kind:`attempt.diff`,locator:e.locator}),{select:RB}),m=[...s,...c,l,u,d,f,p];if(m.some(e=>e.isPending))return(0,M.jsx)(`p`,{role:`status`,children:r(`report.loadingDetails`)});if(m.some(e=>e.isError))return(0,M.jsxs)(`div`,{role:`alert`,children:[(0,M.jsx)(`p`,{children:r(`report.unableToLoadDetails`)}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>{for(let e of m)e.isError&&e.refetch()},children:r(`report.retry`)})]});let h=s.map(e=>e.data),g=c.map(e=>e.data),_=l.data,v=jB(h),y=MB(_,g,e.locator),b=NB(_,g,e.locator),x=PB(_),S=sH(tH(oH(LB(f.data,_,e.locator)),oH(v)),oH(y)),C=[...rH(oH(x)),...aH(`Assertions`,v),...aH(`Source`,LB(f.data,_,e.locator)),...aH(`Execution timeline`,u.data),...aH(`Usage`,IB(d.data,_)),...aH(`Conversation`,y),...aH(`Commands`,b),...aH(`Diagnostics`,x),...aH(`File changes`,p.data)];return(0,M.jsxs)(DB,{className:GI(`niceeval-report`,n),children:[(0,M.jsx)(hH,{locator:e.locator,data:e.summary,locale:t}),(0,M.jsx)(yH,{usage:d.data.usage}),(0,M.jsx)(xL,{items:C,locale:t}),S.source===null?(0,M.jsx)(AB,{data:QV(oH(v)),locale:t}):(0,M.jsx)(nB,{data:S.source,locale:t}),(0,M.jsx)(EB,{nodes:oH(u.data),title:{en:`Execution timeline`,"zh-CN":`执行时间轴`},locale:t}),(0,M.jsx)(_H,{data:oH(IB(d.data,_))}),(0,M.jsx)(pH,{locator:e.locator,initial:_.trace.execution},e.locator),S.conversation===null?oH(y)===null&&_.trace.execution.state===`not-recorded`?(0,M.jsx)(xL,{items:nH,locale:t}):null:(0,M.jsx)(Vz,{data:S.conversation,locale:t}),(0,M.jsx)(VL,{data:oH(b),locale:t}),(0,M.jsx)(sR,{files:oH(p.data),locale:t})]})}function xH({locator:e,onClose:t}){let{data:n}=dc(FM(yM(),e)),{i18n:r,t:i}=Fo(),a=r.resolvedLanguage===`zh-CN`?`zh-CN`:`en`;return(0,M.jsx)(UI,{title:i(`attempt.title`),onClose:t,children:(0,M.jsx)(bH,{model:n,locale:a})})}function SH(e,t){if(typeof e==`string`)return e;let n=e[t];if(n!==void 0&&n!==``)return n;let r=e.en;if(r!==void 0&&r!==``)return r;for(let t of Object.keys(e).sort()){let n=e[t];if(n!==void 0&&n!==``)return n}throw Error(`LocalizedText object has no non-empty value. Provide at least one locale entry, e.g. { en: "…" }.`)}function CH(e,t,n){return Ro.getFixedT(e)(t,n)}function wH(e){return Object.freeze({en:CH(`en`,e),"zh-CN":CH(`zh-CN`,e)})}function TH(e,t,n){return CH(e,t,{n})}function EH(e){let t=e.toFixed(1);return t.endsWith(`.0`)?t.slice(0,-2):t}function DH(e){return e>=1e9?`${EH(e/1e9)}B`:e>=1e6?`${EH(e/1e6)}M`:e>=1e3?`${EH(e/1e3)}k`:Number.isInteger(e)?String(e):EH(e)}function OH(e){if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${EH(e/1e3)}s`;let t=Math.round(e/1e3);return`${Math.floor(t/60)}m ${t%60}s`}function kH(e){return e>=1e3?DH(e):e>=.01||e===0?e.toFixed(2):String(e)}function AH(e,t){let n=e<0?`-`:``,r=Math.abs(e);if(t===`%`)return`${n}${EH(Math.round(r*1e3)/10)}%`;if(t===`ms`)return n+OH(r);if(t===`$`||t===`USD`)return`${n}$${kH(r)}`;let i=DH(r);return t?`${n}${i} ${t}`:`${n}${i}`}function jH(e,t){switch(typeof e==`string`?e:e&&`kind`in e?e.kind:void 0){case`percent`:case`ratio`:return`%`;case`usd`:case`currency`:case`currency-usd`:return`$`;case`duration`:case`duration-ms`:case`milliseconds`:return`ms`;case`number`:case`count`:case`integer`:return;default:return t}}function MH(e,t,n,r=`en`){return e===null?FH(`noSamples`,r):n&&typeof n==`object`&&n.kind===`custom`&&`format`in n&&typeof n.format==`function`?n.format(e,r):AH(e,jH(n,t))}function NH(e,t=`en`){switch(e){case`available`:case`partial`:case`empty`:return FH(`noSamples`,t);case`failed`:return CH(t,`cell.metricFailed`);case`unavailable`:return CH(t,`cell.metricUnavailable`);case`unsupported`:return CH(t,`cell.metricUnsupported`);case`migration-required`:return CH(t,`cell.metricMigrationRequired`)}}var PH={noSamples:`cell.missing`,unscorable:`cell.unscorable`,noCurrentResult:`cell.noCurrentResult`,mixedExecution:`cell.mixedExecution`};function FH(e,t=`en`){let n=PH[e];return n?CH(t,n):e}function IH(e){return(e<0?`-`:``)+EH(Math.round(Math.abs(e)*10)/10)}function LH(e){switch(e){case`passed`:return`✓`;case`failed`:return`✗`;case`errored`:return`!`;case`skipped`:return`–`}}function RH(e){let t=e.projection;if(typeof t!=`object`||!t)return;let n=t;if(n.state===`available`||n.state===`partial`||n.state===`unavailable`||n.state===`migration-required`){if(n.combined===null)return{state:n.state,combined:null};if(typeof n.combined==`object`&&typeof n.combined.amount==`string`)return{state:n.state,combined:{amount:n.combined.amount}}}}function zH(e,t,n=!1){let r=RH(e.metric),i=r?.combined!==null&&r?.combined!==void 0?`$${r.combined.amount}`:e.metric.value===null?NH(e.metric.state,t):`${e.metric.source===`estimated`?`~`:``}${MH(e.metric.value,e.metric.unit,e.metric.format,t)}`;return e.showCoverage===!1?i:n&&e.metric.value!==null&&e.metric.samples<e.metric.total?`${i}\n ${CH(t,`cell.coverageDetail`,{samples:e.metric.samples,total:e.metric.total})}`:`${i} · ${e.metric.state}`}function BH(e,t){if(e==null)return`—`;switch(e.kind){case`stack`:{let n=t??`en`,r=e.cells.map((e,r)=>r===0&&e.kind===`metric`?zH(e,n,!0):BH(e,t)).filter(e=>e!==`—`);if(r.length===0)return`—`;let i=[],a=[];for(let e of r){let[t,...n]=e.split(`
58
+ `},vI=0,yI=[];function bI(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(vI++)[0],a=v.useState(HF)[0],o=v.useRef(e);v.useEffect(function(){o.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=vF([e.lockRef.current],(e.shards||[]).map(hI),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=v.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=pI(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=oI(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=oI(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return fI(h,t,e,h===`h`?s:c,!0)},[]),c=v.useCallback(function(e){var n=e;if(yI.length&&yI[yI.length-1]===a){var r=`deltaY`in n?mI(n):pI(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&gI(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(hI).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=v.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:xI(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=v.useCallback(function(e){n.current=pI(e),r.current=void 0},[]),d=v.useCallback(function(t){l(t.type,mI(t),t.target,s(t,e.lockRef.current))},[]),f=v.useCallback(function(t){l(t.type,pI(t),t.target,s(t,e.lockRef.current))},[]);v.useEffect(function(){return yI.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,tI),document.addEventListener(`touchmove`,c,tI),document.addEventListener(`touchstart`,u,tI),function(){yI=yI.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,tI),document.removeEventListener(`touchmove`,c,tI),document.removeEventListener(`touchstart`,u,tI)}},[]);var p=e.removeScrollBar,m=e.inert;return v.createElement(v.Fragment,null,m?v.createElement(a,{styles:_I(i)}):null,p?v.createElement(QF,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function xI(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var SI=MF(NF,bI),CI=v.forwardRef(function(e,t){return v.createElement(FF,gF({},e,{ref:t,sideCar:SI}))});CI.classNames=FF.classNames;var wI=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},TI=new WeakMap,EI=new WeakMap,DI={},OI=0,kI=function(e){return e&&(e.host||kI(e.parentNode))},AI=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=kI(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},jI=function(e,t,n,r){var i=AI(t,Array.isArray(e)?e:[e]);DI[n]||(DI[n]=new WeakMap);var a=DI[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(TI.get(e)||0)+1,l=(a.get(e)||0)+1;TI.set(e,c),a.set(e,l),o.push(e),c===1&&i&&EI.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),OI++,function(){o.forEach(function(e){var t=TI.get(e)-1,i=a.get(e)-1;TI.set(e,t),a.set(e,i),t||(EI.has(e)||e.removeAttribute(r),EI.delete(e)),i||e.removeAttribute(n)}),OI--,OI||(TI=new WeakMap,TI=new WeakMap,EI=new WeakMap,DI={})}},MI=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||wI(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),jI(r,i,n,`aria-hidden`)):function(){return null}},NI=Object.defineProperty,PI=(e,t)=>NI(e,`name`,{value:t,configurable:!0}),FI=`Dialog`,[II,LI]=MN(FI),[RI,zI]=II(FI),BI=PI(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=v.useRef(null),c=v.useRef(null),[l,u]=JN({prop:r,defaultProp:i??!1,onChange:a,caller:FI}),[d,f]=v.useState(0),[p,m]=v.useState(0);return(0,M.jsx)(RI,{scope:t,triggerRef:s,contentRef:c,contentId:zN(),titleId:zN(),descriptionId:zN(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:v.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),VI=`DialogPortal`,[HI,UI]=II(VI,{forceMount:void 0}),WI=PI(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=zI(VI,t);return(0,M.jsx)(HI,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,M.jsx)(rF,{present:n||a.open,children:(0,M.jsx)($P,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),GI=`DialogOverlay`,KI=v.forwardRef(PI(function(e,t){let n=UI(GI,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=zI(GI,e.__scopeDialog);return a.modal?(0,M.jsx)(rF,{present:r||a.open,children:(0,M.jsx)(JI,{...i,ref:t})}):null},`DialogOverlay`)),qI=tP(`DialogOverlay.RemoveScroll`),JI=v.forwardRef(PI(function(e,t){let{__scopeDialog:n,...r}=e,i=zI(GI,n),a=ON(t,kP());return(0,M.jsx)(CI,{as:qI,allowPinchZoom:!0,shards:[i.contentRef],children:(0,M.jsx)(gP.div,{"data-state":iL(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),YI=`DialogContent`,XI=v.forwardRef(PI(function(e,t){let n=UI(YI,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=zI(YI,e.__scopeDialog);return(0,M.jsx)(rF,{present:r||a.open,children:a.modal?(0,M.jsx)(ZI,{...i,ref:t}):(0,M.jsx)(QI,{...i,ref:t})})},`DialogContent`)),ZI=v.forwardRef(PI(function(e,t){let n=zI(YI,e.__scopeDialog),r=v.useRef(null),i=ON(t,n.contentRef,r);return v.useEffect(()=>{let e=r.current;if(e)return MI(e)},[]),(0,M.jsx)($I,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:yN(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:yN(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:yN(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),QI=v.forwardRef(PI(function(e,t){let n=zI(YI,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,M.jsx)($I,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),$I=v.forwardRef(PI(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=zI(YI,n);return mF(),(0,M.jsx)(M.Fragment,{children:(0,M.jsx)(BP,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,M.jsx)(OP,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":iL(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),eL=`DialogTitle`,tL=v.forwardRef(PI(function(e,t){let{__scopeDialog:n,...r}=e,i=zI(eL,n),{setTitleCount:a}=i;return PN(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,M.jsx)(gP.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),nL=`DialogClose`,rL=v.forwardRef(PI(function(e,t){let{__scopeDialog:n,...r}=e,i=zI(nL,n);return(0,M.jsx)(gP.button,{type:`button`,...r,ref:t,onClick:yN(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function iL(e){return e?`open`:`closed`}PI(iL,`getState`);var aL=(0,v.createContext)(!1);function oL({locked:e,children:t}){return(0,M.jsx)(aL.Provider,{value:e,children:t})}function sL(){return(0,v.useContext)(aL)}function cL(){let e=Ar(),[t,n]=(0,v.useState)(`idle`),r=(0,v.useRef)(!0),i=(0,v.useRef)(0),a=(0,v.useRef)(!1),o=(0,v.useRef)(void 0),s=(0,v.useRef)(void 0),c=(0,v.useRef)([]),l=(0,v.useRef)([]),u=t!==`idle`,d=(0,v.useCallback)(({nextLocation:e})=>{let t=o.current;if(!u||t===void 0||!t.active||t.signal.aborted||!r.current)return!1;let n={sequence:++i.current,source:a.current?`fallback`:`user`,location:e};t.latestIntent=n;let s=c.current.filter(e=>e.session===t&&e.intent.sequence<n.sequence);c.current=c.current.filter(e=>e.session!==t||e.intent.sequence>=n.sequence);for(let e of s)e.resolve(void 0);return!0},[u]),f=Yr(d),p=(0,v.useRef)(f);p.current=f;let m=(0,v.useCallback)(e=>{if(!r.current||!e.active)throw Error(`View refresh navigation lock owner is no longer active.`);if(e.signal.aborted)throw e.signal.reason},[]),h=(0,v.useCallback)((e,t)=>{m(e);let n=p.current;return lL(n,t)?Promise.resolve(n):new Promise((n,r)=>{c.current.push({session:e,intent:t,resolve:n,reject:r})})},[m]),g=(0,v.useCallback)(e=>(m(e),p.current.state===`unblocked`?Promise.resolve():new Promise((t,n)=>l.current.push({session:e,resolve:t,reject:n}))),[m]),_=(0,v.useCallback)((e,t)=>{if(!e.active)return;e.active=!1,e.removeAbortListener(),o.current===e&&(o.current=void 0);let n=s.current;n?.session===e&&(s.current=void 0,n.reject(t));let r=c.current.filter(t=>t.session===e);c.current=c.current.filter(t=>t.session!==e);for(let e of r)e.reject(t);let i=l.current.filter(t=>t.session===e);l.current=l.current.filter(t=>t.session!==e);for(let e of i)e.reject(t)},[]),y=(0,v.useCallback)(e=>{if(e.aborted)return Promise.reject(e.reason);if(!r.current||s.current!==void 0||o.current!==void 0||t!==`idle`)return Promise.reject(Error(`A View refresh navigation lock is already active.`));let i,a=()=>_(i,e.reason);return i={signal:e,active:!0,removeAbortListener:()=>e.removeEventListener(`abort`,a)},o.current=i,e.addEventListener(`abort`,a,{once:!0}),n(`locked`),new Promise((e,t)=>{s.current={session:i,resolve:e,reject:t}})},[_,t]),b=(0,v.useRef)(void 0);return b.current===void 0&&(b.current={hasUserIntent:()=>o.current?.latestIntent?.source===`user`,enqueueFallback:async t=>{let n=o.current;if(n===void 0)throw Error(`View refresh navigation lock is not active.`);if(m(n),n.latestIntent?.source!==`user`){a.current=!0;try{await e(t,{replace:!0,state:null})}finally{a.current=!1}if(n.latestIntent===void 0)throw Error(`View refresh fallback navigation was not blocked.`);m(n)}},release:async()=>{let e=o.current;if(e===void 0)throw Error(`View refresh navigation lock is not active.`);return e.release===void 0&&(e.release=(async()=>{m(e);let t;for(;e.latestIntent!==void 0;){let n=e.latestIntent,r=await h(e,n);if(m(e),e.latestIntent?.sequence!==n.sequence)continue;let i=p.current;if(r!==void 0&&lL(i,n)&&i===r){t=n.source,i.proceed();break}}return m(e),await g(e),m(e),n(`idle`),e.active=!1,e.removeAbortListener(),o.current===e&&(o.current=void 0),t})()),e.release},recover:()=>{let e=o.current;if(e===void 0)throw Error(`View refresh navigation lock is not active.`);m(e),n(`recovery`)}}),(0,v.useEffect)(()=>{if(t!==`locked`||s.current===void 0)return;let e=s.current;m(e.session),s.current=void 0,e.resolve(b.current)},[t,m,d]),(0,v.useEffect)(()=>{if(f.state!==`blocked`)return;let e=c.current.filter(e=>lL(f,e.intent));c.current=c.current.filter(e=>!lL(f,e.intent));for(let t of e)try{m(t.session),t.resolve(f)}catch(e){t.reject(e)}},[f,m]),(0,v.useEffect)(()=>{if(f.state!==`unblocked`)return;let e=l.current.splice(0);for(let t of e)try{m(t.session),t.resolve()}catch(e){t.reject(e)}},[f,m]),(0,v.useEffect)(()=>(r.current=!0,()=>{r.current=!1;let e=o.current;e!==void 0&&_(e,Error(`View refresh navigation lock owner was unmounted.`))}),[_]),{acquire:y,interactionLocked:u,recoveryRequired:t===`recovery`}}function lL(e,t){return e.state===`blocked`&&e.location===t.location&&uL(e.location,t.location)}function uL(e,t){return e.key===t.key&&e.pathname===t.pathname&&e.search===t.search&&e.hash===t.hash}function dL({title:e,children:t,onClose:n}){let{t:r}=Fo(),i=sL();return(0,M.jsx)(BI,{open:!0,onOpenChange:e=>{e||n()},children:(0,M.jsxs)(WI,{children:[(0,M.jsx)(KI,{className:`niceeval-view-dialog-overlay`,inert:i?!0:void 0}),(0,M.jsxs)(XI,{className:`niceeval-view-dialog`,inert:i?!0:void 0,onEscapeKeyDown:e=>{i&&e.preventDefault()},onPointerDownOutside:e=>{i&&e.preventDefault()},children:[(0,M.jsxs)(`div`,{className:`niceeval-view-dialog-head`,children:[(0,M.jsx)(tL,{className:`niceeval-view-dialog-title`,children:e}),(0,M.jsx)(rL,{disabled:i,className:`niceeval-view-dialog-close`,"aria-label":r(`report.close`),children:`×`})]}),(0,M.jsx)(`div`,{className:`niceeval-view-dialog-body niceeval-view-report-slot`,children:t})]})]})})}function fL(e,t){return typeof e==`string`?e:e[t]??e.en??Object.values(e).find(e=>typeof e==`string`)??``}function pL(...e){return e.filter(Boolean).join(` `)}function mL(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function hL(e){return typeof e==`string`||mL(e)&&Object.values(e).every(e=>typeof e==`string`)}function gL(e,t,n,r){return Error(`<${e}> received invalid ${n} from ${t}: ${r}.`)}function _L(e){return e.replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g,``)}function vL(e){let t=/^turn[-_ ]?(\d+)$/i.exec(e);return t===null?e:`Turn ${t[1]}`}function yL(e){if(e<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function bL(e,t=`en`){return new Intl.NumberFormat(t===`zh-CN`?`zh-CN`:`en-US`,{maximumFractionDigits:12,maximumSignificantDigits:12}).format(e)}function xL(e,t=`en`){return`${bL(e,t)} ${e===1?`pt`:`pts`}`}function SL(e,t){let n=new Date(e);return Number.isNaN(n.valueOf())?e:n.toLocaleString(t===`zh-CN`?`zh-CN`:`en-US`)}function CL(e){let t=Math.abs(e);if(t!==0&&t<1e-9)return`$${e.toExponential(4)}`;let n=t===0||t>=1?6:Math.min(12,Math.max(2,Math.ceil(-Math.log10(t))+5));return`$${e.toFixed(n).replace(/(?:\.0+|(?:(\.[0-9]*?)0+))$/,`$1`)}`}var wL={error:3,warning:2,info:1};function TL(e){return e.length===0||DL(e)===0}function EL(e){let t=[];for(let n of e){let e=n.groups;if(n.items.length===0&&e?.length===1){t.push(e[0]);continue}t.push(n)}return t}function DL(e){let t=0,n=e=>{for(let r of e)t+=r.items.length,r.groups&&n(r.groups)};return n(e),t}function OL(e){let t=`info`,n=e=>{for(let r of e){for(let e of r.items)wL[e.level]>wL[t]&&(t=e.level);r.groups&&n(r.groups)}};return n(e),t}function kL(e){return[...new Set(e.map(e=>e.command).filter(e=>e!==void 0))]}function AL(e){let t=kL(e.items);return t.length>1?null:t.length===1?t[0]:e.command??null}function jL(e,t){return t===`zh-CN`?e===`error`?`错误`:e===`warning`?`警告`:`提示`:e===`error`?`errors`:e===`warning`?`warnings`:`notices`}function ML(e,t){let n=EL(e),r=DL(e),i=jL(OL(e),t);if(n.length===1){let e=fL(n[0].title,t);return t===`zh-CN`?`${e} · ${r} 条${i}`:`${e} · ${r} ${i}`}return t===`zh-CN`?`${n.length} 组 · ${r} 条${i}`:`${n.length} groups · ${r} ${i}`}function NL(e,t){return e===`zh-CN`?`${t} 条明细`:t===1?`1 detail`:`${t} details`}function PL(e,t){let n=fL(e.message,t),r=e.count??1;return r<=1?n:`${n} ×${r}`}function FL({text:e,className:t,children:n}){let[r,i]=(0,v.useState)(!1),a=async()=>{try{if(navigator.clipboard===void 0)throw Error(`Clipboard API unavailable`);await navigator.clipboard.writeText(e),i(!0),window.setTimeout(()=>i(!1),1500)}catch{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.append(t),t.select();let n=document.execCommand(`copy`);t.remove(),n&&(i(!0),window.setTimeout(()=>i(!1),1500))}};return(0,M.jsxs)(`button`,{type:`button`,className:t,onClick:()=>void a(),children:[n,r?` ✓`:``]})}function IL(...e){return e.filter(Boolean).join(` `)}function LL(e,t){return mL(e)?e.level!==`error`&&e.level!==`warning`&&e.level!==`info`?`"${t}.level" must be error | warning | info`:hL(e.message)?null:`"${t}.message" must be a LocalizedText`:`"${t}" must be an object`}function RL(e,t){if(!mL(e))return`"${t}" must be an object`;if(!hL(e.title))return`"${t}.title" must be a LocalizedText`;if(!Array.isArray(e.items))return`"${t}.items" must be an array`;for(let n=0;n<e.items.length;n++){let r=LL(e.items[n],`${t}.items[${n}]`);if(r!==null)return r}return null}function zL(e){if(!Array.isArray(e))throw gL(`Callouts`,`toSampleNotices`,`CalloutGroup[]`,`"items" must be an array`);for(let t=0;t<e.length;t++){let n=RL(e[t],`items[${t}]`);if(n!==null)throw gL(`Callouts`,`toSampleNotices`,`CalloutGroup[]`,n)}return e}function BL({command:e}){return(0,M.jsx)(FL,{className:`niceeval-callout-command`,text:e,children:(0,M.jsx)(`code`,{children:e})})}function VL({group:e,locale:t,detailsOpen:n}){let r=AL(e),i=e.groups;return(0,M.jsxs)(`li`,{className:`niceeval-callout-group`,children:[(0,M.jsxs)(`div`,{className:IL(`niceeval-callout-head`,`niceeval-callout-head--${OL([e])}`),children:[(0,M.jsx)(`span`,{className:`niceeval-callout-title`,children:fL(e.title,t)}),e.badges?.map((e,n)=>(0,M.jsx)(`span`,{className:`niceeval-callout-badge`,children:fL(e,t)},n)),r===null?null:(0,M.jsx)(BL,{command:r})]}),e.items.length>0?(0,M.jsxs)(`details`,{className:`niceeval-callout-details`,open:n||void 0,children:[(0,M.jsx)(`summary`,{children:NL(t,e.items.length)}),(0,M.jsx)(`ul`,{className:`niceeval-callout-items`,children:e.items.map((e,n)=>(0,M.jsxs)(`li`,{className:IL(`niceeval-callout-item`,`niceeval-callout-item--${e.level}`),children:[(0,M.jsx)(`span`,{className:`niceeval-callout-message`,children:PL(e,t)}),r===null&&e.command!==void 0?(0,M.jsx)(BL,{command:e.command}):null]},n))})]}):null,i&&i.length>0?(0,M.jsx)(`ul`,{className:`niceeval-callout-nested`,children:EL(i).map((e,r)=>(0,M.jsx)(VL,{group:e,locale:t,detailsOpen:n},r))}):null]})}function HL(e,t,n){if(TL(e))return null;let r=EL(e),i=DL(e)<=3,a=OL(e);return(0,M.jsx)(`div`,{className:IL(`niceeval-report`,`niceeval-callouts`,n),children:(0,M.jsxs)(`details`,{className:`niceeval-callouts-root`,children:[(0,M.jsx)(`summary`,{className:IL(`niceeval-callouts-summary`,`niceeval-callouts-summary--${a}`),children:ML(e,t)}),(0,M.jsx)(`ul`,{className:`niceeval-callout-groups`,children:r.map((e,n)=>(0,M.jsx)(VL,{group:e,locale:t,detailsOpen:i},n))})]})})}function UL({items:e,locale:t,className:n}){return HL(zL(e??[]),t,n)}function WL(...e){return e.filter(Boolean).join(` `)}function GL(e,t,n){return e===`zh-CN`?n:t}function KL(e){try{return JSON.parse(e)}catch{return}}function qL(e){return mL(e)?e:void 0}function JL(e,t){for(let n of t){let t=e[n];if(typeof t==`string`)return t}}function YL(e,t){for(let n of t){let t=e[n];if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)return t}}function XL(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>!t.has(e)))}function ZL({children:e,tone:t}){return(0,M.jsx)(`pre`,{className:WL(`niceeval-tool-evidence-code`,t===`error`&&`niceeval-tool-evidence-code--error`),children:e})}function QL({label:e,children:t}){return(0,M.jsxs)(`section`,{className:`niceeval-tool-evidence-section`,children:[(0,M.jsx)(`h5`,{children:e}),t]})}function $L(e,t){let n=JL(e,[`command`,`cmd`,`script`]);if(n===void 0)return;let r=JL(e,[`cwd`,`workdir`]),i=XL(e,new Set([`command`,`cmd`,`script`,`cwd`,`workdir`]));return(0,M.jsxs)(`div`,{className:`niceeval-tool-evidence`,"data-tool-evidence-kind":`command`,children:[r===void 0?null:(0,M.jsxs)(`div`,{className:`niceeval-tool-evidence-context`,children:[(0,M.jsx)(`span`,{children:GL(t,`Working directory`,`工作目录`)}),(0,M.jsx)(`code`,{children:r})]}),(0,M.jsx)(QL,{label:GL(t,`Command`,`命令`),children:(0,M.jsx)(ZL,{children:n})}),Object.keys(i).length===0?null:(0,M.jsx)(QL,{label:GL(t,`Additional input`,`其他输入`),children:(0,M.jsx)(ZL,{children:JSON.stringify(i,null,2)})})]})}function eR(e,t){let n=JL(e,[`output`,`stdout`]),r=JL(e,[`stderr`]),i=YL(e,[`exit_code`,`exitCode`]),a=YL(e,[`signal`]);if(n===void 0&&r===void 0&&i===void 0&&a===void 0)return;let o=XL(e,new Set([`output`,`stdout`,`stderr`,`exit_code`,`exitCode`,`signal`]));return(0,M.jsxs)(`div`,{className:`niceeval-tool-evidence`,"data-tool-evidence-kind":`terminal`,children:[(0,M.jsxs)(`div`,{className:`niceeval-tool-evidence-context`,children:[i===void 0?null:(0,M.jsxs)(`span`,{children:[GL(t,`Exit`,`退出码`),` `,(0,M.jsx)(`strong`,{"data-failed":Number(i)!==0||void 0,children:String(i)})]}),a===void 0?null:(0,M.jsxs)(`span`,{children:[GL(t,`Signal`,`信号`),` `,(0,M.jsx)(`strong`,{children:String(a)})]})]}),n===void 0?null:(0,M.jsx)(QL,{label:GL(t,`Output`,`输出`),children:(0,M.jsx)(ZL,{children:n||GL(t,`No output`,`无输出`)})}),r===void 0||r===``?null:(0,M.jsx)(QL,{label:`stderr`,children:(0,M.jsx)(ZL,{tone:`error`,children:r})}),Object.keys(o).length===0?null:(0,M.jsx)(QL,{label:GL(t,`Additional result`,`其他结果`),children:(0,M.jsx)(ZL,{children:JSON.stringify(o,null,2)})})]})}function tR(e,t){let n=e.phase===`finished`?e.outputSummary??``:e.inputSummary,r=KL(n),i=qL(r),a=i===void 0?void 0:e.phase===`started`?$L(i,t):eR(i,t);if(a!==void 0)return a;let o=r===void 0?n:typeof r==`string`?r:JSON.stringify(r,null,2);return(0,M.jsx)(`div`,{className:`niceeval-tool-evidence`,"data-tool-evidence-kind":r===void 0?`text`:`json`,children:(0,M.jsx)(QL,{label:r===void 0?GL(t,`Text`,`文本`):`JSON`,children:(0,M.jsx)(ZL,{tone:e.outcome===`failed`||e.outcome===`rejected`?`error`:void 0,children:o})})})}function nR({content:e,locale:t}){return tR(e,t)}function rR(...e){return e.filter(Boolean).join(` `)}function iR(e,t){return e.kind===`tool-evidence`?(0,M.jsx)(nR,{content:e.content,locale:t}):e.kind===`text`?(0,M.jsx)(`div`,{className:rR(`niceeval-report`,`niceeval-text`,e.className),children:e.text}):e.items.map((e,n)=>(0,M.jsx)(v.Fragment,{children:iR(e,t)},n))}function aR(e,t,n=140){let r=_L(fL(e,t)).replace(/\s+/g,` `).trim();return r.length>n?`${r.slice(0,n)}…`:r}function oR(e){let t=e.classification===`succeeded`?`COMMAND`:e.classification===`failed`?`FAILED COMMAND`:`NON-ZERO COMMAND · observed`,n=e.exitCode===void 0?typeof e.outcome==`string`?e.outcome:JSON.stringify(e.outcome):`exit ${e.exitCode}`;return`${t} · ${e.phase} · ${n}${e.durationMs===void 0?``:` · ${e.durationMs}ms`}`}function sR({command:e}){return(0,M.jsxs)(`article`,{className:rR(`niceeval-command-evidence-card`,`niceeval-command-evidence--${e.classification}`),children:[(0,M.jsx)(`header`,{className:`niceeval-conversation-turn-head`,children:(0,M.jsx)(`span`,{className:`niceeval-conversation-turn-label`,children:oR(e)})}),(0,M.jsx)(`div`,{className:`niceeval-command-evidence-display`,children:e.display}),e.stdout?(0,M.jsxs)(`details`,{className:`niceeval-conversation-entry niceeval-conversation-entry--expandable`,children:[(0,M.jsx)(`summary`,{className:`niceeval-conversation-entry-summary`,children:`stdout`}),(0,M.jsx)(`pre`,{className:`niceeval-conversation-io`,children:e.stdout})]}):null,e.stderr?(0,M.jsxs)(`details`,{className:`niceeval-conversation-entry niceeval-conversation-entry--expandable`,open:!0,children:[(0,M.jsx)(`summary`,{className:`niceeval-conversation-entry-summary`,children:`stderr`}),(0,M.jsx)(`pre`,{className:`niceeval-conversation-io`,children:e.stderr})]}):null]})}function cR(e){if(e==null)return null;if(!mL(e)||!Array.isArray(e.commands))throw gL(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands" must be an array`);for(let[t,n]of e.commands.entries()){if(!mL(n))throw gL(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}]" must be an object`);if(typeof n.commandId!=`string`)throw gL(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}].commandId" must be a string`);if(typeof n.phase!=`string`)throw gL(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}].phase" must be a string`);if(typeof n.display!=`string`)throw gL(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}].display" must be a string`);if(n.exitCode!==void 0&&typeof n.exitCode!=`number`)throw gL(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}].exitCode" must be a number`);if(n.outcome===void 0)throw gL(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}].outcome" must be present`);if(n.classification!==`succeeded`&&n.classification!==`observed`&&n.classification!==`failed`)throw gL(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}].classification" must be succeeded | observed | failed`);if(n.durationMs!==void 0&&typeof n.durationMs!=`number`)throw gL(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}].durationMs" must be a number`);if(n.stdout!==void 0&&typeof n.stdout!=`string`)throw gL(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}].stdout" must be a string`);if(n.stderr!==void 0&&typeof n.stderr!=`string`)throw gL(`CommandEvidence`,`commandEvidenceData`,`CommandEvidenceContent`,`"data.commands[${t}].stderr" must be a string`)}return e}function lR({data:e,className:t,locale:n}){let r=cR(e);return r===null||r.commands.length===0?null:(0,M.jsx)(`section`,{className:rR(`niceeval-report`,`niceeval-command-evidence`,t),children:(0,M.jsxs)(`details`,{className:`niceeval-command-evidence-region`,children:[(0,M.jsx)(`summary`,{className:`niceeval-command-evidence-summary`,children:fL({en:`Commands · ${r.commands.length}`,"zh-CN":`命令证据 · ${r.commands.length}`},n)}),(0,M.jsx)(`div`,{className:`niceeval-command-evidence-cards`,children:r.commands.map(e=>(0,M.jsx)(sR,{command:e},e.commandId))})]})})}function uR(e){return e===`added`?`A`:e===`deleted`?`D`:`M`}function dR(e){return e===`binary`?`binary`:`oversized text`}function fR(e){return[...e].sort((e,t)=>e.path.localeCompare(t.path))}var pR=new TextEncoder;function mR(e){let t=0;for(let n of e.windows)n.patch!==void 0&&(t+=pR.encode(n.patch).length);return t}function hR(e){let t=new Set,n=0;for(let r of fR(e)){if(r.elided)continue;let e=mR(r);e===0||e>65536||n+e>524288||(n+=e,t.add(r.path))}return t}function gR(e,t){return{name:e,path:t,dirs:new Map,files:[]}}function _R(e){let t=gR(``,``);for(let n of fR(e)){let e=n.path.split(`/`),r=t;for(let t=0;t<e.length-1;t++){let n=e[t],i=r.path===``?n:`${r.path}/${n}`,a=r.dirs.get(n);a===void 0&&(a=gR(n,i),r.dirs.set(n,a)),r=a}r.files.push(n)}return vR(t)}function vR(e){let t=e;for(;t.files.length===0&&t.dirs.size===1&&t.path!==``;){let e=[...t.dirs.values()][0];t={name:`${t.name}/${e.name}`,path:e.path,dirs:e.dirs,files:e.files}}let n=[...t.dirs.values()].map(vR).sort((e,t)=>e.path.localeCompare(t.path)),r=t.files,i=r.length,a=0,o=0;for(let e of r)a+=e.added,o+=e.removed;for(let e of n)i+=e.fileCount,a+=e.added,o+=e.removed;return{name:t.name,path:t.path,dirs:n,files:r,fileCount:i,added:a,removed:o}}function yR(e,t){if(!mL(e))return`"${t}" must be a DiffFile object`;if(typeof e.path!=`string`)return`"${t}.path" must be a string`;if(e.change!==`added`&&e.change!==`modified`&&e.change!==`deleted`)return`"${t}.change" must be added | modified | deleted`;if(typeof e.added!=`number`)return`"${t}.added" must be a number`;if(typeof e.removed!=`number`)return`"${t}.removed" must be a number`;if(!Array.isArray(e.windows))return`"${t}.windows" must be an array of DiffFileWindow`;for(let n=0;n<e.windows.length;n++){let r=e.windows[n];if(!mL(r)||typeof r.window!=`string`)return`"${t}.windows[${n}].window" must be a string`;if(r.patch!==void 0&&typeof r.patch!=`string`)return`"${t}.windows[${n}].patch" must be a string`}return null}function bR(e){if(e==null)return null;if(!Array.isArray(e))throw gL(`DiffView`,`diffViewFiles`,`DiffContent`,`"files" must be an array or null`);for(let t=0;t<e.length;t++){let n=yR(e[t],`files[${t}]`);if(n!==null)throw gL(`DiffView`,`diffViewFiles`,`DiffContent`,n)}return e}function xR(e){let t=[],n=1,r=1;for(let i of e.split(`
59
+ `)){if(i.startsWith(`@@`)){t.push({kind:`meta`,oldNo:null,newNo:null,text:i});let e=i.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);e&&(n=Number(e[1]),r=Number(e[2]));continue}if(i.startsWith(`+++`)||i.startsWith(`---`)){t.push({kind:`meta`,oldNo:null,newNo:null,text:i});continue}if(i.startsWith(`+`)){t.push({kind:`add`,oldNo:null,newNo:r,text:i.slice(1)}),r+=1;continue}if(i.startsWith(`-`)){t.push({kind:`remove`,oldNo:n,newNo:null,text:i.slice(1)}),n+=1;continue}let e=i.startsWith(` `)?i.slice(1):i;t.push({kind:`context`,oldNo:n,newNo:r,text:e}),n+=1,r+=1}return t}function SR({patch:e}){let t=xR(e);return(0,M.jsx)(`pre`,{className:`niceeval-diff-patch`,children:t.map((e,t)=>(0,M.jsxs)(`div`,{className:pL(`niceeval-diff-patch-line`,e.kind===`add`&&`niceeval-diff-patch-line--add`,e.kind===`remove`&&`niceeval-diff-patch-line--remove`,e.kind===`meta`&&`niceeval-diff-patch-line--meta`),children:[(0,M.jsx)(`span`,{className:`niceeval-diff-patch-ln niceeval-diff-patch-ln-old`,children:e.oldNo===null?``:e.oldNo}),(0,M.jsx)(`span`,{className:`niceeval-diff-patch-ln niceeval-diff-patch-ln-new`,children:e.newNo===null?``:e.newNo}),(0,M.jsx)(`span`,{className:`niceeval-diff-patch-text`,children:e.text})]},t))})}function CR({windows:e}){let t=e.filter(e=>e.patch!==void 0&&e.patch.length>0);return t.length===0?(0,M.jsx)(`p`,{className:`niceeval-diff-patch-missing`,children:`Patch unavailable for this file.`}):(0,M.jsx)(M.Fragment,{children:t.map(e=>(0,M.jsxs)(`section`,{className:`niceeval-diff-window`,children:[(0,M.jsxs)(`h4`,{className:`niceeval-diff-window-title`,children:[`window `,vL(e.window)]}),(0,M.jsx)(SR,{patch:e.patch})]},e.window))})}function wR(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function TR({added:e,removed:t}){return(0,M.jsxs)(`span`,{className:`niceeval-diff-lines`,children:[(0,M.jsxs)(`span`,{className:`niceeval-diff-lines-added`,children:[`+`,e]}),` / `,(0,M.jsxs)(`span`,{className:`niceeval-diff-lines-removed`,children:[`-`,t]})]})}function ER({file:e}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`niceeval-diff-change`,"data-change":e.change,children:uR(e.change)}),(0,M.jsx)(`span`,{className:`niceeval-diff-path`,children:wR(e.path)}),e.elided?(0,M.jsxs)(`span`,{className:`niceeval-diff-bytes`,children:[dR(e.elided.reason),` `,e.elided.beforeBytes??0,` → `,e.elided.afterBytes??0,` bytes`]}):(0,M.jsx)(TR,{added:e.added,removed:e.removed})]})}function DR({file:e,inlined:t,drillCommand:n}){let r=pL(`niceeval-diff-file`,`niceeval-diff-${e.change}`);if(!t){let t=e.elided;return(0,M.jsxs)(`li`,{className:r,"data-inlined":`false`,children:[(0,M.jsx)(`div`,{className:`niceeval-diff-file-summary`,children:(0,M.jsx)(ER,{file:e})}),(0,M.jsxs)(`p`,{className:`niceeval-diff-patch-omitted`,children:[t?`${dR(t.reason)} file · content elided from the diff export`:`patch over inline budget`,t===void 0&&n!==void 0?(0,M.jsxs)(M.Fragment,{children:[` · `,(0,M.jsx)(`code`,{children:`${n}=${e.path}`})]}):null]})]})}return(0,M.jsx)(`li`,{className:r,"data-inlined":`true`,children:(0,M.jsxs)(`details`,{children:[(0,M.jsx)(`summary`,{className:`niceeval-diff-file-summary`,children:(0,M.jsx)(ER,{file:e})}),(0,M.jsx)(CR,{windows:e.windows})]})})}function OR({node:e,inlined:t,drillCommand:n}){return(0,M.jsxs)(`ul`,{className:`niceeval-diff-tree`,children:[e.dirs.map(e=>(0,M.jsx)(`li`,{className:`niceeval-diff-dir`,children:(0,M.jsxs)(`details`,{open:!0,children:[(0,M.jsxs)(`summary`,{className:`niceeval-diff-dir-summary`,children:[(0,M.jsxs)(`span`,{className:`niceeval-diff-dir-name`,children:[e.name,`/`]}),(0,M.jsxs)(`span`,{className:`niceeval-diff-dir-count`,children:[e.fileCount,` `,e.fileCount===1?`file`:`files`]}),(0,M.jsx)(TR,{added:e.added,removed:e.removed})]}),(0,M.jsx)(OR,{node:e,inlined:t,drillCommand:n})]})},e.path)),e.files.map(e=>(0,M.jsx)(DR,{file:e,inlined:t.has(e.path),drillCommand:n},e.path))]})}function kR({files:e,className:t,drillCommand:n}){let r=bR(e);return r===null||r.length===0?null:(0,M.jsx)(`div`,{className:pL(`niceeval-report`,`niceeval-diff-view`,t),children:(0,M.jsx)(OR,{node:_R(r),inlined:hR(r),drillCommand:n})})}function X(e,t,n){return e===`zh-CN`?n:t}function AR(e,t){switch(e){case`requirement`:return X(t,`Requirement`,`目标`);case`observed`:return X(t,`Observed`,`结果`);case`examined`:return X(t,`Examined`,`检查范围`);case`coverage`:return X(t,`Source`,`记录完整度`)}}function jR(e,t){switch(e){case`matched`:return X(t,`Match`,`命中`);case`mismatched`:return X(t,`No match`,`未命中`);case`unavailable`:return X(t,`Unknown`,`无法判断`);case`not-evaluated`:return X(t,`Not evaluated`,`未参与判断`);case`not-retained`:return X(t,`Checked`,`已检查`);case`outside-snapshot`:return X(t,`After evaluation`,`评估后出现`);case`legacy`:return X(t,`Recorded`,`已记录`)}}function MR(e,t){switch(e){case`tool`:return X(t,`Tool call`,`工具调用`);case`event`:return X(t,`Event`,`事件`);case`legacy-source-row`:return X(t,`Record`,`记录`)}}function NR(e,t){return e===void 0?null:e===`matched`?X(t,`match`,`命中`):e===`mismatched`?X(t,`different`,`不匹配`):X(t,`unknown`,`无法判断`)}function PR({fields:e,locale:t}){return e.length===0?null:(0,M.jsx)(`dl`,{className:`niceeval-filter-row-fields`,children:e.map((e,n)=>{let r=NR(e.state,t);return(0,M.jsxs)(`div`,{"data-field-state":e.state,children:[(0,M.jsx)(`dt`,{children:e.label}),(0,M.jsx)(`dd`,{children:(0,M.jsx)(`pre`,{children:e.value})}),r===null?null:(0,M.jsx)(`span`,{children:r})]},`${e.label}:${n}`)})})}function FR({anchor:e,locale:t}){return(0,M.jsxs)(`button`,{type:`button`,className:`niceeval-filter-row-target`,onClick:()=>{let t=document.getElementById(`conversation-${e}`)??document.getElementById(`trace-${e}`),n=t?.closest(`details`);n instanceof HTMLDetailsElement&&(n.open=!0),t?.scrollIntoView({behavior:`smooth`,block:`center`}),t instanceof HTMLElement&&t.focus()},children:[X(t,`View in conversation`,`在会话中查看`),(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`↗`})]})}function IR({row:e,locale:t}){let n=`${MR(e.kind,t)} ${e.number}`,r=e.fields.length>0||(e.difference?.length??0)>0||e.note!==void 0||e.conversationTarget!==void 0,i=(0,M.jsxs)(`span`,{className:`niceeval-filter-row-summary`,children:[(0,M.jsx)(`span`,{className:`niceeval-filter-row-number`,children:n}),(0,M.jsx)(`strong`,{children:e.summary}),(0,M.jsx)(`span`,{className:`niceeval-filter-row-state`,"data-state":e.state,children:jR(e.state,t)})]});return r?(0,M.jsxs)(`details`,{className:`niceeval-filter-row`,"data-state":e.state,children:[(0,M.jsx)(`summary`,{children:i}),(0,M.jsxs)(`div`,{className:`niceeval-filter-row-detail`,children:[e.note===void 0?null:(0,M.jsx)(`p`,{className:`niceeval-filter-row-note`,children:e.note}),e.difference===void 0||e.difference.length===0?null:(0,M.jsxs)(`section`,{children:[(0,M.jsx)(`h6`,{children:X(t,`Filter comparison`,`Filter 对比`)}),(0,M.jsx)(PR,{fields:e.difference,locale:t})]}),e.fields.length===0?null:(0,M.jsxs)(`section`,{children:[(0,M.jsx)(`h6`,{children:X(t,`Recorded detail`,`调用详情`)}),(0,M.jsx)(PR,{fields:e.fields,locale:t})]}),e.conversationTarget===void 0?null:(0,M.jsx)(FR,{anchor:e.conversationTarget.anchor,locale:t})]})]}):(0,M.jsx)(`div`,{className:`niceeval-filter-row`,"data-state":e.state,children:i})}function LR(e,t){switch(e){case`matched`:return X(t,`Matched`,`已匹配`);case`possible`:return X(t,`Possible`,`可能匹配`);case`blocked`:return X(t,`Blocked here`,`阻塞于此`);case`not-reached`:return X(t,`Not reached`,`尚未到达`)}}function RR({steps:e,locale:t}){return e.length===0?null:(0,M.jsxs)(`section`,{className:`niceeval-filter-steps`,children:[(0,M.jsx)(`h5`,{children:X(t,`Sequence path`,`顺序匹配路径`)}),(0,M.jsx)(`ol`,{children:e.map(e=>(0,M.jsxs)(`li`,{"data-state":e.state,children:[(0,M.jsx)(`span`,{className:`niceeval-filter-step-index`,children:e.step}),(0,M.jsx)(`code`,{children:e.summary}),e.sourceRow===void 0?null:(0,M.jsx)(`span`,{children:e.sourceRow}),(0,M.jsx)(`span`,{className:`niceeval-filter-step-state`,children:LR(e.state,t)}),e.conversationTarget===void 0?null:(0,M.jsx)(FR,{anchor:e.conversationTarget.anchor,locale:t})]},e.step))})]})}function zR(e,t){return e===`tool`?X(t,`tool calls`,`工具调用`):e===`event`?X(t,`events`,`事件`):X(t,`records`,`记录`)}function BR(e,t){switch(e){case`historical-not-recorded`:return X(t,`This historical Record did not retain this Matcher query or its row-by-row relation. Rerun it to inspect match reasons and paths.`,`此历史 Record 未保存本次 Matcher 查询与逐行关联,重跑后可查看命中原因/匹配路径。`);case`source-unavailable`:return X(t,`The source records were not retained.`,`没有保存可用的来源记录。`);case`ambiguous-relation`:return X(t,`The stored identities cannot prove a unique assertion-to-row relation.`,`已保存的身份无法证明断言与记录之间唯一对应。`);case`source-partial`:return X(t,`The source records may be incomplete; missing rows are not treated as mismatches.`,`来源记录可能不完整;缺失记录不会被当作未命中。`);case`overlay-partial`:return X(t,`Only bounded representative comparisons were retained; other examined rows are marked as checked.`,`只保留了有界的代表性对比;其余参与评估的记录标记为“已检查”。`)}}function VR(e,t){return e.queryKind===`ordered-sequence`?X(t,`Event order`,`事件顺序`):e.subject===`tool`?X(t,`Tool call filter`,`工具调用筛选`):X(t,`Event filter`,`事件筛选`)}function HR(e){return typeof e==`object`&&e&&!Array.isArray(e)&&`kind`in e&&typeof e.kind==`string`?e.kind:void 0}function UR(e){let t=e.comparator;return typeof t==`object`&&t&&!Array.isArray(t)&&`display`in t&&typeof t.display==`string`?t.display:t==null?e.querySummary:JSON.stringify(t)}function WR(e,t,n){let r=e.atEvaluation.rows.length;return n===`zh-CN`?e.state===`legacy`?`查看已记录的 ${r} 条${t}`:`查看评估时的 ${r} 条${t}`:e.state===`legacy`?`View ${r} recorded ${t}`:`View the ${r} ${t} at evaluation`}function GR({content:e,locale:t}){let n=zR(e.subject,t),r=e.state===`legacy`;return(0,M.jsxs)(`section`,{className:`niceeval-filter-debugger`,"aria-label":VR(e,t),"data-state":e.state,"data-source-state":e.atEvaluation.state,"data-comparator":HR(e.comparator),children:[r?null:(0,M.jsxs)(`header`,{className:`niceeval-filter-debugger-head`,children:[(0,M.jsx)(`span`,{children:VR(e,t)}),(0,M.jsx)(`code`,{children:UR(e)}),e.retainedTarget?.state===`available`?(0,M.jsx)(FR,{anchor:e.retainedTarget.anchor,locale:t}):null]}),e.facts.length===0?null:(0,M.jsx)(`dl`,{className:`niceeval-filter-facts`,children:e.facts.map(e=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:AR(e.kind,t)}),(0,M.jsx)(`dd`,{children:fL(e.value,t)})]},e.kind))}),(0,M.jsx)(RR,{steps:e.steps??[],locale:t}),e.relationNotice===void 0?null:(0,M.jsx)(`p`,{className:`niceeval-filter-notice`,children:BR(e.relationNotice,t)}),e.retainedTarget?.state===`unavailable`?(0,M.jsx)(`p`,{className:`niceeval-filter-notice`,children:e.retainedTarget.reason}):null,e.commandMatch?.state===`unavailable`?(0,M.jsx)(`p`,{className:`niceeval-filter-notice`,children:e.commandMatch.reason}):null,(e.atEvaluation.notices??[]).map(e=>(0,M.jsx)(`p`,{className:`niceeval-filter-notice`,children:BR(e,t)},e)),(0,M.jsxs)(`details`,{className:`niceeval-filter-ledger`,children:[(0,M.jsxs)(`summary`,{children:[(0,M.jsx)(`span`,{children:WR(e,n,t)}),r&&e.atEvaluation.state===`partial`?(0,M.jsx)(`small`,{children:X(t,`Records may be incomplete`,`记录可能不完整`)}):null]}),(0,M.jsxs)(`div`,{className:`niceeval-filter-ledger-content`,children:[(0,M.jsx)(`p`,{children:r?X(t,`Open a row to inspect its recorded detail.`,`展开任一行可查看已记录详情。`):X(t,`Open a row to inspect its captured detail and filter comparison.`,`展开任一行可查看已记录详情和 Filter 对比。`)}),e.atEvaluation.rows.length===0?null:(0,M.jsx)(`div`,{className:`niceeval-filter-rows`,children:e.atEvaluation.rows.map(e=>(0,M.jsx)(IR,{row:e,locale:t},e.key))}),e.atEvaluation.rows.length===0&&(r||e.atEvaluation.state!==`unavailable`)?(0,M.jsx)(`p`,{className:`niceeval-filter-empty`,children:e.atEvaluation.state===`unavailable`?X(t,`Source rows were not recorded.`,`没有记录可用的来源行。`):X(t,`No ${n} were in this evaluation snapshot.`,`这个评估快照里没有${n}。`)}):null]})]}),e.afterEvaluation.length===0?null:(0,M.jsxs)(`details`,{className:`niceeval-filter-later`,children:[(0,M.jsxs)(`summary`,{children:[X(t,`Context recorded after evaluation`,`评估后记录的上下文`),(0,M.jsx)(`span`,{children:e.afterEvaluation.length})]}),(0,M.jsx)(`p`,{children:X(t,`These rows are visible for context and did not affect the sealed result.`,`这些行只用于查看上下文,不影响已经封口的判断结果。`)}),(0,M.jsx)(`div`,{className:`niceeval-filter-rows`,children:e.afterEvaluation.map(e=>(0,M.jsx)(IR,{row:e,locale:t},e.key))})]})]})}var KR=240,qR=120;function Z(e,t,n){return e===`zh-CN`?n:t}function JR(e){return typeof e==`string`?JSON.stringify(e):String(e)}function YR(e){return Array.from(e)}function XR(e,t){let n=YR(e),r=n.slice(0,qR).join(``),i=Z(t,n.length===1?`character`:`characters`,`字符`);return`${n.length} ${i} · ${JSON.stringify(r)}…`}function Q(e,t){return e?.kind===`fields`?e.fields.find(e=>e.label===t)?.value:void 0}function ZR(e){return e?.kind===`value`&&typeof e.value==`string`?e.value:void 0}function QR(e){if(e?.kind===`text`)return e.text;if(e?.kind===`unavailable`)return e.reason;if(e?.kind===`value`)return typeof e.value==`string`?e.value:String(e.value)}function $R(e){return e?.kind===`value`&&typeof e.value==`number`?e.value:void 0}function ez(e){let t=Q(e,`data`);if(rz(e)===`numeric-comparison/v1`){let e=ZR(Q(t,`comparator`)),n=$R(Q(t,`threshold`));if(e!==void 0&&n!==void 0){let r=ZR(Q(t,`unit`)),i=ly(n,r),a=$R(Q(t,`upperThreshold`));if(e===`between`&&a!==void 0)return`between(${i}, ${ly(a,r)})`;let o=e===`less-than`?`lessThan`:e===`at-most`?`atMost`:e===`greater-than`?`greaterThan`:e===`at-least`?`atLeast`:void 0;if(o!==void 0)return`${o}(${i})`}}let n=ZR(Q(Q(t,`matcher`),`name`));if(n!==void 0)return n;if(rz(e)!==`occurrence/v1`&&rz(e)!==`occurrence/v2`||ZR(Q(t,`occurrence`))!==`tool`)return;let r=ZR(Q(t,`matcher`));if(r===void 0)return;let i=ZR(Q(t,`assertion`));if(i===`order`)return r;let a=Q(t,`quantifier`),o=ZR(Q(a,`kind`)),s=$R(Q(a,`count`));if(i===`absent`||o===`absent`)return`notCalledTool(${r})`;if(o===`at-least`&&s===1)return`calledTool(${r})`;let c=o===`at-least`?`atLeast`:o===`less-than`?`lessThan`:o===`at-most`?`atMost`:o===`greater-than`?`greaterThan`:o===`exact`?`exactly`:void 0;return c!==void 0&&s!==void 0?`${r}.${c}(${s})`:`calledTool(${r})`}function tz(e){let t=ZR(e);return t===`matched`||t===`mismatched`||t===`unavailable`?t:void 0}function nz(e){if(e?.kind!==`fields`)return null;let t=Q(e,`children`),n=t?.kind===`list`?t.items.flatMap((e,t)=>{let n=tz(Q(e,`state`));return n===void 0?[]:[{index:$R(Q(e,`index`))??t,label:ZR(Q(e,`label`))??`matcher ${t+1}`,state:n,diagnostic:nz(Q(e,`diagnostic`))}]}):[];return{code:ZR(Q(e,`code`)),expected:Q(e,`expected`),received:Q(e,`received`),reason:ZR(Q(e,`reason`)),locator:ZR(Q(Q(e,`locator`),`id`)),children:n}}function rz(e){return ZR(Q(e,`id`))}function iz(e){return(rz(e)===`occurrence/v1`||rz(e)===`occurrence/v2`)&&ZR(Q(Q(e,`data`),`occurrence`))===`tool`}function az(e){return e===`less-than`||e===`at-most`||e===`greater-than`||e===`at-least`||e===`between`?e:void 0}function oz(e){return e===`exact`||e===`lower-bound`||e===`unavailable`?e:void 0}function sz(e,t){if(rz(e)!==`numeric-comparison/v1`)return;let n=Q(e,`data`),r=az(ZR(Q(n,`comparator`))),i=$R(Q(n,`threshold`)),a=Q(n,`subject`),o=ZR(Q(a,`kind`)),s=Q(t,`input`),c=oz(ZR(Q(s,`state`)));if(r===void 0||i===void 0||c===void 0||o!==`explicit-value`&&o!==`scope-metric`&&o!==`collection-cardinality`)return;let l=ZR(Q(a,`metric`)),u=ZR(Q(a,`scope`)),d=ZR(Q(a,`unit`));return{comparator:r,threshold:i,upperThreshold:$R(Q(n,`upperThreshold`)),unit:ZR(Q(n,`unit`)),subject:{kind:o,...l===`tokens`||l===`cost`?{metric:l}:{},...u===`turn`||u===`session`||u===`attempt`?{scope:u}:{},...d===`tokens`||d===`usd`?{unit:d}:{}},material:{state:c,unit:ZR(Q(s,`unit`)),...$R(Q(s,`value`))===void 0?{}:{value:$R(Q(s,`value`))},...ZR(Q(s,`reason`))===void 0?{}:{reason:ZR(Q(s,`reason`))},...Q(s,`derivation`)===void 0?{}:{derivation:Q(s,`derivation`)}}}}function cz(e){if(ZR(Q(e,`kind`))!==`pricing-estimate`)return;let t=ZR(Q(e,`model`)),n=Q(e,`priceSource`),r=ZR(Q(n,`kind`)),i=ZR(Q(n,`selector`)),a=$R(Q(e,`amountUSD`)),o=Q(e,`charges`);if(!(t===void 0||i===void 0||a===void 0||r!==`configured-override`&&r!==`builtin`||o?.kind!==`list`))return{model:t,sourceKind:r,sourceSelector:i,charges:o.items.flatMap(e=>{let t=ZR(Q(e,`bucket`)),n=$R(Q(e,`tokens`)),r=$R(Q(e,`rateUSDPerMTok`)),i=$R(Q(e,`amountUSD`));return t!==`input`&&t!==`output`&&t!==`cache-read`&&t!==`cache-write`||n===void 0||r===void 0||i===void 0?[]:[{bucket:t,tokens:n,rateUSDPerMTok:r,amountUSD:i}]}),amountUSD:a}}function lz(e){let t=ZR(Q(e,`kind`));if(t===`at-least`){let t=$R(Q(e,`threshold`));return t===void 0?void 0:{kind:`text`,text:`≥ ${t}`}}return t===void 0?e:void 0}function uz(e){return Q(e,`value`)??e}function dz({value:e,locale:t,quoted:n}){return(0,M.jsxs)(`details`,{className:`niceeval-assertion-evidence-long-value`,children:[(0,M.jsx)(`summary`,{children:XR(e,t)}),(0,M.jsx)(`pre`,{className:`niceeval-assertion-evidence-code`,children:n?JSON.stringify(e):e})]})}function fz({value:e,locale:t}){switch(e.kind){case`text`:return YR(e.text).length>KR?(0,M.jsx)(dz,{value:e.text,locale:t,quoted:!1}):(0,M.jsx)(`p`,{children:e.text});case`value`:return typeof e.value==`string`&&YR(e.value).length>KR?(0,M.jsx)(dz,{value:e.value,locale:t,quoted:!0}):(0,M.jsx)(`pre`,{className:`niceeval-assertion-evidence-code`,children:JR(e.value)});case`unavailable`:return(0,M.jsxs)(`p`,{className:`niceeval-assertion-evidence-state`,children:[(0,M.jsx)(`code`,{children:`unavailable`}),(0,M.jsx)(`span`,{children:e.reason})]});case`fields`:return(0,M.jsx)(`dl`,{className:`niceeval-assertion-evidence-fields`,children:e.fields.map((e,n)=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:e.label}),(0,M.jsx)(`dd`,{children:(0,M.jsx)(fz,{value:e.value,locale:t})})]},`${e.label}:${n}`))});case`list`:return(0,M.jsxs)(`details`,{className:`niceeval-assertion-evidence-collection`,children:[(0,M.jsx)(`summary`,{children:(0,M.jsx)(`code`,{children:`Array(${e.items.length})`})}),(0,M.jsx)(`ol`,{className:`niceeval-assertion-evidence-list`,children:e.items.map((e,n)=>(0,M.jsx)(`li`,{children:(0,M.jsx)(fz,{value:e,locale:t})},n))})]})}}function pz({heading:e,value:t,locale:n}){return(0,M.jsxs)(`section`,{className:`niceeval-assertion-evidence-section`,children:[(0,M.jsx)(`h5`,{children:e}),(0,M.jsx)(fz,{value:t,locale:n})]})}function mz({rows:e}){return(0,M.jsx)(`dl`,{className:`niceeval-match-facts`,children:e.map(e=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:e.label}),(0,M.jsx)(`dd`,{children:e.value})]},e.label))})}function hz({diagnostic:e,locale:t}){let n=[...e.expected===void 0?[]:[{label:Z(t,`Expected`,`预期`),value:e.expected}],...e.received===void 0?[]:[{label:Z(t,`Observed`,`实际`),value:e.received}],...e.locator===void 0?[]:[{label:Z(t,`Call`,`调用`),value:e.locator}],...e.reason===void 0?[]:[{label:Z(t,`Reason`,`原因`),value:e.reason}]];return n.length===0?null:(0,M.jsx)(`dl`,{className:`niceeval-match-facts`,children:n.map(e=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:e.label}),(0,M.jsx)(`dd`,{children:typeof e.value==`string`?e.value:(0,M.jsx)(fz,{value:e.value,locale:t})})]},e.label))})}function gz({input:e,diagnostic:t,locale:n}){let r=ZR(Q(e,`command`)),i=$R(Q(e,`exitCode`)),a=QR(t?.expected),o=[...r===void 0?[]:[{label:Z(n,`Command`,`命令`),value:r}],...i===void 0?[]:[{label:Z(n,`Result`,`结果`),value:Z(n,`Exit code ${i}`,`退出码 ${i}`)}],...a===void 0?[]:[{label:Z(n,`Expected`,`预期`),value:a}]];return(0,M.jsxs)(`section`,{className:`niceeval-assertion-evidence-section`,children:[(0,M.jsx)(`h5`,{children:Z(n,`Command result`,`命令结果`)}),(0,M.jsx)(mz,{rows:o})]})}function _z({observed:e,diagnostic:t,locale:n}){let r=$R(Q(Q(e,`receipt`),`examined`));return(0,M.jsxs)(`div`,{className:`niceeval-match-evidence-grid`,children:[t?.received===void 0?null:(0,M.jsx)(pz,{heading:Z(n,`Observed`,`实际结果`),value:t.received,locale:n}),t?.expected===void 0?null:(0,M.jsx)(pz,{heading:Z(n,`Expected`,`预期结果`),value:t.expected,locale:n}),r===void 0?null:(0,M.jsxs)(`section`,{className:`niceeval-assertion-evidence-section`,children:[(0,M.jsx)(`h5`,{children:Z(n,`Tool calls`,`工具调用`)}),(0,M.jsx)(mz,{rows:[{label:Z(n,`Examined`,`已检查`),value:Z(n,`${r} tool call${r===1?``:`s`}`,`${r} 次工具调用`)}]})]})]})}function vz(e,t){return new Intl.NumberFormat(t===`zh-CN`?`zh-CN`:`en-US`,{maximumFractionDigits:12,maximumSignificantDigits:12}).format(e)}function yz(e){let t=Math.abs(e);if(t!==0&&t<1e-9)return`$${e.toExponential(4)}`;let n=t===0||t>=1?6:Math.min(12,Math.max(2,Math.ceil(-Math.log10(t))+5));return`$${e.toFixed(n).replace(/(?:\.0+|(?:(\.[0-9]*?)0+))$/,`$1`)}`}function bz(e){return e===`between`?`∈`:e===`less-than`?`<`:e===`at-most`?`≤`:e===`greater-than`?`>`:`≥`}function xz(e){return e===`between`?`∉`:e===`less-than`?`≥`:e===`at-most`?`>`:e===`greater-than`?`≤`:`<`}function Sz(e,t){return t===`zh-CN`?e===`turn`?`本轮`:e===`session`?`本次会话`:`本次 Attempt`:e===`turn`?`Turn`:e===`session`?`Session`:`Attempt`}function Cz(e,t){if(e.subject.kind===`explicit-value`)return Z(t,`Number comparison`,`数值比较`);let n=Sz(e.subject.scope,t);return e.subject.kind===`collection-cardinality`?Z(t,`${n} tool calls`,`${n}工具调用`):e.subject.metric===`cost`?Z(t,`${n} estimated cost`,`${n}估算费用`):Z(t,`${n} token usage`,`${n} token 用量`)}function wz(e,t,n){if(e.unit!==void 0)return ly(t,e.unit);if(e.subject.metric===`cost`)return yz(t);let r=vz(t,n);return e.subject.metric===`tokens`?`${r} tokens`:r}function Tz(e,t){let n=wz(e,e.threshold,t);return e.comparator===`between`&&e.upperThreshold!==void 0?`[${n}, ${wz(e,e.upperThreshold,t)}]`:e.subject.metric===`tokens`||e.subject.metric===`cost`?Z(t,`limit ${n}`,`上限 ${n}`):n}function Ez(e,t){switch(e){case`model-not-recorded`:return Z(t,`The model was not recorded, so its price cannot be selected.`,`没有记录模型,无法选择对应价格。`);case`price-source-not-found`:return Z(t,`No configured or built-in price was found for this model.`,`没有找到该模型的配置价格或内置价格。`);case`pricing-input-invalid`:return Z(t,`The recorded pricing input is invalid.`,`记录的计价输入无效。`);case`usage-not-recorded`:return Z(t,`Usage was not recorded.`,`没有记录用量。`);case`usage-input-invalid`:return Z(t,`The recorded token usage is invalid.`,`记录的 token 用量无效。`);case`non-finite-number`:case`numeric-value-non-finite`:return Z(t,`The compared number is not finite.`,`被比较的数值不是有限数。`);default:return Z(t,`The compared value is unavailable.`,`没有可用于比较的数值。`)}}function Dz(e,t,n){let r=e.material.value;if(e.material.state===`unavailable`||r===void 0)return Ez(e.material.reason,n);if(e.material.unit!==e.unit)return Z(n,`The observation and threshold use different units; they cannot be compared.`,`观测值与阈值的单位不同,无法比较。`);let i=wz({...e,unit:e.material.unit},r,n),a=Tz(e,n);if(e.material.state===`lower-bound`&&t===`unavailable`)return e.subject.kind===`collection-cardinality`?Z(n,`At least ${i} tool calls were recorded, but the collection is incomplete, so NiceEval cannot determine whether it is ${bz(e.comparator)} ${a}.`,`目前至少已有 ${i} 次工具调用,但集合不完整,无法判断是否 ${bz(e.comparator)} ${a}。`):Z(n,`At least ${i} was recorded, but usage is incomplete, so NiceEval cannot determine whether it is ${bz(e.comparator)} ${a}.`,`目前至少记录了 ${i},但用量记录不完整,无法判断是否 ${bz(e.comparator)} ${a}。`);let o=t===`mismatched`?xz(e.comparator):bz(e.comparator),s=e.material.state===`lower-bound`?Z(n,`Known minimum`,`已知至少`):e.subject.kind===`collection-cardinality`?Z(n,`Tool calls`,`工具调用`):e.subject.metric===`cost`?Z(n,`Estimated`,`估算`):e.subject.metric===`tokens`?Z(n,`Used`,`已用`):Z(n,`Observed`,`实际`),c=t===`matched`?Z(n,`so it passes.`,`所以通过。`):t===`mismatched`?Z(n,`so it does not pass.`,`所以未通过。`):Z(n,`so the result is unavailable.`,`所以无法判断。`);return`${s} ${i} ${o} ${a}${n===`zh-CN`?`,`:`, `}${c}`}function Oz(e,t){return e===`input`?Z(t,`Input`,`输入`):e===`output`?Z(t,`Output`,`输出`):e===`cache-read`?Z(t,`Cache read`,`缓存读取`):Z(t,`Cache write`,`缓存写入`)}function kz({receipt:e,locale:t}){let n=e.sourceKind===`builtin`?Z(t,`Built-in price`,`内置价格`):Z(t,`Configured override`,`配置覆盖价格`);return(0,M.jsxs)(`details`,{className:`niceeval-numeric-pricing`,children:[(0,M.jsxs)(`summary`,{children:[(0,M.jsx)(`span`,{children:Z(t,`View estimate basis`,`查看估算依据`)}),(0,M.jsx)(`code`,{children:e.model}),(0,M.jsxs)(`small`,{children:[n,` · `,e.sourceSelector]})]}),(0,M.jsxs)(`dl`,{children:[e.charges.map(e=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:Oz(e.bucket,t)}),(0,M.jsxs)(`dd`,{children:[(0,M.jsxs)(`code`,{children:[vz(e.tokens,t),` tokens`]}),(0,M.jsx)(`span`,{children:`×`}),(0,M.jsxs)(`code`,{children:[yz(e.rateUSDPerMTok),`/M`]}),(0,M.jsx)(`span`,{children:`=`}),(0,M.jsx)(`strong`,{children:yz(e.amountUSD)})]})]},e.bucket)),(0,M.jsxs)(`div`,{className:`niceeval-numeric-pricing-total`,children:[(0,M.jsx)(`dt`,{children:Z(t,`Estimated total`,`估算合计`)}),(0,M.jsx)(`dd`,{children:(0,M.jsx)(`strong`,{children:yz(e.amountUSD)})})]})]})]})}function Az({view:e,state:t,locale:n}){let r=e.material.value,i=t===`mismatched`?xz(e.comparator):bz(e.comparator),a=e.subject.metric===`cost`?cz(e.material.derivation):void 0;return(0,M.jsxs)(`section`,{className:`niceeval-numeric-evidence`,"data-state":t,children:[(0,M.jsx)(`span`,{className:`niceeval-numeric-evidence-label`,children:Cz(e,n)}),r===void 0||e.material.unit!==e.unit?(0,M.jsx)(`p`,{className:`niceeval-numeric-evidence-unavailable`,children:Z(n,`No comparable value`,`没有可比较的数值`)}):e.material.state===`lower-bound`&&t===`unavailable`?(0,M.jsxs)(`p`,{className:`niceeval-numeric-evidence-formula`,children:[(0,M.jsx)(`small`,{children:Z(n,`Known minimum`,`已知至少`)}),(0,M.jsx)(`strong`,{children:wz({...e,unit:e.material.unit},r,n)}),(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,M.jsx)(`small`,{children:Tz(e,n)})]}):(0,M.jsxs)(`p`,{className:`niceeval-numeric-evidence-formula`,children:[e.material.state===`lower-bound`?(0,M.jsx)(`small`,{children:Z(n,`Known minimum`,`已知至少`)}):null,(0,M.jsx)(`strong`,{children:wz({...e,unit:e.material.unit},r,n)}),(0,M.jsx)(`span`,{className:`niceeval-numeric-evidence-operator`,children:i}),(0,M.jsx)(`strong`,{children:Tz(e,n)})]}),(0,M.jsx)(`p`,{className:`niceeval-numeric-evidence-conclusion`,children:Dz(e,t,n)}),a===void 0?null:(0,M.jsx)(kz,{receipt:a,locale:n})]})}function jz({content:e,input:t,diagnostic:n,locale:r}){let i=n?.expected===void 0?lz(e.expected):n.expected,a=n?.received===void 0?uz(e.observed):n.received;return(0,M.jsxs)(`div`,{className:`niceeval-match-evidence-grid`,children:[(0,M.jsx)(pz,{heading:Z(r,`Input`,`输入`),value:t,locale:r}),a===void 0?null:(0,M.jsx)(pz,{heading:Z(r,`Observed`,`实际结果`),value:a,locale:r}),i===void 0?null:(0,M.jsx)(pz,{heading:Z(r,`Expected`,`预期结果`),value:i,locale:r})]})}function Mz({source:e,locale:t}){let n=Q(e,`coverage`),r=ZR(Q(n,`state`));if(r===void 0||r===`complete`)return null;let i=ZR(Q(n,`reason`)),a=Q(e,`limitations`),o=a?.kind===`list`?a.items.map(e=>$R(Q(e,`omittedBytes`))).find(e=>e!==void 0):void 0,s=[i,o===void 0?void 0:Z(t,`${o} bytes omitted`,`省略 ${o} 字节`)].filter(e=>e!==void 0).join(` · `);return(0,M.jsxs)(`p`,{className:`niceeval-match-coverage`,children:[Z(t,`Input evidence ${r}`,`输入证据${r===`partial`?`不完整`:`不可用`}`),s.length===0?``:` · ${s}`]})}function Nz(e,t){return t===`zh-CN`?e===`matched`?`命中`:e===`mismatched`?`未命中`:`无法判断`:e}function Pz(e){return e?.code===`tool-count-match`||e?.code===`tool-count-mismatch`||e?.code===`tool-count-exceeded`||e?.code===`tool-count-unavailable`||e?.code===`tool-absence-match`||e?.code===`tool-absence-mismatch`||e?.code===`tool-absence-unavailable`}function Fz(e){if(e?.received!==void 0)return QR(e.received);let t=e?.children.find(e=>e.label===`name`);return t?.diagnostic?.received===void 0?t?.state===`matched`?QR(t.diagnostic?.expected):void 0:QR(t.diagnostic.received)}function Iz(e,t,n,r){let i=t===`command-candidate`?Z(r,`Command`,`命令`):t===`tool-candidate`?Z(r,`Tool call`,`工具调用`):Z(r,`Candidate`,`候选`),a=Fz(n),o=Z(r,`invocation details not recorded`,`调用详情未记录`);return`${i} ${e+1} · ${a??o}`}function Lz(e,t){return t===`zh-CN`?e===`name`?`名称`:e===`input`?`输入`:e===`output`?`输出`:e===`command`?`命令`:e===`status`?`状态`:e:e}function Rz(e,t){if(e===null||e.children.length>0)return[];let n=QR(e.expected),r=QR(e.received);return[...n===void 0?[]:[{label:Z(t,`Expected`,`预期`),value:n}],...r===void 0?[]:[{label:Z(t,`Observed`,`实际`),value:r}],...e.reason===void 0?[]:[{label:Z(t,`Reason`,`原因`),value:e.reason}]]}function zz({label:e,state:t,diagnostic:n,locale:r,root:i=!1,toolCandidateIndex:a,toolField:o=!1,children:s}){let c=a===void 0?o?Lz(e,r):e:Iz(a,e,n,r),l=Nz(t,r),u=`${c}: ${l}`,d=Rz(n,r),f=(0,M.jsxs)(`span`,{className:`niceeval-match-summary niceeval-match-summary--${t}`,children:[(0,M.jsxs)(`span`,{className:`niceeval-match-summary-main`,children:[(0,M.jsx)(`code`,{children:c}),d.length===0?null:(0,M.jsx)(`span`,{className:`niceeval-match-summary-facts`,children:d.map(e=>(0,M.jsxs)(`span`,{className:`niceeval-match-summary-fact`,children:[(0,M.jsx)(`span`,{children:e.label}),(0,M.jsx)(`code`,{children:e.value})]},e.label))})]}),(0,M.jsx)(`span`,{className:`niceeval-match-state`,children:l})]}),p=n?.children??[],m=Pz(n),h=p.length>0||n?.locator!==void 0||s!==void 0?(0,M.jsxs)(`div`,{className:`niceeval-match-detail`,children:[p.length>0?(0,M.jsx)(`div`,{className:`niceeval-match-children`,children:p.map((e,t)=>(0,M.jsx)(zz,{label:e.label,state:e.state,diagnostic:e.diagnostic,locale:r,...m?{toolCandidateIndex:e.index}:{},...a===void 0?{}:{toolField:!0}},`${e.label}:${t}`))}):null,i||n===null||n.locator===void 0?null:(0,M.jsx)(hz,{diagnostic:n,locale:r}),s]}):null;return h===null?(0,M.jsx)(`div`,{className:`niceeval-match-node`,"aria-label":u,children:f}):(0,M.jsxs)(`details`,{className:`niceeval-match-node${i?` niceeval-match-node--root`:``}`,children:[(0,M.jsx)(`summary`,{"aria-label":u,children:f}),h]})}function Bz(e,t,n,r){let i=nz(e.explanation),a=ez(e.check)??n??Z(t,`Match`,`检查`),o=Q(e.source,`input`)??e.source,s=i?.code,c=sz(e.check,e.source),l=c===void 0?s===`command-succeeded`||s===`command-failed`?(0,M.jsx)(gz,{input:o,diagnostic:i,locale:t}):iz(e.check)?(0,M.jsx)(_z,{observed:e.observed,diagnostic:i,locale:t}):(0,M.jsx)(jz,{content:e,input:o,diagnostic:i,locale:t}):(0,M.jsx)(Az,{view:c,state:r,locale:t});return(0,M.jsx)(`div`,{className:`niceeval-assertion-evidence`,children:(0,M.jsx)(zz,{label:a,state:r,diagnostic:c===void 0?i:null,locale:t,root:!0,children:(0,M.jsxs)(`div`,{className:`niceeval-match-body`,children:[e.matcherDebugger===void 0?l:(0,M.jsxs)(M.Fragment,{children:[l,(0,M.jsx)(GR,{content:e.matcherDebugger,locale:t})]}),(0,M.jsx)(Mz,{source:e.source,locale:t}),(0,M.jsxs)(`details`,{className:`niceeval-match-raw`,children:[(0,M.jsx)(`summary`,{children:Z(t,`Raw assertion data`,`原始断言数据`)}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(pz,{heading:Z(t,`Source`,`来源`),value:e.source,locale:t}),(0,M.jsx)(pz,{heading:Z(t,`Check`,`检查条件`),value:e.check,locale:t}),(0,M.jsx)(pz,{heading:Z(t,`Explanation`,`解释`),value:e.explanation,locale:t})]})]})]})})})}function Vz({content:e,label:t,state:n,locale:r}){return Bz(e,r,t,n??`unavailable`)}var Hz=(0,v.createContext)(null);function Uz(){let e=(0,v.useContext)(Hz);if(e===null)throw Error(`Trace interaction context is missing`);return e}function Wz(...e){return e.filter(Boolean).join(` `)}function $(e,t,n){return e===`zh-CN`?n:t}function Gz(e){if(e===void 0)return`Not recorded`;if(e<1e3)return`${Math.round(e)} ms`;let t=Math.round(e/1e3);return t<60?`${t} s`:`${Math.floor(t/60)} m ${t%60} s`}function Kz(e){return e.durationMs!==void 0&&Number.isFinite(e.durationMs)?Math.max(0,e.durationMs):void 0}function qz(e){switch(e.toLowerCase()){case`user`:case`input`:case`context`:return`input`;case`tool`:case`subagent`:case`skill`:return`tools`;default:return`model`}}function Jz(e){return qz(e)===`tools`}function Yz(e){let t=e.filter(e=>e.entry.callPhase===`started`).length;return t===0?e.filter(e=>e.toolLike).length:t}function Xz(e,t){return e.callOutcome===`completed`?$(t,`Completed`,`已完成`):e.callOutcome===`failed`?$(t,`Failed`,`失败`):e.callOutcome===`rejected`?$(t,`Rejected`,`已拒绝`):e.callOutcome===`cancelled`?$(t,`Cancelled`,`已取消`):e.failed===!0?$(t,`Failed`,`失败`):e.callPhase===`started`?$(t,`Started`,`已开始`):e.callPhase===`finished`?$(t,`Completed`,`已完成`):$(t,`Captured`,`已捕获`)}function Zz(e){return e.toolOccurrence?.state===`exact`?e.toolOccurrence.toolOccurrenceId:e.toolOccurrence===void 0?e.callId:void 0}function Qz(e){let t=new Map;for(let[n,r]of e.entries.entries()){let e=Zz(r);if(e===void 0||r.callPhase===void 0)continue;let i=t.get(e)??{started:[],finished:[]};i[r.callPhase].push(n),t.set(e,i)}let n=new Map,r=new Set;for(let i of t.values()){if(i.started.length!==1||i.finished.length!==1)continue;let t=i.started[0],a=i.finished[0];if(a<=t)continue;let o=e.entries[t],s=e.entries[a],c=[o.raw,s.raw].filter(e=>e!==void 0).join(`
60
+ `),l=[o.detail,s.detail].filter(e=>e!==void 0);n.set(t,{id:o.id,kind:o.kind,preview:o.preview,...o.anchor===void 0?{}:{anchor:o.anchor},callId:Zz(o),...o.toolOccurrence===void 0?{}:{toolOccurrence:o.toolOccurrence},callPhase:`finished`,...s.callOutcome===void 0?{}:{callOutcome:s.callOutcome},...o.failed===!0||s.failed===!0?{failed:!0}:{},...(s.commandMatch??o.commandMatch)===void 0?{}:{commandMatch:s.commandMatch??o.commandMatch},...c===``?{}:{raw:c},...l.length===0?{}:{detail:l.length===1?l[0]:{kind:`stack`,items:l}}}),r.add(a)}return e.entries.flatMap((e,t)=>r.has(t)?[]:[{entry:n.get(t)??e,entryIndex:t}])}function $z(e,t){return e.turns.flatMap((e,n)=>Qz(e).map(({entry:r,entryIndex:i})=>{let a=r.raw??fL(r.preview,t);return{id:r.id,turn:e,turnIndex:n,entry:r,entryIndex:i,lane:qz(r.kind),summary:aR(r.preview,t,180),raw:a,toolLike:Jz(r.kind)}}))}function eB(e){return e.every(e=>e.entries.length===0||Kz(e)!==void 0)}function tB(e,t){let n=new Map;if(t.length===0)return n;let r=eB(e),i=new Map;for(let n of e){let e=t.filter(e=>e.turn.key===n.key);if(e.length===0)continue;let a=Kz(n),o=r&&a!==void 0?Math.max(1,a)/e.length:1;for(let t of e)i.set(t.id,o)}let a=t.length*1,o=t.reduce((e,t)=>e+(i.get(t.id)??1),0),s=0,c=0;for(let e of t){let t=i.get(e.id)??1;n.set(e.id,{sequenceLeft:s/a*100,sequenceWidth:1/a*100,durationLeft:c/o*100,durationWidth:t/o*100}),s+=1,c+=t}return n}function nB(e){return e===`input`?7:e===`model`?21:35}function rB(e,t){let n=fL(e.turn.label,t),r=Kz(e.turn),i=r===void 0?$(t,`timing not recorded`,`未记录时长`):`${Gz(r)} ${$(t,`turn duration`,`轮次时长`)}`;return`${e.entry.kind} · ${n} · ${i}`}function iB({content:e,events:t,locale:n}){let r=e.turns.flatMap(e=>{let t=Kz(e);return t===void 0?[]:[t]}),i=r.length===0?$(n,`—`,`—`):Gz(r.reduce((e,t)=>e+t,0)),a=Yz(t),o=eB(e.turns)&&t.length>0,s=Uz();return(0,M.jsxs)(`header`,{className:`niceeval-trace-toolbar`,role:`toolbar`,"aria-label":$(n,`Trajectory controls`,`轨迹控制`),children:[(0,M.jsxs)(`div`,{className:`niceeval-trace-toolbar-main`,children:[(0,M.jsx)(`span`,{className:`niceeval-trace-toolbar-title`,children:$(n,`Session log`,`会话日志`)}),(0,M.jsxs)(`div`,{className:`niceeval-trace-toolbar-actions`,children:[(0,M.jsxs)(`button`,{type:`button`,className:`niceeval-trace-toolbar-button niceeval-trace-toolbar-button--duration`,onClick:()=>s.setDuration(!s.duration),"aria-pressed":s.duration,disabled:!o,title:o?$(n,`Use turn-duration projection`,`按轮次时长投影`):$(n,`Turn timing is incomplete; sequence stays equal-width`,`轮次时长不完整;保持等宽顺序`),children:[(0,M.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,M.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.25`}),(0,M.jsx)(`path`,{d:`M8 4.75V8l2.25 1.5`})]}),(0,M.jsx)(`span`,{children:$(n,`Duration`,`时长`)}),(0,M.jsx)(`b`,{children:i})]}),(0,M.jsxs)(`button`,{type:`button`,className:`niceeval-trace-toolbar-button`,onClick:()=>s.setTurnsCollapsed(!s.turnsCollapsed),"aria-pressed":s.turnsCollapsed,title:$(n,`Collapse turns`,`折叠轮次`),children:[(0,M.jsx)(`span`,{className:`niceeval-trace-toolbar-glyph`,"aria-hidden":`true`,children:`⊟`}),(0,M.jsx)(`span`,{children:$(n,`Turns`,`轮次`)}),(0,M.jsx)(`b`,{children:e.turns.length})]}),(0,M.jsxs)(`button`,{type:`button`,className:`niceeval-trace-toolbar-button`,onClick:()=>s.setCallsCollapsed(!s.callsCollapsed),"aria-pressed":s.callsCollapsed,title:$(n,`Collapse tool calls`,`折叠工具调用`),disabled:a===0,children:[(0,M.jsx)(`span`,{className:`niceeval-trace-toolbar-glyph`,"aria-hidden":`true`,children:`⊟`}),(0,M.jsx)(`span`,{children:$(n,`Calls`,`调用`)}),(0,M.jsx)(`b`,{children:a})]})]})]}),(0,M.jsxs)(`label`,{className:`niceeval-trace-search`,children:[(0,M.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,M.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.25`}),(0,M.jsx)(`path`,{d:`m10.25 10.25 3 3`})]}),(0,M.jsx)(`span`,{className:`niceeval-trace-visually-hidden`,children:$(n,`Search trajectory`,`搜索轨迹`)}),(0,M.jsx)(`input`,{type:`search`,value:s.query,onChange:e=>s.setQuery(e.target.value),placeholder:$(n,`Search`,`搜索`),"aria-label":$(n,`Search trajectory`,`搜索轨迹`)})]})]})}function aB({content:e,events:t,locale:n}){let r=tB(e.turns,t),i=eB(e.turns),a=Uz(),o=t.filter((e,n)=>n===0||t[n-1]?.turn.key!==e.turn.key);return(0,M.jsxs)(`section`,{className:`niceeval-trace-timeline`,"aria-label":$(n,`Trajectory timeline`,`轨迹时间线`),"data-timing-complete":i?`true`:void 0,children:[(0,M.jsxs)(`div`,{className:`niceeval-trace-timeline-plot`,children:[(0,M.jsxs)(`div`,{className:`niceeval-trace-timeline-labels`,"aria-hidden":`true`,children:[(0,M.jsx)(`span`,{children:$(n,`Input / User`,`输入 / 用户`)}),(0,M.jsx)(`span`,{children:$(n,`Model / Assistant`,`模型 / 助手`)}),(0,M.jsx)(`span`,{children:$(n,`Tools / Tool`,`工具 / 工具`)})]}),(0,M.jsxs)(`svg`,{className:`niceeval-trace-timeline-track`,viewBox:`0 0 100 50`,preserveAspectRatio:`none`,"aria-hidden":t.length===0?`true`:void 0,children:[t.length===0?(0,M.jsx)(`text`,{className:`niceeval-trace-timeline-empty`,x:`50`,y:`25`,textAnchor:`middle`,dominantBaseline:`middle`,children:$(n,`No captured events`,`没有已捕获事件`)}):null,(e=>(0,M.jsxs)(`g`,{className:`niceeval-trace-timeline-projection niceeval-trace-timeline-projection--${e}`,children:[o.map(t=>{let n=r.get(t.id);if(n===void 0)return null;let i=e===`sequence`?n.sequenceLeft:n.durationLeft;return(0,M.jsx)(`line`,{className:`niceeval-trace-timeline-boundary`,x1:i,x2:i,y1:`0`,y2:`50`,"aria-hidden":`true`},`${e}-boundary-${t.id}`)}),t.map(t=>{let i=r.get(t.id);if(i===void 0)return null;let o=e===`sequence`?i.sequenceLeft:i.durationLeft,s=e===`sequence`?i.sequenceWidth:i.durationWidth,c=rB(t,n),l=t.entry.kind===`assistant`?`assistant: ${t.summary} · ${c}`:c;return(0,M.jsxs)(`g`,{className:`niceeval-trace-timeline-span`,role:`button`,tabIndex:0,onClick:()=>a.setSelected(a.selected===t.id?null:t.id),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&a.setSelected(a.selected===t.id?null:t.id)},"data-lane":t.lane,"data-failed":t.entry.failed?`true`:void 0,"aria-label":l,"aria-pressed":a.selected===t.id,children:[(0,M.jsx)(`title`,{children:l}),(0,M.jsx)(`rect`,{className:`niceeval-trace-timeline-span-geometry`,x:o,y:nB(t.lane),width:s,height:`8`,rx:`1`})]},`${e}-event-${t.id}`)})]}))(a.duration?`duration`:`sequence`)]})]}),(0,M.jsx)(`p`,{className:`niceeval-trace-timeline-note`,children:i?$(n,`Duration projects captured turn durations; without per-event timestamps, events remain evenly sequenced within each turn.`,`时长模式投影已捕获的轮次时长;没有逐事件时间戳时,事件在轮次内保持等宽顺序。`):$(n,`Per-event timing was not captured, so the timeline uses equal-width sequence spans.`,`未捕获逐事件时长,因此时间线使用等宽顺序跨度。`)})]})}function oB({event:e,locale:t}){let n=e.entry.detail===void 0?null:iR(e.entry.detail,t),r=Kz(e.turn),i=Uz(),[a,o]=(0,v.useState)(`preview`);return(0,M.jsxs)(`details`,{className:`niceeval-trace-evidence`,open:i.selected===e.id,children:[(0,M.jsx)(`summary`,{children:$(t,`Evidence`,`证据`)}),(0,M.jsxs)(`div`,{className:`niceeval-trace-evidence-body`,children:[(0,M.jsxs)(`dl`,{className:`niceeval-trace-evidence-meta`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:$(t,`Source`,`来源`)}),(0,M.jsx)(`dd`,{children:fL(e.turn.label,t)})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:$(t,`Status`,`状态`)}),(0,M.jsx)(`dd`,{children:Xz(e.entry,t)})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:$(t,`Total duration`,`总时长`)}),(0,M.jsx)(`dd`,{children:r===void 0?$(t,`Not recorded`,`未记录`):Gz(r)})]}),e.entry.callPhase===void 0?null:(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:$(t,`Call phase`,`调用阶段`)}),(0,M.jsx)(`dd`,{children:e.entry.callPhase})]}),e.entry.callId===void 0?null:(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:$(t,`Call ID`,`调用 ID`)}),(0,M.jsx)(`dd`,{children:e.entry.callId})]}),e.entry.toolOccurrence?.state===`unavailable`?(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:$(t,`Tool occurrence`,`工具调用身份`)}),(0,M.jsxs)(`dd`,{children:[$(t,`Unavailable`,`不可用`),` · `,e.entry.toolOccurrence.reason]})]}):null,e.entry.commandMatch===void 0?null:e.entry.commandMatch.state===`matched`?(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:$(t,`Command`,`命令`)}),(0,M.jsx)(`dd`,{children:e.entry.commandMatch.commandId})]}):(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:$(t,`Command`,`命令`)}),(0,M.jsxs)(`dd`,{children:[$(t,`Unavailable`,`不可用`),` · `,e.entry.commandMatch.reason]})]})]}),(0,M.jsxs)(`div`,{className:`niceeval-trace-evidence-tabs`,role:`tablist`,"aria-label":$(t,`Record detail tabs`,`记录详情标签`),children:[(0,M.jsx)(`button`,{type:`button`,role:`tab`,onClick:()=>o(`preview`),onKeyDown:uB,"aria-selected":a===`preview`,children:$(t,`Preview`,`预览`)}),(0,M.jsx)(`button`,{type:`button`,role:`tab`,onClick:()=>o(`raw`),onKeyDown:uB,"aria-selected":a===`raw`,children:$(t,`Raw`,`原始`)})]}),(0,M.jsxs)(`section`,{className:`niceeval-trace-evidence-panel`,hidden:a!==`preview`,role:`tabpanel`,"aria-label":$(t,`Preview`,`预览`),children:[(0,M.jsx)(`h4`,{children:$(t,`Preview`,`预览`)}),n===null?(0,M.jsx)(`pre`,{className:`niceeval-trace-evidence-raw`,children:e.raw}):(0,M.jsx)(`div`,{className:`niceeval-trace-evidence-detail`,children:n})]}),(0,M.jsxs)(`section`,{className:`niceeval-trace-evidence-panel`,hidden:a!==`raw`,role:`tabpanel`,"aria-label":$(t,`Raw`,`原始`),children:[(0,M.jsx)(`h4`,{children:$(t,`Raw`,`原始`)}),(0,M.jsx)(`pre`,{className:`niceeval-trace-evidence-raw`,children:e.raw})]})]})]})}function sB({event:e,locale:t}){let n=fL(e.turn.label,t),r=Kz(e.turn),i=Xz(e.entry,t),a=Uz(),o=a.callsCollapsed&&e.toolLike||a.query!==``&&!`${e.entry.kind} ${e.summary} ${e.raw}`.toLocaleLowerCase().includes(a.query.toLocaleLowerCase());return(0,M.jsxs)(`article`,{hidden:o,className:Wz(`niceeval-trace-event-row`,e.toolLike&&`niceeval-trace-event-row--tool`,e.entry.failed&&`niceeval-trace-event-row--failed`),id:`trace-${e.entry.anchor}`,"data-tool-row":e.toolLike?`true`:void 0,"data-call-outcome":e.entry.callOutcome,children:[(0,M.jsx)(`span`,{className:`niceeval-trace-event-turn-rail`,"aria-hidden":`true`}),(0,M.jsxs)(`button`,{type:`button`,className:`niceeval-trace-event-select`,onClick:()=>a.setSelected(a.selected===e.id?null:e.id),"aria-pressed":a.selected===e.id,"aria-expanded":a.selected===e.id,"aria-label":`${e.entry.kind}: ${e.summary||$(t,`captured event`,`已捕获事件`)}`,children:[(0,M.jsx)(`span`,{className:`niceeval-trace-event-kind`,"data-lane":e.lane,children:e.entry.kind}),(0,M.jsx)(`span`,{className:`niceeval-trace-event-summary`,children:e.summary||`—`}),(0,M.jsx)(`span`,{className:`niceeval-trace-event-meta`,title:r===void 0?$(t,`Turn timing not recorded`,`未记录轮次时长`):`${n} · ${Gz(r)}`,children:r===void 0?`—`:Gz(r)}),(0,M.jsx)(`span`,{className:`niceeval-trace-event-status`,"data-call-outcome":e.entry.callOutcome,children:i})]}),(0,M.jsx)(oB,{event:e,locale:t})]})}function cB({turn:e,events:t,locale:n}){let r=Kz(e),i=Yz(t),a=t.some(e=>e.entry.failed===!0),o=Uz(),[s,c]=(0,v.useState)(!1),l=o.turnsCollapsed||s;return(0,M.jsxs)(`section`,{className:Wz(`niceeval-trace-turn`,e.verdict&&`niceeval-trace-turn--${e.verdict}`,a&&`niceeval-trace-turn--failed-events`),"data-collapsed":l,children:[(0,M.jsx)(`header`,{className:`niceeval-trace-turn-head niceeval-conversation-turn-head`,children:(0,M.jsxs)(`button`,{type:`button`,className:`niceeval-trace-turn-toggle`,onClick:()=>c(!s),"aria-expanded":!l,title:$(n,`Collapse turn`,`折叠轮次`),children:[(0,M.jsx)(`span`,{className:`niceeval-trace-turn-chevron`,"aria-hidden":`true`,children:`⌄`}),(0,M.jsx)(`span`,{className:`niceeval-trace-turn-label`,children:fL(e.label,n)}),(0,M.jsxs)(`span`,{className:`niceeval-trace-turn-facts`,children:[r===void 0?$(n,`timing unavailable`,`时长不可用`):Gz(r),(0,M.jsxs)(`span`,{children:[t.length,` `,$(n,`events`,`事件`)]}),i>0?(0,M.jsxs)(`span`,{children:[i,` `,$(n,`calls`,`调用`)]}):null]}),e.verdict?(0,M.jsx)(`span`,{className:`niceeval-trace-turn-verdict`,children:e.verdict}):null]})}),(0,M.jsx)(`div`,{className:`niceeval-trace-turn-events`,hidden:l,children:t.length===0?(0,M.jsx)(`p`,{className:`niceeval-trace-empty-turn`,children:$(n,`No events captured for this turn.`,`此轮没有已捕获事件。`)}):t.map(e=>(0,M.jsx)(sB,{event:e,locale:n},e.id))})]})}function lB({data:e,locale:t,className:n}){let[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(null);if(e===null||e.turns.length===0)return null;let p=$z(e,t),m={duration:r,setDuration:i,turnsCollapsed:a,setTurnsCollapsed:o,callsCollapsed:s,setCallsCollapsed:c,query:l,setQuery:u,selected:d,setSelected:f};return(0,M.jsx)(Hz.Provider,{value:m,children:(0,M.jsxs)(`section`,{className:Wz(`niceeval-report`,`niceeval-turn-trace`,n),"data-duration-mode":r?`duration`:`sequence`,onKeyDown:e=>{e.key===`Escape`&&f(null)},children:[(0,M.jsx)(iB,{content:e,events:p,locale:t}),(0,M.jsx)(aB,{content:e,events:p,locale:t}),(0,M.jsx)(`div`,{className:`niceeval-trace-ledger`,children:e.turns.map((e,n)=>(0,M.jsx)(cB,{turn:e,events:p.filter(e=>e.turnIndex===n),locale:t},e.key))})]})})}function uB(e){if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;let t=[...e.currentTarget.parentElement?.querySelectorAll(`[role=tab]`)??[]],n=t.indexOf(e.currentTarget);n<0||t.length===0||(e.preventDefault(),t[(n+(e.key===`ArrowRight`?1:-1)+t.length)%t.length]?.focus())}var dB=/(\/\/[^\n]*)|(\/\*[^]*?\*\/)|(`(?:\\.|[^`\\])*`|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')|\b(import|from|export|default|const|let|var|async|await|function|return|if|else|for|of|in|new|class|extends|typeof|void|true|false|null|undefined)\b|\b(\d[\d_.]*)\b|([A-Za-z_$][\w$]*)(?=\s*\()/g;function fB(e){let t=[],n=0,r=0,i;for(dB.lastIndex=0;i=dB.exec(e);){i.index>n&&t.push(e.slice(n,i.index));let a=i[1]||i[2]?`tok-comment`:i[3]?`tok-str`:i[4]?`tok-kw`:i[5]?`tok-num`:`tok-fn`;t.push((0,M.jsx)(`span`,{className:a,children:i[0]},r++)),n=i.index+i[0].length,i[0].length===0&&dB.lastIndex++}return n<e.length&&t.push(e.slice(n)),t}function pB(e,t){return e.kind===`assertion`?(0,M.jsx)(Vz,{content:e.content,label:e.label,state:e.state,locale:t}):e.kind===`turn-trace`?(0,M.jsx)(lB,{data:e.data,locale:t}):(0,M.jsx)(`div`,{className:pL(`niceeval-report`,`niceeval-text`,e.className),children:e.text})}function mB(e,t){if(!mL(e))return`"${t}" must be an object`;if(typeof e.sourceItemId!=`string`)return`"${t}.sourceItemId" must be a string`;if(typeof e.sha256!=`string`)return`"${t}.sha256" must be a string`;if(typeof e.path!=`string`)return`"${t}.path" must be a string`;if(!Array.isArray(e.lines))return`"${t}.lines" must be an array`;for(let n=0;n<e.lines.length;n++){let r=e.lines[n];if(!mL(r))return`"${t}.lines[${n}]" must be an object`;if(typeof r.number!=`number`)return`"${t}.lines[${n}].number" must be a number`;if(typeof r.text!=`string`)return`"${t}.lines[${n}].text" must be a string`;if(r.interaction!==void 0&&r.interaction!==`send`)return`"${t}.lines[${n}].interaction" must be send`;if(r.turnIds!==void 0&&(!Array.isArray(r.turnIds)||r.turnIds.some(e=>typeof e!=`string`)))return`"${t}.lines[${n}].turnIds" must be an array of strings`;if(r.pill!==void 0&&!hL(r.pill))return`"${t}.lines[${n}].pill" must be a LocalizedText`}return null}function hB(e){if(e==null)return null;if(!mL(e))throw gL(`SourceView`,`sourceViewData`,`SourceContent`,`"data" must be an object or null`);let t=mB(e.spine,`data.spine`);if(t!==null)throw gL(`SourceView`,`sourceViewData`,`SourceContent`,t);if(!Array.isArray(e.detached))throw gL(`SourceView`,`sourceViewData`,`SourceContent`,`"data.detached" must be an array`);for(let t=0;t<e.detached.length;t++){let n=mB(e.detached[t],`data.detached[${t}]`);if(n!==null)throw gL(`SourceView`,`sourceViewData`,`SourceContent`,n)}return e}function gB(e){return e.aborted?`gate-fail`:e.tone}function _B(e){if(e)return`niceeval-source-line--${e}`}var vB={send:(0,M.jsx)(`path`,{d:`M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z`}),passed:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,M.jsx)(`path`,{d:`m9 12 2 2 4-4`})]}),"gate-fail":(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,M.jsx)(`path`,{d:`m15 9-6 6`}),(0,M.jsx)(`path`,{d:`m9 9 6 6`})]}),"soft-fail":(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,M.jsx)(`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`}),(0,M.jsx)(`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`})]}),unavailable:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,M.jsx)(`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}),(0,M.jsx)(`path`,{d:`M12 17h.01`})]})},yB={send:`send`,passed:`passed`,"gate-fail":`failed`,"soft-fail":`mismatched`,unavailable:`unavailable`};function bB({line:e}){let t=e.interaction===`send`?`send`:gB(e);return t===void 0?(0,M.jsx)(`span`,{className:`niceeval-source-gutter`,children:e.number}):(0,M.jsx)(`span`,{className:`niceeval-source-gutter niceeval-source-gutter-mark`,role:`img`,"aria-label":yB[t],title:yB[t],children:(0,M.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:vB[t]})})}function xB({line:e,locale:t}){return(0,M.jsxs)(`span`,{className:`niceeval-source-line-summary`,children:[(0,M.jsx)(bB,{line:e}),(0,M.jsx)(`span`,{className:`niceeval-source-code`,children:fB(e.text)}),(0,M.jsxs)(`span`,{className:`niceeval-source-meta`,children:[e.pill===void 0?null:(0,M.jsx)(`span`,{className:`niceeval-source-pill`,children:fL(e.pill,t)}),e.aborted?(0,M.jsx)(`span`,{className:`niceeval-source-abort-mark`,"aria-hidden":`true`,children:`⤓`}):null]})]})}function SB({calls:e,locale:t,renderChild:n}){return(0,M.jsx)(`div`,{className:`niceeval-source-calls`,children:e.map((e,r)=>(0,M.jsxs)(`details`,{className:pL(`niceeval-source-call`,e.tone&&`niceeval-source-call--${e.tone}`),open:e.open,children:[(0,M.jsx)(`summary`,{children:fL(e.summary,t)}),e.target.kind===`opaque`?(0,M.jsxs)(`div`,{className:`niceeval-source-opaque`,children:[(0,M.jsx)(`div`,{className:`niceeval-source-opaque-label`,children:fL(e.target.label,t)}),e.target.calls?(0,M.jsx)(SB,{calls:e.target.calls,locale:t,renderChild:n}):null]}):(0,M.jsx)(CB,{block:e.target.block,locale:t,renderChild:n,nested:!0})]},r))})}function CB({block:e,locale:t,renderChild:n,nested:r=!1}){let i=e.lines.find(e=>e.tone===`gate-fail`||e.tone===`soft-fail`||e.tone===`unavailable`)?.number,a=!1;return(0,M.jsxs)(`div`,{className:pL(`niceeval-source-block`,r&&`niceeval-source-block--nested`),children:[(0,M.jsx)(`div`,{className:`niceeval-source-block-path`,children:e.path}),(0,M.jsx)(`div`,{className:`niceeval-source-lines`,children:e.lines.map(e=>{let r=a;e.aborted&&(a=!0);let o=e.details!==void 0&&e.details.length>0||e.calls!==void 0&&e.calls.length>0,s=pL(`niceeval-source-line`,e.interaction===`send`&&`niceeval-source-line--send`,_B(gB(e)),r&&`niceeval-source-line-unreached`);return o?(0,M.jsxs)(`details`,{className:s,open:e.interaction!==`send`&&e.number===i,children:[(0,M.jsx)(`summary`,{children:(0,M.jsx)(xB,{line:e,locale:t})}),(0,M.jsxs)(`div`,{className:`niceeval-source-line-detail`,children:[e.details?.map((e,t)=>(0,M.jsx)(`div`,{children:n(e)},t)),e.calls?(0,M.jsx)(SB,{calls:e.calls,locale:t,renderChild:n}):null]})]},e.number):(0,M.jsx)(`div`,{className:s,children:(0,M.jsx)(xB,{line:e,locale:t})},e.number)})})]})}function wB({data:e,locale:t,className:n}){let r=hB(e??null);if(r===null)return null;let i=e=>pB(e,t);return(0,M.jsxs)(`div`,{className:pL(`niceeval-report`,`niceeval-source-view`,n),children:[(0,M.jsx)(CB,{block:r.spine,locale:t,renderChild:i}),r.detached.map(e=>(0,M.jsx)(CB,{block:e,locale:t,renderChild:i},e.path)),r.unmapped&&r.unmapped.length>0?(0,M.jsx)(`div`,{className:`niceeval-source-unmapped`,children:r.unmapped.map((e,t)=>(0,M.jsx)(`div`,{children:i(e)},t))}):null]})}var TB=`—`;function EB(e){return e===null?TB:yL(e)}function DB(e,t,n){let r=Math.max(n,1),i=Math.min(r,Math.max(0,e));return{x:i,width:Math.min(r-i,Math.max(t,r/1e3))}}function OB(e){return e.reduce((e,t)=>e+1+OB(t.children??[]),0)}function kB(e,t=[]){for(let n of e){let e=n.children??[];e.length===0?t.push(n):kB(e,t)}return t}var AB=5;function jB(e){let t=0;for(let n=0;n<e.length;n++)t=Math.imul(t,31)+e.charCodeAt(n)>>>0;return t%AB}function MB(e){return e.reduce((e,t)=>e+ +!!t.failed+MB(t.children??[]),0)}var NB=.01,PB=3,FB=2;function IB(e,t){return!!e.failed||!!e.open||e.durationMs===null||e.durationMs>=t*NB}function LB(e){return!e.failed&&!e.open&&e.durationMs!==null}function RB(e,t){if(t===null||t<=0)return e.map(e=>({kind:`node`,node:e}));let n=[];for(let r of e){if(IB(r,t)){n.push({kind:`node`,node:r});continue}let e=n[n.length-1];e!==void 0&&e.kind===`fold`?e.nodes.push(r):n.push({kind:`fold`,nodes:[r]})}return n.map(e=>e.kind===`fold`&&e.nodes.length<FB?{kind:`node`,node:e.nodes[0]}:e)}function zB(e,t){let n=[],r=[],i=null,a=()=>{if(r.length>=PB)n.push({kind:`repeat`,nodes:r});else for(let e of r)n.push({kind:`node`,node:e});r=[],i=null};for(let o of e){if(o.kind===`node`&&LB(o.node)){let e=`${o.node.kind}\u0000${fL(o.node.label,t)}`;e!==i&&a(),i=e,r.push(o.node);continue}a(),n.push(o)}return a(),n}function BB(e,t,n){return zB(RB(e,t),n)}function VB(e){let t=new Map;for(let n of e)t.set(n.kind,(t.get(n.kind)??0)+1);return[...t.entries()].map(([e,t])=>`${e} ×${t}`).join(` · `)}function HB(e,t){return`${fL(e[0].label,t)} ×${e.length}`}function UB(e,t){let n=e.reduce((e,t)=>e+(t.durationMs??0),0);return t===`zh-CN`?`合计 ${yL(n)}`:`total ${yL(n)}`}function WB(e,t,n){return e===`zh-CN`?t===`nodes`?`${n} 个节点`:`${n} 个失败节点`:`${n} ${t===`nodes`?`node`:`failed node`}${n===1?``:`s`}`}function GB({nodes:e,locale:t,rowDurationMs:n,className:r=`niceeval-waterfall-nodes`}){return(0,M.jsx)(`ul`,{className:r,children:BB(e,n,t).map(e=>e.kind===`node`?(0,M.jsx)(KB,{node:e.node,locale:t,rowDurationMs:n},e.node.key):(0,M.jsx)(`li`,{children:(0,M.jsxs)(`details`,{className:`niceeval-waterfall-fold`,children:[(0,M.jsxs)(`summary`,{className:`niceeval-waterfall-node niceeval-waterfall-fold-summary`,children:[(0,M.jsx)(`span`,{className:`niceeval-waterfall-node-name`,children:e.kind===`fold`?VB(e.nodes):HB(e.nodes,t)}),(0,M.jsx)(`span`,{className:`niceeval-waterfall-node-dur`,children:UB(e.nodes,t)})]}),(0,M.jsx)(`ul`,{className:`niceeval-waterfall-node-children`,children:e.nodes.map(e=>(0,M.jsx)(KB,{node:e,locale:t,rowDurationMs:n},e.key))})]})},`${e.kind}:${e.nodes[0].key}`))})}function KB({node:e,locale:t,rowDurationMs:n}){let r=fL(e.label,t),i=e.children??[],a=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`niceeval-waterfall-node-kind`,children:e.kind}),(0,M.jsx)(`span`,{className:`niceeval-waterfall-node-name`,title:r,children:r}),e.failed?(0,M.jsx)(`span`,{className:`niceeval-waterfall-node-failed`,children:`✗`}):null,(0,M.jsx)(`span`,{className:`niceeval-waterfall-node-dur`,children:EB(e.durationMs)})]});return i.length===0?(0,M.jsx)(`li`,{className:pL(`niceeval-waterfall-node`,e.failed&&`niceeval-waterfall-node--failed`),children:a}):(0,M.jsx)(`li`,{children:(0,M.jsxs)(`details`,{open:!!e.failed||!!e.open,children:[(0,M.jsx)(`summary`,{className:pL(`niceeval-waterfall-node`,e.failed&&`niceeval-waterfall-node--failed`),children:a}),(0,M.jsx)(GB,{nodes:i,locale:t,rowDurationMs:n,className:`niceeval-waterfall-node-children`})]})})}function qB(e,t,n,r){return(0,M.jsxs)(`section`,{className:pL(`niceeval-report`,`niceeval-waterfall`,r),children:[n===void 0?null:(0,M.jsx)(`div`,{className:`niceeval-waterfall-title`,children:fL(n,t)}),(0,M.jsx)(`ul`,{className:`niceeval-waterfall-list`,children:e.map(e=>{let n=OB(e.nodes),r=MB(e.nodes),i=kB(e.nodes),a=fL(e.label,t),o=e.locator!==void 0&&a===String(e.locator);return(0,M.jsxs)(`li`,{className:`niceeval-waterfall-row`,children:[(0,M.jsxs)(`div`,{className:`niceeval-waterfall-head`,children:[e.locator===void 0?null:e.href===void 0?(0,M.jsx)(`span`,{className:`niceeval-locator`,children:e.locator}):(0,M.jsx)(`a`,{className:`niceeval-locator`,href:e.href,children:e.locator}),o?null:(0,M.jsx)(`span`,{className:`niceeval-waterfall-label`,children:a}),(0,M.jsx)(`span`,{className:`niceeval-waterfall-duration`,children:EB(e.durationMs)}),(0,M.jsx)(`span`,{className:`niceeval-waterfall-count`,children:WB(t,`nodes`,n)}),r>0?(0,M.jsxs)(`span`,{className:`niceeval-waterfall-failed`,children:[`✗ `,WB(t,`failed`,r)]}):null]}),e.durationMs!==null&&i.some(e=>e.durationMs!==null)?(0,M.jsx)(`svg`,{className:`niceeval-waterfall-track`,viewBox:`0 0 ${Math.max(e.durationMs,1)} 1`,preserveAspectRatio:`none`,children:i.map(n=>{if(n.durationMs===null)return null;let r=DB(n.startOffsetMs,n.durationMs,e.durationMs);return(0,M.jsx)(`rect`,{className:pL(`niceeval-waterfall-bar`,`niceeval-span-kind-${jB(n.kind)}`,n.failed&&`niceeval-span-failed`),x:r.x,y:.15,width:r.width,height:.7,children:(0,M.jsx)(`title`,{children:`${fL(n.label,t)} · ${yL(n.durationMs)}${n.failed?` · ✗`:``}`})},n.key)})}):null,e.nodes.length>0?(0,M.jsx)(GB,{nodes:e.nodes,locale:t,rowDurationMs:e.durationMs}):null]},e.key)})})]})}function JB({nodes:e,locale:t,title:n,className:r}){let i=e??null;return i===null||i.length===0?null:qB(i,t,n,r)}function YB({children:e,className:t}){return(0,M.jsx)(`div`,{className:pL(`niceeval-report`,`niceeval-col`,t),children:v.Children.toArray(e)})}function XB({children:e,className:t}){let n=v.Children.toArray(e);return(0,M.jsx)(`div`,{className:`niceeval-report niceeval-grid-fit`,children:(0,M.jsx)(`div`,{className:pL(`niceeval-report`,`niceeval-grid`,t),"data-cells":n.length,children:n.map((e,t)=>(0,M.jsx)(`div`,{className:`niceeval-grid-cell`,children:e},t))})})}function ZB({cell:e}){return e===void 0||e.kind===`notApplicable`?`—`:e.kind===`verdict`?(0,M.jsx)(`span`,{className:pL(`niceeval-verdict-pill`,`niceeval-verdict-${e.verdict}`),children:e.verdict}):e.text}function QB({data:e,locale:t,className:n}){return e===null||e.rows.length===0||e.columns.length===0?null:(0,M.jsxs)(`table`,{className:pL(`niceeval-report`,`niceeval-table`,n),children:[(0,M.jsx)(`thead`,{children:(0,M.jsx)(`tr`,{children:e.columns.map(e=>(0,M.jsx)(`th`,{scope:`col`,children:fL(e.header,t)},e.key))})}),(0,M.jsx)(`tbody`,{children:e.rows.map(t=>(0,M.jsx)(`tr`,{children:e.columns.map(e=>(0,M.jsx)(`td`,{children:(0,M.jsx)(ZB,{cell:t.cells[e.key]})},e.key))},t.key))})]})}function $B(e){return sV(e.map(e=>cH(e,`assertion`))).slice}function eV(e,t,n){return VV(cH(e,`trace`),t,n)}function tV(e,t,n){return GV(cH(e,`trace`),t,n)}function nV(e){return KV(cH(e,`trace`))}function rV(e,t){return UV(cH(e,`timing`),t).slice}function iV(e,t){return WV(cH(t,`trace`),cH(e,`usage`))}function aV(e,t,n){return qV(cH(e,`sources`),cH(t,`trace`),n).slice}function oV(e){return JV(cH(e,`diff`))}function sV(e){let t=e.flatMap(e=>{try{return[cV(e)]}catch{return[]}}),n=t.filter(e=>e.display.outcome!==`passed`||e.score!==void 0),r=t.filter(e=>e.display.outcome===`passed`&&e.score===void 0),i=new Map;for(let e of r){let t=e.display.groupPath.join(` > `)||`Passed checks`,n=i.get(t)??[];n.push(e),i.set(t,n)}let a=t.flatMap(({score:e})=>e===void 0?[]:[e]),o=Object.freeze({attention:Object.freeze(n),passedGroups:Object.freeze([...i].map(([e,t])=>Object.freeze({group:e,items:Object.freeze(t)}))),evaluationKind:a.length===0?`pass`:`points`});return Object.freeze({data:o,slice:Object.freeze({state:`available`,data:o})})}function cV(e){let t=cH(e,`entry`),n=cH(e,`display`),r=cH(t,`decision`),i=cH(t,`evaluation`),a=uH(t.contribution)??uH(r.contribution),o=cH(t,`criterion`),s=cH(t,`materials`),c=uH(t.judgeMaterial),l=uH(t.scoreMatchAudit),u=uH(uH(t.policy)?.condition),d=ZV(r.result),f=dH(e,`sourceSites`).flatMap(e=>{let t=uH(e),n=uH(t?.source),r=uH(t?.start),i=uH(t?.end);return t===void 0||n===void 0||r===void 0||i===void 0||typeof t.entryId!=`string`||typeof t.sourceOrder!=`number`||typeof t.role!=`string`||typeof n.sourceItemId!=`string`||typeof n.sha256!=`string`||typeof r.line!=`number`||typeof r.column!=`number`||typeof i.line!=`number`||typeof i.column!=`number`?[]:[Object.freeze({entryId:t.entryId,sourceOrder:t.sourceOrder,role:t.role,source:n,start:Object.freeze({line:r.line,column:r.column}),end:Object.freeze({line:i.line,column:i.column})})]}),p=f.map(e=>{let t=lH(e.source,`assertion.sourceSites[].source`);return Object.freeze({...e,target:Object.freeze({state:`exact`,sourceItemId:fH(t,`sourceItemId`),sha256:fH(t,`sha256`)})})}),m=lV(cH(e,`check`)),h=cH(e,`matcher`),g=BV(h),_=xV(h.debugger),v=uV(o),y=fV(i,g),b=dV(u),x=mV(t,m),S=pV(s,c,l),C=Object.freeze({entryId:fH(e,`entryId`),display:Object.freeze({...typeof n.key==`string`?{key:n.key}:{},...typeof n.label==`string`?{label:n.label}:{},groupPath:Object.freeze(pH(n.groupPath))}),entry:t,sourceSites:Object.freeze(f),check:m,matcher:g}),w=typeof n.label==`string`?n.label:typeof n.key==`string`?n.key:C.entryId,T=XV(a),E=r.gate,D=d===`matched`?`passed`:d===`mismatched`||d===`errored`?`failed`:`unavailable`;return Object.freeze({entryId:C.entryId,closed:C,display:Object.freeze({name:w,severity:E===`failed`||E===`unavailable`?`gate`:T===void 0?`recorded`:`scored`,outcome:D,groupPath:C.display.groupPath,detail:typeof r.reason==`string`?r.reason:``}),sourceSites:Object.freeze(p),check:v,decision:Object.freeze({result:d,observed:y,expected:b,diagnosticTree:x,...typeof r.reason==`string`?{reason:r.reason}:{}}),evidence:Object.freeze({source:S,check:v,observed:y,expected:b,explanation:x,..._===void 0?{}:{matcherDebugger:_}}),...T===void 0?{}:{score:T},retained:Object.freeze({matcher:g})})}function lV(e){return Object.freeze({label:fH(e,`label`),state:fH(e,`state`),expected:vH(e.expected),observed:vH(e.observed),reason:gH(e.reason),anchor:vH(e.anchor),children:Object.freeze(dH(e,`children`).map((e,t)=>lV(lH(e,`check.children[${t}]`))))})}function uV(e){return e.state===`available`?nH(e.value):Object.freeze({kind:`unavailable`,reason:`not-recorded`})}function dV(e){return e?.state===`available`?nH(e.value):Object.freeze({kind:`unavailable`,reason:`not-recorded`})}function fV(e,t){let n=tH(e.observed),r=e.kind===`ordinary`?e.receipt:e.kind===`matcher-current`&&!Array.isArray(t.comparator)?t.receipt:void 0;return eH([...n.kind===`fields`?n.fields:[{label:`value`,value:n}],...r==null?[]:[{label:`receipt`,value:nH(r)}]])}function pV(e,t,n){let r=yV(cH(e,`source`)),i=dH(e,`evidence`).map((e,t)=>yV(lH(e,`materials.evidence[${t}]`))),a=dH(e,`limitations`).map(nH);return eH([{label:`input`,value:r},...t===void 0?[]:[{label:`judge material`,value:nH(t)}],...n===void 0?[]:[{label:`model evaluation`,value:nH(n)}],...i.length===0?[]:[{label:`evidence`,value:Object.freeze({kind:`list`,items:Object.freeze(i)})}],{label:`coverage`,value:nH(e.coverage)},...a.length===0?[]:[{label:`limitations`,value:Object.freeze({kind:`list`,items:Object.freeze(a)})}]])}function mV(e,t){let n=cH(e,`explanationRetention`);if(n.state===`retained`){let e=gV(tH(n.value));if(e.kind!==`fields`)return _V(t);let r=new Set(e.fields.map(e=>e.label));return eH([...e.fields,...!r.has(`expected`)&&t.expected!==null?[{label:`expected`,value:hV(t.expected)}]:[],...!r.has(`received`)&&t.observed!==null?[{label:`received`,value:hV(t.observed)}]:[],...!r.has(`reason`)&&t.reason!==null?[{label:`reason`,value:$V(t.reason)}]:[]])}return _V(t)}function hV(e){let t=uH(e);return t!==void 0&&(t.kind===`unavailable`||t.kind===`value`||t.kind===`text`||t.kind===`list`||t.kind===`fields`)?tH(e):nH(e)}function gV(e){if(e.kind===`list`)return Object.freeze({kind:`list`,items:Object.freeze(e.items.map(gV))});if(e.kind!==`fields`)return e;let t=new Set(e.fields.map(e=>e.label));return eH(e.fields.map(e=>({label:e.label===`observed`&&!t.has(`received`)?`received`:e.label===`message`&&!t.has(`reason`)?`reason`:e.label,value:gV(e.value)})))}function _V(e){let t=uH(e.anchor),n=typeof t?.id==`string`?t.id:typeof t?.toolOccurrenceId==`string`?t.toolOccurrenceId:typeof t?.eventId==`string`?t.eventId:void 0;return eH([{label:`code`,value:$V(e.label)},...e.expected===null?[]:[{label:`expected`,value:hV(e.expected)}],...e.observed===null?[]:[{label:`received`,value:hV(e.observed)}],...e.reason===null?[]:[{label:`reason`,value:$V(e.reason)}],...n===void 0?[]:[{label:`locator`,value:eH([{label:`id`,value:$V(n)}])}],{label:`children`,value:Object.freeze({kind:`list`,items:Object.freeze(e.children.map((e,t)=>eH([{label:`index`,value:$V(t)},{label:`label`,value:$V(e.label)},{label:`state`,value:$V(vV(e.state))},{label:`diagnostic`,value:_V(e)}])))})}])}function vV(e){return e===`matched`||e===`mismatched`?e:`unavailable`}function yV(e){if(e.kind===`snapshot`)return nH(e.value);if(e.kind===`unavailable`)return Object.freeze({kind:`unavailable`,reason:`not-recorded`});if(e.kind!==`content`)throw Error(`Assertion material kind is invalid`);let t=cH(e,`content`);if(t.state!==`available`||typeof t.base64!=`string`)throw Error(`Assertion material content is unavailable`);let n=bV(t.base64);return e.encoding===`json`?nH(JSON.parse(n)):e.encoding===`utf-8`?Object.freeze({kind:`text`,text:n}):nH({encoding:e.encoding,byteLength:e.byteLength,preview:e.preview})}function bV(e){let t=globalThis.atob(e),n=Uint8Array.from(t,e=>e.charCodeAt(0));return new TextDecoder(`utf-8`,{fatal:!0}).decode(n)}function xV(e){if(e==null)return;let t=lH(e,`matcher.debugger`),n=MV(t.state),r=NV(t.subject),i=cH(t,`source`),a=SV(cH(i,`final`));if(n===`legacy`)return Object.freeze({state:n,queryKind:`unavailable`,subject:r,querySummary:`Matcher query was not retained`,facts:Object.freeze([]),atEvaluation:Object.freeze({state:a.state,rows:Object.freeze(a.rows.map(e=>e.content))}),afterEvaluation:Object.freeze([]),relationNotice:`historical-not-recorded`});let o=cH(t,`query`),s=PV(o.kind),c=Object.freeze(s===`collection-filter`?[tH(o.summary)]:dH(o,`summaries`).map(tH)),l=s===`collection-filter`?EV(c[0]):c.map(DV).join(` → `),u=cH(t,`receipt`),d=SV(cH(i,`atEvaluation`)),f=jV(cH(t,`identityRelation`)),p=[...d.state===`partial`?[`source-partial`]:[],...t.overlayRetention===`partial`?[`overlay-partial`]:[],...d.state===`unavailable`?[`source-unavailable`]:[]].filter(e=>e!==f);return Object.freeze({state:n,queryKind:s,subject:r,querySummary:l,receipt:vH(u),sourceLedger:vH(i),facts:Object.freeze([Object.freeze({kind:`observed`,value:kV(s,c.length,u)}),Object.freeze({kind:`examined`,value:AV(s,u)})]),steps:Object.freeze(dH(t,`steps`).map(wV)),atEvaluation:Object.freeze({state:d.state,rows:Object.freeze(d.rows.map(e=>e.content)),...p.length===0?{}:{notices:Object.freeze(p)}}),afterEvaluation:Object.freeze(a.rows.filter(e=>e.phase===`outside-evaluation-snapshot`).map(e=>e.content)),...f===void 0?{}:{relationNotice:f}})}function SV(e){return Object.freeze({state:FV(e.state),rows:Object.freeze(dH(e,`rows`).map((e,t)=>CV(lH(e,`matcher.debugger.source.rows[${t}]`))))})}function CV(e){let t=cH(e,`evaluation`),n=LV(t.result),r=t.difference===void 0?void 0:TV(tH(t.difference)),i=uH(e.conversationTarget);return Object.freeze({phase:RV(e.phase),content:Object.freeze({key:fH(e,`rowId`),number:fH(e,`number`),kind:IV(e.kind),summary:fH(e,`summary`),state:n,fields:TV(tH(e.detail)),...r===void 0?{}:{difference:r},...i?.state===`exact`&&typeof i.anchor==`string`?{conversationTarget:Object.freeze({anchor:i.anchor})}:{}})})}function wV(e,t){let n=lH(e,`matcher.debugger.steps[${t}]`),r=uH(n.conversationTarget);return Object.freeze({step:hH(n,`step`),summary:rH(tH(n.summary)),state:zV(n.state),...typeof n.sourceRow==`string`?{sourceRow:n.sourceRow}:{},...r?.state===`exact`&&typeof r.anchor==`string`?{conversationTarget:Object.freeze({anchor:r.anchor})}:{}})}function TV(e){return e.kind===`fields`?Object.freeze(e.fields.map(e=>Object.freeze({label:e.label,value:rH(e.value)}))):e.kind===`list`?Object.freeze(e.items.map((e,t)=>Object.freeze({label:String(t+1),value:rH(e)}))):Object.freeze([Object.freeze({label:`value`,value:rH(e)})])}function EV(e){let t=OV(e,`matcher`),n=OV(e,`quantifier`),r=n===void 0?void 0:OV(n,`kind`),i=n===void 0?void 0:OV(n,`count`),a=t===void 0?void 0:rH(t);return a===void 0||a.length===0||r?.kind!==`value`||typeof r.value!=`string`?rH(e):r.value===`absent`?`none × ${a}`:i?.kind!==`value`||typeof i.value!=`number`?rH(e):r.value===`exact`?`exactly ${i.value} × ${a}`:r.value===`at-least`?`at least ${i.value} × ${a}`:r.value===`less-than`?`less than ${i.value} × ${a}`:r.value===`at-most`?`at most ${i.value} × ${a}`:r.value===`greater-than`?`greater than ${i.value} × ${a}`:rH(e)}function DV(e){let t=OV(e,`matcher`);if(t===void 0)return rH(e);let n=rH(t);return n.length===0?rH(e):n}function OV(e,t){return e.kind===`fields`?e.fields.find(e=>e.label===t)?.value:void 0}function kV(e,t,n){return e===`collection-filter`&&typeof n.matched==`number`&&typeof n.mismatched==`number`&&typeof n.unavailable==`number`?Object.freeze({en:`${n.matched} matched · ${n.mismatched} not matched · ${n.unavailable} unknown`,"zh-CN":`${n.matched} 条命中 · ${n.mismatched} 条未命中 · ${n.unavailable} 条无法判断`}):e===`ordered-sequence`&&typeof n.definitePrefixLength==`number`&&typeof n.possiblePrefixLength==`number`?Object.freeze({en:`${n.definitePrefixLength}/${t} definite · ${n.possiblePrefixLength}/${t} possible`,"zh-CN":`${n.definitePrefixLength}/${t} 步确定 · ${n.possiblePrefixLength}/${t} 步可能`}):Object.freeze({en:`unavailable`,"zh-CN":`不可用`})}function AV(e,t){if(e===`collection-filter`&&typeof t.examined==`number`){let e=typeof t.knownTotal==`number`?t.knownTotal:`?`;return Object.freeze({en:`${t.examined}/${e} rows`,"zh-CN":`${t.examined}/${e} 条记录`})}return e===`ordered-sequence`&&typeof t.sourceRows==`number`&&typeof t.comparisons==`number`?Object.freeze({en:`${t.sourceRows} rows · ${t.comparisons} comparisons`,"zh-CN":`${t.sourceRows} 条记录 · ${t.comparisons} 次比较`}):Object.freeze({en:`unavailable`,"zh-CN":`不可用`})}function jV(e){if(e.state!==`exact`)return e.reason===`ambiguous`?`ambiguous-relation`:`source-unavailable`}function MV(e){if(e===`current`||e===`legacy`)return e;throw Error(`matcher.debugger.state is invalid`)}function NV(e){if(e===`tool`||e===`event`||e===`source-row`)return e;throw Error(`matcher.debugger.subject is invalid`)}function PV(e){if(e===`collection-filter`||e===`ordered-sequence`)return e;throw Error(`matcher.debugger.query.kind is invalid`)}function FV(e){if(e===`complete`||e===`partial`||e===`unavailable`)return e;throw Error(`matcher.debugger source state is invalid`)}function IV(e){if(e===`tool`||e===`event`||e===`legacy-source-row`)return e;throw Error(`matcher.debugger row kind is invalid`)}function LV(e){if(e===`matched`||e===`mismatched`||e===`unavailable`||e===`not-evaluated`||e===`not-retained`||e===`outside-snapshot`||e===`legacy`)return e;throw Error(`matcher.debugger row state is invalid`)}function RV(e){if(e===`at-evaluation`||e===`outside-evaluation-snapshot`||e===`historical`)return e;throw Error(`matcher.debugger row phase is invalid`)}function zV(e){if(e===`matched`||e===`possible`||e===`blocked`||e===`not-reached`)return e;throw Error(`matcher.debugger step state is invalid`)}function BV(e){let t=dH(e,`targets`).flatMap(e=>{let t=uH(e),n=uH(t?.anchor);if(t===void 0||n===void 0||typeof t.state!=`string`)return[];let r;return n.kind===`tool-occurrence`&&typeof n.toolOccurrenceId==`string`?r={kind:`tool-occurrence`,toolOccurrenceId:n.toolOccurrenceId}:n.kind===`event`&&typeof n.eventId==`string`&&(r={kind:`event`,eventId:n.eventId}),r===void 0?[]:[Object.freeze({state:t.state,anchor:Object.freeze(r),difference:vH(t.difference),conversationAnchor:QV(r)})]}),n=uH(e.sandboxCommandJoin),r=n?.state===`matched`&&typeof n.commandId==`string`?{state:`matched`,commandId:n.commandId}:{state:`unavailable`,reason:typeof n?.reason==`string`?n.reason:`not-recorded`},i=e.state===`ordinary`||e.state===`legacy`||e.state===`available`||e.state===`missing`?e.state:`missing`;return Object.freeze({state:i,sourceState:typeof e.sourceState==`string`?e.sourceState:null,comparator:vH(e.comparator),sourceLedger:vH(e.sourceLedger),receipt:vH(e.receipt),result:vH(e.result),targets:Object.freeze(t),sandboxCommandJoin:r,commandMatch:r,...typeof e.reason==`string`?{reason:e.reason}:{}})}function VV(e,t,n){let r=cH(e,`conversation`),i=dH(r,`items`).map((e,t)=>lH(e,`trace.conversation.items[${t}]`)),a=new Map;for(let e of t){if(e.operation!==`attempt.trace.detail`)continue;let t=cH(e,`detail`);if(t.kind===`item`){let e=uH(t.item);e!==void 0&&typeof t.itemId==`string`&&a.set(t.itemId,e)}}let o=dH(r,`turns`).map((e,t)=>{let n=lH(e,`trace.conversation.turns[${t}]`),r=fH(n,`turnId`),o=i.filter(e=>e.turnId===r).map(e=>HV(a.get(fH(e,`itemId`))??e));return Object.freeze({key:r,label:`Turn ${hH(n,`sequence`)}`,verdict:sH(n.outcome),entries:Object.freeze(o)})}),s=Object.freeze({turns:Object.freeze(o),locator:n});return YV(r.state,s,`Closed observability`)}function HV(e){let t=fH(e,`itemId`),n=fH(e,`kind`),r=uH(e.occurrence),i=typeof e.toolOccurrenceId==`string`?e.toolOccurrenceId:r?.state===`exact`&&typeof r.toolOccurrenceId==`string`?r.toolOccurrenceId:void 0,a=typeof e.eventId==`string`?e.eventId:void 0,o=iH(e,n),s=typeof e.role==`string`?e.role:void 0,c=n===`message`?s===`user`?`user`:s===`assistant`?`assistant`:`message`:n===`tool-call`||n===`tool-result`?`tool`:n,l=typeof e.tool==`string`?e.tool:`tool`,u=typeof e.input==`string`?e.input:``,d=typeof e.output==`string`?e.output:void 0,f=n===`tool-call`?`started`:n===`tool-result`?`finished`:void 0,p=oH(e.outcome),m=i===void 0?a===void 0?void 0:QV({kind:`event`,eventId:a}):QV({kind:`tool-occurrence`,toolOccurrenceId:i}),h=f===void 0?{kind:`text`,text:o}:{kind:`tool-evidence`,content:{phase:f,tool:l,...i===void 0?{}:{callId:i},...r===void 0?{}:i===void 0?{toolOccurrence:{state:`unavailable`,reason:String(r.reason??`not-recorded`)}}:{toolOccurrence:{state:`exact`,toolOccurrenceId:i}},inputSummary:u,...d===void 0?{}:{outputSummary:d},...p===void 0?{}:{outcome:p}}};return Object.freeze({id:t,...a===void 0?{}:{eventId:a},...typeof e.sequence==`number`?{sequence:e.sequence}:{},kind:c,preview:o,...m===void 0?{}:{anchor:m},detail:h,raw:JSON.stringify(e),...p===`failed`||p===`rejected`?{failed:!0}:{},...f===void 0?{}:{callPhase:f},...i===void 0?{}:{callId:i},...r===void 0?{}:i===void 0?{toolOccurrence:{state:`unavailable`,reason:String(r.reason??`not-recorded`)}}:{toolOccurrence:{state:`exact`,toolOccurrenceId:i}},...p===void 0?{}:{callOutcome:p},commandMatch:{state:`unavailable`,reason:`not-recorded`}})}function UV(e,t){let n=dH(e,`activities`).map((e,t)=>lH(e,`timing.activities[${t}]`)),r=new Map;for(let e of n){let t=typeof e.parentActivityId==`string`?e.parentActivityId:null,n=r.get(t)??[];n.push(e),r.set(t,n)}let i=e=>{let t=fH(e,`activityId`),n=(r.get(t)??[]).map(i);return Object.freeze({key:t,label:fH(e,`label`),kind:fH(e,`phase`),startOffsetMs:mH(e,`startOffsetMs`),durationMs:_H(e.durationMs),...e.outcome===`failed`?{failed:!0}:{},...n.length===0?{}:{children:Object.freeze(n)}})},a=(r.get(null)??[]).map(i),o=n.reduce((e,t)=>{let n=mH(t,`startOffsetMs`),r=_H(t.durationMs);return r===null?e:Math.max(e??0,n+r)},null),s=n.length===0?Object.freeze([]):Object.freeze([{key:t,label:t,durationMs:o,nodes:Object.freeze(a),locator:t}]);return Object.freeze({data:s,slice:YV(e.state,s,`Execution timeline`)})}function WV(e,t){let n=[];for(let e of dH(t,`observations`)){let t=uH(e);if(t!==void 0&&typeof t.kind==`string`&&typeof t.turnId==`string`){if(t.kind===`token-bucket`&&typeof t.usageObservationId==`string`&&typeof t.provider==`string`&&typeof t.bucket==`string`&&typeof t.tokens==`number`){n.push({kind:`token-bucket`,usageObservationId:t.usageObservationId,turnId:t.turnId,provider:t.provider,bucket:t.bucket,tokens:t.tokens});continue}if(t.kind===`request`&&typeof t.usageObservationId==`string`&&typeof t.provider==`string`&&typeof t.requestKind==`string`){n.push({kind:`request`,usageObservationId:t.usageObservationId,turnId:t.turnId,provider:t.provider,requestKind:t.requestKind});continue}t.kind===`provider-cost`&&typeof t.usageObservationId==`string`&&typeof t.provider==`string`&&typeof t.amount==`string`&&typeof t.currency==`string`&&n.push({kind:`provider-cost`,usageObservationId:t.usageObservationId,turnId:t.turnId,provider:t.provider,amount:t.amount,currency:t.currency})}}let r=cH(e,`conversation`),i=Object.freeze({turns:dH(r,`turns`).length,toolCalls:dH(r,`items`).filter(e=>uH(e)?.kind===`tool-call`).length,observations:Object.freeze(n)});return YV(t.state,i,`Usage`)}function GV(e,t,n){let r=cH(e,`commands`),i=new Map;for(let e of t){if(e.operation!==`attempt.trace.detail`)continue;let t=cH(e,`detail`);t.kind===`command`&&typeof t.commandId==`string`&&i.set(t.commandId,t)}let a=dH(r,`items`).map((e,t)=>{let n=lH(e,`trace.commands.items[${t}]`),a=fH(n,`commandId`),o=i.get(a)??n,s=cH(o,`invocation`),c=cH(o,`outcome`),l=uH(o.stdout),u=uH(o.stderr),d=uH(l?.truncation),f=uH(u?.truncation),p=c.kind===`exited`&&typeof c.exitCode==`number`?c.exitCode:void 0;return Object.freeze({commandId:a,timingNodeId:a,phase:fH(o,`phase`),display:aH(s),...p===void 0?{}:{exitCode:p},invocation:s,...typeof o.workingDirectory==`string`?{workingDirectory:o.workingDirectory}:{},outcome:c,classification:p===0?`succeeded`:p===void 0?`observed`:`failed`,...typeof l?.text==`string`&&l.text.length>0?{stdout:l.text}:{},...typeof u?.text==`string`&&u.text.length>0?{stderr:u.text}:{},collectionState:r.state===`partial`?`partial`:`complete`,...l===void 0?{}:{stdoutState:l.textTruncated===!0||d?.state===`truncated`?`truncated`:`complete`,...typeof l.retainedBytes==`number`?{stdoutRetainedBytes:l.retainedBytes}:{},...typeof l.totalSafeUtf8Bytes==`number`?{stdoutTotalBytes:l.totalSafeUtf8Bytes}:{}},...u===void 0?{}:{stderrState:u.textTruncated===!0||f?.state===`truncated`?`truncated`:`complete`,...typeof u.retainedBytes==`number`?{stderrRetainedBytes:u.retainedBytes}:{},...typeof u.totalSafeUtf8Bytes==`number`?{stderrTotalBytes:u.totalSafeUtf8Bytes}:{}}})});return YV(r.state,Object.freeze({commands:Object.freeze(a),locator:n}),`Commands`)}function KV(e){let t=uH(e.diagnostics);if(t===void 0)return Object.freeze({state:`unavailable`,limitations:Object.freeze([{code:`diagnostics-projection-unavailable`,summary:`Diagnostics are not exposed by the fixed execution projection.`}])});let n=dH(t,`items`).map((e,t)=>{let n=lH(e,`trace.diagnostics.items[${t}]`),r=uH(n.redaction),i=fH(n,`kind`),a=r?.state===`applied`&&typeof r.replacements==`number`?{state:`applied`,replacements:r.replacements}:{state:`none`};return Object.freeze({diagnosticId:fH(n,`diagnosticId`),code:fH(n,`code`),kind:i,phase:fH(n,`phase`),summary:fH(n,`summary`),level:i===`execution-error`?`error`:`warning`,causes:Object.freeze(dH(n,`causes`).flatMap(e=>{let t=uH(e);return typeof t?.code==`string`&&typeof t.summary==`string`?[{code:t.code,summary:t.summary}]:[]})),redaction:a,...n.sourceFrame===null||n.sourceFrame===void 0?{}:{sourceFrame:vH(n.sourceFrame)}})}),r=new Map;for(let e of n){let t=r.get(e.phase)??[];t.push(e),r.set(e.phase,t)}let i=Object.freeze({groups:Object.freeze([...r].map(([e,t])=>Object.freeze({phase:e,items:Object.freeze(t)})))});return YV(t.state,i,`Diagnostics`)}function qV(e,t,n){let r=dH(cH(t,`conversation`),`turns`),i=dH(e,`items`).flatMap((e,t)=>{let n=uH(e),i=uH(n?.content);if(n===void 0||i?.state!==`available`||typeof n.sourceItemId!=`string`||typeof n.path!=`string`||typeof n.sha256!=`string`||typeof i.text!=`string`)return[];let a=r.flatMap(e=>{let t=uH(e),r=uH(t?.context);return r?.state===`mapped`&&r.sourceItemId===n.sourceItemId&&r.sha256===n.sha256&&typeof t?.turnId==`string`?[{turnId:t.turnId,start:uH(r.start),end:uH(r.end)}]:[]}),o=i.text.split(`
61
+ `).map((e,t)=>{let n=t+1,r=a.flatMap(e=>typeof e.start?.line==`number`&&typeof e.end?.line==`number`&&n>=e.start.line&&n<=e.end.line?[e.turnId]:[]);return Object.freeze({number:n,text:e,...r.length===0?{}:{tone:`send`,turnIds:Object.freeze(r)}})});return[Object.freeze({sourceItemId:n.sourceItemId,sha256:n.sha256,path:n.path,lines:Object.freeze(o)})]});if(i.length===0)return Object.freeze({data:null,slice:YV(e.state,null,`Source navigation`)});let a=Object.freeze({spine:i[0],detached:Object.freeze(i.slice(1)),locator:n}),o=YV(e.state,a,`Source navigation`);return Object.freeze({data:a,slice:o})}function JV(e){return e.state===`not-recorded`||Object.keys(e).length===0?Object.freeze({state:`not-recorded`,limitations:Object.freeze([{code:`file-changes-not-recorded`,summary:`File changes collection was not recorded for this Attempt.`}])}):Object.freeze({state:`unavailable`,limitations:Object.freeze([{code:`file-changes-content-unavailable`,summary:`File changes collection has no display-safe patch projection.`}])})}function YV(e,t,n){if(e===`available`||e===`complete`)return Object.freeze({state:`available`,data:t});let r=Object.freeze([{code:String(e??`unavailable`),summary:`${n}: ${String(e??`unavailable`)}.`}]);return Object.freeze(e===`partial`?{state:`partial`,data:t,limitations:r}:e===`not-recorded`?{state:`not-recorded`,limitations:r}:{state:`unavailable`,limitations:r})}function XV(e){if(e!==void 0&&e.state!==`not-scored`&&typeof e.points==`number`)return e.state===`earned`&&typeof e.earned==`number`?Object.freeze({state:`earned`,points:e.points,earned:e.earned}):Object.freeze({state:`unavailable`,points:e.points})}function ZV(e){return e===`matched`||e===`mismatched`||e===`unavailable`||e===`errored`||e===`not-applicable`?e:`unavailable`}function QV(e){return e.kind===`tool-occurrence`?`tool:${e.toolOccurrenceId}`:`event:${e.eventId}`}function $V(e){return Object.freeze({kind:`value`,value:e})}function eH(e){return Object.freeze({kind:`fields`,fields:Object.freeze(e.map(e=>Object.freeze(e)))})}function tH(e){let t=lH(e,`assertion fact`);if(t.kind===`unavailable`&&typeof t.reason==`string`)return Object.freeze({kind:`unavailable`,reason:t.reason});if(t.kind===`value`&&(t.value===null||typeof t.value==`string`||typeof t.value==`boolean`||typeof t.value==`number`&&Number.isFinite(t.value)))return $V(t.value);if(t.kind===`text`&&typeof t.text==`string`)return Object.freeze({kind:`text`,text:t.text});if(t.kind===`list`)return Object.freeze({kind:`list`,items:Object.freeze(dH(t,`items`).map(tH))});if(t.kind===`fields`)return eH(dH(t,`fields`).map((e,t)=>{let n=lH(e,`assertion fact.fields[${t}]`);return Object.freeze({label:fH(n,`label`),value:tH(n.value)})}));throw Error(`Assertion fact has an invalid closed shape`)}function nH(e){if(e===null||typeof e==`string`||typeof e==`boolean`)return $V(e);if(typeof e==`number`)return Number.isFinite(e)?$V(e):Object.freeze({kind:`unavailable`,reason:`source-unavailable`});if(Array.isArray(e))return Object.freeze({kind:`list`,items:Object.freeze(e.map(nH))});let t=uH(e);return t===void 0?Object.freeze({kind:`unavailable`,reason:`source-unavailable`}):eH(Object.entries(t).map(([e,t])=>({label:e,value:nH(t)})))}function rH(e){switch(e.kind){case`unavailable`:return e.reason;case`value`:return typeof e.value==`string`?e.value:String(e.value);case`text`:return e.text;case`list`:return e.items.map(rH).join(`, `);case`fields`:return e.fields.map(e=>`${e.label}: ${rH(e.value)}`).join(` · `)}}function iH(e,t){return t===`message`&&typeof e.text==`string`?e.text:t===`tool-call`?`${typeof e.tool==`string`?e.tool:`tool`} ${typeof e.input==`string`?e.input:``}`.trim():t===`tool-result`&&typeof e.output==`string`?e.output:typeof e.summary==`string`?e.summary:t===`input-request`&&typeof e.prompt==`string`?typeof e.response==`string`?`${e.prompt}\n${e.response}`:e.prompt:JSON.stringify(e)}function aH(e){return e.kind===`shell`&&typeof e.command==`string`?e.command:e.kind===`argv`&&typeof e.executable==`string`?[e.executable,...pH(e.arguments)].join(` `):JSON.stringify(e)}function oH(e){return e===`completed`||e===`rejected`||e===`failed`||e===`cancelled`?e:void 0}function sH(e){if(e===`completed`)return`passed`;if(e===`failed`)return`failed`;if(e===`cancelled`)return`skipped`;if(e===`interrupted`)return`errored`}function cH(e,t){return lH(Reflect.get(e,t),t)}function lH(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`${t} must be an object.`);return e}function uH(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function dH(e,t){let n=e[t];if(!Array.isArray(n))throw Error(`${t} must be an array.`);return n}function fH(e,t){let n=e[t];if(typeof n!=`string`)throw Error(`${t} must be a string.`);return n}function pH(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function mH(e,t){let n=e[t];if(typeof n!=`number`||!Number.isFinite(n))throw Error(`${t} must be a number.`);return n}function hH(e,t){let n=e[t];if(typeof n!=`number`||!Number.isSafeInteger(n))throw Error(`${t} must be an integer.`);return n}function gH(e){return typeof e==`string`?e:null}function _H(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function vH(e){if(e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e))return e;if(Array.isArray(e))return Object.freeze(e.map(vH));let t=uH(e);return t===void 0?null:Object.freeze(Object.fromEntries(Object.entries(t).map(([e,t])=>[e,vH(t)])))}function yH(e){let t=e.display,n=e.score,r=n?.state===`earned`?n.earned??0:void 0,i=n===void 0?``:` · weight ${n.points} ${n.points===1?`pt`:`pts`} · earned ${r===void 0?`unavailable`:`${r} ${r===1?`pt`:`pts`}`}`;return[{kind:`text`,className:`niceeval-source-assertion ${e.decision.result===`matched`?`niceeval-tone-good`:e.decision.result===`mismatched`&&t.severity===`gate`?`niceeval-tone-bad`:e.decision.result===`mismatched`?`niceeval-tone-warn`:`niceeval-tone-na`}`,text:`${t.name} · ${t.severity} ${t.outcome}${i}`},{kind:`assertion`,entryId:e.entryId,content:e.evidence,label:t.name,state:e.decision.result===`matched`?`matched`:e.decision.result===`mismatched`?`mismatched`:`unavailable`}]}function bH(e){return e===null||e.attention.length===0&&e.passedGroups.length===0?null:{columns:[{key:`name`,header:{en:`Name`,"zh-CN":`名称`}},{key:`severity`,header:{en:`Severity`,"zh-CN":`级别`}},{key:`outcome`,header:{en:`Outcome`,"zh-CN":`结果`}},{key:`detail`,header:{en:`Detail`,"zh-CN":`详情`}}],rows:e.attention.map(e=>({key:e.entryId,cells:{name:{kind:`text`,text:e.display.name},severity:{kind:`text`,text:e.display.severity},outcome:{kind:`verdict`,verdict:e.display.outcome===`unavailable`?`skipped`:e.display.outcome},detail:e.display.detail.length>0?{kind:`text`,text:e.display.detail}:{kind:`notApplicable`}}}))}}function xH(e){if(e.some(e=>e.decision.result===`mismatched`&&e.display.severity===`gate`))return`gate-fail`;if(e.some(e=>e.decision.result===`mismatched`))return`soft-fail`;if(e.some(e=>e.decision.result===`unavailable`||e.decision.result===`errored`||e.decision.result===`not-applicable`))return`unavailable`;if(e.some(e=>e.decision.result===`matched`))return`passed`}function SH(e,t){let n={send:0,passed:1,unavailable:2,"soft-fail":3,"gate-fail":4};return t===void 0?e:e===void 0||n[t]>n[e]?t:e}function CH(e,t){if(e===null||t===null)return e;let n=[...t.attention,...t.passedGroups.flatMap(e=>e.items)],r=[e.spine,...e.detached],i=new Set(r.map(e=>`${e.sourceItemId}\u0000${e.sha256}`)),a=new Set,o=e=>({...e,lines:e.lines.map(t=>{let r=n.flatMap(n=>n.sourceSites.filter(n=>n.target.state===`exact`&&n.target.sourceItemId===e.sourceItemId&&n.target.sha256===e.sha256&&t.number>=n.start.line&&t.number<=n.end.line).map(e=>({entry:n,site:e})));for(let{entry:e}of r)a.add(e.entryId);let i=r.filter(({site:e})=>e.role!==`score`).map(({entry:e})=>e),o=r.filter(({site:e})=>e.role!==`score`&&e.start.line===t.number).map(({entry:e})=>e),s=new Set((t.details??[]).flatMap(e=>e.kind===`assertion`?[e.entryId]:[])),c=[...t.details??[],...o.filter(e=>!s.has(e.entryId)).flatMap(yH)],l=r.filter(({site:e,entry:t})=>e.role===`score`&&t.score!==void 0),u=l.reduce((e,{entry:t})=>e+(t.score?.state===`earned`?t.score.earned??0:0),0),d=l.length===0?t.pill:`${u} ${u===1?`pt`:`pts`}`,f=SH(t.tone,xH(i));return{...t,...f===void 0?{}:{tone:f},...d===void 0?{}:{pill:d},...c.length===0?{}:{details:c}}})}),s=o(e.spine),c=e.detached.map(o);for(let e of n)e.sourceSites.some(e=>e.target.state===`exact`&&i.has(`${e.target.sourceItemId}\u0000${e.target.sha256}`))||a.delete(e.entryId);let l=[...e.unmapped??[],...n.filter(e=>!a.has(e.entryId)).flatMap(yH)];return{...e,spine:s,detached:c,...l.length===0?{}:{unmapped:l}}}var wH=[{title:{en:`Execution evidence unavailable`,"zh-CN":`执行证据不可用`},items:[{level:`warning`,message:{en:`The events artifact is missing or was not published.`,"zh-CN":`事件证据缺失或未发布。`}}]}];function TH(e){return e===null?[]:e.groups.map(e=>({title:e.phase,items:e.items.map(e=>({level:e.level,message:`${e.code}: ${e.summary}`}))}))}function EH(e){return e.map(e=>({level:`warning`,message:`${e.code}: ${e.summary}`}))}function DH(e,t){if(t.state===`available`)return[];let n=EH(t.limitations);return[{title:e,items:n.length>0?n:[{level:`warning`,message:`Evidence state: ${t.state}.`}]}]}function OH(e){return e.state===`available`||e.state===`partial`?e.data:null}function kH(e,t){let n=t?.turns??[],r=new Map(n.map(e=>[e.key,e])),i=new Set,a=e=>{let n=(e.turnIds??[]).flatMap(e=>{let t=r.get(e);return t===void 0?[]:(i.add(e),[t])}),a=e.details===void 0&&n.length===0?void 0:[...e.details??[],...n.length===0?[]:[{kind:`turn-trace`,data:{turns:n,locator:t?.locator}}]];return{...e,...a===void 0?{}:{details:a}}},o=e=>({...e,lines:e.lines.map(a)}),s=e===null?null:{...e,spine:o(e.spine),detached:e.detached.map(o)},c=n.filter(e=>!i.has(e.key));return{source:s,conversation:t===null||c.length===0?null:{...t,turns:c}}}var AH=16777216;function jH({locator:e,block:t}){let{t:n}=Fo(),r=zM(),i=(0,v.useRef)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(),[l,u]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=new IntersectionObserver(t=>{t.some(e=>e.isIntersecting)&&(o(!0),e.disconnect())});return i.current!==null&&e.observe(i.current),()=>e.disconnect()},[]);let d=uc({queryKey:[`execution-display-image`,r.identity,e,t.artifactId],enabled:a&&t.byteLength<=AH,staleTime:1/0,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,queryFn:async()=>{let n=new Uint8Array(t.byteLength),i=0;do{let a=GM({kind:`attempt.artifact`,locator:e,artifactId:t.artifactId,offset:i,limit:262144});if(ad(a)||a.success.kind!==`attempt.artifact`)throw Error(`Image artifact request is invalid.`);let{artifact:o}=await r.inspectRepository(a.success);if(o.state!==`available`||o.byteLength!==t.byteLength||o.mediaType!==t.mediaType||o.sha256!==t.sha256||o.offset!==i)throw Error(`Image artifact does not match the sealed display descriptor.`);let s=Uint8Array.from(atob(o.base64),e=>e.charCodeAt(0));if(i+s.byteLength>n.byteLength||s.byteLength===0&&i<n.byteLength)throw Error(`Image artifact byte range is invalid.`);if(n.set(s,i),i+=s.byteLength,o.nextOffset===null){if(i!==n.byteLength)throw Error(`Image artifact is incomplete.`);break}if(o.nextOffset!==i||i>=n.byteLength)throw Error(`Image artifact continuation is invalid.`)}while(i<n.byteLength);let a=new Uint8Array(await crypto.subtle.digest(`SHA-256`,n));if(Array.from(a,e=>e.toString(16).padStart(2,`0`)).join(``)!==t.sha256)throw Error(`Image artifact bytes do not match the sealed digest.`);return n}});return(0,v.useEffect)(()=>{if(u(!1),c(void 0),d.data===void 0)return;let e=URL.createObjectURL(new Blob([d.data],{type:t.mediaType}));return c(e),()=>URL.revokeObjectURL(e)},[d.data,t.mediaType]),(0,M.jsxs)(`figure`,{ref:i,children:[s===void 0||l?(0,M.jsx)(`p`,{children:t.alt}):(0,M.jsx)(`img`,{src:s,alt:t.alt,style:{maxWidth:`100%`},onError:()=>u(!0)}),(0,M.jsxs)(`figcaption`,{children:[t.mediaType,` · `,t.byteLength,` bytes · `,(0,M.jsx)(`code`,{children:t.artifactId})]}),l?(0,M.jsx)(`p`,{children:n(`executionTrace.imageDecodeFailed`)}):null,d.isError?(0,M.jsx)(`p`,{role:`alert`,children:d.error.message}):null,t.byteLength>AH?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`p`,{children:n(`executionTrace.imageTooLarge`)}),(0,M.jsx)(`pre`,{children:JSON.stringify({protocol:`niceeval.query/v2`,operation:{kind:`attempt.artifact`,locator:e,artifactId:t.artifactId}},null,2)})]}):null]})}function MH({locator:e,block:t}){let{t:n}=Fo(),r=e=>(0,M.jsxs)(M.Fragment,{children:[typeof e==`string`?e:e.preview,typeof e==`string`||e.omittedBytes===0?null:(0,M.jsxs)(`span`,{children:[` `,n(`executionTrace.moreBytes`,{count:e.omittedBytes})]})]});switch(t.kind){case`text`:return(0,M.jsx)(`p`,{style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:r(t.text)});case`message`:return(0,M.jsxs)(`p`,{style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:[(0,M.jsxs)(`strong`,{children:[t.speaker??t.role,`: `]}),r(t.text)]});case`fields`:return(0,M.jsx)(`dl`,{children:t.fields.map((e,t)=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:e.label}),(0,M.jsx)(`dd`,{style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:typeof e.value==`object`&&e.value!==null?r(e.value):typeof e.value==`string`?e.value:JSON.stringify(e.value)})]},t))});case`code`:return(0,M.jsx)(`pre`,{style:{overflow:`auto`,whiteSpace:`pre`},children:(0,M.jsx)(`code`,{children:r(t.text)})});case`image`:return(0,M.jsx)(jH,{locator:e,block:t})}}function NH(e){return new TextDecoder().decode(Uint8Array.from(atob(e),e=>e.charCodeAt(0)))}function PH({locator:e,selector:t,select:n}){let{t:r}=Fo(),i=BM({kind:`attempt.trace.detail`,locator:e,selector:t});if(i.isPending)return(0,M.jsx)(`p`,{role:`status`,children:r(`report.loadingDetails`)});if(i.isError)return(0,M.jsxs)(`div`,{role:`alert`,children:[(0,M.jsx)(`p`,{children:i.error.message}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>void i.refetch(),children:r(`report.retry`)})]});let a=i.data.detail;return a.kind===`execution-evidence`?(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h4`,{children:a.label}),(0,M.jsxs)(`p`,{children:[(0,M.jsx)(`code`,{children:a.evidenceId}),` · `,(0,M.jsx)(`code`,{children:a.pointer})]}),(0,M.jsxs)(`p`,{children:[r(`executionTrace.byteRange`,{offset:a.offset,total:a.targetByteLength}),` · SHA-256 `,(0,M.jsx)(`code`,{children:a.targetSha256})]}),(0,M.jsx)(`pre`,{style:{maxHeight:`28rem`,overflow:`auto`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:NH(a.base64)}),a.nextOffset===null?null:(0,M.jsx)(`button`,{type:`button`,onClick:()=>n({kind:`execution-evidence`,evidenceId:a.evidenceId,offset:a.nextOffset,limit:65536}),children:r(`executionTrace.nextBytes`)})]}):a.kind===`execution-event`?(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h4`,{children:a.event.summary}),(a.event.display??[]).map((t,n)=>(0,M.jsx)(MH,{locator:e,block:t},n)),(0,M.jsx)(`pre`,{style:{maxHeight:`28rem`,overflow:`auto`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:JSON.stringify(a.event,null,2)}),a.evidence.map(e=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h5`,{children:e.label}),(0,M.jsxs)(`p`,{children:[(0,M.jsx)(`code`,{children:e.pointer}),` · `,(0,M.jsx)(`code`,{children:e.evidenceId}),e.truncated?` ${r(`attempt.truncated`)}`:``]}),(0,M.jsx)(`pre`,{style:{maxHeight:`16rem`,overflow:`auto`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:NH(e.base64)}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>n({kind:`execution-evidence`,evidenceId:e.evidenceId}),children:r(`executionTrace.openEvidence`)})]},e.evidenceId))]}):(0,M.jsx)(`pre`,{children:JSON.stringify(a,null,2)})}function FH({locator:e,initial:t}){let{t:n}=Fo(),[r,i]=(0,v.useState)(),[a,o]=(0,v.useState)(),[s,c]=(0,v.useState)(``),l=BM(r===void 0?null:{...QM(e)[1],continuation:r}),u=r===void 0?t:l.data?.trace.execution;return t.state===`not-recorded`?null:(0,M.jsxs)(`section`,{"aria-label":n(`executionTrace.title`),className:`niceeval-col`,children:[(0,M.jsx)(`h3`,{children:n(`executionTrace.title`)}),(0,M.jsx)(`p`,{children:t.state}),t.limitations.length===0?null:(0,M.jsx)(`pre`,{children:JSON.stringify(t.limitations,null,2)}),t.traces.map(e=>(0,M.jsxs)(`details`,{children:[(0,M.jsxs)(`summary`,{children:[e.sourceTraceId,` · `,e.collection.state,` · `,e.eventCount]}),(0,M.jsx)(`pre`,{style:{maxHeight:`16rem`,overflow:`auto`,whiteSpace:`pre-wrap`},children:JSON.stringify({schema:e.schema,collection:e.collection,scopes:e.scopes},null,2)})]},e.traceId)),(0,M.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),s.trim()&&o({kind:`execution-event`,eventId:s.trim()})},children:[(0,M.jsxs)(`label`,{children:[n(`executionTrace.stableId`),` `,(0,M.jsx)(`input`,{value:s,onChange:e=>c(e.target.value)})]}),` `,(0,M.jsx)(`button`,{type:`submit`,disabled:!s.trim(),children:n(`executionTrace.openEvent`)}),` `,(0,M.jsx)(`button`,{type:`button`,disabled:!s.trim(),onClick:()=>o({kind:`execution-evidence`,evidenceId:s.trim()}),children:n(`executionTrace.openEvidence`)})]}),r!==void 0&&l.isPending?(0,M.jsx)(`p`,{role:`status`,children:n(`report.loadingDetails`)}):null,l.isError?(0,M.jsxs)(`div`,{role:`alert`,children:[(0,M.jsx)(`p`,{children:l.error.message}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>void l.refetch(),children:n(`report.retry`)})]}):null,u===void 0?null:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`ol`,{children:u.events.map(t=>(0,M.jsxs)(`li`,{children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>o({kind:`execution-event`,eventId:t.eventId}),children:t.summary||t.type}),(0,M.jsxs)(`p`,{children:[(0,M.jsx)(`code`,{children:t.eventId}),` · `,t.actor?.label??t.actor?.id??t.source.id,` · `,t.type,t.time===void 0?``:` · ${t.time.clockId}: ${t.time.value} ${t.time.unit}`]}),t.display.state===`absent`?null:t.display.blocks.map((t,n)=>(0,M.jsx)(MH,{locator:e,block:t},n)),t.scopeMemberships.map(e=>(0,M.jsxs)(`span`,{children:[e.scopeId,`: `,e.state,` `]},e.scopeId))]},t.eventId))}),u.hasMore?(0,M.jsx)(`p`,{children:n(`executionTrace.omitted`,{count:u.omittedEventCount})}):null,u.continuation===void 0?null:(0,M.jsx)(`button`,{type:`button`,onClick:()=>i(u.continuation),children:n(`executionTrace.nextPage`)})]}),r===void 0?null:(0,M.jsx)(`button`,{type:`button`,onClick:()=>i(void 0),children:n(`executionTrace.firstPage`)}),a===void 0?null:(0,M.jsx)(PH,{locator:e,selector:a,select:o})]})}function IH({label:e,value:t}){return(0,M.jsxs)(`div`,{className:`niceeval-kpi`,children:[(0,M.jsx)(`span`,{className:`niceeval-kpi-label`,children:e}),(0,M.jsx)(`span`,{className:`niceeval-kpi-value`,children:t})]})}function LH({locator:e,data:t,locale:n}){let{t:r}=Fo(),i=t.verdict===`passed`&&t.totalScore!==void 0,a=`${t.adapter.name} · ${t.adapter.contract} · ${t.adapter.behaviorRevision===null?r(`attempt.adapterRevisionNotDeclared`):t.adapter.behaviorRevision}`;return(0,M.jsxs)(`div`,{className:`niceeval-attempt-summary`,children:[(0,M.jsxs)(`div`,{className:`niceeval-attempt-summary-head`,children:[(0,M.jsx)(`span`,{className:`niceeval-verdict-pill niceeval-verdict-${t.verdict}`,children:r(i?`attempt.scoreCompleted`:`attempt.verdict.${t.verdict}`)}),(0,M.jsx)(`span`,{className:`niceeval-attempt-summary-locator`,children:e})]}),(0,M.jsxs)(`div`,{className:`niceeval-grid niceeval-attempt-summary-kpis`,children:[(0,M.jsx)(IH,{label:r(`attempt.experiment`),value:t.experimentId}),(0,M.jsx)(IH,{label:r(`attempt.adapter`),value:a}),(0,M.jsx)(IH,{label:r(`attempt.eval`),value:t.identity.evalId}),(0,M.jsx)(IH,{label:r(`attempt.title`),value:t.identity.attempt.state===`available`?String(t.identity.attempt.value+1):`—`}),t.totalScore===void 0?null:(0,M.jsx)(IH,{label:r(`attempt.score`),value:xL(t.totalScore,n)}),t.startedAt===void 0?null:(0,M.jsx)(IH,{label:r(`attempt.started`),value:SL(t.startedAt,n)}),(0,M.jsx)(IH,{label:r(`attempt.duration`),value:t.durationMs.state===`available`?yL(t.durationMs.value):`—`}),t.observedCostUSD===void 0?null:(0,M.jsx)(IH,{label:r(`attempt.cost`),value:CL(t.observedCostUSD)})]})]})}function RH(e,t){let n=$M(t);if(n.kind!==e)throw Error(`Expected ${e} operation.`);return n}function zH({data:e}){if(e===null)return null;let t=[];e.turns!==void 0&&t.push([`turns`,String(e.turns)]),e.toolCalls!==void 0&&t.push([`tool calls`,String(e.toolCalls)]);for(let n of e.observations)n.kind===`token-bucket`?t.push([`${n.provider} ${n.bucket}`,n.tokens.toLocaleString()]):n.kind===`request`?t.push([`${n.provider} ${n.requestKind}`,`1`]):t.push([`${n.provider} cost`,`${n.amount} ${n.currency}`]);return e.observedCostUSD!==void 0&&t.push([`observed cost`,`$${e.observedCostUSD.toFixed(4)}`]),t.length===0?null:(0,M.jsx)(XB,{className:`niceeval-usage-table`,children:t.map(([e,t],n)=>(0,M.jsx)(IH,{label:e,value:t},`${e}:${n}`))})}function BH({report:e}){let{t}=Fo(),n=[{label:t(`usage.cacheTotal`),summary:e.total},...e.roles.map(e=>({label:`${t(`usage.role`)}: ${e.modelRole??t(`usage.notRecorded`)}`,summary:e}))],r=e=>(0,M.jsx)(`div`,{className:`niceeval-table-wrap`,style:{overflowX:`auto`},children:(0,M.jsxs)(`table`,{"aria-label":t(`usage.cacheReadRate`),children:[(0,M.jsx)(`thead`,{children:(0,M.jsx)(`tr`,{children:[`usage.cacheScope`,`usage.cacheReadRate`,`usage.cacheCoverage`,`usage.cacheCollection`,`usage.cacheReasons`].map(e=>(0,M.jsx)(`th`,{scope:`col`,children:t(e)},e))})}),(0,M.jsx)(`tbody`,{children:e.map(({label:e,summary:n},r)=>(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{scope:`row`,children:e}),(0,M.jsx)(`td`,{children:n.rate.state===`exact`?`${(n.rate.value*100).toFixed(2)}%`:t(`cell.metricUnavailable`)}),(0,M.jsxs)(`td`,{children:[n.coveredCalls,`/`,n.recordedCalls]}),(0,M.jsx)(`td`,{children:t(n.collectionComplete?`usage.cacheComplete`:`usage.cacheIncomplete`)}),(0,M.jsx)(`td`,{children:n.reasons.join(`, `)||`—`})]},r))})]})});return(0,M.jsxs)(`section`,{"aria-label":t(`usage.cacheReadRate`),children:[(0,M.jsx)(`h4`,{children:t(`usage.cacheReadRate`)}),r(n),(0,M.jsxs)(`details`,{children:[(0,M.jsx)(`summary`,{children:t(`usage.actualModels`)}),r(e.models.map(e=>({label:`${e.modelRole??t(`usage.notRecorded`)} / ${e.provider??t(`usage.notRecorded`)} / ${e.model??t(`usage.notRecorded`)}`,summary:e})))]})]})}function VH({usage:e}){let{t}=Fo(),n=e.configuredModels,r=n.state===`available`&&n.bindings.length===1&&n.bindings[0].modelRole==="default"?n.bindings[0]:null,i=e.modelGroups,a=e.totals.costs,o=`totals`in e.judgeUsage?e.judgeUsage.totals:void 0,s={maxHeight:`24rem`,overflow:`auto`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},c=e=>`${e.value??`—`} (${e.state})`,l=e=>t(e===`reported`?`cell.costReported`:e===`estimated`?`cell.costEstimated`:`cell.costMixed`),u=e=>e===null?`—`:e===0?`0 (${t(`usage.noRecordedCalls`)})`:String(e);return(0,M.jsxs)(`section`,{"aria-label":t(`usage.external`),children:[(0,M.jsx)(`h3`,{children:t(e.totalCosts.state===`complete`?`usage.totalCosts`:`usage.totalKnownSubtotal`)}),(0,M.jsx)(`p`,{children:t(e.totalCosts.state===`complete`?`usage.costComplete`:`usage.costIncomplete`)}),e.totalCosts.missingSources.length===0?null:(0,M.jsxs)(`p`,{children:[t(`usage.missingSources`),`: `,e.totalCosts.missingSources.map(e=>t(e===`judge`?`usage.judgeUsage`:`usage.applicationCost`)).join(`, `)]}),e.totalCosts.values.length===0?(0,M.jsx)(`p`,{children:t(e.totalCosts.state===`complete`?`usage.noRecordedCharges`:`cell.metricUnavailable`)}):e.totalCosts.values.map(e=>(0,M.jsxs)(`p`,{children:[e.value,` `,e.currency,` · `,l(e.source)]},e.currency)),(0,M.jsxs)(`details`,{children:[(0,M.jsx)(`summary`,{children:t(`usage.external`)}),(0,M.jsxs)(`p`,{children:[e.state,e.coverage===void 0?``:` · ${e.coverage}`]}),(0,M.jsx)(BH,{report:e.cacheRead}),(0,M.jsx)(`h4`,{children:t(`usage.configuredModels`)}),n.state===`available`?r===null?n.bindings.length===0?(0,M.jsx)(`p`,{children:t(`usage.configuredRoleCount`,{count:0})}):(0,M.jsx)(`div`,{className:`niceeval-table-wrap`,style:{overflowX:`auto`},children:(0,M.jsxs)(`table`,{"aria-label":t(`usage.configuredModels`),children:[(0,M.jsx)(`thead`,{children:(0,M.jsx)(`tr`,{children:[`usage.role`,`usage.configuredModel`,`usage.effort`,`usage.recordedCalls`].map(e=>(0,M.jsx)(`th`,{scope:`col`,children:t(e)},e))})}),(0,M.jsx)(`tbody`,{children:n.bindings.map(e=>(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{scope:`row`,children:e.modelRole}),(0,M.jsx)(`td`,{children:e.model??`—`}),(0,M.jsx)(`td`,{children:e.reasoningEffort??`—`}),(0,M.jsx)(`td`,{children:u(e.recordedCalls)})]},e.modelRole))})]})}):(0,M.jsxs)(XB,{children:[(0,M.jsx)(IH,{label:`${t(`usage.configuredModel`)} (default)`,value:r.model??`—`}),r.reasoningEffort===null?null:(0,M.jsx)(IH,{label:t(`usage.effort`),value:r.reasoningEffort}),(0,M.jsx)(IH,{label:t(`usage.recordedCalls`),value:u(r.recordedCalls)})]}):(0,M.jsx)(`p`,{children:t(`usage.notRecorded`)}),(0,M.jsx)(`h4`,{children:t(`usage.actualModels`)}),(0,M.jsxs)(`p`,{children:[i.state,` · `,i.basis,` · `,t(`usage.groupPreview`,{shown:i.groups.length,total:i.totalGroupCount??`—`,omitted:i.omittedGroupCount}),i.groupsTruncated?` · ${t(`attempt.truncated`)}`:``]}),`reason`in i&&i.reason!==void 0?(0,M.jsx)(`p`,{children:i.reason}):null,i.state===`available`?(0,M.jsx)(`div`,{className:`niceeval-table-wrap`,style:{overflowX:`auto`},children:(0,M.jsxs)(`table`,{"aria-label":t(`usage.actualModels`),children:[(0,M.jsx)(`thead`,{children:(0,M.jsx)(`tr`,{children:[`usage.role`,`usage.servingProvider`,`usage.actualModel`,`usage.recordedCalls`,`usage.tokens`,`usage.applicationCost`].map(e=>(0,M.jsx)(`th`,{scope:`col`,children:t(e)},e))})}),(0,M.jsx)(`tbody`,{children:i.groups.map(e=>(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{scope:`row`,children:e.modelRole??t(`usage.notRecorded`)}),(0,M.jsx)(`td`,{children:e.provider??t(`usage.notRecorded`)}),(0,M.jsx)(`td`,{children:e.model??t(`usage.notRecorded`)}),(0,M.jsx)(`td`,{children:e.recordedCalls}),(0,M.jsxs)(`td`,{children:[t(`usage.inputTotal`),`: `,c(e.tokens.inputTotalTokens),(0,M.jsx)(`br`,{}),t(`usage.output`),`: `,c(e.tokens.outputTokens),(0,M.jsx)(`br`,{}),t(`usage.totalTokens`),`: `,c(e.tokens.totalTokens)]}),(0,M.jsx)(`td`,{children:e.costs.values.length===0?t(`cell.metricUnavailable`):e.costs.values.map(n=>(0,M.jsxs)(`div`,{children:[n.value,` `,n.currency,` · `,l(n.source),` · `,e.costs.state,e.costs.state===`partial`?` · ${t(`usage.knownSubtotal`)}`:``,(0,M.jsx)(`br`,{}),t(`usage.coverage`,{covered:n.coveredCalls,total:e.costs.totalCalls}),` · `,t(`usage.costOrigins`,{reported:n.reportedCalls,estimated:n.estimatedCalls})]},n.currency))})]},JSON.stringify([e.modelRole,e.provider,e.model])))})]})}):(0,M.jsx)(`p`,{children:t(`cell.metricUnavailable`)}),(0,M.jsx)(`h4`,{children:t(`usage.judgeUsage`)}),o===void 0?(0,M.jsxs)(`p`,{children:[t(`cell.metricUnavailable`),` · `,`reason`in e.judgeUsage?e.judgeUsage.reason:``]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`p`,{children:o.requests.value===0&&o.requests.state===`available`?t(`usage.noJudgeCalls`):`${t(`usage.physicalCalls`)}: ${c(o.requests)}`}),(0,M.jsxs)(`p`,{children:[t(`usage.inputTotal`),`: `,c(o.inputTotalTokens),` · `,t(`usage.output`),`: `,c(o.outputTokens),` · `,t(`usage.totalTokens`),`: `,c(o.totalTokens)]}),(0,M.jsx)(`p`,{children:o.costs.state}),o.costs.values.map(e=>(0,M.jsxs)(`p`,{children:[e.value,` `,e.currency,` · `,l(e.source),` · `,t(`usage.coverage`,{covered:e.coveredCalls,total:o.costs.totalCalls})]},e.currency))]}),e.source===`adapter`?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`h4`,{children:t(`usage.applicationCost`)}),(0,M.jsx)(XB,{children:[[`usage.input`,e.totals.inputTokens],[`usage.output`,e.totals.outputTokens],[`usage.requests`,e.totals.requests]].map(([e,n])=>(0,M.jsx)(IH,{label:t(e),value:c(n)},e))}),a===void 0||a.values.length===0?(0,M.jsxs)(`p`,{children:[t(`usage.applicationCost`),`: `,t(`cell.metricUnavailable`)]}):null,a?.values.map(e=>(0,M.jsxs)(`p`,{children:[e.value,` `,e.currency,` · `,l(e.source),` · `,a.state,a.state===`partial`?` · ${t(`usage.knownSubtotal`)}`:``,` · `,t(`usage.coverage`,{covered:e.coveredCalls,total:a.totalCalls})]},e.currency)),(0,M.jsxs)(`details`,{children:[(0,M.jsxs)(`summary`,{children:[t(`usage.calls`),` (`,e.calls?.length??0,`; `,e.omittedCallCount??0,` `,t(`attempt.truncated`),`)`]}),(0,M.jsx)(`pre`,{style:s,children:JSON.stringify(e.calls??[],null,2)})]}),(0,M.jsxs)(`details`,{children:[(0,M.jsx)(`summary`,{children:t(`usage.prices`)}),(0,M.jsx)(`pre`,{style:s,children:JSON.stringify(e.priceReceipts??null,null,2)})]})]}):null,e.limitations.length===0?null:(0,M.jsx)(`pre`,{style:s,children:JSON.stringify(e.limitations,null,2)})]})]})}function HH({model:e,locale:t,className:n}){let{t:r}=Fo(),i=zM(),a=e.assertionEntryIds.map(t=>RH(`attempt.assertion.detail`,{kind:`attempt.assertion.detail`,locator:e.locator,entryId:t})),o=[...e.traceItemIds.map(t=>RH(`attempt.trace.detail`,{kind:`attempt.trace.detail`,locator:e.locator,selector:{kind:`item`,itemId:t}})),...e.toolOccurrenceIds.map(t=>RH(`attempt.trace.detail`,{kind:`attempt.trace.detail`,locator:e.locator,selector:{kind:`tool-occurrence`,toolOccurrenceId:t}})),...e.commandIds.map(t=>RH(`attempt.trace.detail`,{kind:`attempt.trace.detail`,locator:e.locator,selector:{kind:`command`,commandId:t}}))],s=cc({queries:a.map(e=>IM(i,e))}),c=cc({queries:o.map(e=>IM(i,e))}),l=BM(QM(e.locator)[1]),u=BM(RH(`attempt.timing`,{kind:`attempt.timing`,locator:e.locator}),{select:t=>rV(t,e.locator)}),d=BM(RH(`attempt.usage`,{kind:`attempt.usage`,locator:e.locator})),f=BM(RH(`attempt.sources`,{kind:`attempt.sources`,locator:e.locator})),p=BM(RH(`attempt.diff`,{kind:`attempt.diff`,locator:e.locator}),{select:oV}),m=BM(QM(e.locator)[0]),h=[m,...s,...c,l,u,d,f,p];if(h.some(e=>e.isPending))return(0,M.jsx)(`p`,{role:`status`,children:r(`report.loadingDetails`)});if(h.some(e=>e.isError))return(0,M.jsxs)(`div`,{role:`alert`,children:[(0,M.jsx)(`p`,{children:r(`report.unableToLoadDetails`)}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>{for(let e of h)e.isError&&e.refetch()},children:r(`report.retry`)})]});let g=s.map(e=>e.data),_=c.map(e=>e.data),v=l.data,y=$B(g),b=eV(v,_,e.locator),x=tV(v,_,e.locator),S=nV(v),C=kH(CH(OH(aV(f.data,v,e.locator)),OH(y)),OH(b)),w=[...TH(OH(S)),...DH(`Assertions`,y),...DH(`Source`,aV(f.data,v,e.locator)),...DH(`Execution timeline`,u.data),...DH(`Usage`,iV(d.data,v)),...DH(`Conversation`,b),...DH(`Commands`,x),...DH(`Diagnostics`,S),...DH(`File changes`,p.data)];return(0,M.jsxs)(YB,{className:pL(`niceeval-report`,n),children:[(0,M.jsx)(LH,{locator:e.locator,data:e.summary,locale:t}),(0,M.jsx)(VH,{usage:d.data.usage}),(0,M.jsx)(UL,{items:w,locale:t}),C.source===null?(0,M.jsx)(QB,{data:bH(OH(y)),locale:t}):(0,M.jsx)(wB,{data:C.source,locale:t}),(0,M.jsxs)(`section`,{"aria-label":r(`attempt.notes`),children:[(0,M.jsx)(`h3`,{children:r(`attempt.notes`)}),(0,M.jsx)(`dl`,{children:m.data.attempt.notes.map(e=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`dt`,{children:e.label}),(0,M.jsx)(`dd`,{style:{overflowWrap:`anywhere`,whiteSpace:`pre-wrap`},children:e.value===null?r(`cell.metricUnavailable`):typeof e.value==`number`?ly(e.value,e.unit):JSON.stringify(e.value)})]},e.sequence))})]}),(0,M.jsx)(JB,{nodes:OH(u.data),title:{en:`Execution timeline`,"zh-CN":`执行时间轴`},locale:t}),(0,M.jsx)(zH,{data:OH(iV(d.data,v))}),(0,M.jsx)(FH,{locator:e.locator,initial:v.trace.execution},e.locator),C.conversation===null?OH(b)===null&&v.trace.execution.state===`not-recorded`?(0,M.jsx)(UL,{items:wH,locale:t}):null:(0,M.jsx)(lB,{data:C.conversation,locale:t}),(0,M.jsx)(lR,{data:OH(x),locale:t}),(0,M.jsx)(kR,{files:OH(p.data),locale:t})]})}function UH({locator:e,onClose:t}){let{data:n}=dc(rN(zM(),e)),{i18n:r,t:i}=Fo(),a=r.resolvedLanguage===`zh-CN`?`zh-CN`:`en`;return(0,M.jsx)(dL,{title:i(`attempt.title`),onClose:t,children:(0,M.jsx)(HH,{model:n,locale:a})})}function WH(e,t){if(typeof e==`string`)return e;let n=e[t];if(n!==void 0&&n!==``)return n;let r=e.en;if(r!==void 0&&r!==``)return r;for(let t of Object.keys(e).sort()){let n=e[t];if(n!==void 0&&n!==``)return n}throw Error(`LocalizedText object has no non-empty value. Provide at least one locale entry, e.g. { en: "…" }.`)}function GH(e,t,n){return Ro.getFixedT(e)(t,n)}function KH(e){return Object.freeze({en:GH(`en`,e),"zh-CN":GH(`zh-CN`,e)})}function qH(e,t,n){return GH(e,t,{n})}function JH(e){let t=e.toFixed(1);return t.endsWith(`.0`)?t.slice(0,-2):t}function YH(e){return e>=1e9?`${JH(e/1e9)}B`:e>=1e6?`${JH(e/1e6)}M`:e>=1e3?`${JH(e/1e3)}k`:Number.isInteger(e)?String(e):JH(e)}function XH(e){if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${JH(e/1e3)}s`;let t=Math.round(e/1e3);return`${Math.floor(t/60)}m ${t%60}s`}function ZH(e){return e>=1e3?YH(e):e>=.01||e===0?e.toFixed(2):String(e)}function QH(e,t){let n=e<0?`-`:``,r=Math.abs(e);if(t===`%`)return`${n}${JH(Math.round(r*1e3)/10)}%`;if(t===`ms`)return n+XH(r);if(t===`$`||t===`USD`)return`${n}$${ZH(r)}`;let i=YH(r);return t?`${n}${i} ${t}`:`${n}${i}`}function $H(e,t){switch(typeof e==`string`?e:e&&`kind`in e?e.kind:void 0){case`percent`:case`ratio`:return`%`;case`usd`:case`currency`:case`currency-usd`:return`$`;case`duration`:case`duration-ms`:case`milliseconds`:return`ms`;case`number`:case`count`:case`integer`:return;default:return t}}function eU(e,t,n,r=`en`){return e===null?rU(`noSamples`,r):n&&typeof n==`object`&&n.kind===`custom`&&`format`in n&&typeof n.format==`function`?n.format(e,r):QH(e,$H(n,t))}function tU(e,t=`en`){switch(e){case`available`:case`partial`:case`empty`:return rU(`noSamples`,t);case`failed`:return GH(t,`cell.metricFailed`);case`unavailable`:return GH(t,`cell.metricUnavailable`);case`unsupported`:return GH(t,`cell.metricUnsupported`);case`migration-required`:return GH(t,`cell.metricMigrationRequired`)}}var nU={noSamples:`cell.missing`,unscorable:`cell.unscorable`,noCurrentResult:`cell.noCurrentResult`,mixedExecution:`cell.mixedExecution`};function rU(e,t=`en`){let n=nU[e];return n?GH(t,n):e}function iU(e){return(e<0?`-`:``)+JH(Math.round(Math.abs(e)*10)/10)}function aU(e){switch(e){case`passed`:return`✓`;case`failed`:return`✗`;case`errored`:return`!`;case`skipped`:return`–`}}function oU(e){let t=e.projection;if(typeof t!=`object`||!t)return;let n=t;if(n.state===`available`||n.state===`partial`||n.state===`unavailable`||n.state===`migration-required`){if(n.combined===null)return{state:n.state,combined:null};if(typeof n.combined==`object`&&typeof n.combined.amount==`string`)return{state:n.state,combined:{amount:n.combined.amount}}}}function sU(e,t,n=!1){let r=oU(e.metric),i=r?.combined!==null&&r?.combined!==void 0?`$${r.combined.amount}`:e.metric.value===null?tU(e.metric.state,t):`${e.metric.source===`estimated`?`~`:``}${eU(e.metric.value,e.metric.unit,e.metric.format,t)}`;return e.showCoverage===!1?i:n&&e.metric.value!==null&&e.metric.samples<e.metric.total?`${i}\n ${GH(t,`cell.coverageDetail`,{samples:e.metric.samples,total:e.metric.total})}`:`${i} · ${e.metric.state}`}function cU(e,t){if(e==null)return`—`;switch(e.kind){case`stack`:{let n=t??`en`,r=e.cells.map((e,r)=>r===0&&e.kind===`metric`?sU(e,n,!0):cU(e,t)).filter(e=>e!==`—`);if(r.length===0)return`—`;let i=[],a=[];for(let e of r){let[t,...n]=e.split(`
62
62
  `);t&&i.push(t),a.push(...n.map(e=>e.trimStart()).filter(Boolean))}let o=a.length>0?`\n${a.map(e=>` ${e}`).join(`
63
- `)}`:``;return`${i.join(` · `)}${o}`}case`notApplicable`:return`—`;case`missing`:{let n=t??`en`,r=FH(e.code,n);return e.detail?`${r} · ${e.detail}`:r}case`text`:return e.detail?`${e.text}\n ${e.detail}`:e.text;case`locator`:return`${e.verdict===void 0?``:`${LH(e.verdict)} `}${e.locator}`;case`summary`:{let t=e.more&&e.more>0?` +${e.more} more`:``;return`${e.text}${t}`}case`score`:{let n=IH(e.earned),r=e.possible===void 0?n:`${n} / ${IH(e.possible)}`;return e.missedScoreItems===void 0?r:`${r} · ${TH(t??`en`,`experimentList.missedScoreItems`,e.missedScoreItems)}`}case`verdict`:{let n=t??`en`;return e.counts?[`passed`,`failed`,`errored`,`skipped`].filter(t=>e.counts[t]>0).map(t=>`${e.counts[t]} ${CH(n,`verdict.${t}`)}`).join(` · `)||`—`:e.verdict===void 0?`—`:e.bare?LH(e.verdict):`${LH(e.verdict)} ${e.label===void 0?CH(n,`verdict.${e.verdict}`):SH(e.label,n)}`}case`metric`:return zH(e,t??`en`)}}function VH(...e){return e.filter(Boolean).join(` `)}var HH=`—`;function UH(e){return`#/attempt/${e.startsWith(`@`)?e.slice(1):e}`}function WH(e){return GH(e.columns.map(e=>({key:e.key,header:e.header??e.key,align:e.better?`right`:`left`,better:e.better})),e)}function GH(e,t){if(e.length===0)throw Error(`Table needs at least one column.`);let n=new Set;for(let t of e){if(n.has(t.key))throw Error(`Table column key "${t.key}" is declared twice.`);n.add(t.key)}return qH(t.rows),KH(t.rows,n),{columns:e,content:t}}function KH(e,t){for(let n of e){for(let e of Object.keys(n.cells))if(!t.has(e))throw Error(`Table row "${n.key}" has a cell for "${e}", which is not a declared column.`);for(let e of t)if(!(e in n.cells))throw Error(`Table row "${n.key}" has no cell for column "${e}".`);n.subRows?.length&&KH(n.subRows,t)}}function qH(e){let t=new Set;for(let n of e){if(t.has(n.key))throw Error(`Table row key "${n.key}" is declared twice at the same level.`);t.add(n.key),n.subRows?.length&&qH(n.subRows)}}function JH(e){return e.refs.flatMap(e=>e.identity.kind===`attempt`?[e.identity.locator]:[])}function YH({cell:e,href:t,locale:n,showCoverage:r=!0,coverageDetail:i=!1}){let a=n??`en`,o=RH(e);if(o!==void 0){let t=o.combined===null?NH(e.state,a):`$${o.combined.amount}`;return(0,M.jsx)(`span`,{className:`niceeval-cell`,children:(0,M.jsx)(`span`,{className:`niceeval-value`,children:t})})}let s=e.value===null?NH(e.state,a):`${e.source===`estimated`?`~`:``}${MH(e.value,e.unit,e.format,a)}`;if(e.value===null)return(0,M.jsx)(`span`,{className:`niceeval-cell niceeval-cell-missing`,children:(0,M.jsx)(`span`,{className:`niceeval-missing`,title:CH(a,`cell.noneMeasurableTitle`,{total:e.total}),children:s})});let c=JH(e),l=e.samples<e.total,u=e.state===`partial`||r&&l,d=l?CH(a,`cell.coverageTitle`,{samples:e.samples,total:e.total}):CH(a,`cell.partialTitle`),f=l?CH(a,`cell.coverageDetail`,{samples:e.samples,total:e.total}):CH(a,`cell.partialDetail`);return(0,M.jsxs)(`span`,{className:VH(`niceeval-cell`,u&&i&&`niceeval-cell-text`),children:[(0,M.jsx)(`span`,{className:`niceeval-value`,title:CH(a,`cell.measuredTitle`,{samples:e.samples,total:e.total}),children:s}),u&&(i?(0,M.jsx)(`small`,{className:`niceeval-cell-detail`,title:d,children:f}):(0,M.jsx)(`sup`,{className:`niceeval-coverage`,title:d,children:l?`${e.samples}/${e.total}`:CH(a,`cell.partialDetail`)})),e.source==null?null:(0,M.jsx)(`small`,{className:`niceeval-cost-source`,children:CH(a,e.source===`reported`?`cell.costReported`:e.source===`estimated`?`cell.costEstimated`:`cell.costMixed`)}),t&&c.length===1&&t(c[0])!==void 0&&(0,M.jsx)(`span`,{className:`niceeval-refs`,children:(0,M.jsx)(`a`,{className:`niceeval-ref`,href:t(c[0]),children:`#1`})}),t&&c.length>1&&(0,M.jsxs)(`details`,{className:`niceeval-refs`,children:[(0,M.jsx)(`summary`,{className:`niceeval-refs-summary`,children:TH(a,`cell.evidence`,c.length)}),(0,M.jsx)(`span`,{className:`niceeval-refs-list`,children:c.map((e,n)=>t(e)===void 0?(0,M.jsxs)(`span`,{className:`niceeval-ref-text`,children:[`#`,n+1]},e):(0,M.jsxs)(`a`,{className:`niceeval-ref`,href:t(e),children:[`#`,n+1]},e))})]})]})}function XH(e,t,n=!1){if(!e)return(0,M.jsx)(`span`,{className:`niceeval-missing`,children:HH});switch(e.kind){case`stack`:return(0,M.jsx)(`span`,{className:`niceeval-cell-stack`,children:e.cells.map((e,n)=>(0,M.jsx)(`span`,{className:`niceeval-cell-stack-item`,children:XH(e,t,n===0)},n))});case`notApplicable`:return(0,M.jsx)(`span`,{className:`niceeval-missing`,children:HH});case`missing`:return(0,M.jsxs)(`span`,{className:`niceeval-missing`,children:[(0,M.jsx)(`span`,{className:`niceeval-missing-reason`,children:FH(e.code,t.locale)}),e.detail?(0,M.jsx)(`small`,{className:`niceeval-cell-detail`,children:e.detail}):null]});case`text`:return(0,M.jsxs)(`span`,{className:`niceeval-cell-text`,children:[(0,M.jsx)(`span`,{children:e.text}),e.detail?(0,M.jsx)(`small`,{className:`niceeval-cell-detail`,children:e.detail}):null]});case`locator`:{let n=e.verdict,r=VH(`niceeval-locator`,n!==void 0&&`niceeval-verdict-${n}`),i=n===void 0?null:(0,M.jsx)(`span`,{className:`niceeval-locator-mark`,"aria-hidden":`true`,children:LH(n)}),a=t.href(e.locator);return a===void 0?(0,M.jsxs)(`span`,{className:r,children:[i,e.locator]}):(0,M.jsxs)(`a`,{className:r,href:a,children:[i,e.locator]})}case`summary`:case`score`:return BH(e,t.locale);case`verdict`:{if(e.counts){let n=[`passed`,`failed`,`errored`,`skipped`].filter(t=>e.counts[t]>0);return(0,M.jsxs)(`span`,{className:`niceeval-verdict-tally`,children:[n.map(n=>(0,M.jsxs)(`span`,{className:`niceeval-verdict-${n}`,children:[e.counts[n],` `,CH(t.locale,`verdict.${n}`)]},n)),n.length===0?(0,M.jsx)(`span`,{className:`niceeval-missing`,children:HH}):null]})}let n=e.verdict??`skipped`;return(0,M.jsxs)(`span`,{className:VH(`niceeval-verdict`,`niceeval-verdict-${n}`),children:[LH(n),e.bare?null:(0,M.jsxs)(M.Fragment,{children:[` `,e.label===void 0?CH(t.locale,`verdict.${n}`):SH(e.label,t.locale)]})]})}case`metric`:return(0,M.jsx)(YH,{cell:e.metric,href:t.showMeasureRefs===!1?void 0:t.href,locale:t.locale,showCoverage:e.showCoverage!==!1,coverageDetail:n})}}function ZH(e){return e?e.kind===`stack`?ZH(e.cells[0]):e.kind===`metric`?e.metric.value??``:e.kind===`score`?e.earned:e.kind===`text`?e.text:e.kind===`locator`?e.locator:e.kind===`verdict`&&e.counts?e.counts.passed:BH(e):``}function QH(e,t,n,r=0){return e.map(e=>{let i=t.map(t=>(0,M.jsx)(`span`,{className:VH(`niceeval-table-hierarchy-cell`,t.align===`right`&&`niceeval-align-right`),"data-sort-value":ZH(e.cells[t.key]),children:XH(e.cells[t.key],n)},t.key)),a=VH(`niceeval-table-hierarchy-row`,e.variant===`placeholder`&&`niceeval-row-placeholder`,e.variant===`group`&&`niceeval-row-group`);return e.subRows?.length?(0,M.jsxs)(`details`,{className:VH(a,`niceeval-table-hierarchy-group`),"data-depth":r||void 0,children:[(0,M.jsx)(`summary`,{className:`niceeval-table-hierarchy-summary`,children:i}),(0,M.jsx)(`div`,{className:`niceeval-table-hierarchy-children`,children:QH(e.subRows,t,n,r+1)})]},e.key):(0,M.jsx)(`div`,{className:a,"data-depth":r||void 0,children:i},e.key)})}function $H(e,t,n){return e.map(e=>(0,M.jsx)(`tr`,{className:VH(e.variant===`placeholder`&&`niceeval-row-placeholder`,e.variant===`group`&&`niceeval-row-group`),children:t.map(t=>(0,M.jsx)(`td`,{className:t.align===`right`?`niceeval-align-right`:void 0,children:XH(e.cells[t.key],n)},t.key))},e.key))}function eU(e){let t=e.locale??`en`,{columns:n,content:r}=WH(e.data),[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(e.sort===void 0?null:{key:e.sort,direction:`asc`}),c=(0,v.useMemo)(()=>{let e=i.trim().toLocaleLowerCase(),n=r=>{let i=r.subRows?.map(n).filter(e=>e!==null);return e===``||Object.values(r.cells).some(n=>BH(n,t).toLocaleLowerCase().includes(e))||(i?.length??0)>0?{...r,...i===void 0?{}:{subRows:i}}:null},a=r.rows.map(n).filter(e=>e!==null);if(o===null)return a;let s=o.direction===`asc`?1:-1;return[...a].sort((e,n)=>BH(e.cells[o.key],t).localeCompare(BH(n.cells[o.key],t),t,{numeric:!0})*s)},[r.rows,t,i,o]),l=e.hrefForLocator??UH,u=r.rows.some(e=>(e.subRows?.length??0)>0),d=(0,M.jsxs)(`table`,{className:VH(`niceeval-report`,`niceeval-table`,u&&`niceeval-table--hierarchical`,e.className),"data-column-count":u?n.length:void 0,children:[(0,M.jsx)(`thead`,{children:(0,M.jsx)(`tr`,{children:n.map(e=>(0,M.jsx)(`th`,{scope:`col`,className:VH(e.align===`right`&&`niceeval-align-right`,o?.key===e.key?o.direction===`asc`?`niceeval-sort-asc`:`niceeval-sort-desc`:void 0),onClick:e.better===void 0?void 0:()=>s(t=>({key:e.key,direction:t?.key===e.key&&t.direction===`asc`?`desc`:`asc`})),tabIndex:e.better===void 0?void 0:0,onKeyDown:e.better===void 0?void 0:e=>{(e.key===`Enter`||e.key===` `)&&e.currentTarget.click()},children:SH(e.header,t)},e.key))})}),u?(0,M.jsx)(`tbody`,{children:(0,M.jsx)(`tr`,{children:(0,M.jsx)(`td`,{colSpan:n.length,className:`niceeval-table-hierarchy-body`,children:QH(c,n,{href:l,locale:t,showMeasureRefs:!1})})})}):(0,M.jsx)(`tbody`,{children:$H(c,n,{href:l,locale:t})})]});return e.searchable===!0?(0,M.jsxs)(`div`,{className:`niceeval-report niceeval-table-wrap`,children:[(0,M.jsx)(`input`,{className:`niceeval-filter`,type:`search`,value:i,onChange:e=>a(e.target.value),placeholder:CH(t,n[0].key===`entity`?`experimentList.filterPlaceholder`:`table.filterPlaceholder`)}),d]}):d}function tU(e,t){if(!t)return e;let n=`${t}/`;return e.startsWith(n)?e.slice(n.length):e}function nU(e,t){return e?`${e}/${t}`:t}function rU(e){return iU(e,``)}function iU(e,t){if(e.length===0)return[];let n=[],r=new Map;for(let i of e){let e=tU(i,t).split(`/`).filter(Boolean);if(e.length<=1){n.push(i);continue}let a=e[0],o=r.get(a);o?o.push(i):r.set(a,[i])}if(r.size===0||r.size===1&&n.length===0||[...r.values()].every(e=>e.length===1)){if(r.size===1&&n.length===0){let n=[...r.keys()][0];return iU(e,nU(t,n))}return[...n].sort((e,t)=>e.localeCompare(t)).map(e=>({kind:`leaf`,evalId:e}))}let i=[...r.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,n])=>({kind:`group`,segment:e,prefix:nU(t,e),children:iU(n,nU(t,e))})),a=[...n].sort((e,t)=>e.localeCompare(t)).map(e=>({kind:`leaf`,evalId:e}));return[...i,...a]}function aU(e){return e.some(e=>e.evaluationKind!==`pass`)?e.some(e=>e.evaluationKind!==`points`)?`mixed`:`points`:`pass`}function oU(e){let t=aU(e);return[...e].sort(sU(e=>t===`pass`?e.endToEndPassRate?.value??null:e.score?.value??null))}function sU(e){return(t,n)=>{let r=e(t),i=e(n);return r===null&&i===null?t.experimentId.localeCompare(n.experimentId):r===null?1:i===null?-1:i-r||t.experimentId.localeCompare(n.experimentId)}}var cU=`noCurrentResult`,lU=`noSamples`,uU={entity:wH(`experimentList.experiment`),model:wH(`table.model`),adapter:wH(`table.adapter`),durationMs:wH(`experimentList.avgDuration`),passRate:wH(`experimentList.passRate`),totalScore:wH(`experimentList.totalScore`),tokens:wH(`experimentList.tokens`),costUSD:wH(`experimentList.cost`),record:wH(`experimentList.result`),verdict:wH(`experimentList.status`),result:wH(`experimentList.result`)};function dU(e,t){let n={};for(let r of t)n[r.key]=e[r.key]??{kind:`notApplicable`};return n}function fU(e,t=e.state!==`available`){return{kind:`metric`,metric:e,showCoverage:t}}function pU(...e){let t=e.filter(e=>e.kind!==`notApplicable`);return t.length===0?{kind:`notApplicable`}:t.length===1?t[0]:{kind:`stack`,cells:t}}function mU(e){let t={passed:0,failed:0,errored:0,skipped:0};for(let n of e)n.verdict!==null&&(t[n.verdict]+=1);return t}function hU(e){return{kind:`verdict`,counts:mU(e)}}function gU(e){let t=mU(e);return t.failed+t.errored+t.skipped===0?{kind:`notApplicable`}:{kind:`verdict`,counts:{...t,passed:0}}}function _U(e){let t=e.length===1?e[0]:void 0;return t===void 0?hU(e):vU(t)}function vU(e){let{verdict:t}=e;return t===null?{kind:`notApplicable`}:{kind:`verdict`,verdict:t,...t===`passed`&&e.evaluationKind===`points`&&e.score?.state===`available`&&e.score.value!==null?{label:wH(`verdict.scored`)}:{}}}function yU(e){return{kind:`locator`,locator:e.locator,...e.verdict===null?{}:{verdict:e.verdict}}}function bU(e,t){return t?{kind:`text`,text:e,detail:t}:{kind:`text`,text:e}}function xU(e){return e.failureSummary===null?{kind:`text`,text:`—`}:{kind:`summary`,text:e.failureSummary}}function SU(e){return{entity:yU(e),verdict:vU(e),result:xU(e),...e.durationMs===void 0?{}:{durationMs:fU(e.durationMs)},...e.tokens===void 0?{}:{tokens:fU(e.tokens)},...e.score===void 0?{}:{totalScore:fU(e.score)},...e.costUSD===void 0?{}:{costUSD:fU(e.costUSD)}}}var CU=[{key:`entity`,header:uU.entity},{key:`model`,header:uU.model},{key:`adapter`,header:uU.adapter},{key:`durationMs`,better:`lower`,header:uU.durationMs}],wU=[{key:`tokens`,better:`lower`,header:uU.tokens},{key:`summary`,better:`higher`,header:uU.result}];function TU(){return[...CU,...wU]}var EU={key:`costUSD`,better:`lower`,header:uU.costUSD};uU.entity,uU.verdict,uU.result,uU.durationMs;function DU(e,t){if(!t)return e;let n=e.findIndex(e=>e.key===`summary`);return n<0?[...e,EU]:[...e.slice(0,n),EU,...e.slice(n)]}function OU(e,t){return bU(`${e} (${t})`)}function kU(e,t){return t>e?`${e}/${t} evals`:`${e} evals`}function AU(e,t){let n=e?.[t];return n===void 0?{kind:`notApplicable`}:fU(n)}function jU(e,t,n,r){let i={entity:bU(n),summary:{kind:`missing`,code:cU,detail:`niceeval exp ${e}`}};return{key:`${e}:${t}:missing`,variant:`placeholder`,cells:dU(i,r)}}function MU(e,t){return{key:e.locator,cells:dU(SU(e),t)}}function NU(e,t,n){let r={entity:bU(t),...e.durationMs===void 0?{}:{durationMs:fU(e.durationMs)},...e.tokens===void 0?{}:{tokens:fU(e.tokens)},summary:e.evaluationKind===`pass`?e.attempts.length===1?_U(e.attempts):pU(e.endToEndPassRate===void 0?{kind:`notApplicable`}:fU(e.endToEndPassRate),hU(e.attempts)):pU(e.score===void 0?{kind:`notApplicable`}:fU(e.score),gU(e.attempts)),...e.costUSD===void 0?{}:{costUSD:fU(e.costUSD)}};return{key:e.evalId,cells:dU(r,n.columns),subRows:e.attempts.map(e=>MU(e,n.columns))}}function PU(e,t){let n=tU(e.evalId,t.labelPrefix),r=t.item.evalRows.find(t=>t.evalId===e.evalId);return r===void 0?jU(t.item.experimentId,e.evalId,n,t.columns):NU(r,n,t)}function FU(e,t){let n=new Set,r=e=>{for(let t of e)t.kind===`leaf`?n.add(t.evalId):r(t.children)};return r([e]),t.filter(e=>n.has(e.evalId)).flatMap(e=>e.attempts)}function IU(e,t,n){let r=new Set,i=e=>{for(let t of e)t.kind===`leaf`?r.add(t.evalId):i(t.children)};i([e]);let a=t.evalRows.filter(e=>r.has(e.evalId)),o=r.size,s=a.length,c=t.groupMetrics.get(e.prefix),l=FU(e,t.evalRows),u=s===0?{kind:`missing`,code:lU}:hU(l),d=a.every(e=>e.evaluationKind===`pass`),f=d?AU(c,`passRate`):AU(c,`score`),p={entity:OU(e.segment,kU(s,o)),durationMs:AU(c,`durationMs`),tokens:AU(c,`tokens`),...c?.costUSD===void 0?{}:{costUSD:fU(c.costUSD)},summary:pU(f,d?u:gU(l))};return{key:`group:${e.prefix}`,variant:`group`,cells:dU(p,n.columns),subRows:LU(e.children,{...n,labelPrefix:e.prefix})}}function LU(e,t){let n=e.filter(e=>e.kind===`group`).slice().sort((e,n)=>{let r=RU(e,t.item),i=RU(n,t.item);return r===null&&i===null?e.segment.localeCompare(n.segment):r===null?1:i===null?-1:i-r||e.segment.localeCompare(n.segment)}),r=e.filter(e=>e.kind===`leaf`);return[...n.map(e=>IU(e,t.item,t)),...r.map(e=>PU(e,t))]}function RU(e,t){let n=`${e.prefix}/`,r=t.evalRows.some(e=>e.evalId.startsWith(n)&&e.evaluationKind!==`pass`),i=t.groupMetrics.get(e.prefix);return(r?i?.score:i?.passRate)?.value??null}function zU(e,t){let n=new Set(e.evalRows.map(e=>e.evalId)),r=rU([...new Set([...n,...e.missingEvalIds])]),i=e.evalRows.flatMap(e=>e.attempts),a=e.evaluationKind===`pass`?e.endToEndPassRate===void 0?{kind:`notApplicable`}:fU(e.endToEndPassRate,!1):e.score===void 0?{kind:`notApplicable`}:fU(e.score),o=e.evalRows.length,s=o+e.missingEvalIds.length,c={entity:OU(e.experimentId,`${o}/${s}`),model:BU(e.model),adapter:VU(e.adapter),...e.durationMs===void 0?{}:{durationMs:fU(e.durationMs,!1)},...e.tokens===void 0?{}:{tokens:fU(e.tokens,!1)},...e.costUSD===void 0?{}:{costUSD:fU(e.costUSD,!1)},summary:pU(a,e.evaluationKind===`pass`?hU(i):gU(i))};return{key:e.experimentId,cells:dU(c,t.columns),subRows:r.length>0?LU(r,t):[]}}function BU(e){return e.state===`available`?bU(e.value):e.state===`mixed`?{kind:`missing`,code:`mixedExecution`}:{kind:`notApplicable`}}function VU(e){if(e.state===`mixed`)return{kind:`missing`,code:`mixedExecution`};let t=e.value;return bU(t.name,`${t.contract} · ${t.behaviorRevision??`—`}`)}function HU(e){let t=DU(TU(),e.some(e=>e.costUSD!==void 0));return{columns:t,rows:e.map(e=>zU(e,{columns:t,item:e,labelPrefix:``}))}}var UU=(0,v.lazy)(()=>w(()=>import(`./quality-cost-scatter-B--DfJ9s.js`),[]));function WU({data:e,locale:t}){let{t:n}=Fo(),r=oU(e.experiments),i=aU(r)===`pass`?`pass`:`points`;return(0,M.jsxs)(`section`,{className:`niceeval-report niceeval-section`,children:[(0,M.jsx)(`h2`,{className:`niceeval-section-title`,children:SH(e.selectionTitle,t)}),(0,M.jsx)(`div`,{className:`niceeval-quality-cost-comparison`,children:(0,M.jsx)(v.Suspense,{fallback:(0,M.jsx)(`p`,{role:`status`,children:n(`report.loading`)}),children:(0,M.jsx)(UU,{items:r,kind:i,locale:t})})}),(0,M.jsx)(eU,{data:HU(r),sort:`summary`,searchable:!0,locale:t})]})}function GU(e,t,n){let r=e.value===null?NH(e.state,t):MH(e.value,e.unit,void 0,t);return e.state===`partial`?`${r} (${n})`:r}function KU(e){return`#/attempt/${encodeURIComponent(e.startsWith(`@`)?e.slice(1):e)}`}function qU({project:e,history:t,locale:n}){let{t:r}=Fo(),i=e.totals.verdict.tally,a=RM(e),o=e.totals.evaluationKind===`pass`?e.totals.verdict.passRate:e.totals.score;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`header`,{className:`niceeval-report niceeval-hero`,children:[(0,M.jsx)(`h1`,{className:`niceeval-hero-title`,children:r(`insight.title`)}),(0,M.jsx)(`p`,{children:r(`current.title`)})]}),(0,M.jsxs)(`section`,{className:`niceeval-report niceeval-section`,"aria-label":r(`current.summary`),children:[(0,M.jsx)(`h2`,{className:`niceeval-section-title`,children:r(`current.summary`)}),(0,M.jsxs)(OB,{children:[(0,M.jsxs)(`div`,{className:`niceeval-kpi`,children:[(0,M.jsx)(`span`,{className:`niceeval-kpi-label`,children:r(`current.covered`)}),(0,M.jsxs)(`span`,{className:`niceeval-kpi-value`,children:[e.coverage.covered,`/`,e.coverage.expected]})]}),(0,M.jsxs)(`div`,{className:`niceeval-kpi`,children:[(0,M.jsx)(`span`,{className:`niceeval-kpi-label`,children:r(`current.gaps`)}),(0,M.jsx)(`span`,{className:`niceeval-kpi-value`,children:e.coverage.gaps})]}),(0,M.jsxs)(`div`,{className:`niceeval-kpi`,children:[(0,M.jsx)(`span`,{className:`niceeval-kpi-label`,children:r(`current.verdicts`)}),(0,M.jsxs)(`span`,{className:`niceeval-kpi-value`,children:[i.passed,` `,r(`verdict.passed`),`; `,i.failed,` `,r(`verdict.failed`),`; `,i.errored,` `,r(`verdict.errored`),`; `,i.skipped,` `,r(`verdict.skipped`)]})]}),(0,M.jsxs)(`div`,{className:`niceeval-kpi`,children:[(0,M.jsx)(`span`,{className:`niceeval-kpi-label`,children:r(e.totals.evaluationKind===`pass`?`experimentList.passRate`:`experimentList.totalScore`)}),(0,M.jsx)(`span`,{className:`niceeval-kpi-value`,children:GU(o,n,r(`current.partial`))})]})]})]}),(0,M.jsxs)(`section`,{className:`niceeval-report niceeval-section`,"aria-label":r(`nav.experiments`),children:[(0,M.jsx)(`h2`,{className:`niceeval-section-title`,children:r(`nav.experiments`)}),(0,M.jsxs)(`table`,{children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{children:r(`experimentList.experiment`)}),(0,M.jsx)(`th`,{children:r(`current.covered`)}),(0,M.jsx)(`th`,{children:r(`current.gaps`)}),(0,M.jsx)(`th`,{children:r(e.totals.evaluationKind===`pass`?`experimentList.passRate`:`experimentList.totalScore`)})]})}),(0,M.jsx)(`tbody`,{children:a.map(({experiment:e,slots:t,covered:i,gaps:a})=>{let o=e.evaluationKind===`pass`?e.verdict.passRate:e.score;return(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{scope:`row`,children:(0,M.jsx)(`a`,{href:`#/experiment/${encodeURIComponent(e.experimentId)}`,children:e.experimentId})}),(0,M.jsxs)(`td`,{children:[i,`/`,t.length]}),(0,M.jsx)(`td`,{children:a}),(0,M.jsx)(`td`,{children:GU(o,n,r(`current.partial`))})]},e.experimentId)})})]}),a.map(({experiment:e,slots:t,covered:n,gaps:i})=>(0,M.jsxs)(`section`,{"aria-label":e.experimentId,children:[(0,M.jsxs)(`details`,{children:[(0,M.jsxs)(`summary`,{children:[(0,M.jsx)(`strong`,{children:e.experimentId}),` · `,r(`current.covered`),` `,n,`/`,t.length,` · `,r(`current.gaps`),` `,i]}),(0,M.jsxs)(`table`,{children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{children:r(`current.eval`)}),(0,M.jsx)(`th`,{children:r(`current.attempt`)}),(0,M.jsx)(`th`,{children:r(`experimentList.result`)})]})}),(0,M.jsx)(`tbody`,{children:t.map(e=>(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{scope:`row`,children:e.evalId}),(0,M.jsx)(`td`,{children:e.attemptOrdinal}),(0,M.jsx)(`td`,{children:e.state===`reuse`?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{children:r(`current.covered`)}),` `,(0,M.jsx)(`a`,{href:KU(e.locator),children:e.locator})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{children:r(`current.gapReason`,{reason:r(`current.reason.${e.reason}`)})}),e.previous===null?null:(0,M.jsxs)(M.Fragment,{children:[` · `,(0,M.jsx)(`a`,{href:KU(e.previous.locator),children:r(`current.previousResult`)})]})]})})]},`${e.evalId}:${e.attemptOrdinal}`))})]})]}),t.some(e=>e.state===`gap`)?(0,M.jsxs)(`p`,{children:[r(`current.next`),` `,(0,M.jsx)(pL,{text:`niceeval exp ${e.experimentId} --dry`,children:(0,M.jsxs)(`code`,{children:[`niceeval exp `,e.experimentId,` --dry`]})})]}):null]},e.experimentId))]}),t.length===0?null:(0,M.jsxs)(`section`,{className:`niceeval-report niceeval-section`,"aria-label":r(`current.history`),children:[(0,M.jsx)(`h2`,{className:`niceeval-section-title`,children:r(`current.history`)}),(0,M.jsx)(`ul`,{children:t.map(e=>(0,M.jsxs)(`li`,{children:[e.experimentId,` · `,e.evalId,` · `,r(`current.attempt`),` `,e.attemptOrdinal,` · `,e.locator===null?(0,M.jsx)(`a`,{href:`#/run/${encodeURIComponent(e.sourceRunId)}`,children:e.sourceRunId}):(0,M.jsx)(`a`,{href:KU(e.locator),children:e.locator})]},`${e.experimentId}:${e.evalId}:${e.attemptOrdinal}`))})]})]})}function JU({model:e,locale:t,unavailableReason:n}){let{t:r}=Fo();if(e.targetMode===`current`&&e.current!==void 0)return(0,M.jsx)(qU,{project:e.current,history:e.currentHistory??e.current.history,locale:t});if(e.targetMode===`unavailable`){let t=e.overview.catalog.runExperiments[0]?.runId;return(0,M.jsxs)(`section`,{className:`niceeval-report niceeval-section`,role:`alert`,children:[(0,M.jsx)(`h1`,{children:r(`current.unavailable`)}),(0,M.jsx)(`p`,{children:r(`current.unavailableDetail`)}),n==null?null:(0,M.jsxs)(`p`,{children:[r(`current.unavailableReason`),`: `,n]}),t===void 0?null:(0,M.jsx)(`a`,{href:`#/run/${encodeURIComponent(t)}`,children:r(`current.historicalRun`)})]})}let i=VM(e.overview,e.selectedExperiments);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`header`,{className:`niceeval-report niceeval-hero`,children:[(0,M.jsx)(`h1`,{className:`niceeval-hero-title`,children:r(`insight.title`)}),(0,M.jsx)(`p`,{children:r(`current.historicalResults`)})]}),(0,M.jsxs)(`div`,{className:`niceeval-view-report-slot`,children:[e.costSummary===void 0?null:(0,M.jsx)(YU,{summary:e.costSummary}),i.length<=1?null:(0,M.jsx)(`nav`,{"aria-label":r(`nav.experiments`),children:(0,M.jsx)(`ul`,{children:i.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsx)(`a`,{href:e.href,children:e.experimentId})},e.experimentId))})}),(0,M.jsx)(WU,{data:{selectionTitle:e.selectionTitle,experiments:i},locale:t})]})]})}function YU({summary:e}){let{t}=Fo(),{totalCosts:n,coverage:r}=e,i=n.state===`complete`,a=t(i?`experimentCost.totalCosts`:`experimentCost.knownSubtotal`),o=[[`experimentCost.selectedSlots`,r.selectedSlotCount],[`experimentCost.resolvedSlots`,r.resolvedSlotCount],[`experimentCost.originAttempts`,r.originAttemptCount],[`experimentCost.completeAttempts`,r.completeAttemptCount],[`experimentCost.partialAttempts`,r.partialAttemptCount],[`experimentCost.unavailableAttempts`,r.unavailableAttemptCount],[`experimentCost.unresolvedSlots`,r.unresolvedSlotCount]];return(0,M.jsxs)(`section`,{className:`niceeval-report niceeval-section`,"aria-label":a,children:[(0,M.jsx)(`h2`,{className:`niceeval-section-title`,children:a}),(0,M.jsx)(`p`,{children:t(`experimentCost.scope`)}),(0,M.jsx)(`p`,{children:t(i?`usage.costComplete`:`usage.costIncomplete`)}),n.missingSources.length===0?null:(0,M.jsxs)(`p`,{children:[t(`usage.missingSources`),`: `,n.missingSources.map(e=>t(e===`application`?`usage.applicationCost`:`usage.judgeUsage`)).join(`, `)]}),n.values.length===0?(0,M.jsx)(`p`,{children:t(i?`usage.noRecordedCharges`:`cell.metricUnavailable`)}):n.values.map(e=>(0,M.jsxs)(`p`,{children:[e.value,` `,e.currency,` · `,t(e.source===`reported`?`cell.costReported`:e.source===`estimated`?`cell.costEstimated`:`cell.costMixed`)]},e.currency)),(0,M.jsx)(OB,{children:o.map(([e,n])=>(0,M.jsxs)(`div`,{className:`niceeval-kpi`,children:[(0,M.jsx)(`span`,{className:`niceeval-kpi-label`,children:t(e)}),(0,M.jsx)(`span`,{className:`niceeval-kpi-value`,children:n})]},e))})]})}function XU({target:e}){return e.kind===`group`?(0,M.jsx)(ZU,{groupKind:e.groupKind,groupKey:e.key}):(0,M.jsx)(QU,{experimentId:e.experimentId})}function ZU({groupKind:e,groupKey:t}){let n=yM(),r=n.snapshot,{data:i}=dc(IM(n,r.manifest,r.overview,r.targetMode,e,t));return(0,M.jsx)($U,{model:i})}function QU({experimentId:e}){let t=yM(),n=t.snapshot,{data:r}=dc(LM(t,n.overview,n.targetMode,e));return(0,M.jsx)($U,{model:r})}function $U({model:e}){let{i18n:t}=Fo(),n=yM(),r=t.resolvedLanguage??`en`;return(0,M.jsx)(JU,{model:e,locale:r,unavailableReason:n.snapshot.targetFailureReason})}function eW({model:e,locale:t}){let n=e.members.map(t=>{let n={experiment:{kind:`text`,text:e.experimentId},adapter:e.adapter===null?{kind:`notApplicable`}:{kind:`text`,text:e.adapter.name,detail:`${e.adapter.contract} · ${e.adapter.behaviorRevision??`—`}`},eval:{kind:`text`,text:t.evalId},attempt:{kind:`text`,text:String(t.attemptOrdinal+1)},membership:{kind:`text`,text:t.state},outcome:nW(t.outcome),verdict:t.verdict===null?{kind:`notApplicable`}:{kind:`verdict`,verdict:t.verdict,...t.verdict===`passed`&&t.score?.state===`complete`?{label:wH(`verdict.scored`)}:{}},locator:t.locator===null?{kind:`notApplicable`}:{kind:`locator`,locator:t.locator,...t.verdict===null?{}:{verdict:t.verdict}},selectedRun:{kind:`text`,text:e.runId},slot:{kind:`text`,text:t.slotId}};return Object.freeze({key:t.key,cells:Object.freeze(n)})}),r=Object.freeze({columns:Object.freeze([{key:`experiment`,header:{en:`Experiment`,"zh-CN":`实验`}},{key:`adapter`,header:{en:`Adapter`,"zh-CN":`应用`}},{key:`eval`,header:{en:`Eval`,"zh-CN":`评估`}},{key:`attempt`,header:{en:`Attempt`,"zh-CN":`尝试`}},{key:`membership`,header:{en:`Membership`,"zh-CN":`成员关系`}},{key:`outcome`,header:{en:`Outcome`,"zh-CN":`执行结果`}},{key:`verdict`,header:{en:`Verdict`,"zh-CN":`判定`}},{key:`locator`,header:{en:`Attempt locator`,"zh-CN":`Attempt 定位符`}},{key:`selectedRun`,header:{en:`Selected run`,"zh-CN":`所选 Run`}},{key:`slot`,header:{en:`Slot`,"zh-CN":`槽位`}}]),rows:Object.freeze(n)});return(0,M.jsxs)(`section`,{className:`niceeval-report niceeval-section`,children:[(0,M.jsx)(`h2`,{className:`niceeval-section-title`,children:t===`zh-CN`?`Run 成员 · ${e.runId}`:`Run membership · ${e.runId}`}),(0,M.jsx)(eU,{data:r,searchable:!0,locale:t})]})}function tW({runId:e,presentation:t,onClose:n}){let{data:r}=dc(qM(yM(),e)),{i18n:i}=Fo(),a=i.resolvedLanguage===`zh-CN`?`zh-CN`:`en`,o=(0,M.jsx)(eW,{model:r,locale:a});if(t===`page`)return o;if(n===void 0)throw Error(`Run dialog close target is missing.`);return(0,M.jsx)(UI,{title:a===`zh-CN`?`运行`:`Run`,onClose:n,children:o})}function nW(e){return typeof e==`string`&&e.length>0?{kind:`text`,text:e}:{kind:`notApplicable`}}function rW(e){let t=e.indexOf(`/`);if(t===-1)return Object.freeze({kind:`singleton`,experimentId:e,key:`singleton/${e}`});let n=e.slice(0,t);return Object.freeze({kind:`named`,groupId:n,key:`named/${n}`})}function iW(e,t=[]){let n=new Map;for(let t of[...new Set(e.experiments)].sort(_W)){let e=rW(t),r=n.get(e.key)??{identity:e,members:[]};r.members.push(t),n.set(e.key,r)}let r=Object.freeze([...n.values()].sort((e,t)=>_W(e.identity.key,t.identity.key)).map(({identity:e,members:t})=>Object.freeze({identity:e,members:Object.freeze(t),route:aW(e),label:e.key}))),i=t.map(t=>e.runExperiments.find(e=>e.runId===t)?.experimentId).find(e=>e!==void 0),a=i===void 0?r[0]:r.find(({members:e})=>e.includes(i))??r[0],o=a?.route??`/`,s=r.map(e=>gW({pageId:`group:${e.identity.key}`,route:e.route,title:{en:`NiceEval Insight`,"zh-CN":`NiceEval Insight`},navigation:!1,target:e.identity.kind===`named`?{kind:`group`,groupKind:`named`,key:e.identity.groupId}:{kind:`group`,groupKind:`singleton`,key:e.identity.experimentId}}));for(let{experimentId:t}of e.experiments.map(e=>({experimentId:e})))s.push(gW({pageId:`experiment:${t}`,route:`/experiment/${encodeURIComponent(t)}`,title:{en:`Experiment`,"zh-CN":`实验`},navigation:!1,target:{kind:`experiment`,experimentId:t}}));for(let{runId:t}of hW(e.runExperiments,({runId:e})=>e))s.push(gW({pageId:`run:${t}`,route:`/run/${encodeURIComponent(t)}`,title:{en:`Run`,"zh-CN":`运行`},navigation:!1,target:{kind:`run`,runId:t}}));for(let{locator:t}of hW(e.attemptExperiments,({locator:e})=>e))s.push(gW({pageId:`attempt:${t}`,route:`/attempt/${oW(t)}`,title:{en:`Attempt`,"zh-CN":`尝试`},navigation:!1,target:{kind:`attempt`,locator:t}}));return s.unshift(gW({pageId:`overview`,route:`/`,title:{en:`NiceEval Insight`,"zh-CN":`NiceEval Insight`},navigation:!0,target:a===void 0?{kind:`group`,groupKind:`singleton`,key:``}:a.identity.kind===`named`?{kind:`group`,groupKind:`named`,key:a.identity.groupId}:{kind:`group`,groupKind:`singleton`,key:a.identity.experimentId}})),Object.freeze({title:{en:`NiceEval Insight`,"zh-CN":`NiceEval Insight`},defaultRoute:o,experimentSelection:{options:r.map(({route:e,label:t})=>Object.freeze({route:e,label:t}))},pages:Object.freeze(s),groups:r})}function aW(e){return e.kind===`named`?`/group/named/${encodeURIComponent(e.groupId)}`:`/group/singleton/${encodeURIComponent(e.experimentId)}`}function oW(e){return encodeURIComponent(e.startsWith(`@`)?e.slice(1):e)}function sW(e,t){if(t===`/`)return e.pages.find(e=>e.route===t)?.target;if(!t.startsWith(`/`))return;let n=t.slice(1).replace(/\/$/u,``).split(`/`);try{return lW(n.map(cW))}catch{return}}function cW(e){return decodeURIComponent(e).replace(/%2F/gu,`/`)}function lW(e){if(e.length===3&&e[0]===`group`&&(e[1]===`named`||e[1]===`singleton`)&&e[2])return{kind:`group`,groupKind:e[1],key:e[2]};if(e.length===2&&e[1]){if(e[0]===`experiment`)return{kind:`experiment`,experimentId:e[1]};if(e[0]===`run`)return{kind:`run`,runId:e[1]};if(e[0]===`attempt`)return{kind:`attempt`,locator:`@${e[1]}`}}}function uW(e,t){let n=t.pathname,r=sW(e,n);if(r===void 0)throw Error(`Insight route target is malformed.`);let i=pW(t,r,`page`);if(r.kind===`group`||r.kind===`experiment`)return{background:i};let a=mW(t.state),o=a?.background===void 0?void 0:fW(e,a.background);if(r.kind===`run`&&o===void 0)return{background:i};if(o!==void 0)return{background:o,foreground:{...pW(t,r,`dialog`),close:{kind:`history`}}};let s=Object.freeze({pathname:e.defaultRoute}),c=sW(e,s.pathname);if(c===void 0)throw Error(`Insight default route target is missing.`);return{background:pW(s,c,`page`),foreground:{...pW(t,r,`dialog`),close:{kind:`replace`,route:e.defaultRoute}}}}function dW(e){return`${e.target.kind}:${e.location.pathname}:${e.location.search??``}`}function fW(e,t){let n=sW(e,t.pathname);if(n!==void 0&&n.kind!==`attempt`)return pW(t,n,`page`)}function pW(e,t,n){return Object.freeze({location:Object.freeze({pathname:e.pathname,...e.search===void 0?{}:{search:e.search}}),target:t,presentation:n})}function mW(e){if(typeof e!=`object`||!e||!(`background`in e))return;let t=e.background;if(typeof t!=`object`||!t||!(`pathname`in t)||typeof t.pathname!=`string`)return;let n=`search`in t&&typeof t.search==`string`?t.search:void 0;return{background:{pathname:t.pathname,...n===void 0?{}:{search:n}}}}function hW(e,t){let n=new Map;for(let r of e)n.set(t(r),r);return[...n.values()]}function gW(e){return Object.freeze(e)}function _W(e,t){return e<t?-1:+(e>t)}function vW({checkForUpdate:e,refresh:t}){let{manifest:n,presentation:r}=yM().snapshot,{acquire:i,interactionLocked:a,recoveryRequired:o}=BI(),{t:s}=Fo();return o?(0,M.jsxs)(`main`,{className:`niceeval-view-main`,role:`alert`,children:[(0,M.jsx)(`h1`,{children:s(`refresh.reloadRequired`)}),(0,M.jsx)(`p`,{children:s(`refresh.reloadRequiredDetail`)}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:s(`refresh.reload`)})]}):(0,M.jsx)(RI,{locked:a,children:(0,M.jsx)(yW,{manifest:n,presentation:r,refresh:()=>t(i),checkForUpdate:e,interactionLocked:a})})}function yW({checkForUpdate:e,interactionLocked:t,manifest:n,presentation:r,refresh:i}){let a=yM(),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(),[u,d]=(0,v.useState)(!1),{i18n:f,t:p}=Fo(),m=Dr(),h=Ar(),g=uc({queryKey:[`view`,a.identity,`update-available`],queryFn:e,refetchInterval:500,staleTime:0,retry:!1}),_=(0,v.useRef)(void 0);r===void 0?_.current=void 0:(_.current?.generationIdentity!==a.identity||_.current.originLocationKey!==r.originLocationKey)&&(_.current={generationIdentity:a.identity,originLocationKey:r.originLocationKey,consumed:!1}),_.current!==void 0&&m.key!==_.current.originLocationKey&&(_.current.consumed=!0);let y=r!==void 0&&_.current?.consumed===!1?r.plan:uW(n,m),b=f.resolvedLanguage??`en`;(0,v.useEffect)(()=>{document.title=p(`insight.title`)},[p]);let x=n.experimentSelection?.options??[],S=x.find(({route:e})=>m.pathname===e)??x[0],C=(0,v.useCallback)(e=>{if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.target instanceof Element?e.target.closest(`a[href]`):null;if(t===null||t.target&&t.target!==`_self`||t.hasAttribute(`download`))return;let r=new URL(t.href,document.baseURI);if(r.origin!==window.location.origin||!r.hash.startsWith(`#/`))return;let i=r.hash.slice(1),a=sW(n,i);a!==void 0&&(e.preventDefault(),a.kind===`run`||a.kind===`attempt`?h(i,{state:{background:y.background.location}}):h(i,{state:null}))},[n,h,y.background.location]),w=(0,v.useCallback)(e=>{e.kind===`history`?h(-1):h(e.route,{replace:!0,state:null})},[h]),T=y.foreground;return(0,M.jsxs)(`div`,{onClickCapture:C,children:[(0,M.jsxs)(`header`,{className:`niceeval-view-shell`,children:[(0,M.jsxs)(`a`,{className:`niceeval-view-brand`,href:`https://niceeval.com/?utm_source=insight&utm_medium=brand`,target:`_blank`,rel:`noopener`,children:[(0,M.jsx)(`span`,{className:`niceeval-view-mark`,"aria-hidden":`true`}),(0,M.jsx)(`span`,{children:`NiceEval`})]}),(0,M.jsx)(`nav`,{className:`niceeval-view-nav`,"aria-label":p(`nav.pages`),children:(0,M.jsx)(`a`,{href:`#${n.defaultRoute}`,"aria-current":y.foreground===void 0?`page`:void 0,"aria-disabled":t||void 0,children:p(`insight.navigation`)})}),(0,M.jsxs)(`div`,{className:`niceeval-view-controls`,children:[S===void 0?null:(0,M.jsxs)(`label`,{className:`niceeval-view-experiment`,children:[(0,M.jsx)(`span`,{children:p(`nav.experiments`)}),(0,M.jsx)(`select`,{disabled:t,value:S.route,onChange:e=>h(e.target.value),children:x.map(e=>(0,M.jsx)(`option`,{value:e.route,children:e.label},e.route))})]}),(0,M.jsx)(`label`,{className:`niceeval-view-language`,children:(0,M.jsxs)(`select`,{disabled:t,"aria-label":p(`nav.language`),value:b,onChange:e=>void f.changeLanguage(e.target.value),children:[(0,M.jsx)(`option`,{value:`en`,children:`EN`}),(0,M.jsx)(`option`,{value:`zh-CN`,children:`中文`})]})}),(0,M.jsx)(`button`,{type:`button`,disabled:o||t,onClick:()=>{s(!0),d(!1),l(void 0),i().then(e=>{l(e.noticeKey)}).catch(()=>d(!0)).finally(()=>s(!1))},children:p(o?`refresh.working`:`refresh.action`)}),g.data===`available`&&!o?(0,M.jsx)(`span`,{role:`status`,children:p(`refresh.available`)}):null,g.data===`stale`&&!o?(0,M.jsx)(`span`,{role:`status`,children:p(`refresh.lastGoodStale`)}):null,c===void 0?null:(0,M.jsx)(`span`,{role:`status`,children:p(c)}),u?(0,M.jsx)(`span`,{role:`alert`,children:p(`refresh.failed`)}):null]})]}),(0,M.jsxs)(`main`,{className:`niceeval-view-main`,inert:t?!0:void 0,children:[(0,M.jsx)(bW,{surface:y.background},`background:${dW(y.background)}`),T===void 0?null:(0,M.jsx)(bW,{surface:T,onClose:()=>w(T.close)},`foreground:${dW(T)}`)]})]})}function bW({surface:e,onClose:t}){let{target:n,presentation:r}=e;if(n.kind===`group`||n.kind===`experiment`)return(0,M.jsx)(XU,{target:n});if(n.kind===`run`)return(0,M.jsx)(tW,{runId:n.runId,presentation:r,onClose:t});if(t===void 0)throw Error(`Attempt dialog close target is missing.`);return(0,M.jsx)(xH,{locator:n.locator,onClose:t})}var xW=H({generationId:z,sourceCutoffIdentity:z,targetMode:G([`current`,`history`,`unavailable`]),targetIdentity:K(z),targetFailureReason:K(z),refreshSupported:V,stale:V});H({generationId:z}),H({generationId:z,request:Jj});var SW=H({code:G([`view-request-invalid`,`view-generation-not-found`,`view-generation-stale`,`view-inspection-failed`]),reason:z,correction:G([`fix-request`,`refresh-generation`,`retry`])}),CW={errors:`all`,onExcessProperty:`error`},wW=ev(xW,CW),TW=ev(SW,CW),EW=class extends Error{status;code;correction;classification=`view-http`;constructor(e,t,n,r,i){super(r,i),this.status=e,this.code=t,this.correction=n,this.name=`ViewHttpError`}},DW=class{descriptor;generationId;#e=new AbortController;#t=!1;constructor(e){this.descriptor=e,this.generationId=e.generationId}async inspect(e){if(this.#t)throw Error(`HTTP Inspection repository is closed.`);let t=iM(e);if(ad(t))throw Error(t.failure.reason);let n=await MW(`/_niceeval/inspection`,{method:`POST`,signal:this.#e.signal,headers:{"content-type":`application/json`},body:JSON.stringify({generationId:this.descriptor.generationId,request:{protocol:iE,operation:t.success}})}),r=await NW(n);if(!n.ok)throw PW(n.status,r);let i=tM(r);if(!i.success)throw new EW(n.status,`view-response-invalid`,`retry`,i.reason);let a=nM(i.value,e.kind);if(!a.success)throw new EW(n.status,`view-response-invalid`,`retry`,a.reason);return a.value}close(){this.#t||(this.#t=!0,this.#e.abort())}};async function OW(){return jW(`/_niceeval/generation`,{method:`GET`})}async function kW(){return jW(`/_niceeval/generation/refresh`,{method:`POST`})}async function AW(e){return jW(`/_niceeval/generation/commit`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({generationId:e})})}async function jW(e,t){let n=await MW(e,t),r=await NW(n);if(!n.ok)throw PW(n.status,r);let i=wW(r);if(ad(i))throw new EW(n.status,`view-response-invalid`,`retry`,String(i.failure));return i.success}function MW(e,t){return fetch(new URL(e,document.baseURI),{...t,cache:`no-store`,credentials:`same-origin`})}async function NW(e){try{return await e.json()}catch(t){throw new EW(e.status,`view-response-invalid`,`retry`,`View HTTP response is not JSON.`,{cause:t})}}function PW(e,t){let n=TW(t);return ad(n)?new EW(e,`view-response-invalid`,`retry`,`View HTTP request failed (${e}).`):new EW(e,n.success.code,n.success.correction,n.success.reason)}var FW=class extends Error{classification=`generation-prepare`;translationKey=`report.unableToLoad`};async function IW(e){let t=new URL(document.baseURI).searchParams.getAll(`run`),n=new CM,r=new AbortController,i;window.addEventListener(`pagehide`,()=>{r.abort(Error(`NiceEval View page was hidden.`)),e(),i?.(),n.dispose()},{once:!0});let a=await OW(),o=n.prepare(new DW(a)),s,c;try{if(c=zM(await o.lease.inspect(DM(t))),a.targetMode===`current`){let e=await o.lease.inspect(OM());c=XW(c,e.project.experiments.map(e=>e.experimentId))}else a.targetMode===`unavailable`&&(c=XW(c,[]));s=iW(c.catalog,t);let e=HW(s.defaultRoute),r=sW(s,e.pathname)===void 0?{pathname:s.defaultRoute}:e;await GW(o.lease,s,c,a.targetMode,uW(s,r)),n.attachSnapshot(o,YW(s,c,a.targetMode,a.targetFailureReason)),n.commit(o)}catch(e){throw n.reject(o),new FW(`Unable to prepare initial generation.`,{cause:e})}let l=e=>async()=>{let t=n.acquireCurrent();try{return await e(t)}finally{t.release()}},u=(e,t)=>{let n=e[t];if(!n)throw new wM(`Insight route parameter is missing.`);return n},d=e=>({params:t})=>l(async n=>{let r=lW(e(t));if(r===void 0)throw new wM(`Insight route parameter is malformed.`);let i=n.generation.binding;return await KW(n,i.snapshot.manifest,i.snapshot.overview,i.snapshot.targetMode,r),null})(),f=()=>n.current?.snapshot.manifest.defaultRoute??s.defaultRoute,p=0,m=Ji([{path:`/`,element:(0,M.jsx)(vM,{runtime:n,children:(0,M.jsx)(vW,{checkForUpdate:async()=>{RW(r.signal);let e=await OW();return RW(r.signal),e.stale?`stale`:e.generationId===n.current?.identity?`none`:`available`},refresh:async e=>{let i=p,a=m.state.location.pathname,o=m.state.location.key,s=m.state.location.state,c=n.current.identity,l=await kW();if(RW(r.signal),l.generationId===c)return BW(n);let u=n.prepare(new DW(l)),d=!0,f,h=!1,g=!1;try{let _=zM(await u.lease.inspect(DM(t)));if(l.targetMode===`current`){let e=await u.lease.inspect(OM());_=XW(_,e.project.experiments.map(e=>e.experimentId))}else if(l.targetMode===`unavailable`)throw new FW(`Current project target is unavailable.`);let v=iW(_.catalog,t),y=qW(n.current.snapshot.overview,_,v,a),b=uW(v,{pathname:y.route,state:y.fallback?null:s});if(await GW(u.lease,v,_,l.targetMode,b),RW(r.signal),!zW(m,p,i,a,o))throw n.reject(u),d=!1,new FW(`View location changed while refresh was preparing.`);if(f=await e(r.signal),h=!0,RW(r.signal),!zW(m,p,i,a,o))throw n.reject(u),d=!1,await f.release(),h=!1,new FW(`View location changed while refresh was preparing.`);n.attachSnapshot(u,YW(v,_,l.targetMode,l.targetFailureReason,y.fallback?{originLocationKey:o,plan:b}:void 0));let x=await VW(l.generationId,c,r.signal);if(RW(r.signal),x===`rejected`)throw new FW(`View Host rejected the prepared generation.`);if(x===`uncertain`)return n.reject(u),d=!1,f.recover(),h=!1,BW(n);g=!0,y.fallback&&!f.hasUserIntent()&&(await f.enqueueFallback(y.route),RW(r.signal));let S=n.commit(u);d=!1,n.retire(S);let C=await f.release();h=!1;let w=y.fallback&&C!==`user`;return Object.freeze({manifest:v,...w?{fallbackRoute:y.route,noticeKey:`refresh.selectionChanged`}:{}})}catch(e){if(r.signal.aborted)throw r.signal.reason;if(g&&h)return d&&u.generation.status===`preparing`&&n.reject(u),f.recover(),BW(n);throw d&&n.reject(u),h&&await f.release(),e instanceof FW?e:new FW(`Unable to prepare refreshed generation.`,{cause:e})}}})}),errorElement:(0,M.jsx)(WW,{}),children:[{index:!0,loader:()=>{let e=f();return e===`/`?null:st(e)}},{path:`group/:groupKind/:key`,element:null,loader:d(e=>[`group`,u(e,`groupKind`),u(e,`key`)])},{path:`experiment/:experimentId`,element:null,loader:d(e=>[`experiment`,u(e,`experimentId`)])},{path:`run/:runId`,element:null,loader:d(e=>[`run`,u(e,`runId`)])},{path:`attempt/:locator`,element:null,loader:d(e=>[`attempt`,u(e,`locator`)])},{path:`*`,loader:()=>st(f())}]}]);i=()=>m.dispose(),await LW(m);let h=m.state.location;return m.subscribe(e=>{e.location!==h&&(h=e.location,p+=1)}),m}function LW(e){return e.state.initialized?Promise.resolve():new Promise(t=>{let n=e.subscribe(e=>{e.initialized&&(n(),t())});e.state.initialized&&(n(),t())})}function RW(e){if(e.aborted)throw e.reason}function zW(e,t,n,r,i){return t===n&&e.state.location.pathname===r&&e.state.location.key===i&&e.state.navigation.state===`idle`}function BW(e){return Object.freeze({manifest:e.current.snapshot.manifest})}async function VW(e,t,n){let r;try{let t=await AW(e);if(RW(n),t.generationId===e)return`committed`;r=new FW(`View Host committed an unexpected generation.`)}catch(e){RW(n),r=e}let i;try{i=await OW(),RW(n)}catch{return RW(n),`uncertain`}return i.generationId===e?`committed`:r instanceof EW&&r.code===`view-generation-stale`&&i.generationId===t?`rejected`:`uncertain`}function HW(e){let t=window.location.hash,n=t.startsWith(`#/`)?t.slice(1):e,r=n.indexOf(`?`);return{pathname:r<0?n:n.slice(0,r),...r<0?{}:{search:n.slice(r)},state:UW()}}function UW(){let e=window.history.state;return typeof e==`object`&&e&&`usr`in e?e.usr:void 0}function WW(){let e=qr(),{t}=Fo(),n=typeof e==`object`&&e&&`translationKey`in e&&(e.translationKey===`report.unableToLoad`||e.translationKey===`report.unableToLoadDetails`)?e.translationKey:`report.unableToLoad`;return(0,M.jsxs)(`main`,{className:`niceeval-view-main`,role:`alert`,children:[(0,M.jsx)(`h1`,{children:t(`report.unableToLoad`)}),(0,M.jsx)(`p`,{children:t(n)}),(0,M.jsx)(`a`,{href:`#/`,children:t(`report.backToResults`)})]})}async function GW(e,t,n,r,i){await KW(e,t,n,r,i.background.target),i.foreground!==void 0&&await KW(e,t,n,r,i.foreground.target)}async function KW(e,t,n,r,i){let a=e.generation.binding;i.kind===`attempt`?await a.queryClient.fetchQuery(FM(a,i.locator)):i.kind===`run`?await a.queryClient.fetchQuery(qM(a,i.runId)):i.kind===`experiment`?await a.queryClient.fetchQuery(LM(a,n,r,i.experimentId)):await a.queryClient.fetchQuery(IM(a,t,n,r,i.groupKind,i.key))}function qW(e,t,n,r){let i=sW(n,r);if(i===void 0)return{route:n.defaultRoute,fallback:!0};if(i.kind===`attempt`){if(t.catalog.attemptExperiments.some(e=>e.locator===i.locator))return{route:r,fallback:!1};let a=e.catalog.attemptExperiments.find(e=>e.locator===i.locator)?.experimentId;if(a===void 0)return{route:r,fallback:!1};let o=t.catalog.runExperiments.filter(e=>e.experimentId===a).sort((e,t)=>JW(e.runId,t.runId))[0];return o===void 0?{route:n.defaultRoute,fallback:!0}:{route:`/run/${encodeURIComponent(o.runId)}`,fallback:!0}}return i.kind===`run`?e.catalog.runExperiments.some(e=>e.runId===i.runId)?t.catalog.runExperiments.some(e=>e.runId===i.runId)?{route:r,fallback:!1}:{route:n.defaultRoute,fallback:!0}:{route:r,fallback:!1}:i.kind===`experiment`&&e.catalog.experiments.includes(i.experimentId)?t.catalog.experiments.includes(i.experimentId)?{route:r,fallback:!1}:{route:n.defaultRoute,fallback:!0}:{route:r,fallback:!1}}function JW(e,t){return e<t?-1:+(e>t)}function YW(e,t,n,r,i){return Object.freeze({manifest:e,overview:t,targetMode:n,targetFailureReason:r,...i===void 0?{}:{presentation:i}})}function XW(e,t){return Object.freeze({...e,catalog:Object.freeze({...e.catalog,experiments:Object.freeze([...t])})})}var ZW=document.getElementById(`root`);if(ZW===null)throw Error(`NiceEval View root is missing`);var QW=(0,b.createRoot)(ZW),$W=IW(()=>QW.unmount());function eG(){let e=(0,v.use)($W);return(0,M.jsx)(ca,{router:e})}function tG(){let e=window.location.hash.startsWith(`#/attempt/`);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`main`,{className:`niceeval-view-main`,children:e?(0,M.jsx)(`h1`,{children:`NiceEval Insight`}):(0,M.jsx)(`p`,{role:`status`,children:Ro.t(`report.loading`)})}),e?(0,M.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`niceeval-bootstrap-attempt-title`,className:`niceeval-view-dialog`,children:[(0,M.jsx)(`div`,{className:`niceeval-view-dialog-head`,children:(0,M.jsx)(`h2`,{id:`niceeval-bootstrap-attempt-title`,className:`niceeval-view-dialog-title`,children:Ro.t(`attempt.title`)})}),(0,M.jsx)(`p`,{role:`status`,children:Ro.t(`report.loadingDetails`)})]}):null]})}var nG=class extends v.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e,t){}render(){return this.state.failed?(0,M.jsx)(`main`,{className:`niceeval-view-main`,role:`alert`,children:(0,M.jsx)(`h1`,{children:Ro.t(`app.failed`)})}):this.props.children}};QW.render((0,M.jsx)(v.StrictMode,{children:(0,M.jsx)(nG,{children:(0,M.jsx)(v.Suspense,{fallback:(0,M.jsx)(tG,{}),children:(0,M.jsx)(eG,{})})})}));export{d as a,l as c,h as i,Fo as n,o,jo as r,s,Bo as t};
63
+ `)}`:``;return`${i.join(` · `)}${o}`}case`notApplicable`:return`—`;case`missing`:{let n=t??`en`,r=rU(e.code,n);return e.detail?`${r} · ${e.detail}`:r}case`text`:return e.detail?`${e.text}\n ${e.detail}`:e.text;case`locator`:return`${e.verdict===void 0?``:`${aU(e.verdict)} `}${e.locator}`;case`summary`:{let t=e.more&&e.more>0?` +${e.more} more`:``;return`${e.text}${t}`}case`score`:{let n=iU(e.earned),r=e.possible===void 0?n:`${n} / ${iU(e.possible)}`;return e.missedScoreItems===void 0?r:`${r} · ${qH(t??`en`,`experimentList.missedScoreItems`,e.missedScoreItems)}`}case`verdict`:{let n=t??`en`;return e.counts?[`passed`,`failed`,`errored`,`skipped`].filter(t=>e.counts[t]>0).map(t=>`${e.counts[t]} ${GH(n,`verdict.${t}`)}`).join(` · `)||`—`:e.verdict===void 0?`—`:e.bare?aU(e.verdict):`${aU(e.verdict)} ${e.label===void 0?GH(n,`verdict.${e.verdict}`):WH(e.label,n)}`}case`metric`:return sU(e,t??`en`)}}function lU(...e){return e.filter(Boolean).join(` `)}var uU=`—`;function dU(e){return`#/attempt/${e.startsWith(`@`)?e.slice(1):e}`}function fU(e){return pU(e.columns.map(e=>({key:e.key,header:e.header??e.key,align:e.better?`right`:`left`,better:e.better})),e)}function pU(e,t){if(e.length===0)throw Error(`Table needs at least one column.`);let n=new Set;for(let t of e){if(n.has(t.key))throw Error(`Table column key "${t.key}" is declared twice.`);n.add(t.key)}return hU(t.rows),mU(t.rows,n),{columns:e,content:t}}function mU(e,t){for(let n of e){for(let e of Object.keys(n.cells))if(!t.has(e))throw Error(`Table row "${n.key}" has a cell for "${e}", which is not a declared column.`);for(let e of t)if(!(e in n.cells))throw Error(`Table row "${n.key}" has no cell for column "${e}".`);n.subRows?.length&&mU(n.subRows,t)}}function hU(e){let t=new Set;for(let n of e){if(t.has(n.key))throw Error(`Table row key "${n.key}" is declared twice at the same level.`);t.add(n.key),n.subRows?.length&&hU(n.subRows)}}function gU(e){return e.refs.flatMap(e=>e.identity.kind===`attempt`?[e.identity.locator]:[])}function _U({cell:e,href:t,locale:n,showCoverage:r=!0,coverageDetail:i=!1}){let a=n??`en`,o=oU(e);if(o!==void 0){let t=o.combined===null?tU(e.state,a):`$${o.combined.amount}`;return(0,M.jsx)(`span`,{className:`niceeval-cell`,children:(0,M.jsx)(`span`,{className:`niceeval-value`,children:t})})}let s=e.value===null?tU(e.state,a):`${e.source===`estimated`?`~`:``}${eU(e.value,e.unit,e.format,a)}`;if(e.value===null)return(0,M.jsx)(`span`,{className:`niceeval-cell niceeval-cell-missing`,children:(0,M.jsx)(`span`,{className:`niceeval-missing`,title:GH(a,`cell.noneMeasurableTitle`,{total:e.total}),children:s})});let c=gU(e),l=e.samples<e.total,u=e.state===`partial`||r&&l,d=l?GH(a,`cell.coverageTitle`,{samples:e.samples,total:e.total}):GH(a,`cell.partialTitle`),f=l?GH(a,`cell.coverageDetail`,{samples:e.samples,total:e.total}):GH(a,`cell.partialDetail`);return(0,M.jsxs)(`span`,{className:lU(`niceeval-cell`,u&&i&&`niceeval-cell-text`),children:[(0,M.jsx)(`span`,{className:`niceeval-value`,title:GH(a,`cell.measuredTitle`,{samples:e.samples,total:e.total}),children:s}),u&&(i?(0,M.jsx)(`small`,{className:`niceeval-cell-detail`,title:d,children:f}):(0,M.jsx)(`sup`,{className:`niceeval-coverage`,title:d,children:l?`${e.samples}/${e.total}`:GH(a,`cell.partialDetail`)})),e.source==null?null:(0,M.jsx)(`small`,{className:`niceeval-cost-source`,children:GH(a,e.source===`reported`?`cell.costReported`:e.source===`estimated`?`cell.costEstimated`:`cell.costMixed`)}),t&&c.length===1&&t(c[0])!==void 0&&(0,M.jsx)(`span`,{className:`niceeval-refs`,children:(0,M.jsx)(`a`,{className:`niceeval-ref`,href:t(c[0]),children:`#1`})}),t&&c.length>1&&(0,M.jsxs)(`details`,{className:`niceeval-refs`,children:[(0,M.jsx)(`summary`,{className:`niceeval-refs-summary`,children:qH(a,`cell.evidence`,c.length)}),(0,M.jsx)(`span`,{className:`niceeval-refs-list`,children:c.map((e,n)=>t(e)===void 0?(0,M.jsxs)(`span`,{className:`niceeval-ref-text`,children:[`#`,n+1]},e):(0,M.jsxs)(`a`,{className:`niceeval-ref`,href:t(e),children:[`#`,n+1]},e))})]})]})}function vU(e,t,n=!1){if(!e)return(0,M.jsx)(`span`,{className:`niceeval-missing`,children:uU});switch(e.kind){case`stack`:return(0,M.jsx)(`span`,{className:`niceeval-cell-stack`,children:e.cells.map((e,n)=>(0,M.jsx)(`span`,{className:`niceeval-cell-stack-item`,children:vU(e,t,n===0)},n))});case`notApplicable`:return(0,M.jsx)(`span`,{className:`niceeval-missing`,children:uU});case`missing`:return(0,M.jsxs)(`span`,{className:`niceeval-missing`,children:[(0,M.jsx)(`span`,{className:`niceeval-missing-reason`,children:rU(e.code,t.locale)}),e.detail?(0,M.jsx)(`small`,{className:`niceeval-cell-detail`,children:e.detail}):null]});case`text`:return(0,M.jsxs)(`span`,{className:`niceeval-cell-text`,children:[(0,M.jsx)(`span`,{children:e.text}),e.detail?(0,M.jsx)(`small`,{className:`niceeval-cell-detail`,children:e.detail}):null]});case`locator`:{let n=e.verdict,r=lU(`niceeval-locator`,n!==void 0&&`niceeval-verdict-${n}`),i=n===void 0?null:(0,M.jsx)(`span`,{className:`niceeval-locator-mark`,"aria-hidden":`true`,children:aU(n)}),a=t.href(e.locator);return a===void 0?(0,M.jsxs)(`span`,{className:r,children:[i,e.locator]}):(0,M.jsxs)(`a`,{className:r,href:a,children:[i,e.locator]})}case`summary`:case`score`:return cU(e,t.locale);case`verdict`:{if(e.counts){let n=[`passed`,`failed`,`errored`,`skipped`].filter(t=>e.counts[t]>0);return(0,M.jsxs)(`span`,{className:`niceeval-verdict-tally`,children:[n.map(n=>(0,M.jsxs)(`span`,{className:`niceeval-verdict-${n}`,children:[e.counts[n],` `,GH(t.locale,`verdict.${n}`)]},n)),n.length===0?(0,M.jsx)(`span`,{className:`niceeval-missing`,children:uU}):null]})}let n=e.verdict??`skipped`;return(0,M.jsxs)(`span`,{className:lU(`niceeval-verdict`,`niceeval-verdict-${n}`),children:[aU(n),e.bare?null:(0,M.jsxs)(M.Fragment,{children:[` `,e.label===void 0?GH(t.locale,`verdict.${n}`):WH(e.label,t.locale)]})]})}case`metric`:return(0,M.jsx)(_U,{cell:e.metric,href:t.showMeasureRefs===!1?void 0:t.href,locale:t.locale,showCoverage:e.showCoverage!==!1,coverageDetail:n})}}function yU(e){return e?e.kind===`stack`?yU(e.cells[0]):e.kind===`metric`?e.metric.value??``:e.kind===`score`?e.earned:e.kind===`text`?e.text:e.kind===`locator`?e.locator:e.kind===`verdict`&&e.counts?e.counts.passed:cU(e):``}function bU(e,t,n,r=0){return e.map(e=>{let i=t.map(t=>(0,M.jsx)(`span`,{className:lU(`niceeval-table-hierarchy-cell`,t.align===`right`&&`niceeval-align-right`),"data-sort-value":yU(e.cells[t.key]),children:vU(e.cells[t.key],n)},t.key)),a=lU(`niceeval-table-hierarchy-row`,e.variant===`placeholder`&&`niceeval-row-placeholder`,e.variant===`group`&&`niceeval-row-group`);return e.subRows?.length?(0,M.jsxs)(`details`,{className:lU(a,`niceeval-table-hierarchy-group`),"data-depth":r||void 0,children:[(0,M.jsx)(`summary`,{className:`niceeval-table-hierarchy-summary`,children:i}),(0,M.jsx)(`div`,{className:`niceeval-table-hierarchy-children`,children:bU(e.subRows,t,n,r+1)})]},e.key):(0,M.jsx)(`div`,{className:a,"data-depth":r||void 0,children:i},e.key)})}function xU(e,t,n){return e.map(e=>(0,M.jsx)(`tr`,{className:lU(e.variant===`placeholder`&&`niceeval-row-placeholder`,e.variant===`group`&&`niceeval-row-group`),children:t.map(t=>(0,M.jsx)(`td`,{className:t.align===`right`?`niceeval-align-right`:void 0,children:vU(e.cells[t.key],n)},t.key))},e.key))}function SU(e){let t=e.locale??`en`,{columns:n,content:r}=fU(e.data),[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(e.sort===void 0?null:{key:e.sort,direction:`asc`}),c=(0,v.useMemo)(()=>{let e=i.trim().toLocaleLowerCase(),n=r=>{let i=r.subRows?.map(n).filter(e=>e!==null);return e===``||Object.values(r.cells).some(n=>cU(n,t).toLocaleLowerCase().includes(e))||(i?.length??0)>0?{...r,...i===void 0?{}:{subRows:i}}:null},a=r.rows.map(n).filter(e=>e!==null);if(o===null)return a;let s=o.direction===`asc`?1:-1;return[...a].sort((e,n)=>cU(e.cells[o.key],t).localeCompare(cU(n.cells[o.key],t),t,{numeric:!0})*s)},[r.rows,t,i,o]),l=e.hrefForLocator??dU,u=r.rows.some(e=>(e.subRows?.length??0)>0),d=(0,M.jsxs)(`table`,{className:lU(`niceeval-report`,`niceeval-table`,u&&`niceeval-table--hierarchical`,e.className),"data-column-count":u?n.length:void 0,children:[(0,M.jsx)(`thead`,{children:(0,M.jsx)(`tr`,{children:n.map(e=>(0,M.jsx)(`th`,{scope:`col`,className:lU(e.align===`right`&&`niceeval-align-right`,o?.key===e.key?o.direction===`asc`?`niceeval-sort-asc`:`niceeval-sort-desc`:void 0),onClick:e.better===void 0?void 0:()=>s(t=>({key:e.key,direction:t?.key===e.key&&t.direction===`asc`?`desc`:`asc`})),tabIndex:e.better===void 0?void 0:0,onKeyDown:e.better===void 0?void 0:e=>{(e.key===`Enter`||e.key===` `)&&e.currentTarget.click()},children:WH(e.header,t)},e.key))})}),u?(0,M.jsx)(`tbody`,{children:(0,M.jsx)(`tr`,{children:(0,M.jsx)(`td`,{colSpan:n.length,className:`niceeval-table-hierarchy-body`,children:bU(c,n,{href:l,locale:t,showMeasureRefs:!1})})})}):(0,M.jsx)(`tbody`,{children:xU(c,n,{href:l,locale:t})})]});return e.searchable===!0?(0,M.jsxs)(`div`,{className:`niceeval-report niceeval-table-wrap`,children:[(0,M.jsx)(`input`,{className:`niceeval-filter`,type:`search`,value:i,onChange:e=>a(e.target.value),placeholder:GH(t,n[0].key===`entity`?`experimentList.filterPlaceholder`:`table.filterPlaceholder`)}),d]}):d}function CU(e,t){if(!t)return e;let n=`${t}/`;return e.startsWith(n)?e.slice(n.length):e}function wU(e,t){return e?`${e}/${t}`:t}function TU(e){return EU(e,``)}function EU(e,t){if(e.length===0)return[];let n=[],r=new Map;for(let i of e){let e=CU(i,t).split(`/`).filter(Boolean);if(e.length<=1){n.push(i);continue}let a=e[0],o=r.get(a);o?o.push(i):r.set(a,[i])}if(r.size===0||r.size===1&&n.length===0||[...r.values()].every(e=>e.length===1)){if(r.size===1&&n.length===0){let n=[...r.keys()][0];return EU(e,wU(t,n))}return[...n].sort((e,t)=>e.localeCompare(t)).map(e=>({kind:`leaf`,evalId:e}))}let i=[...r.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,n])=>({kind:`group`,segment:e,prefix:wU(t,e),children:EU(n,wU(t,e))})),a=[...n].sort((e,t)=>e.localeCompare(t)).map(e=>({kind:`leaf`,evalId:e}));return[...i,...a]}function DU(e){return e.some(e=>e.evaluationKind!==`pass`)?e.some(e=>e.evaluationKind!==`points`)?`mixed`:`points`:`pass`}function OU(e){let t=DU(e);return[...e].sort(kU(e=>t===`pass`?e.endToEndPassRate?.value??null:e.score?.value??null))}function kU(e){return(t,n)=>{let r=e(t),i=e(n);return r===null&&i===null?t.experimentId.localeCompare(n.experimentId):r===null?1:i===null?-1:i-r||t.experimentId.localeCompare(n.experimentId)}}var AU=`noCurrentResult`,jU=`noSamples`,MU={entity:KH(`experimentList.experiment`),model:KH(`table.model`),adapter:KH(`table.adapter`),durationMs:KH(`experimentList.avgDuration`),passRate:KH(`experimentList.passRate`),totalScore:KH(`experimentList.totalScore`),tokens:KH(`experimentList.tokens`),costUSD:KH(`experimentList.cost`),record:KH(`experimentList.result`),verdict:KH(`experimentList.status`),result:KH(`experimentList.result`)};function NU(e,t){let n={};for(let r of t)n[r.key]=e[r.key]??{kind:`notApplicable`};return n}function PU(e,t=e.state!==`available`){return{kind:`metric`,metric:e,showCoverage:t}}function FU(...e){let t=e.filter(e=>e.kind!==`notApplicable`);return t.length===0?{kind:`notApplicable`}:t.length===1?t[0]:{kind:`stack`,cells:t}}function IU(e){let t={passed:0,failed:0,errored:0,skipped:0};for(let n of e)n.verdict!==null&&(t[n.verdict]+=1);return t}function LU(e){return{kind:`verdict`,counts:IU(e)}}function RU(e){let t=IU(e);return t.failed+t.errored+t.skipped===0?{kind:`notApplicable`}:{kind:`verdict`,counts:{...t,passed:0}}}function zU(e){let t=e.length===1?e[0]:void 0;return t===void 0?LU(e):BU(t)}function BU(e){let{verdict:t}=e;return t===null?{kind:`notApplicable`}:{kind:`verdict`,verdict:t,...t===`passed`&&e.evaluationKind===`points`&&e.score?.state===`available`&&e.score.value!==null?{label:KH(`verdict.scored`)}:{}}}function VU(e){return{kind:`locator`,locator:e.locator,...e.verdict===null?{}:{verdict:e.verdict}}}function HU(e,t){return t?{kind:`text`,text:e,detail:t}:{kind:`text`,text:e}}function UU(e){return e.failureSummary===null?{kind:`text`,text:`—`}:{kind:`summary`,text:e.failureSummary}}function WU(e){return{entity:VU(e),verdict:BU(e),result:UU(e),...e.durationMs===void 0?{}:{durationMs:PU(e.durationMs)},...e.tokens===void 0?{}:{tokens:PU(e.tokens)},...e.score===void 0?{}:{totalScore:PU(e.score)},...e.costUSD===void 0?{}:{costUSD:PU(e.costUSD)}}}var GU=[{key:`entity`,header:MU.entity},{key:`model`,header:MU.model},{key:`adapter`,header:MU.adapter},{key:`durationMs`,better:`lower`,header:MU.durationMs}],KU=[{key:`tokens`,better:`lower`,header:MU.tokens},{key:`summary`,better:`higher`,header:MU.result}];function qU(){return[...GU,...KU]}var JU={key:`costUSD`,better:`lower`,header:MU.costUSD};MU.entity,MU.verdict,MU.result,MU.durationMs;function YU(e,t){if(!t)return e;let n=e.findIndex(e=>e.key===`summary`);return n<0?[...e,JU]:[...e.slice(0,n),JU,...e.slice(n)]}function XU(e,t){return HU(`${e} (${t})`)}function ZU(e,t){return t>e?`${e}/${t} evals`:`${e} evals`}function QU(e,t){let n=e?.[t];return n===void 0?{kind:`notApplicable`}:PU(n)}function $U(e,t,n,r){let i={entity:HU(n),summary:{kind:`missing`,code:AU,detail:`niceeval exp ${e}`}};return{key:`${e}:${t}:missing`,variant:`placeholder`,cells:NU(i,r)}}function eW(e,t){return{key:e.locator,cells:NU(WU(e),t)}}function tW(e,t,n){let r={entity:HU(t),...e.durationMs===void 0?{}:{durationMs:PU(e.durationMs)},...e.tokens===void 0?{}:{tokens:PU(e.tokens)},summary:e.evaluationKind===`pass`?e.attempts.length===1?zU(e.attempts):FU(e.endToEndPassRate===void 0?{kind:`notApplicable`}:PU(e.endToEndPassRate),LU(e.attempts)):FU(e.score===void 0?{kind:`notApplicable`}:PU(e.score),RU(e.attempts)),...e.costUSD===void 0?{}:{costUSD:PU(e.costUSD)}};return{key:e.evalId,cells:NU(r,n.columns),subRows:e.attempts.map(e=>eW(e,n.columns))}}function nW(e,t){let n=CU(e.evalId,t.labelPrefix),r=t.item.evalRows.find(t=>t.evalId===e.evalId);return r===void 0?$U(t.item.experimentId,e.evalId,n,t.columns):tW(r,n,t)}function rW(e,t){let n=new Set,r=e=>{for(let t of e)t.kind===`leaf`?n.add(t.evalId):r(t.children)};return r([e]),t.filter(e=>n.has(e.evalId)).flatMap(e=>e.attempts)}function iW(e,t,n){let r=new Set,i=e=>{for(let t of e)t.kind===`leaf`?r.add(t.evalId):i(t.children)};i([e]);let a=t.evalRows.filter(e=>r.has(e.evalId)),o=r.size,s=a.length,c=t.groupMetrics.get(e.prefix),l=rW(e,t.evalRows),u=s===0?{kind:`missing`,code:jU}:LU(l),d=a.every(e=>e.evaluationKind===`pass`),f=d?QU(c,`passRate`):QU(c,`score`),p={entity:XU(e.segment,ZU(s,o)),durationMs:QU(c,`durationMs`),tokens:QU(c,`tokens`),...c?.costUSD===void 0?{}:{costUSD:PU(c.costUSD)},summary:FU(f,d?u:RU(l))};return{key:`group:${e.prefix}`,variant:`group`,cells:NU(p,n.columns),subRows:aW(e.children,{...n,labelPrefix:e.prefix})}}function aW(e,t){let n=e.filter(e=>e.kind===`group`).slice().sort((e,n)=>{let r=oW(e,t.item),i=oW(n,t.item);return r===null&&i===null?e.segment.localeCompare(n.segment):r===null?1:i===null?-1:i-r||e.segment.localeCompare(n.segment)}),r=e.filter(e=>e.kind===`leaf`);return[...n.map(e=>iW(e,t.item,t)),...r.map(e=>nW(e,t))]}function oW(e,t){let n=`${e.prefix}/`,r=t.evalRows.some(e=>e.evalId.startsWith(n)&&e.evaluationKind!==`pass`),i=t.groupMetrics.get(e.prefix);return(r?i?.score:i?.passRate)?.value??null}function sW(e,t){let n=new Set(e.evalRows.map(e=>e.evalId)),r=TU([...new Set([...n,...e.missingEvalIds])]),i=e.evalRows.flatMap(e=>e.attempts),a=e.evaluationKind===`pass`?e.endToEndPassRate===void 0?{kind:`notApplicable`}:PU(e.endToEndPassRate,!1):e.score===void 0?{kind:`notApplicable`}:PU(e.score),o=e.evalRows.length,s=o+e.missingEvalIds.length,c={entity:FU(XU(e.experimentId,`${o}/${s}`),...(e.plugins??[]).map(e=>HU(`${e.name} (${e.key})`,JSON.stringify(e.identity)))),model:cW(e.model),adapter:lW(e.adapter),...e.durationMs===void 0?{}:{durationMs:PU(e.durationMs,!1)},...e.tokens===void 0?{}:{tokens:PU(e.tokens,!1)},...e.costUSD===void 0?{}:{costUSD:PU(e.costUSD,!1)},summary:FU(a,e.evaluationKind===`pass`?LU(i):RU(i))};return{key:e.experimentId,cells:NU(c,t.columns),subRows:r.length>0?aW(r,t):[]}}function cW(e){return e.state===`available`?HU(e.value):e.state===`mixed`?{kind:`missing`,code:`mixedExecution`}:{kind:`notApplicable`}}function lW(e){if(e.state===`mixed`)return{kind:`missing`,code:`mixedExecution`};let t=e.value;return HU(t.name,`${t.contract} · ${t.behaviorRevision??`—`}`)}function uW(e){let t=YU(qU(),e.some(e=>e.costUSD!==void 0));return{columns:t,rows:e.map(e=>sW(e,{columns:t,item:e,labelPrefix:``}))}}var dW=(0,v.lazy)(()=>w(()=>import(`./quality-cost-scatter-B6Aiss7x.js`),[]));function fW({data:e,locale:t}){let{t:n}=Fo(),r=OU(e.experiments),i=DU(r)===`pass`?`pass`:`points`;return(0,M.jsxs)(`section`,{className:`niceeval-report niceeval-section`,children:[(0,M.jsx)(`h2`,{className:`niceeval-section-title`,children:WH(e.selectionTitle,t)}),(0,M.jsx)(`div`,{className:`niceeval-quality-cost-comparison`,children:(0,M.jsx)(v.Suspense,{fallback:(0,M.jsx)(`p`,{role:`status`,children:n(`report.loading`)}),children:(0,M.jsx)(dW,{items:r,kind:i,locale:t})})}),(0,M.jsx)(SU,{data:uW(r),sort:`summary`,searchable:!0,locale:t})]})}function pW(e,t,n){let r=e.value===null?tU(e.state,t):eU(e.value,e.unit,void 0,t);return e.state===`partial`?`${r} (${n})`:r}function mW(e){return`#/attempt/${encodeURIComponent(e.startsWith(`@`)?e.slice(1):e)}`}function hW({project:e,history:t,locale:n}){let{t:r}=Fo(),i=e.totals.verdict.tally,a=oN(e),o=e.totals.evaluationKind===`pass`?e.totals.verdict.passRate:e.totals.score;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`header`,{className:`niceeval-report niceeval-hero`,children:[(0,M.jsx)(`h1`,{className:`niceeval-hero-title`,children:r(`insight.title`)}),(0,M.jsx)(`p`,{children:r(`current.title`)})]}),(0,M.jsxs)(`section`,{className:`niceeval-report niceeval-section`,"aria-label":r(`current.summary`),children:[(0,M.jsx)(`h2`,{className:`niceeval-section-title`,children:r(`current.summary`)}),(0,M.jsxs)(XB,{children:[(0,M.jsxs)(`div`,{className:`niceeval-kpi`,children:[(0,M.jsx)(`span`,{className:`niceeval-kpi-label`,children:r(`current.covered`)}),(0,M.jsxs)(`span`,{className:`niceeval-kpi-value`,children:[e.coverage.covered,`/`,e.coverage.expected]})]}),(0,M.jsxs)(`div`,{className:`niceeval-kpi`,children:[(0,M.jsx)(`span`,{className:`niceeval-kpi-label`,children:r(`current.gaps`)}),(0,M.jsx)(`span`,{className:`niceeval-kpi-value`,children:e.coverage.gaps})]}),(0,M.jsxs)(`div`,{className:`niceeval-kpi`,children:[(0,M.jsx)(`span`,{className:`niceeval-kpi-label`,children:r(`current.verdicts`)}),(0,M.jsxs)(`span`,{className:`niceeval-kpi-value`,children:[i.passed,` `,r(`verdict.passed`),`; `,i.failed,` `,r(`verdict.failed`),`; `,i.errored,` `,r(`verdict.errored`),`; `,i.skipped,` `,r(`verdict.skipped`)]})]}),(0,M.jsxs)(`div`,{className:`niceeval-kpi`,children:[(0,M.jsx)(`span`,{className:`niceeval-kpi-label`,children:r(e.totals.evaluationKind===`pass`?`experimentList.passRate`:`experimentList.totalScore`)}),(0,M.jsx)(`span`,{className:`niceeval-kpi-value`,children:pW(o,n,r(`current.partial`))})]})]})]}),(0,M.jsxs)(`section`,{className:`niceeval-report niceeval-section`,"aria-label":r(`nav.experiments`),children:[(0,M.jsx)(`h2`,{className:`niceeval-section-title`,children:r(`nav.experiments`)}),(0,M.jsxs)(`table`,{children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{children:r(`experimentList.experiment`)}),(0,M.jsx)(`th`,{children:r(`current.covered`)}),(0,M.jsx)(`th`,{children:r(`current.gaps`)}),(0,M.jsx)(`th`,{children:r(e.totals.evaluationKind===`pass`?`experimentList.passRate`:`experimentList.totalScore`)})]})}),(0,M.jsx)(`tbody`,{children:a.map(({experiment:e,slots:t,covered:i,gaps:a})=>{let o=e.evaluationKind===`pass`?e.verdict.passRate:e.score;return(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{scope:`row`,children:(0,M.jsx)(`a`,{href:`#/experiment/${encodeURIComponent(e.experimentId)}`,children:e.experimentId})}),(0,M.jsxs)(`td`,{children:[i,`/`,t.length]}),(0,M.jsx)(`td`,{children:a}),(0,M.jsx)(`td`,{children:pW(o,n,r(`current.partial`))})]},e.experimentId)})})]}),a.map(({experiment:e,slots:t,covered:n,gaps:i})=>(0,M.jsxs)(`section`,{"aria-label":e.experimentId,children:[(0,M.jsxs)(`details`,{children:[(0,M.jsxs)(`summary`,{children:[(0,M.jsx)(`strong`,{children:e.experimentId}),` · `,r(`current.covered`),` `,n,`/`,t.length,` · `,r(`current.gaps`),` `,i]}),(0,M.jsxs)(`table`,{children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{children:r(`current.eval`)}),(0,M.jsx)(`th`,{children:r(`current.attempt`)}),(0,M.jsx)(`th`,{children:r(`experimentList.result`)})]})}),(0,M.jsx)(`tbody`,{children:t.map(e=>(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{scope:`row`,children:e.evalId}),(0,M.jsx)(`td`,{children:e.attemptOrdinal}),(0,M.jsx)(`td`,{children:e.state===`reuse`?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{children:r(`current.covered`)}),` `,(0,M.jsx)(`a`,{href:mW(e.locator),children:e.locator})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{children:r(`current.gapReason`,{reason:r(`current.reason.${e.reason}`)})}),e.previous===null?null:(0,M.jsxs)(M.Fragment,{children:[` · `,(0,M.jsx)(`a`,{href:mW(e.previous.locator),children:r(`current.previousResult`)})]})]})})]},`${e.evalId}:${e.attemptOrdinal}`))})]})]}),t.some(e=>e.state===`gap`)?(0,M.jsxs)(`p`,{children:[r(`current.next`),` `,(0,M.jsx)(FL,{text:`niceeval exp ${e.experimentId} --dry`,children:(0,M.jsxs)(`code`,{children:[`niceeval exp `,e.experimentId,` --dry`]})})]}):null]},e.experimentId))]}),t.length===0?null:(0,M.jsxs)(`section`,{className:`niceeval-report niceeval-section`,"aria-label":r(`current.history`),children:[(0,M.jsx)(`h2`,{className:`niceeval-section-title`,children:r(`current.history`)}),(0,M.jsx)(`ul`,{children:t.map(e=>(0,M.jsxs)(`li`,{children:[e.experimentId,` · `,e.evalId,` · `,r(`current.attempt`),` `,e.attemptOrdinal,` · `,e.locator===null?(0,M.jsx)(`a`,{href:`#/run/${encodeURIComponent(e.sourceRunId)}`,children:e.sourceRunId}):(0,M.jsx)(`a`,{href:mW(e.locator),children:e.locator})]},`${e.experimentId}:${e.evalId}:${e.attemptOrdinal}`))})]})]})}function gW({model:e,locale:t,unavailableReason:n}){let{t:r}=Fo();if(e.targetMode===`current`&&e.current!==void 0)return(0,M.jsx)(hW,{project:e.current,history:e.currentHistory??e.current.history,locale:t});if(e.targetMode===`unavailable`){let t=e.overview.catalog.runExperiments[0]?.runId;return(0,M.jsxs)(`section`,{className:`niceeval-report niceeval-section`,role:`alert`,children:[(0,M.jsx)(`h1`,{children:r(`current.unavailable`)}),(0,M.jsx)(`p`,{children:r(`current.unavailableDetail`)}),n==null?null:(0,M.jsxs)(`p`,{children:[r(`current.unavailableReason`),`: `,n]}),t===void 0?null:(0,M.jsx)(`a`,{href:`#/run/${encodeURIComponent(t)}`,children:r(`current.historicalRun`)})]})}let i=lN(e.overview,e.selectedExperiments);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`header`,{className:`niceeval-report niceeval-hero`,children:[(0,M.jsx)(`h1`,{className:`niceeval-hero-title`,children:r(`insight.title`)}),(0,M.jsx)(`p`,{children:r(`current.historicalResults`)})]}),(0,M.jsxs)(`div`,{className:`niceeval-view-report-slot`,children:[e.costSummary===void 0?null:(0,M.jsx)(_W,{summary:e.costSummary}),i.length<=1?null:(0,M.jsx)(`nav`,{"aria-label":r(`nav.experiments`),children:(0,M.jsx)(`ul`,{children:i.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsx)(`a`,{href:e.href,children:e.experimentId})},e.experimentId))})}),(0,M.jsx)(fW,{data:{selectionTitle:e.selectionTitle,experiments:i},locale:t})]})]})}function _W({summary:e}){let{t}=Fo(),{totalCosts:n,coverage:r}=e,i=n.state===`complete`,a=t(i?`experimentCost.totalCosts`:`experimentCost.knownSubtotal`),o=[[`experimentCost.selectedSlots`,r.plannedAttemptCount],[`experimentCost.resolvedSlots`,r.recordedAttemptCount],[`experimentCost.originAttempts`,r.originAttemptCount],[`experimentCost.completeAttempts`,r.completeAttemptCount],[`experimentCost.partialAttempts`,r.partialAttemptCount],[`experimentCost.unavailableAttempts`,r.unavailableAttemptCount],[`experimentCost.unresolvedSlots`,r.missingAttemptCount]];return(0,M.jsxs)(`section`,{className:`niceeval-report niceeval-section`,"aria-label":a,children:[(0,M.jsx)(`h2`,{className:`niceeval-section-title`,children:a}),(0,M.jsx)(`p`,{children:t(`experimentCost.scope`)}),(0,M.jsx)(`p`,{children:t(i?`usage.costComplete`:`usage.costIncomplete`)}),n.missingSources.length===0?null:(0,M.jsxs)(`p`,{children:[t(`usage.missingSources`),`: `,n.missingSources.map(e=>t(e===`application`?`usage.applicationCost`:`usage.judgeUsage`)).join(`, `)]}),n.values.length===0?(0,M.jsx)(`p`,{children:t(i?`usage.noRecordedCharges`:`cell.metricUnavailable`)}):n.values.map(e=>(0,M.jsxs)(`p`,{children:[e.value,` `,e.currency,` · `,t(e.source===`reported`?`cell.costReported`:e.source===`estimated`?`cell.costEstimated`:`cell.costMixed`)]},e.currency)),(0,M.jsx)(XB,{children:o.map(([e,n])=>(0,M.jsxs)(`div`,{className:`niceeval-kpi`,children:[(0,M.jsx)(`span`,{className:`niceeval-kpi-label`,children:t(e)}),(0,M.jsx)(`span`,{className:`niceeval-kpi-value`,children:n})]},e))})]})}function vW({target:e}){return e.kind===`group`?(0,M.jsx)(yW,{groupKind:e.groupKind,groupKey:e.key}):(0,M.jsx)(bW,{experimentId:e.experimentId})}function yW({groupKind:e,groupKey:t}){let n=zM(),r=n.snapshot,{data:i}=dc(iN(n,r.manifest,r.overview,r.targetMode,e,t));return(0,M.jsx)(xW,{model:i})}function bW({experimentId:e}){let t=zM(),n=t.snapshot,{data:r}=dc(aN(t,n.overview,n.targetMode,e));return(0,M.jsx)(xW,{model:r})}function xW({model:e}){let{i18n:t}=Fo(),n=zM(),r=t.resolvedLanguage??`en`;return(0,M.jsx)(gW,{model:e,locale:r,unavailableReason:n.snapshot.targetFailureReason})}function SW({model:e,locale:t}){let n=e.members.map(t=>{let n={experiment:{kind:`text`,text:e.experimentId},adapter:e.adapter===null?{kind:`notApplicable`}:{kind:`text`,text:e.adapter.name,detail:`${e.adapter.contract} · ${e.adapter.behaviorRevision??`—`}`},eval:{kind:`text`,text:t.evalId},attempt:{kind:`text`,text:String(t.attemptOrdinal+1)},membership:{kind:`text`,text:t.state},outcome:wW(t.outcome),verdict:t.verdict===null?{kind:`notApplicable`}:{kind:`verdict`,verdict:t.verdict,...t.verdict===`passed`&&t.score?.state===`complete`?{label:KH(`verdict.scored`)}:{}},locator:t.locator===null?{kind:`notApplicable`}:{kind:`locator`,locator:t.locator,...t.verdict===null?{}:{verdict:t.verdict}},selectedRun:{kind:`text`,text:e.runId},slot:{kind:`text`,text:t.plannedAttemptId}};return Object.freeze({key:t.key,cells:Object.freeze(n)})}),r=Object.freeze({columns:Object.freeze([{key:`experiment`,header:{en:`Experiment`,"zh-CN":`实验`}},{key:`adapter`,header:{en:`Adapter`,"zh-CN":`应用`}},{key:`eval`,header:{en:`Eval`,"zh-CN":`评估`}},{key:`attempt`,header:{en:`Attempt`,"zh-CN":`尝试`}},{key:`membership`,header:{en:`Membership`,"zh-CN":`成员关系`}},{key:`outcome`,header:{en:`Outcome`,"zh-CN":`执行结果`}},{key:`verdict`,header:{en:`Verdict`,"zh-CN":`判定`}},{key:`locator`,header:{en:`Attempt locator`,"zh-CN":`Attempt 定位符`}},{key:`selectedRun`,header:{en:`Selected run`,"zh-CN":`所选 Run`}},{key:`slot`,header:{en:`Planned attempt`,"zh-CN":`计划 Attempt`}}]),rows:Object.freeze(n)});return(0,M.jsxs)(`section`,{className:`niceeval-report niceeval-section`,children:[(0,M.jsx)(`h2`,{className:`niceeval-section-title`,children:t===`zh-CN`?`Run 成员 · ${e.runId}`:`Run membership · ${e.runId}`}),(0,M.jsx)(SU,{data:r,searchable:!0,locale:t})]})}function CW({runId:e,presentation:t,onClose:n}){let{data:r}=dc(hN(zM(),e)),{i18n:i}=Fo(),a=i.resolvedLanguage===`zh-CN`?`zh-CN`:`en`,o=(0,M.jsx)(SW,{model:r,locale:a});if(t===`page`)return o;if(n===void 0)throw Error(`Run dialog close target is missing.`);return(0,M.jsx)(dL,{title:a===`zh-CN`?`运行`:`Run`,onClose:n,children:o})}function wW(e){return typeof e==`string`&&e.length>0?{kind:`text`,text:e}:{kind:`notApplicable`}}function TW(e){let t=e.indexOf(`/`);if(t===-1)return Object.freeze({kind:`singleton`,experimentId:e,key:`singleton/${e}`});let n=e.slice(0,t);return Object.freeze({kind:`named`,groupId:n,key:`named/${n}`})}function EW(e,t=[]){let n=new Map;for(let t of[...new Set(e.experiments)].sort(zW)){let e=TW(t),r=n.get(e.key)??{identity:e,members:[]};r.members.push(t),n.set(e.key,r)}let r=Object.freeze([...n.values()].sort((e,t)=>zW(e.identity.key,t.identity.key)).map(({identity:e,members:t})=>Object.freeze({identity:e,members:Object.freeze(t),route:DW(e),label:e.key}))),i=t.map(t=>e.runExperiments.find(e=>e.runId===t)?.experimentId).find(e=>e!==void 0),a=i===void 0?r[0]:r.find(({members:e})=>e.includes(i))??r[0],o=a?.route??`/`,s=r.map(e=>RW({pageId:`group:${e.identity.key}`,route:e.route,title:{en:`NiceEval Insight`,"zh-CN":`NiceEval Insight`},navigation:!1,target:e.identity.kind===`named`?{kind:`group`,groupKind:`named`,key:e.identity.groupId}:{kind:`group`,groupKind:`singleton`,key:e.identity.experimentId}}));for(let{experimentId:t}of e.experiments.map(e=>({experimentId:e})))s.push(RW({pageId:`experiment:${t}`,route:`/experiment/${encodeURIComponent(t)}`,title:{en:`Experiment`,"zh-CN":`实验`},navigation:!1,target:{kind:`experiment`,experimentId:t}}));for(let{runId:t}of LW(e.runExperiments,({runId:e})=>e))s.push(RW({pageId:`run:${t}`,route:`/run/${encodeURIComponent(t)}`,title:{en:`Run`,"zh-CN":`运行`},navigation:!1,target:{kind:`run`,runId:t}}));for(let{locator:t}of LW(e.attemptExperiments,({locator:e})=>e))s.push(RW({pageId:`attempt:${t}`,route:`/attempt/${OW(t)}`,title:{en:`Attempt`,"zh-CN":`尝试`},navigation:!1,target:{kind:`attempt`,locator:t}}));return s.unshift(RW({pageId:`overview`,route:`/`,title:{en:`NiceEval Insight`,"zh-CN":`NiceEval Insight`},navigation:!0,target:a===void 0?{kind:`group`,groupKind:`singleton`,key:``}:a.identity.kind===`named`?{kind:`group`,groupKind:`named`,key:a.identity.groupId}:{kind:`group`,groupKind:`singleton`,key:a.identity.experimentId}})),Object.freeze({title:{en:`NiceEval Insight`,"zh-CN":`NiceEval Insight`},defaultRoute:o,experimentSelection:{options:r.map(({route:e,label:t})=>Object.freeze({route:e,label:t}))},pages:Object.freeze(s),groups:r})}function DW(e){return e.kind===`named`?`/group/named/${encodeURIComponent(e.groupId)}`:`/group/singleton/${encodeURIComponent(e.experimentId)}`}function OW(e){return encodeURIComponent(e.startsWith(`@`)?e.slice(1):e)}function kW(e,t){if(t===`/`)return e.pages.find(e=>e.route===t)?.target;if(!t.startsWith(`/`))return;let n=t.slice(1).replace(/\/$/u,``).split(`/`);try{return jW(n.map(AW))}catch{return}}function AW(e){return decodeURIComponent(e).replace(/%2F/gu,`/`)}function jW(e){if(e.length===3&&e[0]===`group`&&(e[1]===`named`||e[1]===`singleton`)&&e[2])return{kind:`group`,groupKind:e[1],key:e[2]};if(e.length===2&&e[1]){if(e[0]===`experiment`)return{kind:`experiment`,experimentId:e[1]};if(e[0]===`run`)return{kind:`run`,runId:e[1]};if(e[0]===`attempt`)return{kind:`attempt`,locator:`@${e[1]}`}}}function MW(e,t){let n=t.pathname,r=kW(e,n);if(r===void 0)throw Error(`Insight route target is malformed.`);let i=FW(t,r,`page`);if(r.kind===`group`||r.kind===`experiment`)return{background:i};let a=IW(t.state),o=a?.background===void 0?void 0:PW(e,a.background);if(r.kind===`run`&&o===void 0)return{background:i};if(o!==void 0)return{background:o,foreground:{...FW(t,r,`dialog`),close:{kind:`history`}}};let s=Object.freeze({pathname:e.defaultRoute}),c=kW(e,s.pathname);if(c===void 0)throw Error(`Insight default route target is missing.`);return{background:FW(s,c,`page`),foreground:{...FW(t,r,`dialog`),close:{kind:`replace`,route:e.defaultRoute}}}}function NW(e){return`${e.target.kind}:${e.location.pathname}:${e.location.search??``}`}function PW(e,t){let n=kW(e,t.pathname);if(n!==void 0&&n.kind!==`attempt`)return FW(t,n,`page`)}function FW(e,t,n){return Object.freeze({location:Object.freeze({pathname:e.pathname,...e.search===void 0?{}:{search:e.search}}),target:t,presentation:n})}function IW(e){if(typeof e!=`object`||!e||!(`background`in e))return;let t=e.background;if(typeof t!=`object`||!t||!(`pathname`in t)||typeof t.pathname!=`string`)return;let n=`search`in t&&typeof t.search==`string`?t.search:void 0;return{background:{pathname:t.pathname,...n===void 0?{}:{search:n}}}}function LW(e,t){let n=new Map;for(let r of e)n.set(t(r),r);return[...n.values()]}function RW(e){return Object.freeze(e)}function zW(e,t){return e<t?-1:+(e>t)}function BW({checkForUpdate:e,refresh:t}){let{manifest:n,presentation:r}=zM().snapshot,{acquire:i,interactionLocked:a,recoveryRequired:o}=cL(),{t:s}=Fo();return o?(0,M.jsxs)(`main`,{className:`niceeval-view-main`,role:`alert`,children:[(0,M.jsx)(`h1`,{children:s(`refresh.reloadRequired`)}),(0,M.jsx)(`p`,{children:s(`refresh.reloadRequiredDetail`)}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:s(`refresh.reload`)})]}):(0,M.jsx)(oL,{locked:a,children:(0,M.jsx)(VW,{manifest:n,presentation:r,refresh:()=>t(i),checkForUpdate:e,interactionLocked:a})})}function VW({checkForUpdate:e,interactionLocked:t,manifest:n,presentation:r,refresh:i}){let a=zM(),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(),[u,d]=(0,v.useState)(!1),{i18n:f,t:p}=Fo(),m=Dr(),h=Ar(),g=uc({queryKey:[`view`,a.identity,`update-available`],queryFn:e,refetchInterval:500,staleTime:0,retry:!1}),_=(0,v.useRef)(void 0);r===void 0?_.current=void 0:(_.current?.generationIdentity!==a.identity||_.current.originLocationKey!==r.originLocationKey)&&(_.current={generationIdentity:a.identity,originLocationKey:r.originLocationKey,consumed:!1}),_.current!==void 0&&m.key!==_.current.originLocationKey&&(_.current.consumed=!0);let y=r!==void 0&&_.current?.consumed===!1?r.plan:MW(n,m),b=f.resolvedLanguage??`en`;(0,v.useEffect)(()=>{document.title=p(`insight.title`)},[p]);let x=n.experimentSelection?.options??[],S=x.find(({route:e})=>m.pathname===e)??x[0],C=(0,v.useCallback)(e=>{if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.target instanceof Element?e.target.closest(`a[href]`):null;if(t===null||t.target&&t.target!==`_self`||t.hasAttribute(`download`))return;let r=new URL(t.href,document.baseURI);if(r.origin!==window.location.origin||!r.hash.startsWith(`#/`))return;let i=r.hash.slice(1),a=kW(n,i);a!==void 0&&(e.preventDefault(),a.kind===`run`||a.kind===`attempt`?h(i,{state:{background:y.background.location}}):h(i,{state:null}))},[n,h,y.background.location]),w=(0,v.useCallback)(e=>{e.kind===`history`?h(-1):h(e.route,{replace:!0,state:null})},[h]),T=y.foreground;return(0,M.jsxs)(`div`,{onClickCapture:C,children:[(0,M.jsxs)(`header`,{className:`niceeval-view-shell`,children:[(0,M.jsxs)(`a`,{className:`niceeval-view-brand`,href:`https://niceeval.com/?utm_source=insight&utm_medium=brand`,target:`_blank`,rel:`noopener`,children:[(0,M.jsx)(`span`,{className:`niceeval-view-mark`,"aria-hidden":`true`}),(0,M.jsx)(`span`,{children:`NiceEval`})]}),(0,M.jsx)(`nav`,{className:`niceeval-view-nav`,"aria-label":p(`nav.pages`),children:(0,M.jsx)(`a`,{href:`#${n.defaultRoute}`,"aria-current":y.foreground===void 0?`page`:void 0,"aria-disabled":t||void 0,children:p(`insight.navigation`)})}),(0,M.jsxs)(`div`,{className:`niceeval-view-controls`,children:[S===void 0?null:(0,M.jsxs)(`label`,{className:`niceeval-view-experiment`,children:[(0,M.jsx)(`span`,{children:p(`nav.experiments`)}),(0,M.jsx)(`select`,{disabled:t,value:S.route,onChange:e=>h(e.target.value),children:x.map(e=>(0,M.jsx)(`option`,{value:e.route,children:e.label},e.route))})]}),(0,M.jsx)(`label`,{className:`niceeval-view-language`,children:(0,M.jsxs)(`select`,{disabled:t,"aria-label":p(`nav.language`),value:b,onChange:e=>void f.changeLanguage(e.target.value),children:[(0,M.jsx)(`option`,{value:`en`,children:`EN`}),(0,M.jsx)(`option`,{value:`zh-CN`,children:`中文`})]})}),(0,M.jsx)(`button`,{type:`button`,disabled:o||t,onClick:()=>{s(!0),d(!1),l(void 0),i().then(e=>{l(e.noticeKey)}).catch(()=>d(!0)).finally(()=>s(!1))},children:p(o?`refresh.working`:`refresh.action`)}),g.data===`available`&&!o?(0,M.jsx)(`span`,{role:`status`,children:p(`refresh.available`)}):null,g.data===`stale`&&!o?(0,M.jsx)(`span`,{role:`status`,children:p(`refresh.lastGoodStale`)}):null,c===void 0?null:(0,M.jsx)(`span`,{role:`status`,children:p(c)}),u?(0,M.jsx)(`span`,{role:`alert`,children:p(`refresh.failed`)}):null]})]}),(0,M.jsxs)(`main`,{className:`niceeval-view-main`,inert:t?!0:void 0,children:[(0,M.jsx)(HW,{surface:y.background},`background:${NW(y.background)}`),T===void 0?null:(0,M.jsx)(HW,{surface:T,onClose:()=>w(T.close)},`foreground:${NW(T)}`)]})]})}function HW({surface:e,onClose:t}){let{target:n,presentation:r}=e;if(n.kind===`group`||n.kind===`experiment`)return(0,M.jsx)(vW,{target:n});if(n.kind===`run`)return(0,M.jsx)(CW,{runId:n.runId,presentation:r,onClose:t});if(t===void 0)throw Error(`Attempt dialog close target is missing.`);return(0,M.jsx)(UH,{locator:n.locator,onClose:t})}var UW=H({generationId:z,sourceCutoffIdentity:z,targetMode:G([`current`,`history`,`unavailable`]),targetIdentity:K(z),targetFailureReason:K(z),refreshSupported:V,stale:V});H({generationId:z}),H({generationId:z,request:gM});var WW=H({code:G([`view-request-invalid`,`view-generation-not-found`,`view-generation-stale`,`view-inspection-failed`]),reason:z,correction:G([`fix-request`,`refresh-generation`,`retry`])}),GW={errors:`all`,onExcessProperty:`error`},KW=ev(UW,GW),qW=ev(WW,GW),JW=class extends Error{status;code;correction;classification=`view-http`;constructor(e,t,n,r,i){super(r,i),this.status=e,this.code=t,this.correction=n,this.name=`ViewHttpError`}},YW=class{descriptor;generationId;#e=new AbortController;#t=!1;constructor(e){this.descriptor=e,this.generationId=e.generationId}async inspect(e){if(this.#t)throw Error(`HTTP Inspection repository is closed.`);let t=GM(e);if(ad(t))throw Error(t.failure.reason);let n=await eG(`/_niceeval/inspection`,{method:`POST`,signal:this.#e.signal,headers:{"content-type":`application/json`},body:JSON.stringify({generationId:this.descriptor.generationId,request:{protocol:yE,operation:t.success}})}),r=await tG(n);if(!n.ok)throw nG(n.status,r);let i=CM(r);if(!i.success)throw new JW(n.status,`view-response-invalid`,`retry`,i.reason);let a=wM(i.value,e.kind);if(!a.success)throw new JW(n.status,`view-response-invalid`,`retry`,a.reason);return a.value}close(){this.#t||(this.#t=!0,this.#e.abort())}};async function XW(){return $W(`/_niceeval/generation`,{method:`GET`})}async function ZW(){return $W(`/_niceeval/generation/refresh`,{method:`POST`})}async function QW(e){return $W(`/_niceeval/generation/commit`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({generationId:e})})}async function $W(e,t){let n=await eG(e,t),r=await tG(n);if(!n.ok)throw nG(n.status,r);let i=KW(r);if(ad(i))throw new JW(n.status,`view-response-invalid`,`retry`,String(i.failure));return i.success}function eG(e,t){return fetch(new URL(e,document.baseURI),{...t,cache:`no-store`,credentials:`same-origin`})}async function tG(e){try{return await e.json()}catch(t){throw new JW(e.status,`view-response-invalid`,`retry`,`View HTTP response is not JSON.`,{cause:t})}}function nG(e,t){let n=qW(t);return ad(n)?new JW(e,`view-response-invalid`,`retry`,`View HTTP request failed (${e}).`):new JW(e,n.success.code,n.success.correction,n.success.reason)}var rG=class extends Error{classification=`generation-prepare`;translationKey=`report.unableToLoad`};async function iG(e){let t=new URL(document.baseURI).searchParams.getAll(`run`),n=new UM,r=new AbortController,i;window.addEventListener(`pagehide`,()=>{r.abort(Error(`NiceEval View page was hidden.`)),e(),i?.(),n.dispose()},{once:!0});let a=await XW(),o=n.prepare(new YW(a)),s,c;try{if(c=sN(await o.lease.inspect(YM(t))),a.targetMode===`current`){let e=await o.lease.inspect(XM());c=vG(c,e.project.experiments.map(e=>e.experimentId))}else a.targetMode===`unavailable`&&(c=vG(c,[]));s=EW(c.catalog,t);let e=uG(s.defaultRoute),r=kW(s,e.pathname)===void 0?{pathname:s.defaultRoute}:e;await pG(o.lease,s,c,a.targetMode,MW(s,r)),n.attachSnapshot(o,_G(s,c,a.targetMode,a.targetFailureReason)),n.commit(o)}catch(e){throw n.reject(o),new rG(`Unable to prepare initial generation.`,{cause:e})}let l=e=>async()=>{let t=n.acquireCurrent();try{return await e(t)}finally{t.release()}},u=(e,t)=>{let n=e[t];if(!n)throw new KM(`Insight route parameter is missing.`);return n},d=e=>({params:t})=>l(async n=>{let r=jW(e(t));if(r===void 0)throw new KM(`Insight route parameter is malformed.`);let i=n.generation.binding;return await mG(n,i.snapshot.manifest,i.snapshot.overview,i.snapshot.targetMode,r),null})(),f=()=>n.current?.snapshot.manifest.defaultRoute??s.defaultRoute,p=0,m=Ji([{path:`/`,element:(0,M.jsx)(RM,{runtime:n,children:(0,M.jsx)(BW,{checkForUpdate:async()=>{oG(r.signal);let e=await XW();return oG(r.signal),e.stale?`stale`:e.generationId===n.current?.identity?`none`:`available`},refresh:async e=>{let i=p,a=m.state.location.pathname,o=m.state.location.key,s=m.state.location.state,c=n.current.identity,l=await ZW();if(oG(r.signal),l.generationId===c)return cG(n);let u=n.prepare(new YW(l)),d=!0,f,h=!1,g=!1;try{let _=sN(await u.lease.inspect(YM(t)));if(l.targetMode===`current`){let e=await u.lease.inspect(XM());_=vG(_,e.project.experiments.map(e=>e.experimentId))}else if(l.targetMode===`unavailable`)throw new rG(`Current project target is unavailable.`);let v=EW(_.catalog,t),y=hG(n.current.snapshot.overview,_,v,a),b=MW(v,{pathname:y.route,state:y.fallback?null:s});if(await pG(u.lease,v,_,l.targetMode,b),oG(r.signal),!sG(m,p,i,a,o))throw n.reject(u),d=!1,new rG(`View location changed while refresh was preparing.`);if(f=await e(r.signal),h=!0,oG(r.signal),!sG(m,p,i,a,o))throw n.reject(u),d=!1,await f.release(),h=!1,new rG(`View location changed while refresh was preparing.`);n.attachSnapshot(u,_G(v,_,l.targetMode,l.targetFailureReason,y.fallback?{originLocationKey:o,plan:b}:void 0));let x=await lG(l.generationId,c,r.signal);if(oG(r.signal),x===`rejected`)throw new rG(`View Host rejected the prepared generation.`);if(x===`uncertain`)return n.reject(u),d=!1,f.recover(),h=!1,cG(n);g=!0,y.fallback&&!f.hasUserIntent()&&(await f.enqueueFallback(y.route),oG(r.signal));let S=n.commit(u);d=!1,n.retire(S);let C=await f.release();h=!1;let w=y.fallback&&C!==`user`;return Object.freeze({manifest:v,...w?{fallbackRoute:y.route,noticeKey:`refresh.selectionChanged`}:{}})}catch(e){if(r.signal.aborted)throw r.signal.reason;if(g&&h)return d&&u.generation.status===`preparing`&&n.reject(u),f.recover(),cG(n);throw d&&n.reject(u),h&&await f.release(),e instanceof rG?e:new rG(`Unable to prepare refreshed generation.`,{cause:e})}}})}),errorElement:(0,M.jsx)(fG,{}),children:[{index:!0,loader:()=>{let e=f();return e===`/`?null:st(e)}},{path:`group/:groupKind/:key`,element:null,loader:d(e=>[`group`,u(e,`groupKind`),u(e,`key`)])},{path:`experiment/:experimentId`,element:null,loader:d(e=>[`experiment`,u(e,`experimentId`)])},{path:`run/:runId`,element:null,loader:d(e=>[`run`,u(e,`runId`)])},{path:`attempt/:locator`,element:null,loader:d(e=>[`attempt`,u(e,`locator`)])},{path:`*`,loader:()=>st(f())}]}]);i=()=>m.dispose(),await aG(m);let h=m.state.location;return m.subscribe(e=>{e.location!==h&&(h=e.location,p+=1)}),m}function aG(e){return e.state.initialized?Promise.resolve():new Promise(t=>{let n=e.subscribe(e=>{e.initialized&&(n(),t())});e.state.initialized&&(n(),t())})}function oG(e){if(e.aborted)throw e.reason}function sG(e,t,n,r,i){return t===n&&e.state.location.pathname===r&&e.state.location.key===i&&e.state.navigation.state===`idle`}function cG(e){return Object.freeze({manifest:e.current.snapshot.manifest})}async function lG(e,t,n){let r;try{let t=await QW(e);if(oG(n),t.generationId===e)return`committed`;r=new rG(`View Host committed an unexpected generation.`)}catch(e){oG(n),r=e}let i;try{i=await XW(),oG(n)}catch{return oG(n),`uncertain`}return i.generationId===e?`committed`:r instanceof JW&&r.code===`view-generation-stale`&&i.generationId===t?`rejected`:`uncertain`}function uG(e){let t=window.location.hash,n=t.startsWith(`#/`)?t.slice(1):e,r=n.indexOf(`?`);return{pathname:r<0?n:n.slice(0,r),...r<0?{}:{search:n.slice(r)},state:dG()}}function dG(){let e=window.history.state;return typeof e==`object`&&e&&`usr`in e?e.usr:void 0}function fG(){let e=qr(),{t}=Fo(),n=typeof e==`object`&&e&&`translationKey`in e&&(e.translationKey===`report.unableToLoad`||e.translationKey===`report.unableToLoadDetails`)?e.translationKey:`report.unableToLoad`;return(0,M.jsxs)(`main`,{className:`niceeval-view-main`,role:`alert`,children:[(0,M.jsx)(`h1`,{children:t(`report.unableToLoad`)}),(0,M.jsx)(`p`,{children:t(n)}),(0,M.jsx)(`a`,{href:`#/`,children:t(`report.backToResults`)})]})}async function pG(e,t,n,r,i){await mG(e,t,n,r,i.background.target),i.foreground!==void 0&&await mG(e,t,n,r,i.foreground.target)}async function mG(e,t,n,r,i){let a=e.generation.binding;i.kind===`attempt`?await a.queryClient.fetchQuery(rN(a,i.locator)):i.kind===`run`?await a.queryClient.fetchQuery(hN(a,i.runId)):i.kind===`experiment`?await a.queryClient.fetchQuery(aN(a,n,r,i.experimentId)):await a.queryClient.fetchQuery(iN(a,t,n,r,i.groupKind,i.key))}function hG(e,t,n,r){let i=kW(n,r);if(i===void 0)return{route:n.defaultRoute,fallback:!0};if(i.kind===`attempt`){if(t.catalog.attemptExperiments.some(e=>e.locator===i.locator))return{route:r,fallback:!1};let a=e.catalog.attemptExperiments.find(e=>e.locator===i.locator)?.experimentId;if(a===void 0)return{route:r,fallback:!1};let o=t.catalog.runExperiments.filter(e=>e.experimentId===a).sort((e,t)=>gG(e.runId,t.runId))[0];return o===void 0?{route:n.defaultRoute,fallback:!0}:{route:`/run/${encodeURIComponent(o.runId)}`,fallback:!0}}return i.kind===`run`?e.catalog.runExperiments.some(e=>e.runId===i.runId)?t.catalog.runExperiments.some(e=>e.runId===i.runId)?{route:r,fallback:!1}:{route:n.defaultRoute,fallback:!0}:{route:r,fallback:!1}:i.kind===`experiment`&&e.catalog.experiments.includes(i.experimentId)?t.catalog.experiments.includes(i.experimentId)?{route:r,fallback:!1}:{route:n.defaultRoute,fallback:!0}:{route:r,fallback:!1}}function gG(e,t){return e<t?-1:+(e>t)}function _G(e,t,n,r,i){return Object.freeze({manifest:e,overview:t,targetMode:n,targetFailureReason:r,...i===void 0?{}:{presentation:i}})}function vG(e,t){return Object.freeze({...e,catalog:Object.freeze({...e.catalog,experiments:Object.freeze([...t])})})}var yG=document.getElementById(`root`);if(yG===null)throw Error(`NiceEval View root is missing`);var bG=(0,b.createRoot)(yG),xG=iG(()=>bG.unmount());function SG(){let e=(0,v.use)(xG);return(0,M.jsx)(ca,{router:e})}function CG(){let e=window.location.hash.startsWith(`#/attempt/`);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`main`,{className:`niceeval-view-main`,children:e?(0,M.jsx)(`h1`,{children:`NiceEval Insight`}):(0,M.jsx)(`p`,{role:`status`,children:Ro.t(`report.loading`)})}),e?(0,M.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`niceeval-bootstrap-attempt-title`,className:`niceeval-view-dialog`,children:[(0,M.jsx)(`div`,{className:`niceeval-view-dialog-head`,children:(0,M.jsx)(`h2`,{id:`niceeval-bootstrap-attempt-title`,className:`niceeval-view-dialog-title`,children:Ro.t(`attempt.title`)})}),(0,M.jsx)(`p`,{role:`status`,children:Ro.t(`report.loadingDetails`)})]}):null]})}var wG=class extends v.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e,t){}render(){return this.state.failed?(0,M.jsx)(`main`,{className:`niceeval-view-main`,role:`alert`,children:(0,M.jsx)(`h1`,{children:Ro.t(`app.failed`)})}):this.props.children}};bG.render((0,M.jsx)(v.StrictMode,{children:(0,M.jsx)(wG,{children:(0,M.jsx)(v.Suspense,{fallback:(0,M.jsx)(CG,{}),children:(0,M.jsx)(SG,{})})})}));export{d as a,l as c,h as i,Fo as n,o,jo as r,s,Bo as t};