@kingsleyweb/bun-ui 0.0.0-stage → 3.0.0-rc.2

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 (240) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +80 -2
  3. package/app/docs/App.tsx +72 -0
  4. package/app/docs/api/client.ts +303 -0
  5. package/app/docs/api/contract.ts +24 -0
  6. package/app/docs/api/docs.ts +38 -0
  7. package/app/docs/api/errors.ts +144 -0
  8. package/app/docs/boot.tsx +58 -0
  9. package/app/docs/components/Badge.tsx +65 -0
  10. package/app/docs/components/Button.tsx +37 -0
  11. package/app/docs/components/Card.tsx +41 -0
  12. package/app/docs/components/ConfirmDialog.tsx +173 -0
  13. package/app/docs/components/CopyButton.tsx +68 -0
  14. package/app/docs/components/Dialog.tsx +230 -0
  15. package/app/docs/components/EmptyState.tsx +34 -0
  16. package/app/docs/components/ErrorView.tsx +70 -0
  17. package/app/docs/components/Field.tsx +93 -0
  18. package/app/docs/components/JsonEditor.tsx +151 -0
  19. package/app/docs/components/JsonView.tsx +338 -0
  20. package/app/docs/components/KeyValue.tsx +63 -0
  21. package/app/docs/components/ProblemBanner.tsx +116 -0
  22. package/app/docs/components/ScreenErrorBoundary.tsx +141 -0
  23. package/app/docs/components/Spinner.tsx +33 -0
  24. package/app/docs/components/Table.tsx +33 -0
  25. package/app/docs/components/Tabs.tsx +226 -0
  26. package/app/docs/components/classNames.ts +4 -0
  27. package/app/docs/components/components.css +691 -0
  28. package/app/docs/components/copy.ts +89 -0
  29. package/app/docs/components/fieldContext.ts +29 -0
  30. package/app/docs/components/inputValues.ts +142 -0
  31. package/app/docs/components/inputs.tsx +387 -0
  32. package/app/docs/components/jsonParse.ts +338 -0
  33. package/app/docs/components/listKeys.ts +30 -0
  34. package/app/docs/config.ts +86 -0
  35. package/app/docs/context.ts +33 -0
  36. package/app/docs/embed.ts +74 -0
  37. package/app/docs/env.d.ts +2 -0
  38. package/app/docs/format.ts +9 -0
  39. package/app/docs/hooks/useUrlTab.ts +16 -0
  40. package/app/docs/main.tsx +11 -0
  41. package/app/docs/queryClient.ts +54 -0
  42. package/app/docs/router.tsx +194 -0
  43. package/app/docs/routing.ts +194 -0
  44. package/app/docs/screens/docs/document.ts +27 -0
  45. package/app/docs/screens/docs/http/OperationView.tsx +407 -0
  46. package/app/docs/screens/docs/http/Sidebar.tsx +190 -0
  47. package/app/docs/screens/docs/http/TryItPanel.tsx +603 -0
  48. package/app/docs/screens/docs/http/http.css +405 -0
  49. package/app/docs/screens/docs/http/index.tsx +395 -0
  50. package/app/docs/screens/docs/http/model.ts +604 -0
  51. package/app/docs/screens/docs/http/tryIt.ts +455 -0
  52. package/app/docs/screens/docs/permissions.ts +6 -0
  53. package/app/docs/screens/docs/schema/Prose.tsx +43 -0
  54. package/app/docs/screens/docs/schema/SchemaTree.tsx +319 -0
  55. package/app/docs/screens/docs/schema/index.ts +30 -0
  56. package/app/docs/screens/docs/schema/resolve.ts +466 -0
  57. package/app/docs/screens/docs/schema/schema.css +137 -0
  58. package/app/docs/screens/docs/schema/skeleton.ts +92 -0
  59. package/app/docs/screens/docs/viewer.tsx +154 -0
  60. package/app/docs/screens/docs/ws/InlineText.tsx +25 -0
  61. package/app/docs/screens/docs/ws/PayloadSchema.tsx +39 -0
  62. package/app/docs/screens/docs/ws/format.ts +82 -0
  63. package/app/docs/screens/docs/ws/index.tsx +286 -0
  64. package/app/docs/screens/docs/ws/items.tsx +786 -0
  65. package/app/docs/screens/docs/ws/model.ts +1178 -0
  66. package/app/docs/screens/docs/ws/panels.tsx +440 -0
  67. package/app/docs/screens/docs/ws/ws.css +231 -0
  68. package/app/docs/shortcuts.ts +94 -0
  69. package/app/docs/styles/base.css +847 -0
  70. package/app/docs/styles/tokens.css +143 -0
  71. package/app/docs/theme.ts +56 -0
  72. package/app/kit/unauthorized.ts +222 -0
  73. package/dist/docs/assets/main-0rchxtv5.js +18 -0
  74. package/dist/docs/assets/main-0rchxtv5.js.map +99 -0
  75. package/dist/docs/assets/main-cqgyvs86.css +1 -0
  76. package/dist/docs/manifest.json +26 -0
  77. package/dist/jobs/assets/AddFlowDialog-h6xkgx9b.js +6 -0
  78. package/dist/jobs/assets/AddFlowDialog-h6xkgx9b.js.map +11 -0
  79. package/dist/jobs/assets/AddFlowDialog-n7gtc84v.css +1 -0
  80. package/dist/jobs/assets/added-cbwsxv3e.js +4 -0
  81. package/dist/jobs/assets/added-cbwsxv3e.js.map +11 -0
  82. package/dist/jobs/assets/bodies-yyw5hmrp.js +6 -0
  83. package/dist/jobs/assets/bodies-yyw5hmrp.js.map +10 -0
  84. package/dist/jobs/assets/channel-tgkvqm8y.js +4 -0
  85. package/dist/jobs/assets/channel-tgkvqm8y.js.map +10 -0
  86. package/dist/jobs/assets/channelChecks-s4yz4yhw.js +4 -0
  87. package/dist/jobs/assets/channelChecks-s4yz4yhw.js.map +10 -0
  88. package/dist/jobs/assets/index-02427smp.css +1 -0
  89. package/dist/jobs/assets/index-09z2cjft.js +4 -0
  90. package/dist/jobs/assets/index-09z2cjft.js.map +16 -0
  91. package/dist/jobs/assets/index-18bn0gvy.css +1 -0
  92. package/dist/jobs/assets/index-47pxmyxn.js +4 -0
  93. package/dist/jobs/assets/index-47pxmyxn.js.map +10 -0
  94. package/dist/jobs/assets/index-4e55z986.js +4 -0
  95. package/dist/jobs/assets/index-4e55z986.js.map +11 -0
  96. package/dist/jobs/assets/index-5c933424.js +4 -0
  97. package/dist/jobs/assets/index-5c933424.js.map +18 -0
  98. package/dist/jobs/assets/index-5kbyqspm.css +1 -0
  99. package/dist/jobs/assets/index-5ng37hk6.css +1 -0
  100. package/dist/jobs/assets/index-5w8w7fvc.css +1 -0
  101. package/dist/jobs/assets/index-71qs5qyx.css +1 -0
  102. package/dist/jobs/assets/index-btpg4r8b.css +1 -0
  103. package/dist/jobs/assets/index-d5r5n0mm.js +4 -0
  104. package/dist/jobs/assets/index-d5r5n0mm.js.map +23 -0
  105. package/dist/jobs/assets/index-e0yy2skq.css +1 -0
  106. package/dist/jobs/assets/index-hs60b25v.js +10 -0
  107. package/dist/jobs/assets/index-hs60b25v.js.map +62 -0
  108. package/dist/jobs/assets/index-k2smrr70.js +4 -0
  109. package/dist/jobs/assets/index-k2smrr70.js.map +9 -0
  110. package/dist/jobs/assets/index-q24jw3w9.js +4 -0
  111. package/dist/jobs/assets/index-q24jw3w9.js.map +32 -0
  112. package/dist/jobs/assets/index-qfb80xen.css +1 -0
  113. package/dist/jobs/assets/index-rtynx6wj.js +4 -0
  114. package/dist/jobs/assets/index-rtynx6wj.js.map +10 -0
  115. package/dist/jobs/assets/live-6k7s6358.js +4 -0
  116. package/dist/jobs/assets/live-6k7s6358.js.map +10 -0
  117. package/dist/jobs/assets/main-0jmeh6mq.js +6 -0
  118. package/dist/jobs/assets/main-0jmeh6mq.js.map +12 -0
  119. package/dist/jobs/assets/main-3yj6bv90.js +5 -0
  120. package/dist/jobs/assets/main-3yj6bv90.js.map +10 -0
  121. package/dist/jobs/assets/main-4g69fn3x.js +5 -0
  122. package/dist/jobs/assets/main-4g69fn3x.js.map +10 -0
  123. package/dist/jobs/assets/main-4gte3eqq.js +5 -0
  124. package/dist/jobs/assets/main-4gte3eqq.js.map +10 -0
  125. package/dist/jobs/assets/main-4j1fcevh.js +5 -0
  126. package/dist/jobs/assets/main-4j1fcevh.js.map +10 -0
  127. package/dist/jobs/assets/main-54qwkz28.css +1 -0
  128. package/dist/jobs/assets/main-5grjvsy7.js +5 -0
  129. package/dist/jobs/assets/main-5grjvsy7.js.map +11 -0
  130. package/dist/jobs/assets/main-5zbx60gq.js +5 -0
  131. package/dist/jobs/assets/main-5zbx60gq.js.map +11 -0
  132. package/dist/jobs/assets/main-9prgjhg4.js +5 -0
  133. package/dist/jobs/assets/main-9prgjhg4.js.map +10 -0
  134. package/dist/jobs/assets/main-a250ffk7.js +17 -0
  135. package/dist/jobs/assets/main-a250ffk7.js.map +115 -0
  136. package/dist/jobs/assets/main-d6ge7w08.js +5 -0
  137. package/dist/jobs/assets/main-d6ge7w08.js.map +10 -0
  138. package/dist/jobs/assets/main-gngzht43.js +5 -0
  139. package/dist/jobs/assets/main-gngzht43.js.map +10 -0
  140. package/dist/jobs/assets/main-hg0hrg8j.js +5 -0
  141. package/dist/jobs/assets/main-hg0hrg8j.js.map +10 -0
  142. package/dist/jobs/assets/main-hm1ng3yg.js +5 -0
  143. package/dist/jobs/assets/main-hm1ng3yg.js.map +12 -0
  144. package/dist/jobs/assets/main-jkvd92z9.js +5 -0
  145. package/dist/jobs/assets/main-jkvd92z9.js.map +10 -0
  146. package/dist/jobs/assets/main-jv5xqd13.js +5 -0
  147. package/dist/jobs/assets/main-jv5xqd13.js.map +21 -0
  148. package/dist/jobs/assets/main-jxre7w93.js +5 -0
  149. package/dist/jobs/assets/main-jxre7w93.js.map +23 -0
  150. package/dist/jobs/assets/main-kwmqkjfx.js +5 -0
  151. package/dist/jobs/assets/main-kwmqkjfx.js.map +11 -0
  152. package/dist/jobs/assets/main-n9cf6bxm.js +5 -0
  153. package/dist/jobs/assets/main-n9cf6bxm.js.map +11 -0
  154. package/dist/jobs/assets/main-pegp0ygb.js +5 -0
  155. package/dist/jobs/assets/main-pegp0ygb.js.map +10 -0
  156. package/dist/jobs/assets/main-qr573853.js +5 -0
  157. package/dist/jobs/assets/main-qr573853.js.map +12 -0
  158. package/dist/jobs/assets/main-rq97rdr4.js +4 -0
  159. package/dist/jobs/assets/main-rq97rdr4.js.map +22 -0
  160. package/dist/jobs/assets/main-szjdmydc.js +5 -0
  161. package/dist/jobs/assets/main-szjdmydc.js.map +13 -0
  162. package/dist/jobs/assets/main-tnbhrm9n.js +7 -0
  163. package/dist/jobs/assets/main-tnbhrm9n.js.map +11 -0
  164. package/dist/jobs/assets/main-ts19j4n0.js +5 -0
  165. package/dist/jobs/assets/main-ts19j4n0.js.map +25 -0
  166. package/dist/jobs/assets/main-w93x1dzs.js +5 -0
  167. package/dist/jobs/assets/main-w93x1dzs.js.map +10 -0
  168. package/dist/jobs/assets/sections-0ksdxs8m.css +1 -0
  169. package/dist/jobs/assets/sections-0y7w4fb4.js +4 -0
  170. package/dist/jobs/assets/sections-0y7w4fb4.js.map +10 -0
  171. package/dist/jobs/assets/sse-mn0t0fh7.js +5 -0
  172. package/dist/jobs/assets/sse-mn0t0fh7.js.map +11 -0
  173. package/dist/jobs/assets/sseChecks-t7tcm7ra.js +4 -0
  174. package/dist/jobs/assets/sseChecks-t7tcm7ra.js.map +10 -0
  175. package/dist/jobs/assets/validation-ysjfy072.js +4 -0
  176. package/dist/jobs/assets/validation-ysjfy072.js.map +9 -0
  177. package/dist/jobs/manifest.json +511 -0
  178. package/dts/docs/assets.d.ts +144 -0
  179. package/dts/docs/assets.d.ts.map +1 -0
  180. package/dts/docs/browser/config.d.ts +61 -0
  181. package/dts/docs/browser/config.d.ts.map +1 -0
  182. package/dts/docs/browser/index.d.ts +12 -0
  183. package/dts/docs/browser/index.d.ts.map +1 -0
  184. package/dts/docs/docsUi.d.ts +42 -0
  185. package/dts/docs/docsUi.d.ts.map +1 -0
  186. package/dts/docs/hosted.d.ts +22 -0
  187. package/dts/docs/hosted.d.ts.map +1 -0
  188. package/dts/docs/index.d.ts +18 -0
  189. package/dts/docs/index.d.ts.map +1 -0
  190. package/dts/docs/shell.d.ts +57 -0
  191. package/dts/docs/shell.d.ts.map +1 -0
  192. package/dts/docs/types.d.ts +137 -0
  193. package/dts/docs/types.d.ts.map +1 -0
  194. package/dts/index.d.ts +21 -0
  195. package/dts/index.d.ts.map +1 -0
  196. package/dts/jobs/assets.d.ts +157 -0
  197. package/dts/jobs/assets.d.ts.map +1 -0
  198. package/dts/jobs/browser/config.d.ts +67 -0
  199. package/dts/jobs/browser/config.d.ts.map +1 -0
  200. package/dts/jobs/browser/index.d.ts +10 -0
  201. package/dts/jobs/browser/index.d.ts.map +1 -0
  202. package/dts/jobs/browser/unauthorized.d.ts +9 -0
  203. package/dts/jobs/browser/unauthorized.d.ts.map +1 -0
  204. package/dts/jobs/index.d.ts +24 -0
  205. package/dts/jobs/index.d.ts.map +1 -0
  206. package/dts/jobs/jobsUi.d.ts +63 -0
  207. package/dts/jobs/jobsUi.d.ts.map +1 -0
  208. package/dts/jobs/shell.d.ts +77 -0
  209. package/dts/jobs/shell.d.ts.map +1 -0
  210. package/dts/jobs/types.d.ts +146 -0
  211. package/dts/jobs/types.d.ts.map +1 -0
  212. package/dts/kit/browser/shared.d.ts +10 -0
  213. package/dts/kit/browser/shared.d.ts.map +1 -0
  214. package/dts/kit/browser/unauthorized.d.ts +74 -0
  215. package/dts/kit/browser/unauthorized.d.ts.map +1 -0
  216. package/dts/kit/unauthorized.d.ts +47 -0
  217. package/dts/kit/unauthorized.d.ts.map +1 -0
  218. package/guides/docs.md +170 -0
  219. package/guides/jobs.md +1120 -0
  220. package/lib/docs/assets.ts +427 -0
  221. package/lib/docs/browser/config.ts +66 -0
  222. package/lib/docs/browser/index.ts +24 -0
  223. package/lib/docs/docsUi.ts +623 -0
  224. package/lib/docs/hosted.ts +31 -0
  225. package/lib/docs/index.ts +37 -0
  226. package/lib/docs/shell.ts +156 -0
  227. package/lib/docs/types.ts +149 -0
  228. package/lib/index.ts +27 -0
  229. package/lib/jobs/assets.ts +448 -0
  230. package/lib/jobs/browser/config.ts +65 -0
  231. package/lib/jobs/browser/index.ts +9 -0
  232. package/lib/jobs/browser/unauthorized.ts +11 -0
  233. package/lib/jobs/index.ts +41 -0
  234. package/lib/jobs/jobsUi.ts +709 -0
  235. package/lib/jobs/shell.ts +205 -0
  236. package/lib/jobs/types.ts +162 -0
  237. package/lib/kit/browser/shared.ts +11 -0
  238. package/lib/kit/browser/unauthorized.ts +114 -0
  239. package/lib/kit/unauthorized.ts +222 -0
  240. package/package.json +198 -4
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["app/jobs/api/jobs.ts", "app/jobs/screens/job/addJobForm.ts", "app/jobs/screens/job/jobErrors.ts", "app/jobs/screens/job/JobFormFields.tsx"],
4
+ "sourcesContent": [
5
+ "import type { QueryKey } from \"@tanstack/react-query\";\nimport type { ApiClient } from \"./client\";\nimport type {\n AddFlowBody,\n AddFlowResultDto,\n AddJobBody,\n AddJobResultDto,\n ChildrenDto,\n ClearJobLogsResultDto,\n DefinitionListDto,\n FailJobResultDto,\n JobDto,\n JobInclude,\n JobState,\n LogPageDto,\n PromoteJobResultDto,\n RetryJobResultDto,\n SortOrder,\n UpdateJobBody,\n} from \"./types\";\nimport { segment } from \"./client\";\nimport { queryKeys } from \"./queryKeys\";\nimport { assertShape, hasStrings, isJobState } from \"./shape\";\n\n/**\n * One job's reads and writes (`/queues/:queue/jobs/:id*`, adding a job, and\n * `/definitions`), with their query keys.\n *\n * Every key lives under `queryKeys.queue(q)`, so invalidating a queue\n * refreshes its jobs too. Job ids are arbitrary text (up to 1024 characters,\n * `/` and spaces included): each is percent-encoded as ONE path segment.\n */\n\n/** What `GET /queues/:queue/jobs/:id` includes by default (the API's own default, sent explicitly). */\nexport const DEFAULT_JOB_INCLUDE: readonly JobInclude[] = [\n \"data\",\n \"returnValue\",\n \"opts\",\n];\n\n/** States a job does not leave on its own: polling stops there. */\nexport const FINISHED_STATES: ReadonlySet<JobState> = new Set<JobState>([\n \"completed\",\n \"failed\",\n \"dead\",\n]);\n\n/** Whether a job has finished (completed, failed or dead). */\nexport function isFinished(state: JobState): boolean {\n return FINISHED_STATES.has(state);\n}\n\n/** The window and order of one log page. */\nexport interface LogsWindow {\n /** Lines skipped. */\n offset: number;\n /** Page size, at most `limits.maxLogPage`. */\n limit: number;\n /** Oldest (`asc`) or newest (`desc`) first. */\n order: SortOrder;\n}\n\n/** Query keys of one job, all under `[\"queue\", q]`. */\nexport const jobKeys = {\n /** Everything about one job: `[\"queue\", q, \"job\", id]`. */\n job: (queue: string, id: string) =>\n [...queryKeys.queue(queue), \"job\", id] as const,\n /** The job with its stack traces (the lazy section). */\n stacktrace: (queue: string, id: string) =>\n [...jobKeys.job(queue, id), \"stacktrace\"] as const,\n /** Every page of its logs, whatever the window: what clearing them invalidates. */\n logsAll: (queue: string, id: string) =>\n [...jobKeys.job(queue, id), \"logs\"] as const,\n /** One page of its logs. */\n logs: (queue: string, id: string, window: LogsWindow) =>\n [\n ...jobKeys.logsAll(queue, id),\n { offset: window.offset, limit: window.limit, order: window.order },\n ] as const,\n /** Its flow children. */\n children: (queue: string, id: string) =>\n [...jobKeys.job(queue, id), \"children\"] as const,\n /** `GET /definitions`. */\n definitions: () => [\"definitions\"] as const,\n};\n\n/**\n * What every job mutation invalidates: the queue (its lists and this job),\n * every queue list, and the overview.\n */\nexport function mutationInvalidation(queue: string): QueryKey[] {\n return [queryKeys.queue(queue), queryKeys.queuesAll, [\"overview\"]];\n}\n\n/** `/queues/:queue/jobs/:id`, each part percent-encoded. */\nexport function jobPath(queue: string, id: string): string {\n return `/queues/${segment(queue)}/jobs/${segment(id)}`;\n}\n\n/** The app path of a job's screen. */\nexport function jobScreenPath(queue: string, id: string): string {\n return `/queues/${encodeURIComponent(queue)}/jobs/${encodeURIComponent(id)}`;\n}\n\n/** The app path of a queue's screen. */\nexport function queueScreenPath(queue: string): string {\n return `/queues/${encodeURIComponent(queue)}`;\n}\n\n/** Whether a body has what a job screen cannot draw without: string `id`, `name` and `queue`, and a known `state`. */\nexport function isJobShape(fields: Readonly<Record<string, unknown>>): boolean {\n return hasStrings(fields, \"id\", \"name\", \"queue\") && isJobState(fields.state);\n}\n\n/**\n * `GET /queues/:queue/jobs/:id`. A body that is not a job (see\n * {@link isJobShape}) rejects with an `UNEXPECTED_RESPONSE` `ApiError`, so the\n * screen shows its error state rather than an empty job.\n */\nexport async function getJob(\n api: ApiClient,\n queue: string,\n id: string,\n include: readonly JobInclude[] = DEFAULT_JOB_INCLUDE,\n signal?: AbortSignal,\n): Promise<JobDto> {\n const path = jobPath(queue, id);\n const body = await api.request<unknown>(\"GET\", path, {\n query: { include },\n signal,\n });\n return assertShape<JobDto>(body, isJobShape, \"a job\", path);\n}\n\n/** `GET /queues/:queue/jobs/:id/logs`. */\nexport function getJobLogs(\n api: ApiClient,\n queue: string,\n id: string,\n window: LogsWindow,\n signal?: AbortSignal,\n): Promise<LogPageDto> {\n return api.request<LogPageDto>(\"GET\", `${jobPath(queue, id)}/logs`, {\n query: {\n offset: window.offset,\n limit: window.limit,\n order: window.order,\n },\n signal,\n });\n}\n\n/**\n * `DELETE /queues/:queue/jobs/:id/logs`: empties the job's log for good, so\n * its next line is its first again. `removed` is what the log held. 409\n * `JOB_ACTIVE` while a worker runs the job; 404 `JOB_NOT_FOUND`.\n */\nexport function clearJobLogs(\n api: ApiClient,\n queue: string,\n id: string,\n): Promise<ClearJobLogsResultDto> {\n return api.request<ClearJobLogsResultDto>(\n \"DELETE\",\n `${jobPath(queue, id)}/logs`,\n );\n}\n\n/** `GET /queues/:queue/jobs/:id/children`, with no include (the default). */\nexport function getJobChildren(\n api: ApiClient,\n queue: string,\n id: string,\n signal?: AbortSignal,\n): Promise<ChildrenDto> {\n return api.request<ChildrenDto>(\"GET\", `${jobPath(queue, id)}/children`, {\n signal,\n });\n}\n\n/** `PATCH /queues/:queue/jobs/:id`. */\nexport function updateJob(\n api: ApiClient,\n queue: string,\n id: string,\n body: UpdateJobBody,\n): Promise<JobDto> {\n return api.request<JobDto>(\"PATCH\", jobPath(queue, id), { body });\n}\n\n/** `DELETE /queues/:queue/jobs/:id` (204). */\nexport async function removeJob(\n api: ApiClient,\n queue: string,\n id: string,\n): Promise<void> {\n await api.request<undefined>(\"DELETE\", jobPath(queue, id));\n}\n\n/** `POST /queues/:queue/jobs/:id/retry`. */\nexport function retryJob(\n api: ApiClient,\n queue: string,\n id: string,\n resetAttempts: boolean,\n): Promise<RetryJobResultDto> {\n return api.request<RetryJobResultDto>(\"POST\", `${jobPath(queue, id)}/retry`, {\n body: { resetAttempts },\n });\n}\n\n/** `POST /queues/:queue/jobs/:id/promote` (bodiless; the client still sends the JSON content type). */\nexport function promoteJob(\n api: ApiClient,\n queue: string,\n id: string,\n): Promise<PromoteJobResultDto> {\n return api.request<PromoteJobResultDto>(\n \"POST\",\n `${jobPath(queue, id)}/promote`,\n );\n}\n\n/** Longest `reason` `POST /queues/:queue/jobs/:id/fail` accepts (its schema's `maxLength`). */\nexport const FAIL_REASON_MAX_LENGTH = 4096;\n\n/**\n * `POST /queues/:queue/jobs/:id/fail`: the job goes to `dead` with `reason`\n * as its failure, whatever attempts it has left. 409 for a job already\n * completed or dead.\n */\nexport function failJob(\n api: ApiClient,\n queue: string,\n id: string,\n reason: string,\n): Promise<FailJobResultDto> {\n return api.request<FailJobResultDto>(\"POST\", `${jobPath(queue, id)}/fail`, {\n body: { reason },\n });\n}\n\n/** `POST /queues/:queue/jobs`: 201 `added: true`, or 200 `added: false` when the `jobId` already existed. */\nexport function addJob(\n api: ApiClient,\n queue: string,\n body: AddJobBody,\n): Promise<AddJobResultDto> {\n return api.request<AddJobResultDto>(\n \"POST\",\n `/queues/${segment(queue)}/jobs`,\n {\n body,\n },\n );\n}\n\n/**\n * `POST /queues/:queue/flows`: a job and the jobs it waits on, each in its\n * own `queue` or its parent's. 201 when added; 200 `added: false` (with\n * `children: []`) when the top `jobId` already existed, nothing being added\n * below it.\n */\nexport function addFlow(\n api: ApiClient,\n queue: string,\n body: AddFlowBody,\n): Promise<AddFlowResultDto> {\n return api.request<AddFlowResultDto>(\n \"POST\",\n `/queues/${segment(queue)}/flows`,\n { body },\n );\n}\n\n/**\n * What adding a flow invalidates: each queue it wrote to (its jobs lists,\n * counts and detail, all under `[\"queue\", q]`), every queue list, and the\n * overview.\n */\nexport function flowInvalidation(queues: Iterable<string>): QueryKey[] {\n return [\n ...[...new Set(queues)].map((queue) => queryKeys.queue(queue)),\n queryKeys.queuesAll,\n queryKeys.overviewAll,\n ];\n}\n\n/** `GET /definitions`. */\nexport function listDefinitions(\n api: ApiClient,\n signal?: AbortSignal,\n): Promise<DefinitionListDto> {\n return api.request<DefinitionListDto>(\"GET\", \"/definitions\", { signal });\n}\n",
6
+ "import type { AddJobBody, AddJobOptions } from \"../../api/types\";\nimport type { JsonEditorState } from \"../../components/jsonParse\";\nimport { MAX_JOB_ID_LENGTH } from \"@kingsleyweb/bun-jobs/api/contract\";\nimport { jsonEditorState } from \"../../components/jsonParse\";\n\n/** The add-job form's shape, its client-side checks, and its request body. */\n\n/** When the job may first run. */\nexport type AddJobTiming = \"now\" | \"delay\" | \"runAt\";\n\n/** What the add form holds. */\nexport interface AddJobForm {\n /** The job name. */\n name: string;\n /** The payload editor's state. */\n data: JsonEditorState;\n /** A caller-chosen id; `\"\"` lets the queue mint one. */\n jobId: string;\n /** Priority; `undefined` for the default. */\n priority: number | undefined;\n /** Run now, after a delay, or at a time: `delay` and `runAt` are exclusive. */\n timing: AddJobTiming;\n /** The delay in ms, with `timing: \"delay\"`. */\n delay: number | undefined;\n /** The run time (epoch ms), with `timing: \"runAt\"`. */\n runAt: number | undefined;\n /** Attempts allowed in total; `undefined` for the default. */\n attempts: number | undefined;\n /** Fixed delay between attempts, ms; `undefined` for the default. */\n backoff: number | undefined;\n /** Processor timeout, ms; `undefined` for the default. */\n timeout: number | undefined;\n}\n\n/** What {@link emptyAddForm} starts from. */\nexport interface EmptyAddFormOptions {\n /** `MetaDto.addableNames`: the only name is preselected; `null` (any name) or several leave it empty. */\n addableNames: readonly string[] | null;\n /** `limits.maxJobDataBytes`, metered by the data editor. Defaults to no limit. */\n maxBytes?: number;\n}\n\n/** A fresh form: data `{}`, every option at its default, the name preselected when only one is addable. */\nexport function emptyAddForm({\n addableNames,\n maxBytes,\n}: EmptyAddFormOptions): AddJobForm {\n return {\n name: addableNames?.length === 1 ? addableNames[0] : \"\",\n data: jsonEditorState(\"{}\", { maxBytes }),\n jobId: \"\",\n priority: undefined,\n timing: \"now\",\n delay: undefined,\n runAt: undefined,\n attempts: undefined,\n backoff: undefined,\n timeout: undefined,\n };\n}\n\n/** A field of {@link AddJobForm} that can carry an error, keyed as the API's field errors are. */\nexport type AddJobField =\n | \"name\"\n | \"data\"\n | \"opts.jobId\"\n | \"opts.priority\"\n | \"opts.delay\"\n | \"opts.runAt\"\n | \"opts.attempts\"\n | \"opts.backoff\"\n | \"opts.timeout\";\n\n/** Client-side problems, per field. */\nexport type AddJobErrors = Partial<Record<AddJobField, string>>;\n\n/** An integer at least `min`, or `undefined` (left out). */\nfunction checkInteger(\n value: number | undefined,\n min: number,\n): string | undefined {\n if (value === undefined) {\n return undefined;\n }\n if (!Number.isInteger(value)) {\n return \"Enter a whole number.\";\n }\n return value < min ? `Enter ${min} or more.` : undefined;\n}\n\n/** Why a caller-chosen job id would be refused, or `undefined`. */\nexport function checkJobId(jobId: string): string | undefined {\n if (jobId === \"\") {\n return undefined;\n }\n if (jobId.length > MAX_JOB_ID_LENGTH) {\n return `At most ${MAX_JOB_ID_LENGTH} characters (this one has ${jobId.length}).`;\n }\n if (jobId.startsWith(\".\")) {\n return \"An id cannot start with a dot.\";\n }\n // Control characters are refused by bun-jobs' `assertJobId`.\n // eslint-disable-next-line no-control-regex\n if (/[\\u0000-\\u001F\\u007F]/.test(jobId)) {\n return \"An id cannot contain control characters.\";\n }\n return undefined;\n}\n\n/** Checks the form the way the API would. */\nexport function validateAddForm(form: AddJobForm): AddJobErrors {\n const errors: AddJobErrors = {};\n if (form.name.trim() === \"\") {\n errors.name = \"Pick or enter a job name.\";\n } else if (form.name.length > 200) {\n errors.name = \"At most 200 characters.\";\n }\n if (form.data.error) {\n errors.data = \"The data is not valid JSON.\";\n } else if (form.data.overLimit) {\n errors.data = \"The data is larger than the API accepts.\";\n } else if (form.data.value === undefined) {\n errors.data = \"Enter the data as JSON (null is allowed).\";\n }\n const jobId = checkJobId(form.jobId);\n if (jobId) {\n errors[\"opts.jobId\"] = jobId;\n }\n if (form.priority !== undefined && !Number.isFinite(form.priority)) {\n errors[\"opts.priority\"] = \"Enter a number.\";\n }\n if (form.timing === \"delay\") {\n errors[\"opts.delay\"] =\n form.delay === undefined\n ? \"Enter the delay in milliseconds.\"\n : checkInteger(form.delay, 0);\n }\n if (form.timing === \"runAt\" && form.runAt === undefined) {\n errors[\"opts.runAt\"] = \"Pick when it should run.\";\n }\n errors[\"opts.attempts\"] = checkInteger(form.attempts, 1);\n errors[\"opts.backoff\"] = checkInteger(form.backoff, 0);\n errors[\"opts.timeout\"] = checkInteger(form.timeout, 0);\n for (const key of Object.keys(errors) as AddJobField[]) {\n if (errors[key] === undefined) {\n delete errors[key];\n }\n }\n return errors;\n}\n\n/** The request body for a valid {@link AddJobForm}; empty options are left out. */\nexport function addBody(form: AddJobForm): AddJobBody {\n const opts: AddJobOptions = {\n ...(form.jobId === \"\" ? {} : { jobId: form.jobId }),\n ...(form.priority === undefined ? {} : { priority: form.priority }),\n ...(form.timing === \"delay\" && form.delay !== undefined\n ? { delay: form.delay }\n : {}),\n ...(form.timing === \"runAt\" && form.runAt !== undefined\n ? { runAt: form.runAt }\n : {}),\n ...(form.attempts === undefined ? {} : { attempts: form.attempts }),\n ...(form.backoff === undefined ? {} : { backoff: form.backoff }),\n ...(form.timeout === undefined ? {} : { timeout: form.timeout }),\n };\n return {\n name: form.name.trim(),\n data: form.data.value,\n ...(Object.keys(opts).length > 0 ? { opts } : {}),\n };\n}\n",
7
+ "import type { JobState } from \"../../api/types\";\nimport { JOB_STATES } from \"../../api/contract\";\nimport { ApiError, isApiError } from \"../../api/errors\";\nimport { STATE_LABELS } from \"../../format\";\n\n/** A job action whose failures get a plain-language explanation. */\nexport type JobAction =\n \"retry\" | \"promote\" | \"remove\" | \"update\" | \"add\" | \"fail\" | \"clearLogs\";\n\n/** The past participle of each action, for \"cannot be …\". */\nconst VERBS: Readonly<Record<JobAction, string>> = {\n retry: \"retried\",\n promote: \"promoted\",\n remove: \"removed\",\n update: \"updated\",\n add: \"added\",\n fail: \"failed\",\n clearLogs: \"cleared of its logs\",\n};\n\n/** What the action needs, said after a state conflict. */\nconst REQUIREMENTS: Readonly<Record<JobAction, string>> = {\n retry: \"Only a completed, retrying, dead or delayed job can be retried.\",\n promote: \"Only a delayed job can be promoted.\",\n remove: \"Refresh to see where it is now.\",\n update:\n \"A new run time applies only to a waiting or delayed job, and “only in” limits the change to the states you picked.\",\n add: \"\",\n fail: \"Only a job that has not completed or died can be failed.\",\n clearLogs: \"Refresh to see where it is now.\",\n};\n\n/** The job's state from a problem's `context.state`, when it names one. */\nexport function conflictState(error: ApiError): JobState | null {\n const state = error.context.state;\n return typeof state === \"string\" &&\n (JOB_STATES as readonly string[]).includes(state)\n ? (state as JobState)\n : null;\n}\n\n/**\n * The plain-language explanation of a failed job action, or `null` when the\n * API's own detail says it well enough.\n */\nexport function explainJobError(\n error: ApiError,\n action: JobAction,\n): string | null {\n switch (error.code) {\n case \"JOB_ACTIVE\":\n return action === \"clearLogs\"\n ? \"It's running: a worker picked this job up and is still writing its log, so the log cannot be cleared now. Clear it once the job finishes.\"\n : \"It's running: a worker is processing this job right now, so it cannot be removed. Wait for it to finish, then try again.\";\n case \"JOB_STATE_CONFLICT\": {\n const state = conflictState(error);\n if (action === \"fail\" && state === \"active\") {\n // The API buries an active job only under the lock it read it with.\n return \"A worker claimed the job again while it was being failed, so nothing changed. Refresh and try again.\";\n }\n const where = state\n ? `The job is ${STATE_LABELS[state].toLowerCase()} now`\n : \"The job is in another state now\";\n return `${where}, so it cannot be ${VERBS[action]}. ${REQUIREMENTS[action]}`.trim();\n }\n case \"JOB_NOT_FOUND\":\n return \"The job no longer exists: it finished and was cleaned up, or somebody removed it.\";\n case \"NAME_NOT_ADDABLE\": {\n const name = error.context.name;\n return `Jobs named “${typeof name === \"string\" ? name : \"this\"}” may not be added over this API. Pick one of the names it allows.`;\n }\n case \"SERIALIZATION\":\n return \"The data cannot be stored: it is not serialisable for this queue's backend.\";\n default:\n return null;\n }\n}\n\n/**\n * The same error with its detail replaced by the explanation, so a toast or\n * a `ProblemBanner` reads it while keeping the code, status and context.\n * Anything that is not an `ApiError`, or has no better explanation, is\n * returned unchanged.\n */\nexport function friendlyJobError(error: unknown, action: JobAction): unknown {\n if (!isApiError(error)) {\n return error;\n }\n const detail = explainJobError(error, action);\n if (detail === null) {\n return error;\n }\n return new ApiError({\n kind: error.kind,\n status: error.status,\n code: error.code,\n title: error.title,\n detail,\n type: error.type,\n issues: error.issues,\n context: error.context,\n instance: error.instance,\n cause: error,\n });\n}\n\n/** Runs an API call, rethrowing its failure through {@link friendlyJobError}. */\nexport async function withFriendlyErrors<T>(\n action: JobAction,\n run: () => Promise<T>,\n): Promise<T> {\n try {\n return await run();\n } catch (error) {\n throw friendlyJobError(error, action);\n }\n}\n",
8
+ "import type { AddJobField, AddJobForm, AddJobTiming } from \"./addJobForm\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useState } from \"react\";\nimport { MAX_JOB_ID_LENGTH } from \"../../api/contract\";\nimport { jobKeys, listDefinitions } from \"../../api/jobs\";\nimport { Field } from \"../../components/Field\";\nimport {\n DateTimeInput,\n NumberInput,\n Select,\n TextInput,\n} from \"../../components/inputs\";\nimport { JsonEditor } from \"../../components/JsonEditor\";\nimport { useApiClient } from \"../../context\";\nimport { useCan } from \"../../meta/hooks\";\n\n/**\n * The fields of one job to add, shared by the add-job dialog and each job of\n * the add-flow dialog: its name, its data and its options.\n */\n\n/** The timing choices. */\nconst TIMING_OPTIONS = [\n { value: \"now\", label: \"Now\" },\n { value: \"delay\", label: \"After a delay\" },\n { value: \"runAt\", label: \"At a time\" },\n] as const satisfies readonly { value: AddJobTiming; label: string }[];\n\n/**\n * Select values that cannot be job names in practice (bun-jobs refuses\n * control characters in names' ids, and no sane name starts with NUL):\n * \"nothing picked yet\" and \"type another name\".\n */\nconst PICK_NAME = \"\\u0000pick\";\n/** See {@link PICK_NAME}. */\nconst OTHER_NAME = \"\\u0000other\";\n\n/** Props of {@link JobNameField}. */\nexport interface JobNameFieldProps {\n /** The chosen name. */\n value: string;\n /** Called with a new name. */\n onChange: (name: string) => void;\n /** The error to show under it. */\n error: string | undefined;\n /** `MetaDto.addableNames`: `null` for any name. */\n addableNames: string[] | null;\n}\n\n/**\n * The name picker: the allowed names when the API lists them; otherwise the\n * defined names (from `/definitions`) plus free text, since any name goes.\n */\nexport function JobNameField({\n value,\n onChange,\n error,\n addableNames,\n}: JobNameFieldProps) {\n const api = useApiClient();\n const canDefinitions = useCan(\"definitions.list\");\n const anyName = addableNames === null;\n const definitions = useQuery({\n queryKey: jobKeys.definitions(),\n queryFn: ({ signal }) => listDefinitions(api, signal),\n enabled: anyName && canDefinitions,\n staleTime: 60_000,\n });\n const [typing, setTyping] = useState(false);\n\n if (!anyName) {\n return (\n <Field\n label=\"Name\"\n required\n error={error}\n >\n <Select\n options={[\n { value: \"\", label: \"Pick a name…\", disabled: true },\n ...addableNames.map((name) => ({ value: name })),\n ]}\n value={value}\n onChange={onChange}\n />\n </Field>\n );\n }\n\n const defined = definitions.data?.items.map((item) => item.name) ?? [];\n const freeText = typing || defined.length === 0;\n return (\n <>\n {defined.length > 0 && (\n <Field\n label=\"Name\"\n required\n hint=\"Any name is accepted; the defined ones are listed.\"\n error={freeText ? undefined : error}\n >\n <Select\n options={[\n { value: PICK_NAME, label: \"Pick a name…\", disabled: true },\n ...defined.map((name) => ({ value: name })),\n { value: OTHER_NAME, label: \"Another name…\" },\n ]}\n value={\n freeText\n ? OTHER_NAME\n : defined.includes(value)\n ? value\n : PICK_NAME\n }\n onChange={(chosen) => {\n if (chosen === OTHER_NAME) {\n setTyping(true);\n onChange(\"\");\n } else {\n setTyping(false);\n onChange(chosen);\n }\n }}\n />\n </Field>\n )}\n {freeText && (\n <Field\n label={defined.length > 0 ? \"Another name\" : \"Name\"}\n required\n hint={\n defined.length > 0\n ? undefined\n : \"Any name is accepted. A worker must handle it for the job to run.\"\n }\n error={error}\n >\n <TextInput\n value={value}\n onChange={onChange}\n maxLength={200}\n autoComplete=\"off\"\n spellCheck={false}\n />\n </Field>\n )}\n </>\n );\n}\n\n/** Props of {@link JobDataField}. */\nexport interface JobDataFieldProps {\n /** The editor's text. */\n value: string;\n /** Called with the editor's new state. */\n onChange: (data: AddJobForm[\"data\"]) => void;\n /** The error to show under it. */\n error: string | undefined;\n /** `limits.maxJobDataBytes`, metered as the data is typed. */\n maxBytes: number;\n /** Visible rows. Defaults to 8. */\n rows?: number;\n}\n\n/** The job's data, as JSON (`null` allowed). */\nexport function JobDataField({\n value,\n onChange,\n error,\n maxBytes,\n rows = 8,\n}: JobDataFieldProps) {\n return (\n <Field\n label=\"Data\"\n required\n hint=\"JSON; null is allowed.\"\n error={error}\n >\n <JsonEditor\n value={value}\n onChange={onChange}\n maxBytes={maxBytes}\n rows={rows}\n />\n </Field>\n );\n}\n\n/** Props of {@link JobOptionsFields}. */\nexport interface JobOptionsFieldsProps {\n /** The form whose options are shown. */\n form: AddJobForm;\n /** Called with the fields that changed. */\n patch: (next: Partial<AddJobForm>) => void;\n /** The error to show under a field, if any. */\n fieldError: (field: AddJobField) => string | undefined;\n /** The run-time input's own problem (out of range, unparseable), or `undefined` once it has none. */\n onRunAtProblem: (problem: string | undefined) => void;\n}\n\n/** The options `POST /queues/:queue/jobs` accepts, in a fieldset of their own. */\nexport function JobOptionsFields({\n form,\n patch,\n fieldError,\n onRunAtProblem,\n}: JobOptionsFieldsProps) {\n return (\n <fieldset className=\"job-form-options\">\n <legend>Options</legend>\n <Field\n label=\"Job id\"\n hint={`Optional, at most ${MAX_JOB_ID_LENGTH} characters. An id that already exists returns that job instead.`}\n error={fieldError(\"opts.jobId\")}\n >\n <TextInput\n value={form.jobId}\n onChange={(jobId) => patch({ jobId })}\n maxLength={MAX_JOB_ID_LENGTH}\n autoComplete=\"off\"\n spellCheck={false}\n />\n </Field>\n <Field\n label=\"Priority\"\n hint=\"Lower runs first.\"\n error={fieldError(\"opts.priority\")}\n >\n <NumberInput\n value={form.priority}\n onChange={(priority) => patch({ priority })}\n step=\"any\"\n />\n </Field>\n <Field label=\"Run\">\n <Select\n options={TIMING_OPTIONS}\n value={form.timing}\n onChange={(timing) => patch({ timing })}\n />\n </Field>\n {form.timing === \"delay\" && (\n <Field\n label=\"Delay (ms)\"\n required\n error={fieldError(\"opts.delay\")}\n >\n <NumberInput\n value={form.delay}\n onChange={(delay) => patch({ delay })}\n min={0}\n />\n </Field>\n )}\n {form.timing === \"runAt\" && (\n <Field\n label=\"Run at\"\n required\n error={fieldError(\"opts.runAt\")}\n >\n <DateTimeInput\n value={form.runAt}\n onChange={(runAt) => patch({ runAt })}\n onProblem={onRunAtProblem}\n />\n </Field>\n )}\n <Field\n label=\"Attempts\"\n hint=\"Attempts allowed in total, 1 or more.\"\n error={fieldError(\"opts.attempts\")}\n >\n <NumberInput\n value={form.attempts}\n onChange={(attempts) => patch({ attempts })}\n min={1}\n />\n </Field>\n <Field\n label=\"Backoff (ms)\"\n hint=\"Fixed delay between attempts.\"\n error={fieldError(\"opts.backoff\")}\n >\n <NumberInput\n value={form.backoff}\n onChange={(backoff) => patch({ backoff })}\n min={0}\n />\n </Field>\n <Field\n label=\"Timeout (ms)\"\n hint=\"How long one attempt may run.\"\n error={fieldError(\"opts.timeout\")}\n >\n <NumberInput\n value={form.timeout}\n onChange={(timeout) => patch({ timeout })}\n min={0}\n />\n </Field>\n </fieldset>\n );\n}\n"
9
+ ],
10
+ "mappings": "uHAkCO,IAAM,GAA6C,CACxD,OACA,cACA,MACF,EAGa,EAAyC,IAAI,IAAc,CACtE,YACA,SACA,MACF,CAAC,EAGM,SAAS,EAAU,CAAC,EAA0B,CACnD,OAAO,EAAgB,IAAI,CAAK,EAc3B,IAAM,GAAU,CAErB,IAAK,CAAC,EAAe,IACnB,CAAC,GAAG,EAAU,MAAM,CAAK,EAAG,MAAO,CAAE,EAEvC,WAAY,CAAC,EAAe,IAC1B,CAAC,GAAG,GAAQ,IAAI,EAAO,CAAE,EAAG,YAAY,EAE1C,QAAS,CAAC,EAAe,IACvB,CAAC,GAAG,GAAQ,IAAI,EAAO,CAAE,EAAG,MAAM,EAEpC,KAAM,CAAC,EAAe,EAAY,IAChC,CACE,GAAG,GAAQ,QAAQ,EAAO,CAAE,EAC5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UAAS,CAAC,EAC1C,IAAK,EACP,EACA,EACF,EAAC,EAAD,CACE,MAAM,eACN,KAAK,gCACL,MAAO,EAAW,cAAc,EAHlC,SAKE,EAAC,EAAD,CACE,MAAO,EAAK,QACZ,SAAU,CAAC,IAAY,EAAM,CAAE,SAAQ,CAAC,EACxC,IAAK,EACP,EACA,EACF,EAAC,EAAD,CACE,MAAM,eACN,KAAK,gCACL,MAAO,EAAW,cAAc,EAHlC,SAKE,EAAC,EAAD,CACE,MAAO,EAAK,QACZ,SAAU,CAAC,IAAY,EAAM,CAAE,SAAQ,CAAC,EACxC,IAAK,EACP,EACA,GACF",
11
+ "debugId": "D5FF077F8955C70A64756E2164756E21",
12
+ "names": []
13
+ }
@@ -0,0 +1,7 @@
1
+ import{c,g,N,e,t,s,mr,wt}from"./main-a250ffk7.js";class v extends Error{offset;constructor(r,n){super(r);this.offset=n}}function O(r,n){return n>=r.length?"end of input":`'${r[n]===`
2
+ `?"\\n":r[n]}'`}function y(r){let n=0,o=()=>{while(n<r.length&&(r[n]===" "||r[n]==="\t"||r[n]===`
3
+ `||r[n]==="\r"))n++},i=(a)=>{throw new v(`Expected ${a} but found ${O(r,n)}`,n)},l=(a)=>{for(let f=0;f<a.length;f++){if(r[n]!==a[f])i(`'${a}'`);n++}},d=()=>{n++;while(n<r.length){let a=r[n];if(a==='"'){n++;return}if(a==="\\"){let f=r[n+1];if(f==="u"){if(!/^[0-9a-f]{4}$/i.test(r.slice(n+2,n+6)))n+=2,i("four hex digits after \\u");n+=6;continue}if(f===void 0||!'"\\/bfnrt'.includes(f))n++,i("a valid escape");n+=2;continue}if(a<" ")throw new v("Control characters must be escaped in strings",n);n++}throw new v("Unterminated string",n)},J=()=>{let a=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:e[+-]?\d+)?/i.exec(r.slice(n,n+400));if(!a)i("a number");n+=a[0].length},m=()=>{o();let a=r[n];if(a==="{"){if(n++,o(),r[n]==="}"){n++;return}for(;;){if(o(),r[n]!=='"')i("a property name in double quotes");if(d(),o(),r[n]!==":")i("':'");if(n++,m(),o(),r[n]===","){n++;continue}if(r[n]==="}"){n++;return}i("',' or '}'")}}if(a==="["){if(n++,o(),r[n]==="]"){n++;return}for(;;){if(m(),o(),r[n]===","){n++;continue}if(r[n]==="]"){n++;return}i("',' or ']'")}}if(a==='"'){d();return}if(a==="t"){l("true");return}if(a==="f"){l("false");return}if(a==="n"){l("null");return}if(a==="-"||a!==void 0&&a>="0"&&a<="9"){J();return}i("a value")};if(m(),o(),n<r.length)i("end of input")}function z(r,n){let o=1,i=0,l=Math.min(n,r.length);for(let d=0;d<l;d++)if(r.charCodeAt(d)===10)o++,i=d+1;return{line:o,column:l-i+1}}function I(r){try{return{ok:!0,value:JSON.parse(r)}}catch(n){let o=n instanceof Error?n.message:String(n),i=0;try{y(r)}catch(l){if(l instanceof v)o=l.message,i=l.offset}return{ok:!1,error:{message:o,offset:i,...z(r,i)}}}}function F(r){return new TextEncoder().encode(r).byteLength}function p(r){if(r<1024)return`${r} B`;if(r<1048576)return`${(r/1024).toFixed(1)} KiB`;return`${(r/1048576).toFixed(1)} MiB`}function Ue(r,{maxBytes:n,allowEmpty:o=!1}={}){let i=F(r),l=n!==void 0&&i>n;if(o&&r.trim()==="")return{text:r,value:void 0,valid:!l,error:null,bytes:i,overLimit:l};let d=I(r);return d.ok?{text:r,value:d.value,valid:!l,error:null,bytes:i,overLimit:l}:{text:r,value:void 0,valid:!1,error:d.error,bytes:i,overLimit:l}}function ct({value:r,onChange:n,maxBytes:o,allowEmpty:i=!1,rows:l=10,"aria-label":d,id:J,readOnly:m=!1,disabled:a=!1,placeholder:f,className:P}){let h=mr(),L=c(),E=J??h?.id??L,j=`${E}-json-error`,k=`${E}-json-size`,u=g(()=>Ue(r,{maxBytes:o,allowEmpty:i}),[r,o,i]),w=(b)=>n(Ue(b,{maxBytes:o,allowEmpty:i})),S=(b)=>{if(u.error===null&&u.value!==void 0)w(JSON.stringify(u.value,null,b))},C=!m&&!a&&u.error===null&&u.value!==void 0;return t("div",{className:N("json-editor",!u.valid&&"json-editor-invalid",P),children:[e("textarea",{id:E,className:"input json-editor-text",rows:l,value:r,placeholder:f,readOnly:m,disabled:a,spellCheck:!1,autoCapitalize:"off",autoComplete:"off","aria-label":d,"aria-invalid":!u.valid||h?.["aria-invalid"]||void 0,"aria-required":h?.required,"aria-describedby":wt(h?.["aria-describedby"],u.error&&j,k),onChange:(b)=>w(b.target.value)}),t("div",{className:"json-editor-bar",children:[u.error?t("p",{id:j,className:"json-editor-error",children:["Line ",u.error.line,", column ",u.error.column,":"," ",u.error.message]}):e("p",{className:"json-editor-ok muted",children:"Valid JSON"}),t("span",{id:k,className:N("json-editor-size",u.overLimit&&"is-over"),children:[o!==void 0&&e("meter",{className:"json-editor-meter",min:0,max:o,low:o*0.8,high:o,optimum:0,value:Math.min(u.bytes,o),"aria-hidden":"true"}),o===void 0?p(u.bytes):u.overLimit?`${p(u.bytes)} of ${p(o)}: over the limit by ${p(u.bytes-o)}`:`${p(u.bytes)} of ${p(o)}`]}),!m&&t("span",{className:"json-editor-actions",children:[e(s,{size:"sm",disabled:!C,onClick:()=>S(2),children:"Format"}),e(s,{size:"sm",disabled:!C,onClick:()=>S(void 0),children:"Minify"})]})]})]})}
4
+ export{Ue,ct};
5
+
6
+ //# debugId=F2BC7A909EE74D4464756E2164756E21
7
+ //# sourceMappingURL=main-tnbhrm9n.js.map
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["app/jobs/components/jsonParse.ts", "app/jobs/components/JsonEditor.tsx"],
4
+ "sourcesContent": [
5
+ "/**\n * JSON parsing that says *where* it failed. `JSON.parse` does the parsing;\n * only when it throws does a small scanner walk the text to find the\n * offending position, because engines disagree on whether (and how) their\n * messages carry one — JavaScriptCore's carry none at all.\n */\n\n/** Where and why a JSON text failed to parse. */\nexport interface JsonParseError {\n /** What is wrong, e.g. \"Expected ',' or '}'\". */\n message: string;\n /** 1-based line. */\n line: number;\n /** 1-based column (in UTF-16 code units). */\n column: number;\n /** 0-based offset into the text. */\n offset: number;\n}\n\n/** The outcome of {@link parseJsonText}. */\nexport type JsonParseResult =\n | {\n /** It parsed. */\n ok: true;\n /** The parsed value. */\n value: unknown;\n }\n | {\n /** It did not parse. */\n ok: false;\n /** Where and why. */\n error: JsonParseError;\n };\n\n/** Thrown inside the scanner with the failing offset. */\nclass ScanError extends Error {\n /** 0-based offset. */\n readonly offset: number;\n\n constructor(message: string, offset: number) {\n super(message);\n this.offset = offset;\n }\n}\n\n/** Describes the character at `index` for a message. */\nfunction describe(text: string, index: number): string {\n return index >= text.length\n ? \"end of input\"\n : `'${text[index] === \"\\n\" ? \"\\\\n\" : text[index]}'`;\n}\n\n/**\n * Walks `text` as JSON (RFC 8259) and throws a {@link ScanError} at the\n * first position that is not valid. Returns normally for valid JSON.\n */\nfunction scan(text: string): void {\n let index = 0;\n\n const skipWhitespace = () => {\n while (\n index < text.length &&\n (text[index] === \" \" ||\n text[index] === \"\\t\" ||\n text[index] === \"\\n\" ||\n text[index] === \"\\r\")\n ) {\n index++;\n }\n };\n\n const fail = (expected: string): never => {\n throw new ScanError(\n `Expected ${expected} but found ${describe(text, index)}`,\n index,\n );\n };\n\n const literal = (word: string) => {\n for (let i = 0; i < word.length; i++) {\n if (text[index] !== word[i]) {\n fail(`'${word}'`);\n }\n index++;\n }\n };\n\n const string = () => {\n index++; // opening quote\n while (index < text.length) {\n const char = text[index];\n if (char === '\"') {\n index++;\n return;\n }\n if (char === \"\\\\\") {\n const next = text[index + 1];\n if (next === \"u\") {\n if (!/^[0-9a-f]{4}$/i.test(text.slice(index + 2, index + 6))) {\n index += 2;\n fail(\"four hex digits after \\\\u\");\n }\n index += 6;\n continue;\n }\n if (next === undefined || !'\"\\\\/bfnrt'.includes(next)) {\n index++;\n fail(\"a valid escape\");\n }\n index += 2;\n continue;\n }\n if (char < \" \") {\n throw new ScanError(\n \"Control characters must be escaped in strings\",\n index,\n );\n }\n index++;\n }\n throw new ScanError(\"Unterminated string\", index);\n };\n\n const number = () => {\n const match = /^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:e[+-]?\\d+)?/i.exec(\n text.slice(index, index + 400),\n );\n if (!match) {\n fail(\"a number\");\n }\n index += match![0].length;\n };\n\n const value = (): void => {\n skipWhitespace();\n const char = text[index];\n if (char === \"{\") {\n index++;\n skipWhitespace();\n if (text[index] === \"}\") {\n index++;\n return;\n }\n for (;;) {\n skipWhitespace();\n if (text[index] !== '\"') {\n fail(\"a property name in double quotes\");\n }\n string();\n skipWhitespace();\n if (text[index] !== \":\") {\n fail(\"':'\");\n }\n index++;\n value();\n skipWhitespace();\n if (text[index] === \",\") {\n index++;\n continue;\n }\n if (text[index] === \"}\") {\n index++;\n return;\n }\n fail(\"',' or '}'\");\n }\n }\n if (char === \"[\") {\n index++;\n skipWhitespace();\n if (text[index] === \"]\") {\n index++;\n return;\n }\n for (;;) {\n value();\n skipWhitespace();\n if (text[index] === \",\") {\n index++;\n continue;\n }\n if (text[index] === \"]\") {\n index++;\n return;\n }\n fail(\"',' or ']'\");\n }\n }\n if (char === '\"') {\n string();\n return;\n }\n if (char === \"t\") {\n literal(\"true\");\n return;\n }\n if (char === \"f\") {\n literal(\"false\");\n return;\n }\n if (char === \"n\") {\n literal(\"null\");\n return;\n }\n if (char === \"-\" || (char !== undefined && char >= \"0\" && char <= \"9\")) {\n number();\n return;\n }\n fail(\"a value\");\n };\n\n value();\n skipWhitespace();\n if (index < text.length) {\n fail(\"end of input\");\n }\n}\n\n/** 1-based line and column of an offset. */\nexport function lineColumn(\n text: string,\n offset: number,\n): { line: number; column: number } {\n let line = 1;\n let lineStart = 0;\n const end = Math.min(offset, text.length);\n for (let i = 0; i < end; i++) {\n if (text.charCodeAt(i) === 10) {\n line++;\n lineStart = i + 1;\n }\n }\n return { line, column: end - lineStart + 1 };\n}\n\n/** Parses JSON; on failure, reports the message with its line and column. */\nexport function parseJsonText(text: string): JsonParseResult {\n try {\n return { ok: true, value: JSON.parse(text) as unknown };\n } catch (caught) {\n let message = caught instanceof Error ? caught.message : String(caught);\n let offset = 0;\n try {\n scan(text);\n // The scanner accepted what JSON.parse refused (should not happen);\n // keep the engine's message without a position.\n } catch (scanned) {\n if (scanned instanceof ScanError) {\n message = scanned.message;\n offset = scanned.offset;\n }\n }\n return {\n ok: false,\n error: { message, offset, ...lineColumn(text, offset) },\n };\n }\n}\n\n/** The UTF-8 size of a text, in bytes (what the API measures against its limits). */\nexport function byteLength(text: string): number {\n return new TextEncoder().encode(text).byteLength;\n}\n\n/** Formats a byte count: `512 B`, `1.5 KiB`, `2.0 MiB`. */\nexport function formatBytes(bytes: number): string {\n if (bytes < 1024) {\n return `${bytes} B`;\n }\n if (bytes < 1024 * 1024) {\n return `${(bytes / 1024).toFixed(1)} KiB`;\n }\n return `${(bytes / (1024 * 1024)).toFixed(1)} MiB`;\n}\n\n/** The editor's state, as `JsonEditor` reports it on every change. */\nexport interface JsonEditorState {\n /** The raw text. */\n text: string;\n /** The parsed value; `undefined` when the text does not parse (or is empty). */\n value: unknown;\n /** Whether the text parses (or is empty and `allowEmpty`) and fits `maxBytes`. The one flag a submit button needs. */\n valid: boolean;\n /** The parse error with its line and column, or `null`. */\n error: JsonParseError | null;\n /** The text's UTF-8 size. */\n bytes: number;\n /** Whether `bytes` exceeds `maxBytes`. */\n overLimit: boolean;\n}\n\n/** Options of {@link jsonEditorState}. */\nexport interface JsonEditorStateOptions {\n /** The size limit, bytes. */\n maxBytes?: number;\n /** Whether empty (whitespace-only) text is valid, as `undefined`. Defaults to `false`. */\n allowEmpty?: boolean;\n}\n\n/**\n * Works out a {@link JsonEditorState} from text, e.g. to seed a form's\n * validity before the first edit.\n */\nexport function jsonEditorState(\n text: string,\n { maxBytes, allowEmpty = false }: JsonEditorStateOptions = {},\n): JsonEditorState {\n const bytes = byteLength(text);\n const overLimit = maxBytes !== undefined && bytes > maxBytes;\n if (allowEmpty && text.trim() === \"\") {\n return {\n text,\n value: undefined,\n valid: !overLimit,\n error: null,\n bytes,\n overLimit,\n };\n }\n const parsed = parseJsonText(text);\n return parsed.ok\n ? {\n text,\n value: parsed.value,\n valid: !overLimit,\n error: null,\n bytes,\n overLimit,\n }\n : {\n text,\n value: undefined,\n valid: false,\n error: parsed.error,\n bytes,\n overLimit,\n };\n}\n",
6
+ "import type { JsonEditorState, JsonEditorStateOptions } from \"./jsonParse\";\nimport { useId, useMemo } from \"react\";\nimport { Button } from \"./Button\";\nimport { cx } from \"./classNames\";\nimport { joinIds, useField } from \"./fieldContext\";\nimport { formatBytes, jsonEditorState } from \"./jsonParse\";\n\n/** Props of {@link JsonEditor}. */\nexport interface JsonEditorProps extends JsonEditorStateOptions {\n /** The text (controlled). Seed it with `JSON.stringify(value, null, 2)`. */\n value: string;\n /** Called on every edit, format and minify with the new state. */\n onChange: (state: JsonEditorState) => void;\n /** Visible rows. Defaults to `10`. */\n rows?: number;\n /** Accessible name when not inside a `Field`. */\n \"aria-label\"?: string;\n /** The textarea's id. Defaults to the enclosing field's, or a generated one. */\n id?: string;\n /** Read-only: no editing, no format/minify. */\n readOnly?: boolean;\n /** Disabled. */\n disabled?: boolean;\n /** Placeholder text. */\n placeholder?: string;\n /** Extra class names on the wrapper. */\n className?: string;\n}\n\n/**\n * A plain-textarea JSON editor: the parse error with line and column, a\n * UTF-8 size meter against `maxBytes` (turning red over it), and Format /\n * Minify. Inside a `Field` it takes the field's id and description.\n */\nexport function JsonEditor({\n value: text,\n onChange,\n maxBytes,\n allowEmpty = false,\n rows = 10,\n \"aria-label\": ariaLabel,\n id,\n readOnly = false,\n disabled = false,\n placeholder,\n className,\n}: JsonEditorProps) {\n const field = useField();\n const generatedId = useId();\n const inputId = id ?? field?.id ?? generatedId;\n const errorId = `${inputId}-json-error`;\n const sizeId = `${inputId}-json-size`;\n const state = useMemo(\n () => jsonEditorState(text, { maxBytes, allowEmpty }),\n [text, maxBytes, allowEmpty],\n );\n const emit = (next: string) =>\n onChange(jsonEditorState(next, { maxBytes, allowEmpty }));\n const reformat = (indent: number | undefined) => {\n if (state.error === null && state.value !== undefined) {\n emit(JSON.stringify(state.value, null, indent));\n }\n };\n const canFormat =\n !readOnly && !disabled && state.error === null && state.value !== undefined;\n\n return (\n <div\n className={cx(\n \"json-editor\",\n !state.valid && \"json-editor-invalid\",\n className,\n )}\n >\n <textarea\n id={inputId}\n className=\"input json-editor-text\"\n rows={rows}\n value={text}\n placeholder={placeholder}\n readOnly={readOnly}\n disabled={disabled}\n spellCheck={false}\n autoCapitalize=\"off\"\n autoComplete=\"off\"\n aria-label={ariaLabel}\n aria-invalid={!state.valid || field?.[\"aria-invalid\"] || undefined}\n aria-required={field?.required}\n aria-describedby={joinIds(\n field?.[\"aria-describedby\"],\n state.error && errorId,\n sizeId,\n )}\n onChange={(event) => emit(event.target.value)}\n />\n <div className=\"json-editor-bar\">\n {state.error ? (\n <p\n id={errorId}\n className=\"json-editor-error\"\n >\n Line {state.error.line}, column {state.error.column}:{\" \"}\n {state.error.message}\n </p>\n ) : (\n <p className=\"json-editor-ok muted\">Valid JSON</p>\n )}\n <span\n id={sizeId}\n className={cx(\"json-editor-size\", state.overLimit && \"is-over\")}\n >\n {maxBytes !== undefined && (\n <meter\n className=\"json-editor-meter\"\n min={0}\n max={maxBytes}\n low={maxBytes * 0.8}\n high={maxBytes}\n optimum={0}\n value={Math.min(state.bytes, maxBytes)}\n aria-hidden=\"true\"\n />\n )}\n {maxBytes === undefined\n ? formatBytes(state.bytes)\n : state.overLimit\n ? `${formatBytes(state.bytes)} of ${formatBytes(maxBytes)}: over the limit by ${formatBytes(state.bytes - maxBytes)}`\n : `${formatBytes(state.bytes)} of ${formatBytes(maxBytes)}`}\n </span>\n {!readOnly && (\n <span className=\"json-editor-actions\">\n <Button\n size=\"sm\"\n disabled={!canFormat}\n onClick={() => reformat(2)}\n >\n Format\n </Button>\n <Button\n size=\"sm\"\n disabled={!canFormat}\n onClick={() => reformat(undefined)}\n >\n Minify\n </Button>\n </span>\n )}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Aa,QACZ,EAAC,QAAD,CACE,UAAU,oBACV,IAAK,EACL,IAAK,EACL,IAAK,EAAW,IAChB,KAAM,EACN,QAAS,EACT,MAAO,KAAK,IAAI,EAAM,MAAO,CAAQ,EACrC,cAAY,OACd,EAED,IAAa,OACV,EAAY,EAAM,KAAK,EACvB,EAAM,UACJ,GAAG,EAAY,EAAM,KAAK,QAAQ,EAAY,CAAQ,wBAAwB,EAAY,EAAM,MAAQ,CAAQ,IAChH,GAAG,EAAY,EAAM,KAAK,QAAQ,EAAY,CAAQ,KAC5D,EACD,CAAC,GACA,EAAC,OAAD,CAAM,UAAU,sBAAhB,SAeE,CAdA,EAAC,EAAD,CACE,KAAK,KACL,SAAU,CAAC,EACX,QAAS,IAAM,EAAS,CAAC,EAH3B,kBAME,EACF,EAAC,EAAD,CACE,KAAK,KACL,SAAU,CAAC,EACX,QAAS,IAAM,EAAS,MAAS,EAHnC,kBAME,GACF,GAEJ,GACF",
9
+ "debugId": "F2BC7A909EE74D4464756E2164756E21",
10
+ "names": []
11
+ }
@@ -0,0 +1,5 @@
1
+ import{C,v,c,T,r,Z,Fr,je,Vr,K,b,N,n,e,t,f,i,m,Y,a,s,be,E,oe,ve,ue,ye,H,d,p,Qr,ee,ce,Cn,Ve,Ln,ys,Es,bs,L,o,_s,z,Ut,h,u,te,l,M,V,S,w,Be,I,ne,le,kt}from"./main-a250ffk7.js";import{_e,ze,He,_r,_o,gn,Jt,Io,Qn,Oe}from"./main-kwmqkjfx.js";import{U}from"./main-hg0hrg8j.js";import{k}from"./main-4g69fn3x.js";import{O}from"./main-4j1fcevh.js";import{W,me,Tt,we}from"./main-3yj6bv90.js";import{A}from"./main-0jmeh6mq.js";import{re}from"./main-jkvd92z9.js";import{D}from"./main-hm1ng3yg.js";import{ge}from"./main-5grjvsy7.js";function Ye(g,y,x){let{location:B}=be(),j=new URLSearchParams(B.search).get(g);return y.find((G)=>G.value===j)?.value??x}var Pt=new Intl.NumberFormat(void 0,{notation:"compact"});function xt({tabs:g,value:y,onChange:x,label:B,children:j,activation:G="auto",className:se}){let _=c(),Q=T(null),X=(R)=>`${_}-tab-${R}`,ae=`${_}-panel`,J=g.findIndex((R)=>R.value===y),q=(R)=>{let ie=g.map((he,Se)=>({tab:he,index:Se})).filter(({tab:he})=>!he.disabled);if(ie.length===0)return;let P=ie.findIndex(({index:he})=>X(he)===R.currentTarget.id),de=null;switch(R.key){case"ArrowRight":de=(P+1)%ie.length;break;case"ArrowLeft":de=(P-1+ie.length)%ie.length;break;case"Home":de=0;break;case"End":de=ie.length-1;break;default:return}R.preventDefault();let pe=ie[de];if(Q.current?.ownerDocument.getElementById(X(pe.index))?.focus(),G==="auto")x(pe.tab.value)};return t("div",{className:N("tabs",se),children:[e("div",{ref:Q,className:"tabs-list",role:"tablist","aria-label":B,children:g.map((R,ie)=>{let P=ie===J,de=P||J===-1&&ie===g.findIndex((pe)=>!pe.disabled);return t("button",{id:X(ie),type:"button",role:"tab",className:"tab","aria-selected":P,"aria-controls":j!==void 0?ae:void 0,tabIndex:de?0:-1,disabled:R.disabled,title:R.title,onClick:()=>x(R.value),onKeyDown:q,children:[e("span",{className:"tab-label",children:R.label}),R.count!==void 0&&e("span",{className:"tab-count",title:String(R.count),children:Pt.format(R.count)})]},R.value)})}),j!==void 0&&e("div",{id:ae,className:"tabs-panel",role:"tabpanel","aria-labelledby":J>=0?X(J):void 0,tabIndex:0,children:j})]})}function Rt({param:g,defaultValue:y,resetParams:x=[],onChange:B,tabs:j,...G}){let{location:se,navigate:_}=be(),Q=Ye(g,j,y),X=C((ae)=>{let J=new URLSearchParams(se.search);if(ae===y)J.delete(g);else J.set(g,ae);if(ae!==Q)for(let R of x)J.delete(R);let q=J.toString();_(`${se.path??"/"}${q?`?${q}`:""}`,{replace:!0}),B?.(ae)},[se.search,se.path,y,g,Q,x,_,B]);return e(xt,{...G,tabs:j,value:Q,onChange:X})}var De="all",st=80;function it(g,y){return g.length>y?`${g.slice(0,y-1)}…`:g}function Je(g,y,x,B){return{state:y===De?null:y,offset:me(g,"offset",0),...B===void 0?{}:{cursor:B},limit:we(me(g,"limit",x.defaultPageSize),x.maxPageSize),order:g.get("order")==="asc"?"asc":"desc",names:Tt(g.get("name")??""),search:g.get("search")??"",total:g.get("total")==="1"}}function Ke(g){return{key:g,trail:[]}}function xe(g,y){return g.key===y?g:Ke(y)}function Et(g,y){return{key:g.key,trail:[...g.trail,y]}}function It(g){return g.trail.length===0?g:{key:g.key,trail:g.trail.slice(0,-1)}}function At(g){return g.trail.at(-1)}function at(g){let[y,x]=r(()=>Ke(g)),B=xe(y,g),j=C((_)=>x((Q)=>Et(xe(Q,g),_)),[g]),G=C(()=>x((_)=>It(xe(_,g))),[g]),se=C(()=>x((_)=>xe(_,g).trail.length===0?_:Ke(g)),[g]);return{cursor:At(B),canPrev:B.trail.length>0,forward:j,back:G,reset:se}}var lt=10;function mn(g){let y=g.slice(0,lt).join(", "),x=g.length-lt;return x>0?`${y} and ${o(x)} more`:y}function Eo(g){if(g.cron)return g.tz?`${g.cron} (${g.tz})`:g.cron;if(g.every!==void 0)return`every ${U(g.every)}`;return"—"}var Lt=["offset"];function Ot(g){return g==="waiting"?"Walks from where this page ended, so no waiting job is skipped by the queue draining. A job promoted or retried into the queue while you page can land behind this point, and is then not on any page of this walk.":"Walks from where this page ended, so no job is skipped by the list changing under you. A job that joins these states behind the point you have reached is not on any page of this walk."}function bo({queue:g,counts:y}){let x=i(),B=m(),[j,G]=W(),se=[{value:De,label:"All",count:y?Z.reduce((P,de)=>P+y[de],0):void 0},...Z.map((P)=>({value:P,label:z[P],title:Ut[P],count:y?.[P]}))],_=Ye("state",se,De),Q=B.features.addedByState,X=Je(j,_,B.limits),ae=at(JSON.stringify([g,X.state,X.offset,X.order,X.names,X.search,X.total,Qr(X,Q)])),J=Je(j,_,B.limits,ae.cursor),q=le("jobs"),R=a({queryKey:ee.jobs(g,J),queryFn:({signal:P})=>Ln(x,g,J,P,{createdOrder:Q}),refetchInterval:q,placeholderData:Y}),ie=JSON.stringify([J.state,J.order,J.names,J.search]);return t("section",{className:"jobs-section","aria-label":"Jobs",children:[e(Rt,{tabs:se,param:"state",defaultValue:De,resetParams:Lt,label:"Job states"}),e(Tr,{filters:J,searchIndexed:B.features.search,createdOrder:B.features.addedByState,onApply:(P)=>G({...P,offset:null}),onOrder:(P)=>G({order:P==="asc"?"asc":null,offset:null}),onTotal:(P)=>G({total:P?"1":null})},`${j.get("name")??""}|${J.search}`),R.isPending?e(p,{label:"Loading jobs",showLabel:!0}):R.isError?e(L,{error:R.error,title:"Could not load jobs",onRetry:()=>void R.refetch()}):t(n,{children:[e(vr,{queue:g,items:R.data.items},ie),e(ne,{label:"Job pages",offset:R.data.page.offset??J.offset,limit:J.limit,total:R.data.page.total,itemCount:R.data.items.length,hasMore:R.data.page.hasMore,walk:{canNext:typeof R.data.page.next==="string",canPrev:ae.canPrev,unnumbered:R.data.page.offset===void 0,hint:Ot(_)},maxPageSize:B.limits.maxPageSize,disabled:R.isFetching&&R.isPlaceholderData,onChange:(P)=>{let de=R.data.page.next;if(P.step==="next"&&typeof de==="string"){ae.forward(de);return}if(P.step==="prev"){ae.back();return}if(P.resize===!0&&ae.cursor!==void 0){G({limit:String(P.limit)});return}ae.reset(),G({offset:P.offset>0?String(P.offset):null,limit:String(P.limit)})}})]})]})}function Tr({filters:g,searchIndexed:y,createdOrder:x=!1,onApply:B,onOrder:j,onTotal:G}){let[se,_]=r(g.names.join(", ")),[Q,X]=r(g.search),ae=c(),J=c(),q=c();return t("form",{className:"jobs-filters",role:"search","aria-label":"Filter jobs",onSubmit:(ie)=>{ie.preventDefault();let P=Tt(se);B({name:P.length>0?P.join(","):null,search:Q.trim()||null})},children:[t("span",{className:"jobs-filter",children:[e("label",{htmlFor:ae,children:"Names"}),e(M,{id:ae,value:se,onChange:_,placeholder:"exact, comma-separated",maxLength:2000})]}),t("span",{className:"jobs-filter",children:[e("label",{htmlFor:J,children:"Search"}),e(M,{id:J,type:"search",value:Q,onChange:X,placeholder:"id or name contains",...ve,maxLength:512,title:y?void 0:"This backend has no search index: the API scans the queue."})]}),e(s,{type:"submit",size:"sm",children:"Apply"}),t("span",{className:"jobs-filter",children:[e("label",{htmlFor:q,children:"Order"}),e(S,{id:q,options:[{value:"desc",label:"Newest first"},{value:"asc",label:"Oldest first"}],value:g.order,onChange:j})]}),G&&e(w,{checked:g.total,onChange:G,label:"Count total",hint:x&&g.total?"While counting, a one-state tab keeps its own order, not creation order.":void 0,className:"jobs-total"})]})}function vr({queue:g,items:y,label:x,linkJobs:B=!0,empty:j,processedBy:G=!0}){let se=i(),_=m(),Q=Oe(),X=G&&_.features.jobAttribution,ae=te(),J=re(),q=_.limits.maxBulkIds,[R,ie]=r(()=>new Set),[P,de]=r(!0),[pe,he]=r(null),Se=T(null),Re=T(null),Ze=J("jobs.retry"),et=J("jobs.remove"),tt=J("jobs.promote"),We=Ze||et||tt,Ce=y.map((F)=>F.id),Ie=Ce.filter((F)=>R.has(F)).length,Ne=Ce.length>0&&Ie===Ce.length,Ae=R.size>=q,Le=T(!1);v(()=>{if(R.size>0||pe!==null){Le.current=!0;return}if(!Le.current)return;Le.current=!1;let F=document.activeElement;if(F===null||F===document.body||F instanceof HTMLButtonElement&&F.disabled&&Re.current?.contains(F)===!0)Re.current?.focus()},[R,pe]),v(()=>{if(Se.current)Se.current.indeterminate=Ie>0&&!Ne},[Ie,Ne]);let Ct=(F,ke)=>{ie((fe)=>{let Te=new Set(fe);if(ke&&Te.size<q)Te.add(F);else if(!ke)Te.delete(F);return Te})},Nt=(F)=>{ie((ke)=>{let fe=new Set(ke);for(let Te of Ce)if(!F)fe.delete(Te);else if(fe.size<q)fe.add(Te);return fe})},$e=(F,ke,fe)=>{ae.success(`${F} ${o(ke.length)}, skipped ${o(fe.length)}`,{description:fe.length>0?`Skipped: ${mn(fe)}`:void 0}),ie(new Set)},Fe=ce(g),ot=O({mutationFn:(F)=>ys(se,g,F,P),onSuccess:(F)=>$e("Retried",F.retried,F.skipped),errorTitle:"Could not retry the jobs",invalidate:Fe}),nt=O({mutationFn:(F)=>bs(se,g,F),onSuccess:(F)=>$e("Promoted",F.promoted,F.skipped),errorTitle:"Could not promote the jobs",invalidate:Fe}),rt=O({mutationFn:(F)=>Es(se,g,F),onSuccess:(F)=>$e("Removed",F.removed,F.skipped),invalidate:Fe,toastErrors:!1}),Me=ot.isPending||nt.isPending||rt.isPending,Pe=[...R];if(y.length===0)return j??e(d,{title:"No jobs",description:"No job in this queue matches the state and filters."});return t(n,{children:[We&&t("div",{ref:Re,className:"bulk-bar",role:"group",tabIndex:-1,"aria-label":"Bulk actions",children:[t("span",{className:"bulk-count","aria-live":"polite","data-testid":"bulk-count",children:[h(R.size,"job")," selected",Ae&&` (the most one action takes: ${o(q)})`]}),Ze&&t(n,{children:[e(w,{checked:P,onChange:de,label:"Reset attempts"}),e(s,{size:"sm",disabled:R.size===0||Me,onClick:()=>ot.mutate(Pe),children:"Retry selected"})]}),tt&&e(s,{size:"sm",disabled:R.size===0||Me,onClick:()=>nt.mutate(Pe),children:"Promote selected"}),et&&e(s,{size:"sm",variant:"danger",disabled:R.size===0||Me,onClick:()=>he("remove"),children:"Remove selected…"}),R.size>0&&e(s,{size:"sm",variant:"ghost",onClick:()=>ie(new Set),children:"Clear selection"})]}),t(I,{label:x??`Jobs in ${g}`,children:[e("thead",{children:t("tr",{children:[We&&e("th",{scope:"col",className:"select-cell",children:e("input",{ref:Se,type:"checkbox","aria-label":"Select all jobs on this page",checked:Ne,disabled:!Ne&&Ae,onChange:(F)=>Nt(F.target.checked)})}),e("th",{scope:"col",children:"Id"}),e("th",{scope:"col",children:"Name"}),e("th",{scope:"col",children:"State"}),e("th",{scope:"col",className:"num",children:"Attempts"}),e("th",{scope:"col",className:"num",children:"Priority"}),e("th",{scope:"col",children:"Created"}),e("th",{scope:"col",children:"Processed"}),X&&e("th",{scope:"col",className:"job-processed-by-col",title:"The worker that ran the job's last attempt","data-testid":"jobs-processed-by-header",children:"Processed by"}),e("th",{scope:"col",children:"Finished"}),e("th",{scope:"col",children:"Failure"})]})}),e("tbody",{children:y.map((F)=>{let ke=R.has(F.id),fe=F.failedReason?.message;return t("tr",{"data-testid":`job-row-${F.id}`,"aria-selected":We?ke:void 0,children:[We&&e("td",{className:"select-cell",children:e("input",{type:"checkbox","aria-label":`Select job ${F.id}`,checked:ke,disabled:!ke&&Ae,onChange:(Te)=>Ct(F.id,Te.target.checked)})}),t("th",{scope:"row",className:"job-id",children:[B?e(E,{to:Cn(g,F.id),children:F.id}):F.id,e(ge,{text:F.id,label:"Copy",ariaLabel:`Copy job id ${F.id}`})]}),e("td",{children:u(F.name)}),e("td",{children:e(Be,{state:F.state})}),t("td",{className:"num",children:[o(F.attemptsMade),"/",o(F.maxAttempts)]}),e("td",{className:"num",children:o(F.priority)}),e("td",{children:e(A,{value:F.createdAt})}),e("td",{children:e(A,{value:F.processedOn})}),X&&e($t,{queue:g,worker:F.processedBy,linked:Q}),e("td",{children:e(A,{value:F.finishedOn})}),e("td",{className:"job-failure",title:fe,children:fe?it(fe,st):"—"})]},F.id)})})]}),e(k,{open:pe==="remove",onClose:()=>he(null),title:`Remove ${h(Pe.length,"job")}?`,description:"Removes the selected jobs for good. Running jobs are skipped.",variant:"danger",confirmLabel:"Remove",pendingLabel:"Removing…",onConfirm:()=>rt.mutateAsync(Pe)})]})}function $t({queue:g,worker:y,linked:x}){if(y===null)return e("td",{className:"job-processed-by-col muted",title:"No worker recorded: the job was never claimed, or was claimed before this backend recorded who ran a job.","data-testid":"jobs-processed-by-none",children:"—"});if(y.key===void 0)return e("td",{className:"job-processed-by-col",title:`Worker incarnation ${y.id} (no stable key recorded)`,children:e("code",{className:"job-processed-by-text","data-testid":"jobs-processed-by-id",children:y.id})});return e("td",{className:"job-processed-by-col",title:`${y.key} (incarnation ${y.id})`,children:x?e(E,{to:He(g,y.key),className:"job-processed-by-text","data-testid":"jobs-processed-by-key",children:y.key}):e("span",{className:"job-processed-by-text","data-testid":"jobs-processed-by-key",children:y.key})})}var Ft={list:5000};function No(g){ye([ue.workers],[_e.all],{enabled:g})}function fn(g,y){ye([ue.queueWorkers(g)],[_e.ofQueue(g),_e.all],{enabled:y})}function Fn(){return H(Ft.list)}var _t={pause:"pause this worker",resume:"resume this worker",stop:"stop this worker",start:"start this worker",configure:"change this worker's settings"};function qe(g,y){switch(g.code){case"WORKER_NOT_FOUND":return"This worker is not in the registry: it was never there, or its record was removed. Refresh to see the workers reporting now.";case"WORKER_GONE":return"This worker's record lapsed before the instruction reached it — its process stopped reporting. Refresh; if it comes back it will have a new id.";case"WORKER_STATE_CONFLICT":return`Could not ${_t[y]}: it is no longer in the state that action needs. Refresh and look at its state — a stopped worker is started, not resumed.`;case"WORKER_NOT_CONTROLLABLE":return"This API cannot control this worker: remote control is off for it, or it runs an older release that does not listen for instructions.";case"WORKER_PERSISTENCE_NOT_ALLOWED":return"This deployment does not let a stop's persistence be chosen per request. Stop it with the behaviour the deployment configured.";case"CONTROL_CONTENDED":return"Somebody else changed this worker while the dialog was open, so nothing was written. Refresh to see their change, then apply yours again.";case"CONFIG_NOT_ALLOWED":return"The API refused these settings: a value is outside what it allows, or this deployment does not allow that setting to be overridden.";default:return null}}function Ue(g,y){if(!b(g))return g;let x=qe(g,y);if(x===null)return g;return new K({kind:g.kind,status:g.status,code:g.code,title:g.title,detail:x,type:g.type,issues:g.issues,context:g.context,instance:g.instance,cause:g})}function Bt(g,y,x=Date.now()){let B=Jt(g),j=Qn(g,x),G=Io(g),se=B==="stopping"||B==="restarting",_=G&&!j&&!se;return{pause:_&&B==="running"&&y("workers.pause"),resume:_&&B==="paused"&&y("workers.resume"),stop:_&&(B==="running"||B==="paused")&&y("workers.stop"),start:_&&B==="stopped"&&y("workers.start"),configure:G&&g.key!==void 0&&y("workers.configure"),blocked:!G?"uncontrollable":j?"stale":se?"transitioning":null}}function Ee(g,y){return g.blocked!==null&&y("workers.pause")}var dt={stale:"This worker stopped reporting, so nothing would receive the instruction. Its record lapses shortly.",transitioning:"This worker is between states. Its actions come back once it settles.",uncontrollable:"This API cannot control this worker: remote control is off for it, or it runs an older release that does not listen for instructions."};function qt(){let g=m(),y=re();return(x)=>g.features.workerControl&&y(x)}var jt={process:"Until this process restarts",key:"Until somebody starts it again"},ct={process:"A redeploy or a restart brings this worker back running, because the stop is recorded against this incarnation only.",key:"Recorded against the worker's stable key, so every replica of it — including one started later — comes up stopped."};function ut({open:g,onClose:y,worker:x,onConfirm:B}){let j=x.control?.stopPersistence??"process",G=x.control?.stopPersistenceOverridable===!0,[se,_]=r(j),Q=x.active;return e(k,{open:g,onClose:y,title:`Stop worker ${x.id}?`,description:Q>0?`It finishes the ${Q===1?"job it is running":`${Q} jobs it is running`} and takes no more. It stays listed, so you can start it again.`:"It parks its loop and takes no jobs. It stays listed, so you can start it again.",confirmLabel:"Stop worker",pendingLabel:"Stopping…",variant:"danger",onConfirm:()=>B(G?se:void 0),children:G?e(l,{label:"How long it stays stopped",hint:ct[se],children:e(S,{value:se,onChange:_,options:Fr.map((X)=>({value:X,label:jt[X]}))})}):e("p",{className:"muted",children:ct[j]})})}var Vn={concurrency:"How many jobs this worker runs at once.",pollInterval:"How often it looks for work when nothing woke it, in ms.",maxBlock:"How long one wait for work may block, in ms.",lockDuration:"How long a job's lock lasts before another worker may claim it, in ms.",heartbeatInterval:"How often a held lock is renewed, in ms. Must be at most half the lock duration.",stalledInterval:"How often stalled jobs are looked for, in ms.",maxStalledCount:"How often one job may stall before it is failed.",reportInterval:"How often this worker reports itself to the registry, in ms.",drainDelay:"How long it waits before declaring the queue drained, in ms."};function Bn({worker:g,onClose:y}){let x=i(),B=g.config,j=g.key??g.id,[G,se]=r({}),[_,Q]=r(null),X=(P)=>(P in G)?G[P]:B?.effective[P],ae=()=>{let P={};for(let de of je){if(!(de in G))continue;let pe=G[de];if(pe===void 0){if(B?.overridden.includes(de))P[de]=null;continue}if(pe!==B?.effective[de])P[de]=pe}if(B)P.expectedSeq=B.seq;return P},J=O({mutationFn:()=>_o(x,g.queue,j,ae()),invalidate:ze(g.queue),successMessage:(P)=>P.instances.length>1?`Saved the settings of ${j}; ${P.instances.length} workers carry it`:`Saved the settings of ${j}`,toastErrors:!1,onSuccess:y,onError:(P)=>Q(Ue(P,"configure"))}),q=O({mutationFn:()=>gn(x,g.queue,j),invalidate:ze(g.queue),successMessage:`Reset ${j} to the values in its code`,toastErrors:!1,onSuccess:y,onError:(P)=>Q(Ue(P,"configure"))}),R=J.isPending||q.isPending,ie=Object.keys(ae()).filter((P)=>P!=="expectedSeq");return t(oe,{open:!0,onClose:y,closeOnEscape:!R,size:"lg",title:`Settings of ${j}`,description:t(n,{children:["Stored against the worker’s key, so this reaches every worker carrying ",e("code",{children:j})," — including ones started later — until you reset it. Changes apply in place: nothing drains or restarts."]}),footer:t(n,{children:[e(s,{onClick:y,disabled:R,children:"Cancel"}),B&&B.overridden.length>0&&e(s,{variant:"danger",onClick:()=>q.mutate(),disabled:R,"aria-busy":q.isPending||void 0,children:q.isPending?"Resetting…":"Reset to code values"}),e(s,{variant:"primary",onClick:()=>J.mutate(),disabled:R||ie.length===0,"aria-busy":J.isPending||void 0,children:J.isPending?"Saving…":"Save settings"})]}),children:[_!==null&&e(D,{error:_}),g.control?.pending===!0&&e("p",{className:"worker-config-note","data-testid":"worker-config-pending",children:"A change is waiting to be taken up, so the values below are the ones this worker still runs with. Saving now replaces the waiting change."}),B===void 0?e("p",{className:"worker-config-note",children:"This worker does not report its settings, so there is nothing to show yet. It reports them at its next heartbeat."}):e("div",{className:"worker-config-form",children:je.map((P)=>{let de=Vr[P],pe=B.overridden.includes(P),he=B.code[P];return t("div",{className:"worker-config-row",children:[e(l,{label:P,hint:t(n,{children:[Vn[P]," ",de.min,"–",de.max,"."," ",pe?`Overridden; its code asks for ${he}.`:`Its code asks for ${he}.`]}),children:e(V,{value:X(P),min:de.min,max:de.max,onChange:(Se)=>se((Re)=>({...Re,[P]:Se}))})}),pe&&e(s,{size:"sm",onClick:()=>se((Se)=>({...Se,[P]:he})),disabled:R,children:"Use code value"})]},P)})})]})}function Ge(g,y,x){return g?y:x}function Mt(g,y){let x=y.persisted==="key"?"; every replica of it stays stopped until started":"",B=y.worker;return(B===void 0?y.applied:Jt(B)==="stopped"&&B.control?.pending!==!0||y.applied&&B.active===0)?`Stopped ${g}${x}`:`Asked ${g} to stop; it finishes its jobs first${x}`}function pt({worker:g}){let y=i(),x=te(),B=qt(),[j,G]=r(null),se=()=>G(null),_=Bt(g,B),Q=O({mutationFn:(q)=>_r(y,g.queue,g.id,q).then((R)=>({action:q,result:R})),invalidate:ze(g.queue),successMessage:({action:q,result:R})=>q==="pause"?Ge(R.applied,`Paused ${g.id}`,`Asked ${g.id} to pause; it stops taking jobs shortly`):q==="resume"?Ge(R.applied,`Resumed ${g.id}`,`Asked ${g.id} to resume; it takes jobs again shortly`):Ge(R.applied,`Started ${g.id}`,`Asked ${g.id} to start; it takes jobs again shortly`),toastErrors:!1,onError:(q,R)=>{x.error(`Could not ${R} ${g.id}`,{description:b(q)?qe(q,R)??q.detail??q.title:q.message})}}),X=O({mutationFn:(q)=>_r(y,g.queue,g.id,"stop",{persist:q}),invalidate:ze(g.queue),successMessage:(q)=>Mt(g.id,q),toastErrors:!1}),ae=_.pause||_.resume||_.stop||_.start,J=_.blocked!==null&&Ee(_,B)?e("span",{className:"worker-actions-hint muted","data-testid":`worker-blocked-${g.id}`,children:dt[_.blocked]}):null;if(!ae&&!_.configure)return J;return t("div",{className:"worker-actions",role:"group","aria-label":`Actions for worker ${g.id}`,children:[_.pause&&e(s,{size:"sm",onClick:()=>Q.mutate("pause"),disabled:Q.isPending,"aria-busy":Q.isPending||void 0,children:"Pause"}),_.resume&&e(s,{size:"sm",onClick:()=>Q.mutate("resume"),disabled:Q.isPending,"aria-busy":Q.isPending||void 0,children:"Resume"}),_.start&&e(s,{size:"sm",variant:"primary",onClick:()=>Q.mutate("start"),disabled:Q.isPending,"aria-busy":Q.isPending||void 0,children:"Start"}),_.stop&&e(s,{size:"sm",variant:"danger",onClick:()=>G("stop"),children:"Stop…"}),_.configure&&e(s,{size:"sm",onClick:()=>G("settings"),children:"Settings…"}),J,e(ut,{open:j==="stop",onClose:se,worker:g,onConfirm:(q)=>X.mutateAsync(q)}),j==="settings"&&e(Bn,{worker:g,onClose:se})]})}var Qe={"exit-on-idle":{label:"Exit when idle",hint:"The summoner asked it to exit once its queue has no work for it."},"until-stopped":{label:"Run until stopped",hint:"The summoner asked it to keep running until something stops it."},"in-invocation":{label:"Within one invocation",hint:"The summoner asked it to run inside a single platform invocation, and end with it."}},Oo="How this worker was started, as its summoner recorded it. The mode and deadline are what the summoner requested, not a report of what the worker is doing.";function mt(g){return typeof g==="string"&&Object.hasOwn(Qe,g)}function pn(g){return mt(g)?Qe[g].label:u(g)}function Ao(g){return mt(g)?Qe[g].hint:`The summoner requested a mode this version of the UI does not know ("${u(g)}").`}function ft(g){return g.kind===void 0?"Summoned":`Summoned by ${u(g.kind)}`}function gt(g){return`Unit of ${u(g)}`}function qn(g){return`This worker runs in the shared unit summoned for the summon group ${u(g)}: one process serving its member queues.`}function ht(g){let y=[g.mode!==void 0&&`requested mode: ${pn(g.mode)}`,typeof g.deadlineAt==="number"&&Number.isFinite(g.deadlineAt)&&`requested deadline: ${new Date(g.deadlineAt).toISOString()}`].filter((x)=>x!==!1);return[`Started by a summoner, attempt ${u(g.id)}.`,g.resolvedMode===void 0?"":`Runs as: ${pn(g.resolvedMode)}.`,y.length>0?`The summoner's ${y.join("; ")}.`:"","How it was started, not a setting."].filter((x)=>x!=="").join(" ")}var Xe={"in-process":{label:"In process",hint:"Its attempts run in the worker's own process, on the thread that claims them."},"worker-thread":{label:"Worker thread",hint:"Each attempt runs on a fresh worker thread (a Web Worker) inside the worker's process."},"child-process":{label:"Child process",hint:"Each attempt runs in a fresh child process, which can be killed if it ignores its signal."},container:{label:"Container",hint:"Each attempt runs in a fresh container: no network, none of the worker's environment, a read-only filesystem."},custom:{label:"Custom",hint:"Its attempts run on a target the application supplied."}},bt={function:"Function",file:"File"},yt="Set in the worker's code when it was built; changing it is a redeploy, not a setting.";function vt(g){return typeof g==="string"&&Object.hasOwn(Xe,g)}function Jn(g){return vt(g)?Xe[g].label:u(g)}function Sr(g){return typeof g==="string"&&Object.hasOwn(bt,g)?bt[g]:u(g)}function St(g){if(g.kind==="custom"&&g.name!==void 0)return u(g.name);return Jn(g.kind)}function Hn(g){return vt(g)?Xe[g].hint:`Its attempts run on a target this version of the UI does not know ("${u(g)}").`}function wt(g){let y=Hn(g.kind),x=g.kind==="custom"&&g.name!==void 0?` Named "${u(g.name)}" by the application.`:"";return`${y}${x} ${yt}`}var Ro=yt;function Ht(g){return g===void 0?"":JSON.stringify([g.kind,g.processor,g.name,g.file])}function Do(g){let y=new Map;for(let x of g){let B=Ht(x.target),j=y.get(B);if(j===void 0)y.set(B,{target:x.target,ids:[x.id]});else j.ids.push(x.id)}return[...y.values()]}var Kt={running:{label:"Running",tone:"success",hint:"Taking jobs from its queue."},paused:{label:"Paused",tone:"warning",hint:"Its loop runs, but it takes no new jobs until it is resumed."},stopping:{label:"Stopping",tone:"neutral",hint:"Finishing the jobs it holds; it takes no more."},stopped:{label:"Stopped",tone:"neutral",hint:"Parked, and still listed, so it can be started again."},restarting:{label:"Restarting",tone:"accent",hint:"Taking up changed settings; this lasts milliseconds."}},zt="Resident memory of the process this worker runs in, at its last report — not the worker's own. Workers sharing a pid repeat the same figure, so do not add these up; to size a host, take one row per pid.",Vt=new Intl.NumberFormat(void 0,{maximumFractionDigits:1});function Gt(g){let y=g.heartbeatRttMs;if(y===void 0)return;return`Last write took ${Vt.format(y)} ms (the previous report's round trip to the driver, not a network ping).`}function Qt({worker:g}){let y=Kt[Jt(g)];return t(n,{children:[e(f,{tone:y.tone,title:y.hint,testId:"worker-state",children:y.label})," ",g.control?.pending===!0&&e(f,{tone:"accent",title:"A change was recorded and this worker has not taken it up yet. It applies within seconds.",children:"Change pending"})," ",Qn(g)&&e(f,{tone:"danger",title:"This worker stopped reporting. Its record lapses unless it reports again.",children:"Not reporting"})," ",g.target!==void 0&&t(f,{className:"worker-target",title:wt(g.target),children:[e("span",{className:"visually-hidden",children:"Runs in: "}),St(g.target)]})," ",g.summon!==void 0&&e(f,{className:"worker-summon",title:ht(g.summon),testId:"worker-summon-badge",children:ft(g.summon)})," ",g.summon?.group!==void 0&&e(f,{className:"worker-summon",title:qn(g.summon.group),testId:"worker-summon-unit",children:gt(g.summon.group)})]})}function Wt({value:g}){return e("td",{className:"num",children:g===void 0?e("span",{className:"muted",title:"This worker does not report its counts (it predates them).",children:"—"}):o(g)})}function Xt({value:g}){return e("td",{className:"num",children:g===void 0?e("span",{className:"muted",title:"This worker does not report its process memory (it predates it).",children:"—"}):_s(g)})}function Dt({workers:g,label:y,showQueue:x=!0,linkQueues:B=!1,showHost:j=!1,linkKeys:G=!1,showMemory:se=!1,pageSize:_}){let Q=qt(),X=kt(g,_??null),ae=se&&g.some((R)=>R.rssBytes!==void 0),J=g.some((R)=>R.completed!==void 0||R.failed!==void 0),q=g.some((R)=>{let ie=Bt(R,Q);return ie.pause||ie.resume||ie.stop||ie.start||ie.configure||Ee(ie,Q)});return t(n,{children:[t(I,{label:y,children:[e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:"Worker"}),x&&e("th",{scope:"col",children:"Queue"}),j&&e("th",{scope:"col",children:"Host"}),j&&e("th",{scope:"col",className:"num",children:"Pid"}),e("th",{scope:"col",children:"State"}),e("th",{scope:"col",className:"num",children:"Active / concurrency"}),J&&e("th",{scope:"col",className:"num",title:"Jobs this incarnation completed since it started; a restart starts it again.",children:"Completed"}),J&&e("th",{scope:"col",className:"num",title:"Attempts this incarnation failed since it started; a restart starts it again.",children:"Failed"}),ae&&e("th",{scope:"col",className:"num",title:zt,children:"Memory"}),e("th",{scope:"col",children:"Started"}),e("th",{scope:"col",children:"Heartbeat"}),q&&e("th",{scope:"col",children:"Actions"})]})}),e("tbody",{children:X.rows.map((R)=>t("tr",{"data-testid":`worker-row-${R.id}`,children:[t("th",{scope:"row",children:[e("code",{children:R.id}),G&&R.key!==void 0&&e("div",{className:"worker-key",children:e(E,{to:He(R.queue,R.key),title:`Every instance of ${R.key}, its settings and its numbers`,"data-testid":`worker-key-link-${R.id}`,children:R.key})})]}),x&&e("td",{children:B?e(E,{to:Ve(R.queue),children:R.queue}):R.queue}),j&&e("td",{children:R.host??"—"}),j&&e("td",{className:"num",children:R.pid??"—"}),e("td",{children:e(Qt,{worker:R})}),t("td",{className:"num",children:[o(R.active)," /"," ",o(R.concurrency)]}),J&&e(Wt,{value:R.completed}),J&&e(Wt,{value:R.failed}),ae&&e(Xt,{value:R.rssBytes}),e("td",{children:e(A,{value:R.startedAt})}),e("td",{children:e(A,{value:R.heartbeatAt,hint:Gt(R)})}),q&&e("td",{children:e(pt,{worker:R})})]},`${R.queue}/${R.id}`))})]}),X.paged&&e(ne,{label:`Pages of ${y}`,offset:X.offset,limit:X.limit,total:X.total,itemCount:X.rows.length,onChange:X.onChange})]})}
2
+ export{Ye,Rt,De,mn,Eo,bo,Tr,vr,No,fn,Fn,Bt,qt,Vn,Bn,Oo,pn,Ao,qn,Jn,Sr,Hn,Ro,Do,Dt};
3
+
4
+ //# debugId=5D33D4D714AC86E364756E2164756E21
5
+ //# sourceMappingURL=main-ts19j4n0.js.map