dirigent-server 0.13.0__tar.gz → 0.14.0__tar.gz

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 (159) hide show
  1. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/PKG-INFO +1 -1
  2. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/pyproject.toml +1 -1
  3. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/pyproject.toml.orig +1 -1
  4. dirigent_server-0.14.0/src/dirigent_server/static/assets/Alerting-CWXFU2pv.js +1 -0
  5. dirigent_server-0.13.0/src/dirigent_server/static/assets/Blocks-CBpLFYQo.js → dirigent_server-0.14.0/src/dirigent_server/static/assets/Blocks-BNvPhhHF.js +1 -1
  6. dirigent_server-0.14.0/src/dirigent_server/static/assets/Connections-DgDXeKE2.js +1 -0
  7. dirigent_server-0.13.0/src/dirigent_server/static/assets/Dashboard-Dbc7eWnn.js → dirigent_server-0.14.0/src/dirigent_server/static/assets/Dashboard-BCOstDxl.js +1 -1
  8. dirigent_server-0.13.0/src/dirigent_server/static/assets/JsonBlock-CJ30Zb39.js → dirigent_server-0.14.0/src/dirigent_server/static/assets/JsonBlock-DRCXIp-W.js +1 -1
  9. dirigent_server-0.13.0/src/dirigent_server/static/assets/Overview-DOWTLAA0.js → dirigent_server-0.14.0/src/dirigent_server/static/assets/Overview-BJz6p7fG.js +1 -1
  10. dirigent_server-0.14.0/src/dirigent_server/static/assets/Picker-CNyDCsNP.js +1 -0
  11. dirigent_server-0.14.0/src/dirigent_server/static/assets/PipelineEditor-DDZwROr9.js +2 -0
  12. dirigent_server-0.13.0/src/dirigent_server/static/assets/PipelineGraph-HaxpLDYk.js → dirigent_server-0.14.0/src/dirigent_server/static/assets/PipelineGraph-BPtZkp6B.js +1 -1
  13. dirigent_server-0.13.0/src/dirigent_server/static/assets/PipelinePreview-ChkpwVTd.js → dirigent_server-0.14.0/src/dirigent_server/static/assets/PipelinePreview-BBCW_rdW.js +1 -1
  14. dirigent_server-0.13.0/src/dirigent_server/static/assets/PipelineTab-B_LAnOAD.js → dirigent_server-0.14.0/src/dirigent_server/static/assets/PipelineTab-ePfoBa3H.js +1 -1
  15. dirigent_server-0.14.0/src/dirigent_server/static/assets/ProgramReference-qv2Y4zei.js +1 -0
  16. dirigent_server-0.13.0/src/dirigent_server/static/assets/Refusal-BJLvb6gD.js → dirigent_server-0.14.0/src/dirigent_server/static/assets/Refusal-TkoEvvgs.js +1 -1
  17. dirigent_server-0.14.0/src/dirigent_server/static/assets/RunDetail-BxGHbTZ4.js +3 -0
  18. dirigent_server-0.13.0/src/dirigent_server/static/assets/RunGraph-sL3fQFFh.js → dirigent_server-0.14.0/src/dirigent_server/static/assets/RunGraph-DTsPfgHF.js +1 -1
  19. dirigent_server-0.14.0/src/dirigent_server/static/assets/SchemaForm-CBmpygQH.js +1 -0
  20. dirigent_server-0.13.0/src/dirigent_server/static/assets/Schemas-THJMNYrJ.js → dirigent_server-0.14.0/src/dirigent_server/static/assets/Schemas--W-pOmoC.js +1 -1
  21. dirigent_server-0.13.0/src/dirigent_server/static/assets/SettingsDialog-DFHCelV4.js → dirigent_server-0.14.0/src/dirigent_server/static/assets/SettingsDialog-BihiK4NB.js +1 -1
  22. dirigent_server-0.13.0/src/dirigent_server/static/assets/TileCard-C9t5bFGN.js → dirigent_server-0.14.0/src/dirigent_server/static/assets/TileCard-BJHpBqDz.js +1 -1
  23. dirigent_server-0.14.0/src/dirigent_server/static/assets/Triggers-hojIPjw5.js +1 -0
  24. dirigent_server-0.13.0/src/dirigent_server/static/assets/Users-CLFcgtBa.js → dirigent_server-0.14.0/src/dirigent_server/static/assets/Users-D7Mxrc9z.js +1 -1
  25. dirigent_server-0.14.0/src/dirigent_server/static/assets/WindowedPane-Bl60nHe4.js +1 -0
  26. dirigent_server-0.13.0/src/dirigent_server/static/assets/Workers-CHN6ph0B.js → dirigent_server-0.14.0/src/dirigent_server/static/assets/Workers-Y3RH3ljv.js +1 -1
  27. dirigent_server-0.13.0/src/dirigent_server/static/assets/WorkersTable-CVzqLA-a.js → dirigent_server-0.14.0/src/dirigent_server/static/assets/WorkersTable-DZiYF2b7.js +1 -1
  28. dirigent_server-0.13.0/src/dirigent_server/static/assets/connections-BNOH5aGu.js → dirigent_server-0.14.0/src/dirigent_server/static/assets/connections-CdL8xQGj.js +1 -1
  29. dirigent_server-0.14.0/src/dirigent_server/static/assets/index-DPOCILN_.css +2 -0
  30. dirigent_server-0.13.0/src/dirigent_server/static/assets/index-CeUoyQJy.js → dirigent_server-0.14.0/src/dirigent_server/static/assets/index-DaM0mXP1.js +2 -2
  31. dirigent_server-0.14.0/src/dirigent_server/static/assets/schema-form-dcZ8A0M1.js +1 -0
  32. dirigent_server-0.14.0/src/dirigent_server/static/assets/select-BAmX8M_l.js +1 -0
  33. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/index.html +2 -2
  34. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/ui.py +4 -1
  35. dirigent_server-0.13.0/src/dirigent_server/static/assets/Alerting-DH5lSFHB.js +0 -1
  36. dirigent_server-0.13.0/src/dirigent_server/static/assets/Connections-CHOMJC7y.js +0 -1
  37. dirigent_server-0.13.0/src/dirigent_server/static/assets/Picker-DiLS0eON.js +0 -1
  38. dirigent_server-0.13.0/src/dirigent_server/static/assets/PipelineEditor-6pcE1OrR.js +0 -2
  39. dirigent_server-0.13.0/src/dirigent_server/static/assets/RunDetail-CMC8TCo_.js +0 -3
  40. dirigent_server-0.13.0/src/dirigent_server/static/assets/SchemaForm-BpeJKHjN.js +0 -1
  41. dirigent_server-0.13.0/src/dirigent_server/static/assets/Triggers-C1ZYm8vx.js +0 -1
  42. dirigent_server-0.13.0/src/dirigent_server/static/assets/WindowedPane-CSN_GUHP.js +0 -1
  43. dirigent_server-0.13.0/src/dirigent_server/static/assets/index-Cnw-C6y9.css +0 -2
  44. dirigent_server-0.13.0/src/dirigent_server/static/assets/resolveAriaLabelledBy-CtPQ1em7.js +0 -1
  45. dirigent_server-0.13.0/src/dirigent_server/static/assets/schema-form-FkbdR3oI.js +0 -1
  46. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/LICENSE +0 -0
  47. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/README.md +0 -0
  48. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/THIRD_PARTY_NOTICES.md +0 -0
  49. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/__init__.py +0 -0
  50. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/app.py +0 -0
  51. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/dependencies.py +0 -0
  52. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/errors.py +0 -0
  53. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/health.py +0 -0
  54. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/logging.py +0 -0
  55. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/pagination.py +0 -0
  56. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/py.typed +0 -0
  57. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/routes/__init__.py +0 -0
  58. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/routes/alerts.py +0 -0
  59. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/routes/auth.py +0 -0
  60. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/routes/blocks.py +0 -0
  61. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/routes/connections.py +0 -0
  62. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/routes/hooks.py +0 -0
  63. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/routes/pipelines.py +0 -0
  64. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/routes/runs.py +0 -0
  65. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/routes/schema.py +0 -0
  66. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/routes/schemas.py +0 -0
  67. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/routes/system.py +0 -0
  68. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/routes/trigger_documents.py +0 -0
  69. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/routes/triggers.py +0 -0
  70. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/routes/users.py +0 -0
  71. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/routes/workers.py +0 -0
  72. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/security.py +0 -0
  73. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/.gitkeep +0 -0
  74. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/AdminOnly-ChPFWSCk.js +0 -0
  75. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/Breadcrumb-KS3i4O6Q.js +0 -0
  76. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/CodeEditor-B55U_qvj.css +0 -0
  77. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/CodeEditor-cfjDMRpA.js +0 -0
  78. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/Description-DVFPKyRO.js +0 -0
  79. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/Instant-C9TZFyg5.js +0 -0
  80. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/KindChip-CuBFi3X9.js +0 -0
  81. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/Markdown-B6er3LhH.js +0 -0
  82. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/PageState-CTB50fRO.js +0 -0
  83. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/Panel-Bk3CoJZ6.js +0 -0
  84. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/Segmented-DvCzioEn.js +0 -0
  85. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/StepPorts-CtcvnIvJ.js +0 -0
  86. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/auth-DZcJKVvz.js +0 -0
  87. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/badge-LkJ4rIEc.js +0 -0
  88. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/blocks-CPJMNxIu.js +0 -0
  89. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/chevron-down-CrkpqUMs.js +0 -0
  90. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/chunk-BV7QT456-Bfa1dvOx.js +0 -0
  91. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/copy-r6NpGwbU.js +0 -0
  92. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/dist-BWSEJlfk.js +0 -0
  93. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/dropdown-menu-B9iU0HGD.js +0 -0
  94. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/editor.worker-BaAK1IVA.js +0 -0
  95. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/format-CR2ze2LO.js +0 -0
  96. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  97. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  98. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
  99. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
  100. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-600-normal-CTOM6hUh.woff2 +0 -0
  101. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-600-normal-fLZuRloM.woff +0 -0
  102. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  103. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  104. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
  105. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
  106. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-ext-600-normal-9HEixskS.woff +0 -0
  107. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-ext-600-normal-V-xxqcpd.woff2 +0 -0
  108. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  109. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  110. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  111. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  112. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
  113. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
  114. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  115. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  116. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
  117. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
  118. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-ext-600-normal-D38SheWl.woff2 +0 -0
  119. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-ext-600-normal-DmB0ttJJ.woff +0 -0
  120. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  121. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  122. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
  123. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
  124. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-vietnamese-600-normal-D2EvbN8M.woff2 +0 -0
  125. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-mono-vietnamese-600-normal-iLQfcSjf.woff +0 -0
  126. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-sans-cyrillic-ext-wght-normal-d45eAU9y.woff2 +0 -0
  127. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-sans-cyrillic-wght-normal-BAAhND-U.woff2 +0 -0
  128. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-sans-greek-wght-normal-CmyJS8uq.woff2 +0 -0
  129. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-sans-latin-ext-wght-normal-CIII54If.woff2 +0 -0
  130. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-sans-latin-wght-normal-IvpUvPa2.woff2 +0 -0
  131. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/ibm-plex-sans-vietnamese-wght-normal-Dg1JeJN0.woff2 +0 -0
  132. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/identity-BNZxCf_y.js +0 -0
  133. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/input-7d4ZlAGD.js +0 -0
  134. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/json.worker-C-kBQgxp.js +0 -0
  135. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/jsonMode-DC1hnmsD.js +0 -0
  136. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/maximize-2-B2tdtoC6.js +0 -0
  137. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/paging-CZR9Tg8m.js +0 -0
  138. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/pipelines-D_CSKLu-.js +0 -0
  139. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/preferences-Cl9nlEI4.js +0 -0
  140. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/preload-helper-Czpn1I53.js +0 -0
  141. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/react-BatatxyT.js +0 -0
  142. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/rolldown-runtime-Dd_uD5pT.js +0 -0
  143. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/shell-CC2rA5mh.js +0 -0
  144. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/sql-NEE52Syq.js +0 -0
  145. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/status-Ctx8x8Mf.js +0 -0
  146. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/store-CVrCnru0.js +0 -0
  147. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/textarea-XMYmRm72.js +0 -0
  148. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/triggers-DwUJXGxD.js +0 -0
  149. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/twig-De2hgUGE.js +0 -0
  150. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/use-heartbeat-ByRKom_T.js +0 -0
  151. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/use-store-CgWwefFs.js +0 -0
  152. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/users-wbUmMgn8.js +0 -0
  153. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/utils-CRMSf51M.js +0 -0
  154. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/workers-Bforr_yR.js +0 -0
  155. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/yaml-Vu_1GF43.js +0 -0
  156. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/assets/yaml.worker-D2mqiKN-.js +0 -0
  157. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/favicon-32.png +0 -0
  158. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/static/logo.png +0 -0
  159. {dirigent_server-0.13.0 → dirigent_server-0.14.0}/src/dirigent_server/transactions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dirigent-server
3
- Version: 0.13.0
3
+ Version: 0.14.0
4
4
  Summary: Dirigent FastAPI server: the REST API, its authentication, and the health probes.
5
5
  License-Expression: LicenseRef-Proprietary
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dirigent-server"
3
- version = "0.13.0"
3
+ version = "0.14.0"
4
4
  description = "Dirigent FastAPI server: the REST API, its authentication, and the health probes."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dirigent-server"
3
- version = "0.13.0"
3
+ version = "0.14.0"
4
4
  description = "Dirigent FastAPI server: the REST API, its authentication, and the health probes."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-BatatxyT.js";import{i as n}from"./store-CVrCnru0.js";import{n as r}from"./chunk-BV7QT456-Bfa1dvOx.js";import{b as i,y as a}from"./dropdown-menu-B9iU0HGD.js";import{n as o,o as s,t as c}from"./PageState-CTB50fRO.js";import{r as l}from"./utils-CRMSf51M.js";import{t as u}from"./WindowedPane-Bl60nHe4.js";import{d,f}from"./paging-CZR9Tg8m.js";import{t as p}from"./input-7d4ZlAGD.js";import{t as m}from"./identity-BNZxCf_y.js";import{n as h,s as g}from"./pipelines-D_CSKLu-.js";import{At as _,Dt as v,Et as y,It as b,Ot as x,T as S,Tt as C,_t as w,b as T,g as E,k as D,kt as O,lt as k,mt as A,nt as j,rt as ee,st as M,ut as N,v as P,w as F,wt as I,x as L,y as R}from"./index-DaM0mXP1.js";import{t as z}from"./Description-DVFPKyRO.js";import{t as B}from"./Instant-C9TZFyg5.js";import{l as V}from"./connections-CdL8xQGj.js";import{n as H,t as U}from"./Refusal-TkoEvvgs.js";import{t as te}from"./Segmented-DvCzioEn.js";import{t as ne}from"./ProgramReference-qv2Y4zei.js";import{t as W}from"./Picker-CNyDCsNP.js";import{t as re}from"./AdminOnly-ChPFWSCk.js";var ie=n(`bell-plus`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M15 8h6`,key:`8ybuxh`}],[`path`,{d:`M18 5v6`,key:`g5ayrv`}],[`path`,{d:`M20.002 14.464a9 9 0 0 0 .738.863A1 1 0 0 1 20 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 8.75-5.332`,key:`1abcvy`}]]),G=n(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),K=e(t(),1),ae=[`run_failed`,`run_completed_with_errors`,`run_succeeded`,`run_stuck`],oe=[`pending`,`sending`,`sent`,`failed`],se=`0s`;function ce(e){return e===se?`none`:e}function le(e){return e.replaceAll(`_`,` `)}function ue(e){return e.scope===`pipeline`&&e.pipeline!==null?e.pipeline:`every pipeline`}function de(e){return e.active&&!e.paused}function fe(e){return e===`sent`||e===`failed`}function pe(e,t=50){let n=new URLSearchParams({limit:String(t)});return e!==null&&n.set(`after`,e),`/alert-rules?${n.toString()}`}function me(e){return a(pe(e))}function he(e){return i(`/alert-rules`,`POST`,e)}function ge(e,t){return i(`/alert-rules/${encodeURIComponent(e)}`,`PATCH`,t)}function _e(e,t){return ge(e,{paused:t})}function ve(e){return a(`/alert-rules/${encodeURIComponent(e)}`,{method:`DELETE`})}var ye={status:``,notifier:``};function be(e,t,n=50){let r=new URLSearchParams({limit:String(n)});return e.status!==``&&r.set(`status`,e.status),e.notifier!==``&&r.set(`notifier`,e.notifier),t!==null&&r.set(`after`,t),`/notifications?${r.toString()}`}function xe(e,t){return a(be(e,t))}function Se(e){return a(`/notifications/${encodeURIComponent(e)}`)}function Ce(e){return i(`/notifications/${encodeURIComponent(e)}/$retry`,`POST`,{})}function we(e){return i(`/alert-rules/$test`,`POST`,e)}async function Te(){return(await a(`/blocks`)).notifiers.map(e=>e.id)}function Ee(e,t){let n=[];for(let r of e){if(r===`log`){n.push({id:r,notifier:r,connection:null,reachable:!0,last_check_at:null,last_check_healthy:null,last_check_detail:null});continue}let e=t.filter(e=>e.kind===r);if(e.length===0){n.push({id:r,notifier:r,connection:null,reachable:!1,last_check_at:null,last_check_healthy:null,last_check_detail:null});continue}for(let t of e)n.push({id:`${r}:${t.code}`,notifier:r,connection:t.code,reachable:!0,last_check_at:t.last_check_at,last_check_healthy:t.last_check_healthy,last_check_detail:t.last_check_detail})}return n}function De(e){return e.notifier===`log`?{tone:`good`,label:`built in`,detail:null}:e.reachable?e.last_check_at===null?{tone:`quiet`,label:`never checked`,detail:null}:{tone:e.last_check_healthy===!0?`good`:`critical`,label:e.last_check_healthy===!0?`checked`:`failing`,detail:e.last_check_detail}:{tone:`quiet`,label:`no connection`,detail:`Nothing delivers through this channel yet.`}}var Oe=/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/u,ke=/^(?:\d+(?:ms|s|m|h|d|w))+$/u,Ae=`A Jinja template: {{ run.* }} reads the run's pipeline, status, id, error, trigger, duration_ms and url.`,je=`A Jinja template over the run's facts; report is the run's report document when it has one.`,q=`text/x-jinja`;function J(e){let t=e.trim();return t===``?null:t}var Me=[{value:`global`,label:`Every pipeline`},{value:`pipeline`,label:`One pipeline`}],Ne={run_failed:`Failed`,run_completed_with_errors:`Completed with errors`,run_succeeded:`Succeeded`,run_stuck:`Stuck`};function Y(e){return e!==``&&e!==`log`}function Pe(e){if(e.code.trim()===``)return`A rule is addressed by its code, and this one has none.`;if(!Oe.test(e.code.trim()))return`A code is lowercase words joined by - or _.`;if(e.scope===`pipeline`&&e.pipeline===``)return`A rule watching one pipeline names that pipeline, and this one names none.`;if(e.notifier===``)return`A rule delivers through a channel, and this one names none.`;if(Y(e.notifier)&&e.connection===``)return`The ${e.notifier} channel delivers through a connection, and this one names none.`;if(!ke.test(e.throttle.trim()))return`A throttle is a duration, such as 15m.`}function Fe(e,t){if(e===``)return`A test goes through a channel, and this one names none.`;if(Y(e)&&t===``)return`The ${e} channel delivers through a connection, and this one names none.`}var X=l();function Ie({rule:e,onChanged:t,onDeleted:n,onTest:r}){let[i,a]=(0,K.useState)(!1),[o,c]=(0,K.useState)(null),l=o===e.code,u=R(),d=(0,K.useCallback)(e=>xe(ye,e),[]),{state:p}=P(d,ze),m=p.rows.filter(t=>t.rule===e.code);return(0,X.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,X.jsxs)(He,{thing:e,children:[e.paused&&(0,X.jsx)(Ve,{children:`paused`}),!e.active&&(0,X.jsx)(Ve,{children:`off`})]}),(0,X.jsx)(z,{text:e.description}),(0,X.jsxs)(`dl`,{className:`space-y-1.5`,children:[(0,X.jsx)(Q,{label:`Event`,children:le(e.event)}),(0,X.jsx)(Q,{label:`Scope`,children:ue(e)}),(0,X.jsx)(Q,{label:`Delivers through`,children:(0,X.jsx)(Z,{notifier:e.notifier,connection:e.connection})}),(0,X.jsx)(Q,{label:`Throttle`,children:ce(e.throttle)}),l?(0,X.jsx)(Le,{rule:e,onDone:()=>{c(null)},onSaved:e=>{t(e),c(null)}},e.code):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{label:`Subject`,children:(0,X.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-2`,children:[e.template===null?(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`none`}):(0,X.jsx)(`span`,{className:`font-mono text-xs break-all`,children:e.template}),(0,X.jsx)(s,{why:u.why,children:(0,X.jsx)(f,{variant:`ghost`,size:`xs`,disabled:!u.may,title:u.why,onClick:()=>{c(e.code)},children:`Edit`})})]})}),e.body!==null&&(0,X.jsx)(Q,{label:`Body`,children:(0,X.jsx)(`span`,{className:`line-clamp-3 font-mono text-xs break-words whitespace-pre-wrap`,children:e.body})})]}),(0,X.jsx)(Q,{label:`Last sent`,children:e.last_sent_at===null?(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`never`}):(0,X.jsx)(B,{at:e.last_sent_at})})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(s,{why:u.why,children:(0,X.jsx)(f,{variant:`outline`,size:`sm`,disabled:i||!u.may,title:u.why,onClick:()=>{a(!0),_e(e.code,!e.paused).then(t,H).finally(()=>{a(!1)})},children:e.paused?`Resume`:`Pause`})}),(0,X.jsx)(s,{why:u.why,children:(0,X.jsx)(f,{variant:`outline`,size:`sm`,disabled:!u.may,title:u.why,onClick:r,children:`Send a test`})}),(0,X.jsx)(s,{why:u.why,children:(0,X.jsx)(f,{variant:`outline`,size:`sm`,className:`destructive-action ml-auto`,disabled:i||!u.may,title:u.why,onClick:()=>{a(!0),ve(e.code).then(n,H).finally(()=>{a(!1)})},children:`Delete`})})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Recent deliveries`}),!p.read&&(0,X.jsx)(`p`,{className:`text-xs text-faint`,children:`Reading from the server`}),p.read&&m.length===0&&(0,X.jsx)(`p`,{className:`text-xs text-faint`,children:`Nothing sent.`}),(0,X.jsx)(`ul`,{className:`divide-y divide-border`,children:m.map(e=>(0,X.jsxs)(`li`,{className:`row-hover -mx-4 flex items-center gap-2 px-4 py-2`,children:[(0,X.jsx)(L,{status:e.status}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs`,children:e.subject}),(0,X.jsx)(B,{className:`shrink-0 text-xs text-faint`,at:e.created_at})]},e.id))})]})]})}function Le({rule:e,onDone:t,onSaved:n}){let[r,i]=(0,K.useState)(e.template??``),[a,o]=(0,K.useState)(e.body??``),[s,c]=(0,K.useState)(null),[l,m]=(0,K.useState)(!1),h=`alert-rule/${e.code}/body`,g=`rule-${e.code}-subject`;return(0,X.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-border bg-secondary/30 p-3`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(D,{htmlFor:g,children:`Subject`}),(0,X.jsx)(p,{id:g,className:`font-mono`,spellCheck:!1,autoComplete:`off`,value:r,placeholder:`{{ run.pipeline }} run {{ run.status }}`,onChange:e=>{i(e.target.value)}}),(0,X.jsx)(`p`,{className:`text-xs text-faint`,children:Ae})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(D,{children:`Body`}),(0,X.jsx)(`p`,{className:`text-xs text-faint`,children:je}),(0,X.jsx)(u,{name:`body`,className:`overflow-hidden rounded-md border border-border bg-background`,aside:(0,X.jsx)(ne,{mediaType:q}),windowed:(0,X.jsx)(M,{value:a,mediaType:q,path:h,label:`body, in a window`,className:`min-h-0 flex-1`,onChange:o}),children:(0,X.jsx)(M,{value:a,mediaType:q,path:h,label:`body`,placeholder:`{{ run.pipeline }} ended {{ run.status }}: {{ run.url }}`,className:`h-40 min-h-32`,onChange:o})})]}),s!==null&&(0,X.jsx)(U,{problem:s}),(0,X.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,X.jsx)(f,{variant:`ghost`,size:`sm`,onClick:t,children:`Cancel`}),(0,X.jsx)(f,{size:`sm`,disabled:l,onClick:()=>{let i={};if(J(r)!==e.template&&(i.template=J(r)),J(a)!==e.body&&(i.body=J(a)),Object.keys(i).length===0){t();return}m(!0),c(null),ge(e.code,i).then(n,e=>{c(d(e))}).finally(()=>{m(!1)})},children:l?`Saving`:`Save`})]})]})}function Re({notification:e,onChanged:t}){let[n,i]=(0,K.useState)(!1),a=R();return(0,X.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,X.jsx)(`div`,{className:`space-y-1`,children:(0,X.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(L,{status:e.status}),(0,X.jsx)(`span`,{className:`text-sm font-semibold`,children:e.subject})]})}),(0,X.jsxs)(`dl`,{className:`space-y-1.5`,children:[e.rule===null?(0,X.jsx)(Q,{label:`Raised by`,children:(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`a test, not a rule`})}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{label:`Event`,children:le(e.event)}),(0,X.jsx)(Q,{label:`Rule`,children:(0,X.jsx)(`span`,{className:`font-mono text-xs`,children:e.rule})})]}),(0,X.jsx)(Q,{label:`Delivers through`,children:(0,X.jsx)(Z,{notifier:e.notifier,connection:e.connection})}),(0,X.jsx)(Q,{label:`Run`,children:(0,X.jsx)(Be,{notification:e})}),(0,X.jsx)(Q,{label:`Queued`,children:(0,X.jsx)(B,{at:e.created_at})}),e.status===`sent`?(0,X.jsx)(Q,{label:`Sent`,children:(0,X.jsx)(B,{at:e.sent_at})}):(0,X.jsx)(Q,{label:`Next try`,children:(0,X.jsx)(B,{at:e.available_at})}),(0,X.jsxs)(Q,{label:`Attempts`,children:[e.attempt,` of `,e.max_attempts]})]}),e.error!==null&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`What the channel said`}),(0,X.jsx)(`p`,{className:`text-xs break-words text-critical`,children:e.error}),(0,X.jsx)(`p`,{className:`text-xs text-faint`,children:`Only the latest refusal is kept. Earlier attempts are counted, not stored.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(s,{why:a.why,children:(0,X.jsx)(f,{variant:`outline`,size:`sm`,disabled:n||!a.may,title:a.why,onClick:()=>{i(!0),Ce(e.id).then(t,H).finally(()=>{i(!1)})},children:`Retry now`})}),e.run_id!==null&&(0,X.jsx)(f,{variant:`outline`,size:`sm`,render:(0,X.jsx)(r,{to:`/runs/${e.run_id}`}),children:`Open the run`})]})]})}var ze=e=>e.id;function Z({notifier:e,connection:t}){return(0,X.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-sm`,children:e}),t!==null&&(0,X.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:t})]})}function Be({notification:e}){if(e.run_id===null)return(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`no run`});let t=e.run_pipeline??`a run`;return(0,X.jsxs)(r,{className:`text-primary hover:underline`,to:`/runs/${e.run_id}`,children:[(0,X.jsx)(`span`,{className:`text-sm`,children:t}),e.run_started_at!==null&&(0,X.jsx)(B,{className:`ml-1.5 text-xs text-muted-foreground`,at:e.run_started_at})]})}function Ve({children:e}){return(0,X.jsx)(`span`,{className:`rounded-sm border border-border px-1.5 text-xs text-muted-foreground`,children:e})}function He({thing:e,children:t}){let n=m(e);return(0,X.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:n.named?`text-sm font-semibold`:`font-mono text-sm font-semibold`,children:n.title}),t,n.code!==null&&(0,X.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:n.code})]})}function Q({label:e,children:t}){return(0,X.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,X.jsx)(`dt`,{className:`w-32 shrink-0 text-xs text-muted-foreground`,children:e}),(0,X.jsx)(`dd`,{className:`min-w-0 text-sm`,children:t})]})}var Ue={good:`var(--good)`,critical:`var(--critical)`,quiet:`var(--faint)`};function We({channels:e}){return(0,X.jsx)(`ul`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:e.map(e=>(0,X.jsx)(Ge,{channel:e},e.id))})}function Ge({channel:e}){let t=De(e);return(0,X.jsxs)(`li`,{className:`flex items-start justify-between gap-3 rounded-lg border border-border bg-card p-3`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,title:e.connection===null?e.notifier:`${e.notifier} ${e.connection}`,children:[(0,X.jsx)(`span`,{className:`status-dot shrink-0`,style:{"--chip":Ue[t.tone]}}),(0,X.jsx)(`span`,{className:`shrink-0 text-sm font-medium`,children:e.notifier}),e.connection!==null&&(0,X.jsx)(`span`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e.connection})]}),(0,X.jsxs)(`span`,{className:`flex shrink-0 flex-col items-end`,children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.label}),e.last_check_at!==null&&(0,X.jsx)(B,{className:`text-xs text-faint`,at:e.last_check_at}),t.detail!==null&&(0,X.jsx)(`span`,{className:`max-w-48 truncate text-xs text-faint`,title:t.detail,children:t.detail})]})]})}function $({id:e,label:t,value:n,onChange:r,placeholder:i,mono:a,hint:o}){return(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(D,{htmlFor:e,children:t}),(0,X.jsx)(p,{id:e,className:a===!0?`font-mono`:void 0,spellCheck:!1,autoComplete:`off`,value:n,placeholder:i,onChange:e=>{r(e.target.value)}}),o!==void 0&&(0,X.jsx)(`p`,{className:`text-xs text-faint`,children:o})]})}function Ke({id:e,notifiers:t,value:n,onChange:r}){return(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(D,{htmlFor:e,children:`Notifier`}),(0,X.jsx)(W,{id:e,label:`Notifier`,value:n,options:t.map(e=>({value:e,label:e,aside:``})),placeholder:`Search the installed channels`,onChange:r})]})}function qe({id:e,kind:t,value:n,onChange:r}){let i=Je(t);return(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(D,{htmlFor:e,children:`Connection`}),(0,X.jsx)(W,{id:e,label:`Connection`,value:n,options:i,placeholder:i.length===0?`No ${t} connection yet`:`Search by name or code`,onChange:r})]})}function Je(e){let[t,n]=(0,K.useState)([]);return(0,K.useEffect)(()=>{if(e===``||e===`log`)return;let t=!0;return V().then(e=>{t&&n(e.items)},()=>{t&&n([])}),()=>{t=!1}},[e]),t.filter(t=>t.kind===e).map(e=>{let t=m(e);return{value:e.code,label:t.title,aside:t.code??``}})}var Ye=`0s`,Xe=`alert-rule/new/body`,Ze=`body`;function Qe({open:e,onOpenChange:t,notifiers:n,onCreated:r}){let[i,a]=(0,K.useState)(``),[o,c]=(0,K.useState)(``),[l,p]=(0,K.useState)(``),[m,h]=(0,K.useState)(`run_failed`),[g,v]=(0,K.useState)(`global`),[b,S]=(0,K.useState)(``),[w,E]=(0,K.useState)(``),[k,A]=(0,K.useState)(``),[j,ee]=(0,K.useState)(``),[N,P]=(0,K.useState)(``),[F,L]=(0,K.useState)(Ye),[z,B]=(0,K.useState)(null),[V,H]=(0,K.useState)(!1),re=$e(e),ie=R(),G=T(ie.why,Pe({code:i,scope:g,pipeline:b,notifier:w,connection:k,throttle:F}));return(0,X.jsx)(I,{open:e,onOpenChange:t,children:(0,X.jsxs)(y,{className:`flex max-h-[calc(100vh-4rem)] flex-col sm:max-w-3xl`,showCloseButton:!1,children:[(0,X.jsx)(O,{children:(0,X.jsx)(_,{children:`New rule`})}),(0,X.jsxs)(`div`,{className:`-mx-1 min-h-0 flex-1 space-y-4 overflow-y-auto px-1`,children:[(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,X.jsx)($,{id:`rule-code`,label:`Code`,value:i,onChange:a,placeholder:`ops-slack-failed`,mono:!0}),(0,X.jsx)($,{id:`rule-name`,label:`Name`,value:o,onChange:c,placeholder:`Tell the ops channel`})]}),(0,X.jsx)($,{id:`rule-description`,label:`Description`,value:l,onChange:p,placeholder:`What this rule is for`}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(D,{children:`Event`}),(0,X.jsx)(te,{label:`Event`,size:`md`,value:m,options:ae.map(e=>({value:e,label:Ne[e]})),onChoose:h})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(D,{children:`Scope`}),(0,X.jsx)(te,{label:`Scope`,size:`md`,value:g,options:Me,onChoose:v})]}),g===`pipeline`&&(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(D,{htmlFor:`rule-pipeline`,children:`Pipeline`}),(0,X.jsx)(W,{id:`rule-pipeline`,label:`Pipeline`,value:b,options:re,placeholder:`Search by name or code`,onChange:S})]})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,X.jsx)(Ke,{id:`rule-notifier`,notifiers:n,value:w,onChange:e=>{E(e),A(``)}}),Y(w)&&(0,X.jsx)(qe,{id:`rule-connection`,kind:w,value:k,onChange:A})]}),(0,X.jsx)($,{id:`rule-subject`,label:`Subject`,value:j,onChange:ee,placeholder:`{{ run.pipeline }} run {{ run.status }}`,mono:!0,hint:Ae}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(D,{children:`Body`}),(0,X.jsx)(`p`,{className:`text-xs text-faint`,children:je}),(0,X.jsx)(u,{name:Ze,className:`overflow-hidden rounded-md border border-border`,aside:(0,X.jsx)(ne,{mediaType:q}),windowed:(0,X.jsx)(M,{value:N,mediaType:q,path:Xe,label:`${Ze}, in a window`,className:`min-h-0 flex-1`,onChange:P}),children:(0,X.jsx)(M,{value:N,mediaType:q,path:Xe,label:Ze,placeholder:`{{ run.pipeline }} ended {{ run.status }}: {{ run.url }}`,className:`h-40 min-h-32`,onChange:P})})]}),(0,X.jsx)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:(0,X.jsx)($,{id:`rule-throttle`,label:`Throttle`,value:F,onChange:L,placeholder:`15m`,mono:!0})})]}),z!==null&&(0,X.jsx)(U,{problem:z}),(0,X.jsxs)(x,{children:[(0,X.jsx)(`p`,{className:`mr-auto self-center text-xs text-muted-foreground`,children:`A rule fires when a run settles. Nothing is sent now.`}),(0,X.jsx)(C,{render:(0,X.jsx)(f,{variant:`ghost`}),children:`Close`}),(0,X.jsx)(s,{why:G,children:(0,X.jsx)(f,{disabled:V||G!==void 0,title:G,onClick:()=>{H(!0),B(null),he({code:i.trim(),name:J(o),description:J(l),event:m,notifier:w,scope:g,pipeline:g===`pipeline`?b:null,connection:Y(w)?k:null,template:J(j),body:J(N),throttle:F.trim()}).then(()=>{r(),a(``),c(``),p(``),ee(``),P(``),t(!1)},e=>{B(d(e))}).finally(()=>{H(!1)})},children:V?`Creating`:`Create`})})]})]})})}function $e(e){let[t,n]=(0,K.useState)([]);return(0,K.useEffect)(()=>{if(!e)return;let t=!0;return g().then(e=>{t&&n(e.toSorted(h).map(e=>{let t=m(e);return{value:e.code,label:t.title,aside:t.code??``}}))},()=>{t&&n([])}),()=>{t=!1}},[e]),t}var et=1e3,tt=6e4,nt=`dirigent test alert`,rt={notifier:``,connection:``,subject:``};function it({open:e,draft:t,onOpenChange:n,notifiers:r,onQueued:i,onOpenQueue:a}){let[o,c]=(0,K.useState)(t.notifier),[l,u]=(0,K.useState)(t.connection),[p,m]=(0,K.useState)(t.subject),[h,g]=(0,K.useState)(null),[b,S]=(0,K.useState)(null),[w,E]=(0,K.useState)(!1),D=ot(h),k=R(),A=D!==null&&fe(D.status)?D.id:null;(0,K.useEffect)(()=>{A!==null&&i()},[A]);let j=T(k.why,Fe(o,l));return(0,X.jsx)(I,{open:e,onOpenChange:n,children:(0,X.jsxs)(y,{className:`sm:max-w-lg`,showCloseButton:!1,children:[(0,X.jsxs)(O,{children:[(0,X.jsx)(_,{children:`Send a test`}),(0,X.jsx)(v,{children:`The message goes through the same queue a real alert does, and a worker delivers it.`})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,X.jsx)(Ke,{id:`test-notifier`,notifiers:r,value:o,onChange:e=>{c(e),u(``)}}),Y(o)&&(0,X.jsx)(qe,{id:`test-connection`,kind:o,value:l,onChange:u})]}),(0,X.jsx)($,{id:`test-subject`,label:`Subject`,value:p,onChange:m,placeholder:nt}),b!==null&&(0,X.jsx)(U,{problem:b}),D!==null&&(0,X.jsx)(at,{row:D}),(0,X.jsxs)(x,{children:[(0,X.jsx)(C,{render:(0,X.jsx)(f,{variant:`ghost`}),children:`Close`}),h!==null&&(0,X.jsx)(f,{variant:`outline`,onClick:()=>{a(h)},children:`Open in the queue`}),(0,X.jsx)(s,{why:j,children:(0,X.jsx)(f,{disabled:w||j!==void 0,title:j,onClick:()=>{E(!0),S(null),g(null),we({notifier:o,connection:Y(o)?l:null,...p.trim()===``?{}:{subject:p.trim()}}).then(e=>{g(e.notification_id),i()},e=>{S(d(e))}).finally(()=>{E(!1)})},children:h===null?`Send`:`Send again`})})]})]})})}function at({row:e}){return(0,X.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-border bg-secondary/40 p-3`,"data-testid":`test-delivery`,"aria-live":`polite`,children:[(0,X.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(L,{status:e.status}),(0,X.jsx)(`span`,{className:`text-sm`,children:e.subject})]}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.status===`sent`?(0,X.jsxs)(X.Fragment,{children:[`Delivered `,(0,X.jsx)(B,{at:e.sent_at}),`.`]}):e.status===`failed`?(0,X.jsxs)(X.Fragment,{children:[`Given up after `,e.attempt,` of `,e.max_attempts,` attempts.`]}):e.attempt===0?`Queued for the next worker pass.`:(0,X.jsxs)(X.Fragment,{children:[`Attempt `,e.attempt,` of `,e.max_attempts,`, next try`,` `,(0,X.jsx)(B,{at:e.available_at}),`.`]})}),e.error!==null&&(0,X.jsx)(`p`,{className:`text-xs break-words text-critical`,children:e.error})]})}function ot(e){let[t,n]=(0,K.useState)(null);return(0,K.useEffect)(()=>{if(e===null)return;let t=!0,r,i=Date.now()+tt,a=()=>{Se(e).then(o=>{t&&(n({id:e,row:o}),!(fe(o.status)||Date.now()>i)&&(r=setTimeout(a,et)))},()=>{})};return a(),()=>{t=!1,r!==void 0&&clearTimeout(r)}},[e]),t!==null&&t.id===e?t.row:null}var st=e=>e.id,ct=e=>e.id;function lt(){return(0,X.jsx)(re,{children:(0,X.jsx)(ut,{})})}function ut(){let[e,t]=(0,K.useState)(!1),[n,r]=(0,K.useState)(null),[i,a]=(0,K.useState)(null),[s,l]=(0,K.useState)(null),[u,d]=(0,K.useState)({status:``,notifier:``}),[f,p]=(0,K.useState)({}),[m,h]=(0,K.useState)({}),g=P((0,K.useCallback)(e=>me(e),[]),st),_=P((0,K.useCallback)(e=>xe(u,e),[u]),ct),v=pt(),{reload:y}=g,{reload:x}=_,C=(0,K.useMemo)(()=>g.state.rows.map(e=>f[e.id]??e),[f,g.state.rows]),T=(0,K.useMemo)(()=>_.state.rows.map(e=>m[e.id]??e),[m,_.state.rows]),D=C.find(e=>e.id===i)??null,O=T.find(e=>e.id===s)??null,M=(0,K.useCallback)(e=>{r(t=>({draft:e,opened:(t?.opened??0)+1}))},[]);(0,K.useEffect)(()=>(ee({note:null,tone:`quiet`,identifier:null}),j),[]),(0,K.useEffect)(()=>{if(D!==null){let e=D;return k([{id:`rule`,label:`Rule`,render:()=>(0,X.jsx)(Ie,{rule:e,onChanged:e=>{p(t=>({...t,[e.id]:e}))},onDeleted:()=>{a(null),y()},onTest:()=>{M({notifier:e.notifier,connection:e.connection??``,subject:``})}})}],{screen:`alerting`})}if(O!==null){let e=O;return k([{id:`notification`,label:`Notification`,render:()=>(0,X.jsx)(Re,{notification:e,onChanged:e=>{h(t=>({...t,[e.id]:e}))}})}],{screen:`alerting`})}},[O,D,M,y]);let I=R(`admin`),z=I.may;return(0,K.useEffect)(()=>w([...z?[{id:`alerting:rule`,title:`New alert rule`,group:A,screen:!0,icon:ie,keywords:[`alert`,`event`,`create`],run:()=>{t(!0)}},{id:`alerting:test`,title:`Send a test through a channel`,group:A,screen:!0,icon:G,keywords:[`alert`,`notification`,`try`],run:()=>{M(rt)}}]:[],{id:`alerting:reload`,title:`Read the alert rules again`,group:A,screen:!0,icon:b,keywords:[`refresh`,`reload`],run:()=>{y(),x()}}]),[z,M,x,y]),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(c,{title:`Alerting`,aside:(0,X.jsx)(S,{tag:`alerts`}),actions:[{id:`test`,label:`Send a test`,icon:G,variant:`outline`,disabled:!I.may,why:I.why,onClick:()=>{M(rt)}},{id:`rule`,label:`New rule`,icon:ie,disabled:!I.may,why:I.why,onClick:()=>{t(!0)}}]}),(0,X.jsxs)(`section`,{className:`mb-6 space-y-2`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Channels`}),v.read?v.rows.length===0?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No channel is installed.`}):(0,X.jsx)(We,{channels:v.rows}):(0,X.jsx)(`p`,{className:`text-sm text-faint`,children:`Reading from the server`})]}),(0,X.jsxs)(`section`,{className:`space-y-2`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Rules`}),(0,X.jsx)(o,{loading:!g.state.read,problem:g.state.problem,empty:C.length===0,emptyMessage:`No rules.`,children:(0,X.jsx)(F,{columns:mt,rows:C,rowKey:st,rowClassName:e=>de(e)?void 0:`opacity-60`,reading:g.state.reading,next:g.state.next,onMore:g.more,noun:`rules`,onSelect:e=>{l(null),a(e.id),N()},selected:e=>e.id===i})})]}),(0,X.jsxs)(`section`,{className:`mt-8 space-y-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Notifications`}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(E,{label:`Status`,value:u.status,anything:`Any status`,options:oe.map(e=>({value:e,label:e,mark:(0,X.jsx)(L,{status:e})})),onChange:e=>{d(t=>({...t,status:e}))}}),(0,X.jsx)(E,{label:`Notifier`,value:u.notifier,anything:`Any notifier`,options:ft(v.rows),onChange:e=>{d(t=>({...t,notifier:e}))}})]})]}),(0,X.jsx)(o,{loading:!_.state.read,problem:_.state.problem,empty:T.length===0,emptyMessage:`Nothing queued.`,children:(0,X.jsx)(F,{columns:ht,rows:T,rowKey:ct,reading:_.state.reading,next:_.state.next,onMore:_.more,noun:`notifications`,onSelect:e=>{a(null),l(e.id),N()},selected:e=>e.id===s})})]}),(0,X.jsx)(Qe,{open:e,onOpenChange:t,notifiers:dt(v.rows),onCreated:y}),(0,X.jsx)(it,{open:n!==null,draft:n?.draft??rt,onOpenChange:e=>{e||r(null)},notifiers:dt(v.rows),onQueued:x,onOpenQueue:e=>{r(null),a(null),l(e),x(),N()}},n?.opened??0)]})}function dt(e){return[...new Set(e.map(e=>e.notifier))]}function ft(e){return dt(e).map(e=>({value:e,label:e}))}function pt(){let[e,t]=(0,K.useState)(null),[n,r]=(0,K.useState)(null);return(0,K.useEffect)(()=>{let e=!0;return Te().then(n=>{e&&t(n)},()=>{e&&t([])}),V().then(t=>{e&&r(t.items)},()=>{e&&r([])}),()=>{e=!1}},[]),{rows:(0,K.useMemo)(()=>Ee(e??[],n??[]),[n,e]),read:e!==null&&n!==null}}var mt=[{id:`rule`,header:`Rule`,cell:e=>{let t=m(e);return(0,X.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,X.jsx)(`span`,{className:t.named?`text-sm font-medium`:`font-mono text-sm font-medium`,children:t.title}),t.code!==null&&(0,X.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:t.code})]})}},{id:`event`,header:`Event`,cell:e=>(0,X.jsx)(`span`,{className:`text-sm`,children:Ne[e.event]})},{id:`scope`,header:`Scope`,cell:e=>(0,X.jsx)(`span`,{className:e.scope===`pipeline`?`font-mono text-xs`:`text-sm`,children:ue(e)})},{id:`delivers`,header:`Delivers through`,cell:e=>(0,X.jsx)(Z,{notifier:e.notifier,connection:e.connection})},{id:`throttle`,header:`Throttle`,className:`font-mono text-xs`,cell:e=>(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:ce(e.throttle)})},{id:`sent`,header:`Last sent`,className:`text-xs`,cell:e=>e.last_sent_at===null?(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`never`}):(0,X.jsx)(B,{className:`text-muted-foreground`,at:e.last_sent_at})},{id:`live`,header:`State`,cell:e=>e.paused?(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`paused`}):e.active?(0,X.jsx)(`span`,{className:`text-xs text-good`,children:`active`}):(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`off`})}],ht=[{id:`status`,header:`Status`,cell:e=>(0,X.jsx)(L,{status:e.status})},{id:`subject`,header:`Subject`,cell:e=>(0,X.jsxs)(`span`,{className:`flex flex-col`,children:[(0,X.jsx)(`span`,{className:`text-sm`,children:e.subject}),e.error!==null&&(0,X.jsx)(`span`,{className:`max-w-96 truncate text-xs text-critical`,title:e.error,children:e.error})]})},{id:`delivers`,header:`Delivers through`,cell:e=>(0,X.jsx)(Z,{notifier:e.notifier,connection:e.connection})},{id:`run`,header:`Run`,cell:e=>(0,X.jsx)(Be,{notification:e})},{id:`queued`,header:`Queued`,className:`text-xs`,cell:e=>(0,X.jsx)(B,{className:`text-muted-foreground`,at:e.created_at})},{id:`sent`,header:`Sent`,className:`text-xs`,cell:e=>e.status===`sent`?(0,X.jsx)(B,{className:`text-muted-foreground`,at:e.sent_at}):e.attempt>0?(0,X.jsxs)(`span`,{className:`text-faint`,children:[e.attempt,` of `,e.max_attempts,` attempts`]}):null}];export{lt as AdminAlerting};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-BatatxyT.js";import{n,t as r}from"./PageState-CTB50fRO.js";import{r as i}from"./utils-CRMSf51M.js";import{t as a}from"./input-7d4ZlAGD.js";import{T as o,_ as s,lt as c,nt as l,rt as u,ut as d,w as f}from"./index-CeUoyQJy.js";import{t as p}from"./Markdown-B6er3LhH.js";import{t as m}from"./KindChip-CuBFi3X9.js";import{a as h,c as g,l as _,n as v,o as y,r as b,t as x}from"./blocks-CPJMNxIu.js";import{n as S,r as C}from"./Panel-Bk3CoJZ6.js";import{r as w}from"./schema-form-FkbdR3oI.js";var T=e(t(),1),E=i(),D=e=>e.id,O=[{key:`scheme`,title:`Storage schemes`,noun:`schemes`},{key:`notifier`,title:`Notifiers`,noun:`notifiers`},{key:`connection`,title:`Connection kinds`,noun:`connection kinds`}],k=e=>t=>`${e}:${t.id}`,A=()=>{};function j(){let[e,t]=(0,T.useState)(``),[i,p]=(0,T.useState)(null),{value:m,problem:_,read:v}=s(g),b=(0,T.useMemo)(()=>m?.blocks??[],[m]),S=(0,T.useMemo)(()=>h(b,e),[b,e]),C=(0,T.useMemo)(()=>x(S),[S]),w=(0,T.useMemo)(()=>y(m?.storage_schemes??[],e),[m,e]),j=(0,T.useMemo)(()=>y(m?.notifiers??[],e),[m,e]),I=(0,T.useMemo)(()=>y(m?.connection_kinds??[],e),[m,e]),L=b.find(e=>`block:${e.id}`===i)??null,R={scheme:w,notifier:j,connection:I},z=O.flatMap(e=>R[e.key].map(t=>({registry:e,entry:t}))).find(({registry:e,entry:t})=>k(e.key)(t)===i)??null;(0,T.useEffect)(()=>{if(v)return u({note:null,tone:`quiet`,identifier:null}),l},[b,v,m]),(0,T.useEffect)(()=>{if(L!==null)return c([{id:`block`,label:`Block`,render:()=>(0,E.jsx)(F,{entry:L})}],{screen:`blocks`});if(z!==null){let{registry:e,entry:t}=z;return c([{id:`entry`,label:e.title,render:()=>(0,E.jsx)(P,{entry:t})}],{screen:`blocks`})}},[L,z]);let B=(0,T.useCallback)(e=>{p(`block:${e.id}`),d()},[]);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(r,{title:`Blocks`,aside:(0,E.jsx)(o,{tag:`blocks`})}),(0,E.jsx)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:(0,E.jsx)(a,{className:`w-56`,value:e,onChange:e=>{t(e.target.value)},placeholder:`Search blocks`,"aria-label":`Search blocks by id or summary`})}),(0,E.jsx)(n,{loading:!v,problem:_,empty:S.length===0&&w.length===0&&j.length===0&&I.length===0,emptyMessage:b.length===0?`No blocks installed — plugins contribute them.`:`Nothing in the catalog matches that.`,children:(0,E.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[C.map(([e,t])=>(0,E.jsxs)(`section`,{children:[(0,E.jsx)(`h2`,{className:`mb-1.5 font-mono text-xs font-semibold tracking-wide text-faint uppercase`,children:e}),(0,E.jsx)(f,{chrome:{footer:!1},fixed:!0,columns:M,rows:t,rowKey:D,reading:!1,next:null,onMore:A,noun:`blocks`,onSelect:B,selected:e=>`block:${e.id}`===i})]},e)),O.map(e=>{let t=R[e.key];return t.length===0?null:(0,E.jsxs)(`section`,{children:[(0,E.jsx)(`h2`,{className:`mb-1.5 font-mono text-xs font-semibold tracking-wide text-faint uppercase`,children:e.title}),(0,E.jsx)(f,{chrome:{footer:!1},fixed:!0,columns:N(e.key),rows:t,rowKey:k(e.key),reading:!1,next:null,onMore:A,noun:e.noun,onSelect:t=>{p(k(e.key)(t)),d()},selected:t=>k(e.key)(t)===i})]},e.key)})]})})]})}var M=[{id:`block`,header:`Block`,className:`w-full max-w-0`,cell:e=>(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`span`,{className:`font-mono text-sm font-semibold`,children:e.id}),(0,E.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:e.summary,children:e.summary})]})},{id:`kind`,header:`Kind`,className:`w-32 whitespace-nowrap`,cell:e=>(0,E.jsx)(m,{kind:e.kind})},{id:`plugin`,header:`Plugin`,className:`w-36 font-mono text-xs whitespace-nowrap`,cell:e=>(0,E.jsx)(`span`,{className:`text-muted-foreground`,children:e.plugin})}];function N(e){let t=e===`scheme`?`storage`:e;return[{id:`entry`,header:`Entry`,className:`w-full max-w-0`,cell:e=>{let t=typeof e.config_schema.description==`string`?e.config_schema.description:``;return(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`span`,{className:`font-mono text-sm font-semibold`,children:e.id}),(0,E.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:t,children:t})]})}},{id:`kind`,header:`Kind`,className:`w-32 whitespace-nowrap`,cell:()=>(0,E.jsx)(m,{kind:t})},{id:`plugin`,header:`Plugin`,className:`w-36 font-mono text-xs whitespace-nowrap`,cell:e=>(0,E.jsx)(`span`,{className:`text-muted-foreground`,children:e.plugin})}]}function P({entry:e}){let t=(0,T.useMemo)(()=>w(e.config_schema),[e]),n=typeof e.config_schema.description==`string`?e.config_schema.description:null;return(0,E.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(`h2`,{className:`font-mono text-sm font-semibold`,children:e.id}),n!==null&&(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n}),(0,E.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:(0,E.jsx)(S,{term:`plugin`,detail:e.plugin})})]}),(0,E.jsx)(C,{title:`Config`,children:t.length===0?(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This takes no configuration.`}):(0,E.jsx)(`div`,{className:`flex flex-col gap-4`,children:t.map(e=>(0,E.jsx)(I,{field:e},e.name))})})]})}function F({entry:e}){let t=(0,T.useMemo)(()=>w(e.config_schema),[e]),n=b(e);return(0,E.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(`h2`,{className:`font-mono text-sm font-semibold`,children:e.id}),(0,E.jsx)(`p`,{children:(0,E.jsx)(m,{kind:e.kind})}),(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.summary})]}),(0,E.jsx)(C,{title:`Facts`,children:(0,E.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:n.map(e=>(0,E.jsx)(S,{term:e.term,detail:e.detail},e.term))})}),(0,E.jsx)(C,{title:`Config`,children:t.length===0?(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This block takes no configuration.`}):(0,E.jsx)(`div`,{className:`flex flex-col gap-4`,children:t.map(e=>(0,E.jsx)(I,{field:e},e.name))})})]})}function I({field:e}){let t=v(e);return(0,E.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,E.jsx)(`span`,{className:`font-mono text-sm font-medium`,children:e.name}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:_(e)}),e.required&&(0,E.jsx)(`span`,{className:`text-xs text-primary`,children:`required`}),e.hint!==null&&(0,E.jsx)(`span`,{className:`text-xs text-faint`,children:e.hint}),t!==null&&(0,E.jsxs)(`span`,{className:`text-xs text-faint`,children:[`default `,t]})]}),e.options.length>0&&(0,E.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:e.options.map(e=>e.label).join(` · `)}),e.help!==null&&(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,E.jsx)(p,{text:e.help})})]})}export{j as Blocks};
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-BatatxyT.js";import{n,t as r}from"./PageState-CTB50fRO.js";import{r as i}from"./utils-CRMSf51M.js";import{t as a}from"./input-7d4ZlAGD.js";import{T as o,_ as s,lt as c,nt as l,rt as u,ut as d,w as f}from"./index-DaM0mXP1.js";import{t as p}from"./Markdown-B6er3LhH.js";import{t as m}from"./KindChip-CuBFi3X9.js";import{a as h,c as g,l as _,n as v,o as y,r as b,t as x}from"./blocks-CPJMNxIu.js";import{n as S,r as C}from"./Panel-Bk3CoJZ6.js";import{r as w}from"./schema-form-dcZ8A0M1.js";var T=e(t(),1),E=i(),D=e=>e.id,O=[{key:`scheme`,title:`Storage schemes`,noun:`schemes`},{key:`notifier`,title:`Notifiers`,noun:`notifiers`},{key:`connection`,title:`Connection kinds`,noun:`connection kinds`}],k=e=>t=>`${e}:${t.id}`,A=()=>{};function j(){let[e,t]=(0,T.useState)(``),[i,p]=(0,T.useState)(null),{value:m,problem:_,read:v}=s(g),b=(0,T.useMemo)(()=>m?.blocks??[],[m]),S=(0,T.useMemo)(()=>h(b,e),[b,e]),C=(0,T.useMemo)(()=>x(S),[S]),w=(0,T.useMemo)(()=>y(m?.storage_schemes??[],e),[m,e]),j=(0,T.useMemo)(()=>y(m?.notifiers??[],e),[m,e]),I=(0,T.useMemo)(()=>y(m?.connection_kinds??[],e),[m,e]),L=b.find(e=>`block:${e.id}`===i)??null,R={scheme:w,notifier:j,connection:I},z=O.flatMap(e=>R[e.key].map(t=>({registry:e,entry:t}))).find(({registry:e,entry:t})=>k(e.key)(t)===i)??null;(0,T.useEffect)(()=>{if(v)return u({note:null,tone:`quiet`,identifier:null}),l},[b,v,m]),(0,T.useEffect)(()=>{if(L!==null)return c([{id:`block`,label:`Block`,render:()=>(0,E.jsx)(F,{entry:L})}],{screen:`blocks`});if(z!==null){let{registry:e,entry:t}=z;return c([{id:`entry`,label:e.title,render:()=>(0,E.jsx)(P,{entry:t})}],{screen:`blocks`})}},[L,z]);let B=(0,T.useCallback)(e=>{p(`block:${e.id}`),d()},[]);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(r,{title:`Blocks`,aside:(0,E.jsx)(o,{tag:`blocks`})}),(0,E.jsx)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:(0,E.jsx)(a,{className:`w-56`,value:e,onChange:e=>{t(e.target.value)},placeholder:`Search blocks`,"aria-label":`Search blocks by id or summary`})}),(0,E.jsx)(n,{loading:!v,problem:_,empty:S.length===0&&w.length===0&&j.length===0&&I.length===0,emptyMessage:b.length===0?`No blocks installed — plugins contribute them.`:`Nothing in the catalog matches that.`,children:(0,E.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[C.map(([e,t])=>(0,E.jsxs)(`section`,{children:[(0,E.jsx)(`h2`,{className:`mb-1.5 font-mono text-xs font-semibold tracking-wide text-faint uppercase`,children:e}),(0,E.jsx)(f,{chrome:{footer:!1},fixed:!0,columns:M,rows:t,rowKey:D,reading:!1,next:null,onMore:A,noun:`blocks`,onSelect:B,selected:e=>`block:${e.id}`===i})]},e)),O.map(e=>{let t=R[e.key];return t.length===0?null:(0,E.jsxs)(`section`,{children:[(0,E.jsx)(`h2`,{className:`mb-1.5 font-mono text-xs font-semibold tracking-wide text-faint uppercase`,children:e.title}),(0,E.jsx)(f,{chrome:{footer:!1},fixed:!0,columns:N(e.key),rows:t,rowKey:k(e.key),reading:!1,next:null,onMore:A,noun:e.noun,onSelect:t=>{p(k(e.key)(t)),d()},selected:t=>k(e.key)(t)===i})]},e.key)})]})})]})}var M=[{id:`block`,header:`Block`,className:`w-full max-w-0`,cell:e=>(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`span`,{className:`font-mono text-sm font-semibold`,children:e.id}),(0,E.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:e.summary,children:e.summary})]})},{id:`kind`,header:`Kind`,className:`w-32 whitespace-nowrap`,cell:e=>(0,E.jsx)(m,{kind:e.kind})},{id:`plugin`,header:`Plugin`,className:`w-36 font-mono text-xs whitespace-nowrap`,cell:e=>(0,E.jsx)(`span`,{className:`text-muted-foreground`,children:e.plugin})}];function N(e){let t=e===`scheme`?`storage`:e;return[{id:`entry`,header:`Entry`,className:`w-full max-w-0`,cell:e=>{let t=typeof e.config_schema.description==`string`?e.config_schema.description:``;return(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`span`,{className:`font-mono text-sm font-semibold`,children:e.id}),(0,E.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:t,children:t})]})}},{id:`kind`,header:`Kind`,className:`w-32 whitespace-nowrap`,cell:()=>(0,E.jsx)(m,{kind:t})},{id:`plugin`,header:`Plugin`,className:`w-36 font-mono text-xs whitespace-nowrap`,cell:e=>(0,E.jsx)(`span`,{className:`text-muted-foreground`,children:e.plugin})}]}function P({entry:e}){let t=(0,T.useMemo)(()=>w(e.config_schema),[e]),n=typeof e.config_schema.description==`string`?e.config_schema.description:null;return(0,E.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(`h2`,{className:`font-mono text-sm font-semibold`,children:e.id}),n!==null&&(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n}),(0,E.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:(0,E.jsx)(S,{term:`plugin`,detail:e.plugin})})]}),(0,E.jsx)(C,{title:`Config`,children:t.length===0?(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This takes no configuration.`}):(0,E.jsx)(`div`,{className:`flex flex-col gap-4`,children:t.map(e=>(0,E.jsx)(I,{field:e},e.name))})})]})}function F({entry:e}){let t=(0,T.useMemo)(()=>w(e.config_schema),[e]),n=b(e);return(0,E.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(`h2`,{className:`font-mono text-sm font-semibold`,children:e.id}),(0,E.jsx)(`p`,{children:(0,E.jsx)(m,{kind:e.kind})}),(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.summary})]}),(0,E.jsx)(C,{title:`Facts`,children:(0,E.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:n.map(e=>(0,E.jsx)(S,{term:e.term,detail:e.detail},e.term))})}),(0,E.jsx)(C,{title:`Config`,children:t.length===0?(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This block takes no configuration.`}):(0,E.jsx)(`div`,{className:`flex flex-col gap-4`,children:t.map(e=>(0,E.jsx)(I,{field:e},e.name))})})]})}function I({field:e}){let t=v(e);return(0,E.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,E.jsx)(`span`,{className:`font-mono text-sm font-medium`,children:e.name}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:_(e)}),e.required&&(0,E.jsx)(`span`,{className:`text-xs text-primary`,children:`required`}),e.hint!==null&&(0,E.jsx)(`span`,{className:`text-xs text-faint`,children:e.hint}),t!==null&&(0,E.jsxs)(`span`,{className:`text-xs text-faint`,children:[`default `,t]})]}),e.options.length>0&&(0,E.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:e.options.map(e=>e.label).join(` · `)}),e.help!==null&&(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,E.jsx)(p,{text:e.help})})]})}export{j as Blocks};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-BatatxyT.js";import{i as n}from"./store-CVrCnru0.js";import{a as r,i,n as a,r as o,t as s}from"./select-BAmX8M_l.js";import{n as c,o as l,t as u}from"./PageState-CTB50fRO.js";import{r as d}from"./utils-CRMSf51M.js";import{d as f,f as p}from"./paging-CZR9Tg8m.js";import{t as m}from"./input-7d4ZlAGD.js";import{t as h}from"./SchemaForm-CBmpygQH.js";import{t as g}from"./textarea-XMYmRm72.js";import{d as _,l as v,s as y}from"./format-CR2ze2LO.js";import{n as b,t as x}from"./identity-BNZxCf_y.js";import{At as S,Dt as C,Et as w,It as T,Ot as E,T as D,Tt as O,_t as k,b as ee,gt as A,k as j,kt as M,lt as N,nt as P,rt as F,ut as te,v as I,w as ne,wt as re,y as L}from"./index-DaM0mXP1.js";import{t as R}from"./KindChip-CuBFi3X9.js";import{t as z}from"./Description-DVFPKyRO.js";import{t as B}from"./Instant-C9TZFyg5.js";import{d as V,f as H,o as U}from"./schema-form-dcZ8A0M1.js";import{a as W,c as G,d as K,f as q,i as ie,l as J,o as ae,p as Y,r as X,s as oe,t as se,u as ce}from"./connections-CdL8xQGj.js";import{n as le,t as ue}from"./Refusal-TkoEvvgs.js";var de=n(`plug-zap`,[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]]),Z=e(t(),1),Q=d();function fe({id:e,name:t,stored:n,value:r,onChange:i}){return(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(j,{htmlFor:e,className:`font-mono text-sm font-medium`,children:t}),(0,Q.jsx)(m,{id:e,type:`password`,autoComplete:`new-password`,value:r,onChange:e=>{i(e.target.value)},placeholder:n?`stored — typing replaces it, blank keeps it`:`not set — type to set one`})]})}function pe({connection:e,schema:t,onSaved:n}){let[r,i]=(0,Z.useState)(e.name??``),[a,o]=(0,Z.useState)(e.description??``),[s,c]=(0,Z.useState)(()=>he(e)),[u,d]=(0,Z.useState)({}),[v,y]=(0,Z.useState)(()=>new Set),[b,S]=(0,Z.useState)(null),[C,w]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(!1),D=x(e),O=(0,Z.useMemo)(()=>me(e,t),[e,t]),k=(0,Z.useMemo)(()=>V(O,s),[O,s]),A=L(`admin`),M=ee(A.why,U(k,v)?void 0:`A setting above is not what this kind accepts.`);return(0,Q.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:D.named?`text-sm font-semibold`:`font-mono text-sm font-semibold`,children:D.title}),(0,Q.jsx)(R,{kind:e.kind}),D.code!==null&&(0,Q.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:D.code})]}),(0,Q.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Created `,(0,Q.jsx)(B,{at:e.created_at}),_(e.created_at,e.updated_at)&&(0,Q.jsxs)(Q.Fragment,{children:[` · updated `,(0,Q.jsx)(B,{at:e.updated_at})]})]}),(0,Q.jsx)(z,{text:e.description})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(j,{htmlFor:`connection-name`,children:`Name`}),(0,Q.jsx)(m,{id:`connection-name`,value:r,onChange:e=>{i(e.target.value),E(!1)},placeholder:`What to call this on screen`}),(0,Q.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Display only. Every reference to this credential is by its code, `,e.code,`.`]})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(j,{htmlFor:`connection-description`,children:`Description`}),(0,Q.jsx)(g,{id:`connection-description`,className:`h-24`,value:a,onChange:e=>{o(e.target.value),E(!1)},placeholder:`What this credential is for. Markdown is rendered.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-semibold tracking-wide text-faint uppercase`,children:`Settings`}),(0,Q.jsx)(h,{fields:O,values:s,problems:k,onChange:(e,t)=>{c(n=>({...n,[e]:t})),E(!1)},onUnreadable:(e,t)=>{y(n=>H(n,e,t))}}),e.secret_fields.map(t=>(0,Q.jsx)(fe,{id:`secret-${t}`,name:t,stored:ge(e.config[t]),value:u[t]??``,onChange:e=>{d(n=>({...n,[t]:e})),E(!1)}},t))]}),b!==null&&(0,Q.jsx)(ue,{problem:b}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(l,{why:M,children:(0,Q.jsx)(p,{size:`sm`,onClick:()=>{let t=oe(e,_e(e,s,u),$(r),$(a));if(t===null){E(!0);return}w(!0),S(null),q(e.code,t).then(e=>{d({}),E(!0),n(e)},e=>{S(f(e))}).finally(()=>{w(!1)})},disabled:C||M!==void 0,title:M,children:C?`Saving`:`Save`})}),T&&(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Saved.`})]})]})}function me(e,t){let n=new Set(e.secret_fields);return t===null?Object.keys(e.config).filter(e=>!n.has(e)).map(t=>({name:t,kind:typeof e.config[t]==`string`?`text`:`json`,help:null,required:!1,nullable:!0,fallback:void 0,options:[],mediaType:null,hint:null,placeholder:``,bounds:{},accepts:[]})):ce(t,e.secret_fields)}function he(e){let t=new Set(e.secret_fields),n={};for(let[r,i]of Object.entries(e.config))t.has(r)||(n[r]=i);return n}function ge(e){return e!=null}function $(e){let t=e.trim();return t===``?null:t}function _e(e,t,n){let r={};for(let[n,i]of Object.entries(t))Object.is(i,e.config[n])||(r[n]=i);for(let[e,t]of Object.entries(n))t!==``&&(r[e]=t);return r}function ve({open:e,kinds:t,onOpenChange:n,onCreated:c}){let[u,d]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(``),[x,T]=(0,Z.useState)(``),[D,k]=(0,Z.useState)({}),[A,N]=(0,Z.useState)({}),[P,F]=(0,Z.useState)(()=>new Set),[te,I]=(0,Z.useState)(()=>new Set),[ne,R]=(0,Z.useState)(!1),[z,B]=(0,Z.useState)(null),[U,W]=(0,Z.useState)(!1),G=t.find(e=>e.id===y)??null,K=ce(G?.config_schema??null,G?.secret_fields??[]),q=V(K,D),J=ne?void 0:P,Y=L(`admin`),X=ee(Y.why,ye(u,y,q,te));return(0,Q.jsx)(re,{open:e,onOpenChange:n,children:(0,Q.jsxs)(w,{className:`sm:max-w-xl`,showCloseButton:!1,children:[(0,Q.jsxs)(M,{children:[(0,Q.jsx)(S,{children:`New connection`}),(0,Q.jsx)(C,{children:`Secret fields are sealed on the way in and never read back out.`})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(j,{htmlFor:`connection-code`,children:`Code`}),(0,Q.jsx)(m,{id:`connection-code`,className:`font-mono`,value:u,onChange:e=>{d(e.target.value)},placeholder:`postman-echo`})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(j,{htmlFor:`connection-kind`,children:`Kind`}),(0,Q.jsxs)(s,{value:y,onValueChange:e=>{b(String(e)),k({}),N({}),F(new Set),I(new Set),R(!1)},children:[(0,Q.jsx)(i,{id:`connection-kind`,className:`w-full font-mono`,children:(0,Q.jsx)(r,{placeholder:`Choose a kind`})}),(0,Q.jsx)(a,{children:t.map(e=>(0,Q.jsx)(o,{value:e.id,className:`font-mono`,children:e.id},e.id))})]})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(j,{htmlFor:`connection-name-new`,children:`Name`}),(0,Q.jsx)(m,{id:`connection-name-new`,value:_,onChange:e=>{v(e.target.value)},placeholder:`What to call it on screen. Optional; nothing references it.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(j,{htmlFor:`connection-description-new`,children:`Description`}),(0,Q.jsx)(g,{id:`connection-description-new`,className:`h-24`,value:x,onChange:e=>{T(e.target.value)},placeholder:`What this credential is for. Markdown is rendered.`})]}),G!==null&&(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-semibold tracking-wide text-faint uppercase`,children:`Settings`}),(0,Q.jsxs)(`div`,{className:`max-h-[40vh] space-y-3 overflow-y-auto pr-1`,children:[(0,Q.jsx)(h,{fields:K,values:D,problems:q,stated:J,onChange:(e,t)=>{k(n=>{let r={...n};return t===void 0?delete r[e]:r[e]=t,r})},onTouch:e=>{F(t=>t.has(e)?t:new Set(t).add(e))},onUnreadable:(e,t)=>{I(n=>H(n,e,t))}}),G.secret_fields.map(e=>(0,Q.jsx)(fe,{id:`new-secret-${e}`,name:e,stored:!1,value:A[e]??``,onChange:t=>{N(n=>({...n,[e]:t}))}},e))]})]}),z!==null&&(0,Q.jsx)(ue,{problem:z}),(0,Q.jsxs)(E,{children:[(0,Q.jsx)(O,{render:(0,Q.jsx)(p,{variant:`ghost`}),children:`Close`}),(0,Q.jsx)(l,{why:X,children:(0,Q.jsx)(p,{disabled:U||X!==void 0,title:X,onClick:()=>{R(!0),W(!0),B(null),ie({code:u.trim(),name:be(_),kind:y,description:be(x),config:ae(D,A)}).then(e=>{c(e),d(``),v(``),T(``),b(``),k({}),N({}),F(new Set),I(new Set),R(!1),n(!1)},e=>{B(f(e))}).finally(()=>{W(!1)})},children:U?`Creating`:`Create`})})]})]})})}function ye(e,t,n,r){if(e.trim()===``)return`A connection is addressed by its code, and this one has none.`;if(t===``)return`No kind is chosen, and a connection is a credential of one kind.`;if(r.size>0)return`A setting below holds text that is not a value.`;if(!U(n,r))return`A setting below is not what its kind accepts.`}function be(e){let t=e.trim();return t===``?null:t}var xe=e=>e.code,Se={good:`var(--good)`,critical:`var(--critical)`};function Ce(){let[e,t]=(0,Z.useState)(null),[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)({}),[o,s]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(null),{state:m,more:h,reload:g}=I(J,xe),_=(0,Z.useMemo)(()=>m.rows.map(e=>i[e.code]??e),[i,m.rows]),v=_.find(t=>t.code===e)??null,y=(0,Z.useCallback)(e=>{a(t=>({...t,[e.code]:e}))},[]),b=(0,Z.useCallback)(e=>{s(e.code),se(e.code).then(t=>{y(Y(e,t,new Date().toISOString()))},le).finally(()=>{s(null)})},[y]),x=e!==null||n;(0,Z.useEffect)(()=>{if(!x||d!==null)return;let e=!0;return G().then(t=>{e&&f(t)},()=>{}),()=>{e=!1}},[d,x]),(0,Z.useEffect)(()=>{let e=X(_);if(e===null){P();return}return F({note:e,tone:`quiet`,identifier:null}),P},[_]),(0,Z.useEffect)(()=>{if(v===null)return;let e=d?.find(e=>e.id===v.kind)?.config_schema??null;return N([{id:`connection`,label:`Connection`,render:()=>(0,Q.jsx)(pe,{connection:v,schema:e,onSaved:y},v.code)}],{screen:`connections`})},[y,d,v]);let S=L(`admin`),C=S.may;(0,Z.useEffect)(()=>k([...C?[{id:`connections:new`,title:`New connection`,group:A,screen:!0,icon:de,keywords:[`credential`,`create`,`add`],run:()=>{r(!0)}}]:[],{id:`connections:reload`,title:`Read the connections listing again`,group:A,screen:!0,icon:T,keywords:[`refresh`,`reload`],run:g}]),[C,g]);let w=(0,Z.useMemo)(()=>we(b,o,S.why),[b,o,S.why]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(u,{title:`Connections`,aside:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(D,{tag:`connections`}),(0,Q.jsx)(l,{why:S.why,children:(0,Q.jsxs)(p,{size:`sm`,"aria-label":`New connection`,disabled:!S.may,title:S.why,onClick:()=>{r(!0)},children:[(0,Q.jsx)(de,{"aria-hidden":!0}),`New`]})})]})}),(0,Q.jsx)(c,{loading:!m.read,problem:m.problem,empty:_.length===0,emptyMessage:`No connections.`,children:(0,Q.jsx)(ne,{columns:w,rows:_,rowKey:xe,reading:m.reading,next:m.next,onMore:h,noun:`connections`,onSelect:e=>{t(e.code),te()},selected:t=>t.code===e})}),(0,Q.jsx)(ve,{open:n,kinds:d??[],onOpenChange:r,onCreated:()=>{g()}})]})}function we(e,t,n){return[{id:`connection`,header:`Connection`,cell:e=>(0,Q.jsx)(Te,{row:e})},{id:`description`,header:`Description`,cell:e=>(0,Q.jsx)(Ee,{description:e.description})},{id:`health`,header:`Health`,cell:e=>(0,Q.jsx)(De,{row:e})},{id:`checked`,header:`Checked`,className:`text-xs`,cell:e=>(0,Q.jsx)(Oe,{row:e})},{id:`check`,header:``,className:`text-right`,cell:r=>(0,Q.jsx)(l,{why:n,children:(0,Q.jsx)(p,{variant:`outline`,size:`sm`,disabled:t===r.code||n!==void 0,title:n,onClick:t=>{t.stopPropagation(),e(r)},children:t===r.code?`Checking`:`Check`})})}]}function Te({row:e}){let t=x(e);return(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:t.named?`font-semibold`:`font-mono font-semibold`,children:t.title}),(0,Q.jsx)(R,{kind:e.kind}),t.code!==null&&(0,Q.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:t.code})]}),(0,Q.jsx)(`p`,{className:`max-w-md truncate text-xs text-muted-foreground`,title:K(e),children:K(e)})]})}function Ee({description:e}){let t=e===null?``:b(e);return t===``?null:(0,Q.jsx)(`p`,{className:`max-w-64 truncate text-xs text-muted-foreground`,title:t,children:t})}function De({row:e}){let t=W(e);return t.tone===null?(0,Q.jsx)(`span`,{className:`text-xs text-faint`,children:`never checked`}):(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(`span`,{className:`status-dot`,style:{"--chip":Se[t.tone]},"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t.label}),t.detail!==null&&(0,Q.jsx)(`span`,{className:`max-w-64 truncate text-muted-foreground`,title:t.detail,children:t.detail})]})}function Oe({row:e}){return e.last_check_at===null?null:(0,Q.jsx)(`span`,{className:`text-muted-foreground`,title:y(e.last_check_at),children:v(e.last_check_at)})}export{Ce as Connections};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-BatatxyT.js";import{c as n,n as r}from"./chunk-BV7QT456-Bfa1dvOx.js";import{i,n as a,r as o,t as ee}from"./PageState-CTB50fRO.js";import{r as s,t as c}from"./utils-CRMSf51M.js";import{t as l}from"./use-store-CgWwefFs.js";import{t as u}from"./auth-DZcJKVvz.js";import{v as d}from"./format-CR2ze2LO.js";import{t as f}from"./use-heartbeat-ByRKom_T.js";import{t as p}from"./identity-BNZxCf_y.js";import{d as m}from"./pipelines-D_CSKLu-.js";import{It as h,T as te,_ as g,_t as _,ht as v,l as y,m as ne,t as b,u as x,w as S,x as C}from"./index-CeUoyQJy.js";import{t as w}from"./Instant-C9TZFyg5.js";import{l as T,n as E,r as D}from"./connections-BNOH5aGu.js";import{f as O,i as k,p as A,r as j,s as M,t as re,u as ie}from"./TileCard-C9t5bFGN.js";import{a as ae,i as N,r as P}from"./workers-Bforr_yR.js";import{f as F,s as I}from"./triggers-DwUJXGxD.js";var L=e(t(),1),R=s(),z={neutral:`bg-muted-foreground`,good:`bg-good`,info:`bg-info`,warning:`bg-warning`,critical:`bg-critical`};function B({rows:e,note:t,reading:n}){let a=l(u).identity?.role??null;return(0,R.jsx)(o,{className:`gap-0 p-0`,children:(0,R.jsxs)(i,{className:`flex h-full flex-col p-0`,children:[(0,R.jsxs)(`div`,{className:`space-y-1 px-3 py-3`,children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Health`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n?`Reading from the server`:`The workers claiming work, and every connection.`})]}),(0,R.jsx)(`ul`,{className:`max-h-64 grow overflow-y-auto`,children:e.map(e=>{let t=e.kind===`connection`?`/connections`:a===`admin`?`/admin/workers`:null,n=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:c(`size-2 shrink-0 rounded-full`,z[e.tone]),"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`max-w-[55%] shrink-0 truncate font-mono text-xs`,title:e.label,children:e.label}),(0,R.jsxs)(`span`,{className:`ml-auto flex min-w-0 items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,title:e.detail,children:e.detail}),e.at!==null&&(0,R.jsx)(w,{className:`shrink-0 text-xs text-faint`,at:e.at})]})]});return(0,R.jsx)(`li`,{className:`border-t border-border`,children:t===null?(0,R.jsx)(`span`,{className:`flex items-center gap-3 px-3 py-1.5`,children:n}):(0,R.jsx)(r,{to:t,className:`flex items-center gap-3 px-3 py-1.5 hover:bg-accent/60`,children:n})},`${e.kind}:${e.id}`)})}),(0,R.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-xs text-muted-foreground`,children:t})]})})}function V(e,t){return`${String(e)}${t.next===null?``:`+`}`}function H(e,t){return e===0?`neutral`:t}function U(e,t){return e.items.filter(e=>e.status===t).length}function W(e,t,n){let r=(t,n,r)=>{if(e===null)return null;let i=U(e,t);return{id:t,label:n,value:V(i,e),note:``,tone:H(i,r),to:x({...b,status:t,since:`24h`})}},i=(e,t,n,r,i)=>{if(i===null)return null;let a=i.items.length;return{id:e,label:t,value:V(a,i),note:a===0?``:r,tone:H(a,n),to:x({...b,status:e})}};return[{id:`runs`,tile:e===null?null:{id:`runs`,label:`Runs`,value:V(e.items.length,e),note:`Last 24 hours.`,tone:`neutral`,to:x({...b,since:`24h`})}},{id:`succeeded`,tile:r(`succeeded`,`Succeeded`,`good`)},{id:`failed`,tile:r(`failed`,`Failed`,`critical`)},{id:`completed_with_errors`,tile:r(`completed_with_errors`,`With errors`,`warning`)},{id:`running`,tile:i(`running`,`Running`,`info`,`Being worked on now.`,t)},{id:`queued`,tile:i(`queued`,`Queued`,`neutral`,`Waiting for a worker.`,n)}]}var G=36e5,K=864e5;function q(e,t){let n=e+t*6e4;return Math.floor(n/G)*G-t*6e4}function J(e,t){let n=e+t*6e4;return Math.floor((n%K+K)%K/G)}function oe(e,t,n,r=24){let i=q(t.getTime(),n)-(r-1)*G,a=Array.from({length:r},(e,t)=>{let r=i+t*G;return{start:r,hour:J(r,n),succeeded:0,withErrors:0,failed:0,total:0}});for(let t of e){let e=Date.parse(t.created_at);if(Number.isNaN(e))continue;let n=Math.floor((e-i)/G);if(n<0||n>=r)continue;let o=a[n];o.total+=1,t.status===`succeeded`?o.succeeded+=1:t.status===`completed_with_errors`?o.withErrors+=1:t.status===`failed`&&(o.failed+=1)}return a}function Y(e){return e.succeeded+e.withErrors+e.failed}function se(e){return e.reduce((e,t)=>Math.max(e,Y(t)),0)}function ce(e){let t=t=>e.reduce((e,n)=>e+t(n),0),n=t(e=>e.total);if(n===0)return`No run was started in the last 24 hours.`;let r=[`${String(t(e=>e.succeeded))} succeeded`,`${String(t(e=>e.withErrors))} finished with errors`,`${String(t(e=>e.failed))} failed`];return`${String(n)} runs started in the last 24 hours, by the hour: ${r.join(`, `)}.`}function le(e,t){let n=e.map(e=>{let t=P(e);return{id:e.id,kind:`worker`,label:e.name,tone:t===null?`good`:k(t),detail:t===null?`worker · ${String(e.concurrency)} ${e.concurrency===1?`slot`:`slots`}`:N(t),at:t===null?null:e.last_seen_at}}),r=t.map(e=>{let t=e.last_check_healthy;return{id:e.id,kind:`connection`,label:e.code,tone:t===null?`neutral`:t?`good`:`critical`,detail:t===null?`never checked`:e.last_check_detail??(t?`healthy`:`did not answer`),at:e.last_check_at}});return[...n,...r]}function ue(e,t){let n=e.filter(e=>P(e)===null).length,{healthy:r,total:i}=E(t),a=[];if(e.length===0?a.push(`no worker has registered`):n<e.length&&a.push(`${String(n)} of ${String(e.length)} workers healthy`),r<i){let e=D(t,`connections`);e!==null&&a.push(e)}if(a.length>0){let e=a.join(` · `);return`${e.charAt(0).toUpperCase()}${e.slice(1)}.`}return t.length===0?`Every worker is healthy, and this instance holds no connections.`:`Every worker and every connection is healthy.`}function de(e,t,n=6){return[...e,...t].toSorted((e,t)=>Date.parse(t.created_at)-Date.parse(e.created_at)).slice(0,n)}function fe(e,t=6){return e.flatMap(e=>{let t=I(e.schedule);return t.kind===`due`?[{...e,at:t.at}]:[]}).toSorted((e,t)=>Date.parse(e.at)-Date.parse(t.at)).slice(0,t)}async function X(e){let t=e.filter(e=>e.schedules>0);return(await Promise.all(t.map(async e=>(await F(e.code,null)).items.map(t=>({pipeline:e.code,schedule:t}))))).flat()}async function pe(){let e=await m(null);return{pipelines:e.items,schedules:await X(e.items)}}var me=6,Z=[{id:`failed`,label:`Failed`,fill:`bg-status-failed/80`},{id:`withErrors`,label:`With errors`,fill:`bg-status-completed-with-errors/80`},{id:`succeeded`,label:`Succeeded`,fill:`bg-status-succeeded/75`}];function he(e){let t=`${String(e.hour).padStart(2,`0`)}:00`;if(e.total===0)return`${t} — nothing ran`;let n=Z.filter(t=>e[t.id]>0).map(t=>`${String(e[t.id])} ${t.label.toLowerCase()}`),r=n.length===0?`none finished`:n.join(`, `);return`${t} — ${String(e.total)} started, ${r}`}function ge({buckets:e,reading:t,className:n}){let r=se(e);return(0,R.jsx)(o,{className:c(`gap-0 p-0`,n),children:(0,R.jsxs)(i,{className:`space-y-3 p-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1`,children:[(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Runs over time`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t?`Reading from the server`:`Every run started in the last 24 hours, by the hour it started in.`})]}),(0,R.jsx)(`ul`,{className:`flex items-center gap-3`,children:Z.map(e=>(0,R.jsxs)(`li`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:c(`size-2 shrink-0 rounded-sm`,e.fill),"aria-hidden":!0}),e.label]},e.id))})]}),(0,R.jsx)(`div`,{className:`flex h-32 items-end gap-px`,role:`img`,"aria-label":ce(e),children:e.map(e=>(0,R.jsxs)(`div`,{className:`flex h-full flex-1 flex-col justify-end rounded-sm hover:bg-accent/40`,title:he(e),children:[Z.map(t=>e[t.id]===0?null:(0,R.jsx)(`div`,{className:c(`min-h-0.5 w-full`,t.fill),style:{height:`${String(e[t.id]/Math.max(r,1)*100)}%`}},t.id)),Y(e)===0&&(0,R.jsx)(`div`,{className:`h-px w-full bg-border`})]},e.start))}),(0,R.jsx)(`div`,{className:`flex gap-px font-mono text-xs text-faint`,"aria-hidden":!0,children:e.map((e,t)=>(0,R.jsx)(`span`,{className:`flex-1 text-center`,children:t%me===0?`${String(e.hour).padStart(2,`0`)}`:``},e.start))})]})})}function _e(){let e=g((0,L.useCallback)(()=>y({...b,since:`24h`},null,500),[])),t=g((0,L.useCallback)(()=>y({...b,status:`running`},null),[])),r=g((0,L.useCallback)(()=>y({...b,status:`queued`},null),[])),i=g((0,L.useCallback)(()=>y({...b,status:`failed`},null),[])),o=g((0,L.useCallback)(()=>y({...b,status:`completed_with_errors`},null),[])),s=g(pe),u=g((0,L.useCallback)(()=>ae(null),[])),p=g((0,L.useCallback)(()=>T(null),[])),{again:m}=e,{again:x}=t,{again:C}=r,{again:w}=i,{again:E}=o,{again:D}=s,{again:k}=u,{again:N}=p,P=(0,L.useCallback)(()=>{m(),x(),C(),w(),E(),D(),k(),N()},[D,N,m,w,E,C,x,k]);(0,L.useEffect)(()=>_([{id:`dashboard:refresh`,title:`Refresh the dashboard`,group:v,screen:!0,icon:h,keywords:[`refresh`,`reload`,`home`],run:P}]),[P]);let F=n();f(P,l(ne));let I=de(t.value?.items??[],r.value?.items??[]),z=ie(M(i.value?.items??[],o.value?.items??[]),s.value?.pipelines??[]),V=fe(s.value?.schedules??[]),H=W(e.value,t.value,r.value),U=new Date,G=oe(e.value?.items??[],U,d(U)),K=u.problem===null&&p.problem===null;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ee,{title:`Dashboard`,aside:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(te,{tag:`runs`}),(0,R.jsx)(A,{onRefresh:P})]})}),(0,R.jsx)(`div`,{className:`mb-3 grid grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-6`,children:H.map(e=>e.tile===null?(0,R.jsx)(j,{},e.id):(0,R.jsx)(re,{tile:e.tile},e.id))}),(0,R.jsxs)(`div`,{className:`mb-6 grid gap-3 lg:grid-cols-3`,children:[(0,R.jsx)(`div`,{className:c(K?`lg:col-span-2`:`lg:col-span-3`),children:e.problem===null?(0,R.jsx)(ge,{buckets:G,reading:!e.read}):(0,R.jsx)(a,{loading:!1,problem:e.problem,empty:!1,children:null})}),K&&(0,R.jsx)(B,{rows:le(u.value?.items??[],p.value?.items??[]),note:ue(u.value?.items??[],p.value?.items??[]),reading:!u.read||!p.read})]}),(0,R.jsx)(Q,{title:`Right now`,to:`/runs`,children:(0,R.jsx)(a,{loading:!t.read||!r.read,problem:t.problem??r.problem,empty:I.length===0,emptyMessage:`Nothing is running and nothing is waiting.`,children:(0,R.jsx)(S,{chrome:{footer:!1},columns:ve,rows:I,rowKey:e=>e.id,reading:!1,next:null,onMore:$,noun:`runs`,onSelect:e=>void F(`/runs/${e.id}`)})})}),(0,R.jsx)(Q,{title:`Needs a look`,to:`/runs`,children:(0,R.jsx)(a,{loading:!i.read||!o.read,problem:i.problem??o.problem,empty:z.length===0,emptyMessage:`Nothing has failed or finished with errors.`,children:(0,R.jsx)(S,{chrome:{footer:!1},columns:O,rows:z,rowKey:e=>e.run.id,reading:!1,next:null,onMore:$,noun:`runs`,onSelect:e=>void F(`/runs/${e.run.id}`)})})}),(0,R.jsx)(Q,{title:`Next fires`,to:`/triggers`,children:(0,R.jsx)(a,{loading:!s.read,problem:s.problem,empty:V.length===0,emptyMessage:`No schedule is due to fire.`,children:(0,R.jsx)(S,{chrome:{footer:!1},columns:ye,rows:V,rowKey:e=>`${e.pipeline}:${e.schedule.code}`,reading:!1,next:null,onMore:$,noun:`firings`,onSelect:e=>void F(`/pipelines/${encodeURIComponent(e.pipeline)}`)})})})]})}function Q({title:e,to:t,children:n}){return(0,R.jsxs)(`section`,{className:`mb-6 space-y-2 last:mb-0`,children:[(0,R.jsx)(`div`,{className:`space-y-1`,children:(0,R.jsx)(`h2`,{className:`text-sm font-semibold`,children:(0,R.jsx)(r,{to:t,className:`hover:text-primary`,children:e})})}),n]})}var $=()=>{},ve=[{id:`status`,header:`Status`,cell:e=>(0,R.jsx)(C,{status:e.status})},{id:`pipeline`,header:`Pipeline`,cell:e=>(0,R.jsx)(`span`,{className:`font-mono text-sm`,children:p({code:e.pipeline}).title})},{id:`since`,header:`Since`,className:`text-right`,cell:e=>(0,R.jsx)(w,{className:`text-xs text-faint`,at:e.started_at??e.created_at})}],ye=[{id:`pipeline`,header:`Pipeline`,cell:e=>(0,R.jsx)(`span`,{className:`font-mono text-sm`,children:p({code:e.pipeline}).title})},{id:`schedule`,header:`Schedule`,cell:e=>{let t=p(e.schedule);return(0,R.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:c(`truncate text-xs`,t.named?`text-foreground`:`font-mono`),children:t.title}),t.code!==null&&(0,R.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:t.code})]})}},{id:`fires`,header:`Fires`,className:`text-right`,cell:e=>(0,R.jsx)(w,{className:`text-xs text-faint`,at:e.at})}];export{_e as Dashboard};
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-BatatxyT.js";import{c as n,n as r}from"./chunk-BV7QT456-Bfa1dvOx.js";import{i,n as a,r as o,t as ee}from"./PageState-CTB50fRO.js";import{r as s,t as c}from"./utils-CRMSf51M.js";import{t as l}from"./use-store-CgWwefFs.js";import{t as u}from"./auth-DZcJKVvz.js";import{v as d}from"./format-CR2ze2LO.js";import{t as f}from"./use-heartbeat-ByRKom_T.js";import{t as p}from"./identity-BNZxCf_y.js";import{d as m}from"./pipelines-D_CSKLu-.js";import{It as h,T as te,_ as g,_t as _,ht as v,l as y,m as ne,t as b,u as x,w as S,x as C}from"./index-DaM0mXP1.js";import{t as w}from"./Instant-C9TZFyg5.js";import{l as T,n as E,r as D}from"./connections-CdL8xQGj.js";import{f as O,i as k,p as A,r as j,s as M,t as re,u as ie}from"./TileCard-BJHpBqDz.js";import{a as ae,i as N,r as P}from"./workers-Bforr_yR.js";import{f as F,s as I}from"./triggers-DwUJXGxD.js";var L=e(t(),1),R=s(),z={neutral:`bg-muted-foreground`,good:`bg-good`,info:`bg-info`,warning:`bg-warning`,critical:`bg-critical`};function B({rows:e,note:t,reading:n}){let a=l(u).identity?.role??null;return(0,R.jsx)(o,{className:`gap-0 p-0`,children:(0,R.jsxs)(i,{className:`flex h-full flex-col p-0`,children:[(0,R.jsxs)(`div`,{className:`space-y-1 px-3 py-3`,children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Health`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n?`Reading from the server`:`The workers claiming work, and every connection.`})]}),(0,R.jsx)(`ul`,{className:`max-h-64 grow overflow-y-auto`,children:e.map(e=>{let t=e.kind===`connection`?`/connections`:a===`admin`?`/admin/workers`:null,n=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:c(`size-2 shrink-0 rounded-full`,z[e.tone]),"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`max-w-[55%] shrink-0 truncate font-mono text-xs`,title:e.label,children:e.label}),(0,R.jsxs)(`span`,{className:`ml-auto flex min-w-0 items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,title:e.detail,children:e.detail}),e.at!==null&&(0,R.jsx)(w,{className:`shrink-0 text-xs text-faint`,at:e.at})]})]});return(0,R.jsx)(`li`,{className:`border-t border-border`,children:t===null?(0,R.jsx)(`span`,{className:`flex items-center gap-3 px-3 py-1.5`,children:n}):(0,R.jsx)(r,{to:t,className:`flex items-center gap-3 px-3 py-1.5 hover:bg-accent/60`,children:n})},`${e.kind}:${e.id}`)})}),(0,R.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-xs text-muted-foreground`,children:t})]})})}function V(e,t){return`${String(e)}${t.next===null?``:`+`}`}function H(e,t){return e===0?`neutral`:t}function U(e,t){return e.items.filter(e=>e.status===t).length}function W(e,t,n){let r=(t,n,r)=>{if(e===null)return null;let i=U(e,t);return{id:t,label:n,value:V(i,e),note:``,tone:H(i,r),to:x({...b,status:t,since:`24h`})}},i=(e,t,n,r,i)=>{if(i===null)return null;let a=i.items.length;return{id:e,label:t,value:V(a,i),note:a===0?``:r,tone:H(a,n),to:x({...b,status:e})}};return[{id:`runs`,tile:e===null?null:{id:`runs`,label:`Runs`,value:V(e.items.length,e),note:`Last 24 hours.`,tone:`neutral`,to:x({...b,since:`24h`})}},{id:`succeeded`,tile:r(`succeeded`,`Succeeded`,`good`)},{id:`failed`,tile:r(`failed`,`Failed`,`critical`)},{id:`completed_with_errors`,tile:r(`completed_with_errors`,`With errors`,`warning`)},{id:`running`,tile:i(`running`,`Running`,`info`,`Being worked on now.`,t)},{id:`queued`,tile:i(`queued`,`Queued`,`neutral`,`Waiting for a worker.`,n)}]}var G=36e5,K=864e5;function q(e,t){let n=e+t*6e4;return Math.floor(n/G)*G-t*6e4}function J(e,t){let n=e+t*6e4;return Math.floor((n%K+K)%K/G)}function oe(e,t,n,r=24){let i=q(t.getTime(),n)-(r-1)*G,a=Array.from({length:r},(e,t)=>{let r=i+t*G;return{start:r,hour:J(r,n),succeeded:0,withErrors:0,failed:0,total:0}});for(let t of e){let e=Date.parse(t.created_at);if(Number.isNaN(e))continue;let n=Math.floor((e-i)/G);if(n<0||n>=r)continue;let o=a[n];o.total+=1,t.status===`succeeded`?o.succeeded+=1:t.status===`completed_with_errors`?o.withErrors+=1:t.status===`failed`&&(o.failed+=1)}return a}function Y(e){return e.succeeded+e.withErrors+e.failed}function se(e){return e.reduce((e,t)=>Math.max(e,Y(t)),0)}function ce(e){let t=t=>e.reduce((e,n)=>e+t(n),0),n=t(e=>e.total);if(n===0)return`No run was started in the last 24 hours.`;let r=[`${String(t(e=>e.succeeded))} succeeded`,`${String(t(e=>e.withErrors))} finished with errors`,`${String(t(e=>e.failed))} failed`];return`${String(n)} runs started in the last 24 hours, by the hour: ${r.join(`, `)}.`}function le(e,t){let n=e.map(e=>{let t=P(e);return{id:e.id,kind:`worker`,label:e.name,tone:t===null?`good`:k(t),detail:t===null?`worker · ${String(e.concurrency)} ${e.concurrency===1?`slot`:`slots`}`:N(t),at:t===null?null:e.last_seen_at}}),r=t.map(e=>{let t=e.last_check_healthy;return{id:e.id,kind:`connection`,label:e.code,tone:t===null?`neutral`:t?`good`:`critical`,detail:t===null?`never checked`:e.last_check_detail??(t?`healthy`:`did not answer`),at:e.last_check_at}});return[...n,...r]}function ue(e,t){let n=e.filter(e=>P(e)===null).length,{healthy:r,total:i}=E(t),a=[];if(e.length===0?a.push(`no worker has registered`):n<e.length&&a.push(`${String(n)} of ${String(e.length)} workers healthy`),r<i){let e=D(t,`connections`);e!==null&&a.push(e)}if(a.length>0){let e=a.join(` · `);return`${e.charAt(0).toUpperCase()}${e.slice(1)}.`}return t.length===0?`Every worker is healthy, and this instance holds no connections.`:`Every worker and every connection is healthy.`}function de(e,t,n=6){return[...e,...t].toSorted((e,t)=>Date.parse(t.created_at)-Date.parse(e.created_at)).slice(0,n)}function fe(e,t=6){return e.flatMap(e=>{let t=I(e.schedule);return t.kind===`due`?[{...e,at:t.at}]:[]}).toSorted((e,t)=>Date.parse(e.at)-Date.parse(t.at)).slice(0,t)}async function X(e){let t=e.filter(e=>e.schedules>0);return(await Promise.all(t.map(async e=>(await F(e.code,null)).items.map(t=>({pipeline:e.code,schedule:t}))))).flat()}async function pe(){let e=await m(null);return{pipelines:e.items,schedules:await X(e.items)}}var me=6,Z=[{id:`failed`,label:`Failed`,fill:`bg-status-failed/80`},{id:`withErrors`,label:`With errors`,fill:`bg-status-completed-with-errors/80`},{id:`succeeded`,label:`Succeeded`,fill:`bg-status-succeeded/75`}];function he(e){let t=`${String(e.hour).padStart(2,`0`)}:00`;if(e.total===0)return`${t} — nothing ran`;let n=Z.filter(t=>e[t.id]>0).map(t=>`${String(e[t.id])} ${t.label.toLowerCase()}`),r=n.length===0?`none finished`:n.join(`, `);return`${t} — ${String(e.total)} started, ${r}`}function ge({buckets:e,reading:t,className:n}){let r=se(e);return(0,R.jsx)(o,{className:c(`gap-0 p-0`,n),children:(0,R.jsxs)(i,{className:`space-y-3 p-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1`,children:[(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Runs over time`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t?`Reading from the server`:`Every run started in the last 24 hours, by the hour it started in.`})]}),(0,R.jsx)(`ul`,{className:`flex items-center gap-3`,children:Z.map(e=>(0,R.jsxs)(`li`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:c(`size-2 shrink-0 rounded-sm`,e.fill),"aria-hidden":!0}),e.label]},e.id))})]}),(0,R.jsx)(`div`,{className:`flex h-32 items-end gap-px`,role:`img`,"aria-label":ce(e),children:e.map(e=>(0,R.jsxs)(`div`,{className:`flex h-full flex-1 flex-col justify-end rounded-sm hover:bg-accent/40`,title:he(e),children:[Z.map(t=>e[t.id]===0?null:(0,R.jsx)(`div`,{className:c(`min-h-0.5 w-full`,t.fill),style:{height:`${String(e[t.id]/Math.max(r,1)*100)}%`}},t.id)),Y(e)===0&&(0,R.jsx)(`div`,{className:`h-px w-full bg-border`})]},e.start))}),(0,R.jsx)(`div`,{className:`flex gap-px font-mono text-xs text-faint`,"aria-hidden":!0,children:e.map((e,t)=>(0,R.jsx)(`span`,{className:`flex-1 text-center`,children:t%me===0?`${String(e.hour).padStart(2,`0`)}`:``},e.start))})]})})}function _e(){let e=g((0,L.useCallback)(()=>y({...b,since:`24h`},null,500),[])),t=g((0,L.useCallback)(()=>y({...b,status:`running`},null),[])),r=g((0,L.useCallback)(()=>y({...b,status:`queued`},null),[])),i=g((0,L.useCallback)(()=>y({...b,status:`failed`},null),[])),o=g((0,L.useCallback)(()=>y({...b,status:`completed_with_errors`},null),[])),s=g(pe),u=g((0,L.useCallback)(()=>ae(null),[])),p=g((0,L.useCallback)(()=>T(null),[])),{again:m}=e,{again:x}=t,{again:C}=r,{again:w}=i,{again:E}=o,{again:D}=s,{again:k}=u,{again:N}=p,P=(0,L.useCallback)(()=>{m(),x(),C(),w(),E(),D(),k(),N()},[D,N,m,w,E,C,x,k]);(0,L.useEffect)(()=>_([{id:`dashboard:refresh`,title:`Refresh the dashboard`,group:v,screen:!0,icon:h,keywords:[`refresh`,`reload`,`home`],run:P}]),[P]);let F=n();f(P,l(ne));let I=de(t.value?.items??[],r.value?.items??[]),z=ie(M(i.value?.items??[],o.value?.items??[]),s.value?.pipelines??[]),V=fe(s.value?.schedules??[]),H=W(e.value,t.value,r.value),U=new Date,G=oe(e.value?.items??[],U,d(U)),K=u.problem===null&&p.problem===null;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ee,{title:`Dashboard`,aside:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(te,{tag:`runs`}),(0,R.jsx)(A,{onRefresh:P})]})}),(0,R.jsx)(`div`,{className:`mb-3 grid grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-6`,children:H.map(e=>e.tile===null?(0,R.jsx)(j,{},e.id):(0,R.jsx)(re,{tile:e.tile},e.id))}),(0,R.jsxs)(`div`,{className:`mb-6 grid gap-3 lg:grid-cols-3`,children:[(0,R.jsx)(`div`,{className:c(K?`lg:col-span-2`:`lg:col-span-3`),children:e.problem===null?(0,R.jsx)(ge,{buckets:G,reading:!e.read}):(0,R.jsx)(a,{loading:!1,problem:e.problem,empty:!1,children:null})}),K&&(0,R.jsx)(B,{rows:le(u.value?.items??[],p.value?.items??[]),note:ue(u.value?.items??[],p.value?.items??[]),reading:!u.read||!p.read})]}),(0,R.jsx)(Q,{title:`Right now`,to:`/runs`,children:(0,R.jsx)(a,{loading:!t.read||!r.read,problem:t.problem??r.problem,empty:I.length===0,emptyMessage:`Nothing is running and nothing is waiting.`,children:(0,R.jsx)(S,{chrome:{footer:!1},columns:ve,rows:I,rowKey:e=>e.id,reading:!1,next:null,onMore:$,noun:`runs`,onSelect:e=>void F(`/runs/${e.id}`)})})}),(0,R.jsx)(Q,{title:`Needs a look`,to:`/runs`,children:(0,R.jsx)(a,{loading:!i.read||!o.read,problem:i.problem??o.problem,empty:z.length===0,emptyMessage:`Nothing has failed or finished with errors.`,children:(0,R.jsx)(S,{chrome:{footer:!1},columns:O,rows:z,rowKey:e=>e.run.id,reading:!1,next:null,onMore:$,noun:`runs`,onSelect:e=>void F(`/runs/${e.run.id}`)})})}),(0,R.jsx)(Q,{title:`Next fires`,to:`/triggers`,children:(0,R.jsx)(a,{loading:!s.read,problem:s.problem,empty:V.length===0,emptyMessage:`No schedule is due to fire.`,children:(0,R.jsx)(S,{chrome:{footer:!1},columns:ye,rows:V,rowKey:e=>`${e.pipeline}:${e.schedule.code}`,reading:!1,next:null,onMore:$,noun:`firings`,onSelect:e=>void F(`/pipelines/${encodeURIComponent(e.pipeline)}`)})})})]})}function Q({title:e,to:t,children:n}){return(0,R.jsxs)(`section`,{className:`mb-6 space-y-2 last:mb-0`,children:[(0,R.jsx)(`div`,{className:`space-y-1`,children:(0,R.jsx)(`h2`,{className:`text-sm font-semibold`,children:(0,R.jsx)(r,{to:t,className:`hover:text-primary`,children:e})})}),n]})}var $=()=>{},ve=[{id:`status`,header:`Status`,cell:e=>(0,R.jsx)(C,{status:e.status})},{id:`pipeline`,header:`Pipeline`,cell:e=>(0,R.jsx)(`span`,{className:`font-mono text-sm`,children:p({code:e.pipeline}).title})},{id:`since`,header:`Since`,className:`text-right`,cell:e=>(0,R.jsx)(w,{className:`text-xs text-faint`,at:e.started_at??e.created_at})}],ye=[{id:`pipeline`,header:`Pipeline`,cell:e=>(0,R.jsx)(`span`,{className:`font-mono text-sm`,children:p({code:e.pipeline}).title})},{id:`schedule`,header:`Schedule`,cell:e=>{let t=p(e.schedule);return(0,R.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:c(`truncate text-xs`,t.named?`text-foreground`:`font-mono`),children:t.title}),t.code!==null&&(0,R.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:t.code})]})}},{id:`fires`,header:`Fires`,className:`text-right`,cell:e=>(0,R.jsx)(w,{className:`text-xs text-faint`,at:e.at})}];export{_e as Dashboard};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-BatatxyT.js";import{t as n}from"./maximize-2-B2tdtoC6.js";import{r,t as i}from"./utils-CRMSf51M.js";import{f as a}from"./paging-CZR9Tg8m.js";import{At as o,Et as s,st as c,wt as l}from"./index-CeUoyQJy.js";var u=e(t(),1),d=r();function f({title:e,text:t,mediaType:r,path:i}){let[f,p]=(0,u.useState)(!1);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Open ${e} in a window`,className:`absolute top-1.5 right-3.5 size-6 rounded-md border border-border bg-background/90 text-faint`,onClick:()=>{p(!0)},children:(0,d.jsx)(n,{className:`size-3.5`,"aria-hidden":!0})}),(0,d.jsx)(l,{open:f,onOpenChange:p,children:(0,d.jsxs)(s,{finalFocus:!1,className:`flex h-[85vh] w-[min(64rem,90vw)] max-w-[min(64rem,90vw)] flex-col gap-3 sm:max-w-[min(64rem,90vw)]`,children:[(0,d.jsx)(o,{className:`font-mono text-sm`,children:e}),(0,d.jsx)(c,{value:t,mediaType:r,path:i,label:e,readOnly:!0,className:`min-h-0 flex-1`})]})})]})}var p=/("(?:[^"\\]|\\.)*")(\s*:)?|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|(true|false|null)/g;function m(e){let t=[],n=0;for(let r of e.matchAll(p)){r.index>n&&t.push({kind:`punctuation`,text:e.slice(n,r.index)});let[,i,a,o,s]=r;i===void 0?o===void 0?s!==void 0&&t.push({kind:`literal`,text:s}):t.push({kind:`number`,text:o}):(t.push({kind:a===void 0?`string`:`key`,text:i}),a!==void 0&&t.push({kind:`punctuation`,text:a})),n=r.index+r[0].length}return n<e.length&&t.push({kind:`punctuation`,text:e.slice(n)}),t}var h={key:`text-info-ink`,string:`text-good-ink`,number:`text-warning-ink`,literal:`text-warning-ink`,punctuation:`text-muted-foreground`};function g({title:e,text:t,className:n}){let r=(0,u.useMemo)(()=>m(t),[t]);return(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(`pre`,{className:i(`overflow-auto rounded-lg border border-border bg-background p-2 font-mono text-xs`,n),children:r.map((e,t)=>(0,d.jsx)(`span`,{className:h[e.kind],children:e.text},t))}),(0,d.jsx)(f,{title:e,text:t,mediaType:`application/json`,path:`window/${e}`})]})}export{g as t};
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-BatatxyT.js";import{t as n}from"./maximize-2-B2tdtoC6.js";import{r,t as i}from"./utils-CRMSf51M.js";import{f as a}from"./paging-CZR9Tg8m.js";import{At as o,Et as s,st as c,wt as l}from"./index-DaM0mXP1.js";var u=e(t(),1),d=r();function f({title:e,text:t,mediaType:r,path:i}){let[f,p]=(0,u.useState)(!1);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Open ${e} in a window`,className:`absolute top-1.5 right-3.5 size-6 rounded-md border border-border bg-background/90 text-faint`,onClick:()=>{p(!0)},children:(0,d.jsx)(n,{className:`size-3.5`,"aria-hidden":!0})}),(0,d.jsx)(l,{open:f,onOpenChange:p,children:(0,d.jsxs)(s,{finalFocus:!1,className:`flex h-[85vh] w-[min(64rem,90vw)] max-w-[min(64rem,90vw)] flex-col gap-3 sm:max-w-[min(64rem,90vw)]`,children:[(0,d.jsx)(o,{className:`font-mono text-sm`,children:e}),(0,d.jsx)(c,{value:t,mediaType:r,path:i,label:e,readOnly:!0,className:`min-h-0 flex-1`})]})})]})}var p=/("(?:[^"\\]|\\.)*")(\s*:)?|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|(true|false|null)/g;function m(e){let t=[],n=0;for(let r of e.matchAll(p)){r.index>n&&t.push({kind:`punctuation`,text:e.slice(n,r.index)});let[,i,a,o,s]=r;i===void 0?o===void 0?s!==void 0&&t.push({kind:`literal`,text:s}):t.push({kind:`number`,text:o}):(t.push({kind:a===void 0?`string`:`key`,text:i}),a!==void 0&&t.push({kind:`punctuation`,text:a})),n=r.index+r[0].length}return n<e.length&&t.push({kind:`punctuation`,text:e.slice(n)}),t}var h={key:`text-info-ink`,string:`text-good-ink`,number:`text-warning-ink`,literal:`text-warning-ink`,punctuation:`text-muted-foreground`};function g({title:e,text:t,className:n}){let r=(0,u.useMemo)(()=>m(t),[t]);return(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(`pre`,{className:i(`overflow-auto rounded-lg border border-border bg-background p-2 font-mono text-xs`,n),children:r.map((e,t)=>(0,d.jsx)(`span`,{className:h[e.kind],children:e.text},t))}),(0,d.jsx)(f,{title:e,text:t,mediaType:`application/json`,path:`window/${e}`})]})}export{g as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-BatatxyT.js";import{c as n}from"./chunk-BV7QT456-Bfa1dvOx.js";import{n as r,t as i}from"./PageState-CTB50fRO.js";import{r as a}from"./utils-CRMSf51M.js";import{t as o}from"./use-store-CgWwefFs.js";import{t as s}from"./use-heartbeat-ByRKom_T.js";import{d as c}from"./pipelines-D_CSKLu-.js";import{It as l,T as u,_ as d,_t as f,l as p,m,mt as h,nt as g,rt as _,t as v,v as y,w as b}from"./index-CeUoyQJy.js";import{l as x}from"./connections-BNOH5aGu.js";import{a as S,c as ee,d as C,f as w,l as T,n as E,o as D,p as O,r as k,s as A,u as j}from"./TileCard-C9t5bFGN.js";import{a as M}from"./workers-Bforr_yR.js";import{t as N}from"./AdminOnly-ChPFWSCk.js";import{t as P}from"./WorkersTable-CVzqLA-a.js";var F=e(t(),1),I=a(),L=e=>e.id,R=()=>{};function z(){return(0,I.jsx)(N,{children:(0,I.jsx)(B,{})})}function B(){let e=d((0,F.useCallback)(()=>p({...v,since:`24h`},null,500),[])),t=d((0,F.useCallback)(()=>p({...v,status:`failed`},null),[])),a=d((0,F.useCallback)(()=>p({...v,status:`completed_with_errors`},null),[])),N=d((0,F.useCallback)(()=>x(null),[])),z=d((0,F.useCallback)(()=>c(null,[],500),[])),B=y((0,F.useCallback)(e=>M(e),[]),L),{again:V,value:H,problem:U,read:W}=e,{again:G}=t,{again:K}=a,{again:q}=N,{again:J}=z,{reload:Y}=B,X=(0,F.useCallback)(()=>{V(),G(),K(),q(),J(),Y()},[q,V,G,K,J,Y]),Z=n();s(X,o(m)),(0,F.useEffect)(()=>(_({note:null,tone:`quiet`,identifier:null}),g),[]),(0,F.useEffect)(()=>f([{id:`admin:reload`,title:`Refresh the overview`,group:h,screen:!0,icon:l,keywords:[`refresh`,`reload`,`dashboard`],run:X}]),[X]);let Q=[{id:`day`,tile:H===null?null:D(H)},{id:`now`,tile:H===null?null:ee(H)},{id:`workers`,tile:B.state.read?C({items:B.state.rows,next:B.state.next}):null},{id:`connections`,tile:N.value===null?null:S(N.value)},{id:`schedules`,tile:z.value===null?null:T(z.value)}],$=j(A(t.value?.items??[],a.value?.items??[]),z.value?.items??[]);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(i,{title:`Overview`,aside:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u,{tag:`system`}),(0,I.jsx)(O,{onRefresh:X})]})}),(0,I.jsx)(`div`,{className:`mb-6 grid gap-3 sm:grid-cols-2 xl:grid-cols-5`,children:Q.map(e=>e.tile===null?(0,I.jsx)(k,{},e.id):(0,I.jsx)(E,{tile:e.tile},e.id))}),W&&U!==null&&(0,I.jsx)(r,{loading:!1,problem:U,empty:!1,children:null}),(0,I.jsxs)(`section`,{className:`mb-6 space-y-2`,children:[(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Needs a look`}),(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Every run that failed or finished with errors, newest first.`})]}),(0,I.jsx)(r,{loading:!t.read||!a.read,problem:t.problem??a.problem,empty:$.length===0,emptyMessage:`Nothing has failed or finished with errors.`,children:(0,I.jsx)(b,{chrome:{footer:!1},columns:w,rows:$,rowKey:e=>e.run.id,reading:!1,next:null,onMore:R,noun:`runs`,onSelect:e=>void Z(`/runs/${e.run.id}`)})})]}),(0,I.jsxs)(`section`,{className:`space-y-2`,children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Workers`}),(0,I.jsx)(P,{state:B.state,more:B.more,empty:`No workers. Start one with dg worker; nothing is claimed until one registers.`})]})]})}export{z as AdminOverview};
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-BatatxyT.js";import{c as n}from"./chunk-BV7QT456-Bfa1dvOx.js";import{n as r,t as i}from"./PageState-CTB50fRO.js";import{r as a}from"./utils-CRMSf51M.js";import{t as o}from"./use-store-CgWwefFs.js";import{t as s}from"./use-heartbeat-ByRKom_T.js";import{d as c}from"./pipelines-D_CSKLu-.js";import{It as l,T as u,_ as d,_t as f,l as p,m,mt as h,nt as g,rt as _,t as v,v as y,w as b}from"./index-DaM0mXP1.js";import{l as x}from"./connections-CdL8xQGj.js";import{a as S,c as ee,d as C,f as w,l as T,n as E,o as D,p as O,r as k,s as A,u as j}from"./TileCard-BJHpBqDz.js";import{a as M}from"./workers-Bforr_yR.js";import{t as N}from"./AdminOnly-ChPFWSCk.js";import{t as P}from"./WorkersTable-DZiYF2b7.js";var F=e(t(),1),I=a(),L=e=>e.id,R=()=>{};function z(){return(0,I.jsx)(N,{children:(0,I.jsx)(B,{})})}function B(){let e=d((0,F.useCallback)(()=>p({...v,since:`24h`},null,500),[])),t=d((0,F.useCallback)(()=>p({...v,status:`failed`},null),[])),a=d((0,F.useCallback)(()=>p({...v,status:`completed_with_errors`},null),[])),N=d((0,F.useCallback)(()=>x(null),[])),z=d((0,F.useCallback)(()=>c(null,[],500),[])),B=y((0,F.useCallback)(e=>M(e),[]),L),{again:V,value:H,problem:U,read:W}=e,{again:G}=t,{again:K}=a,{again:q}=N,{again:J}=z,{reload:Y}=B,X=(0,F.useCallback)(()=>{V(),G(),K(),q(),J(),Y()},[q,V,G,K,J,Y]),Z=n();s(X,o(m)),(0,F.useEffect)(()=>(_({note:null,tone:`quiet`,identifier:null}),g),[]),(0,F.useEffect)(()=>f([{id:`admin:reload`,title:`Refresh the overview`,group:h,screen:!0,icon:l,keywords:[`refresh`,`reload`,`dashboard`],run:X}]),[X]);let Q=[{id:`day`,tile:H===null?null:D(H)},{id:`now`,tile:H===null?null:ee(H)},{id:`workers`,tile:B.state.read?C({items:B.state.rows,next:B.state.next}):null},{id:`connections`,tile:N.value===null?null:S(N.value)},{id:`schedules`,tile:z.value===null?null:T(z.value)}],$=j(A(t.value?.items??[],a.value?.items??[]),z.value?.items??[]);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(i,{title:`Overview`,aside:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u,{tag:`system`}),(0,I.jsx)(O,{onRefresh:X})]})}),(0,I.jsx)(`div`,{className:`mb-6 grid gap-3 sm:grid-cols-2 xl:grid-cols-5`,children:Q.map(e=>e.tile===null?(0,I.jsx)(k,{},e.id):(0,I.jsx)(E,{tile:e.tile},e.id))}),W&&U!==null&&(0,I.jsx)(r,{loading:!1,problem:U,empty:!1,children:null}),(0,I.jsxs)(`section`,{className:`mb-6 space-y-2`,children:[(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Needs a look`}),(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Every run that failed or finished with errors, newest first.`})]}),(0,I.jsx)(r,{loading:!t.read||!a.read,problem:t.problem??a.problem,empty:$.length===0,emptyMessage:`Nothing has failed or finished with errors.`,children:(0,I.jsx)(b,{chrome:{footer:!1},columns:w,rows:$,rowKey:e=>e.run.id,reading:!1,next:null,onMore:R,noun:`runs`,onSelect:e=>void Z(`/runs/${e.run.id}`)})})]}),(0,I.jsxs)(`section`,{className:`space-y-2`,children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Workers`}),(0,I.jsx)(P,{state:B.state,more:B.more,empty:`No workers. Start one with dg worker; nothing is claimed until one registers.`})]})]})}export{z as AdminOverview};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-BatatxyT.js";import{a as n}from"./store-CVrCnru0.js";import{$ as r,$n as i,An as a,At as o,Bn as s,Bt as c,Cn as l,D as u,Et as d,G as ee,Gn as te,Hn as f,In as p,It as m,J as h,Jn as g,K as _,Kn as v,Mn as y,Mt as b,Nn as x,Nt as S,O as ne,Pt as C,Qt as w,Rt as T,Tt as re,Un as E,V as D,Vt as O,Wt as k,X as ie,Xn as A,Xt as ae,Y as oe,Yn as j,Z as se,Zt as ce,_n as le,an as ue,cn as de,d as fe,en as M,et as pe,f as me,g as he,gn as ge,h as N,hn as _e,in as P,it as ve,j as F,jn as ye,k as be,kt as xe,mn as I,mt as Se,nn as Ce,on as we,q as Te,qn as Ee,qt as De,rt as Oe,sn as L,tn as ke,tr as Ae,tt as je,un as Me,vn as Ne,xn as Pe,yn as Fe,zn as Ie}from"./dropdown-menu-B9iU0HGD.js";import{t as Le}from"./chevron-down-CrkpqUMs.js";import{r as Re,t as ze}from"./utils-CRMSf51M.js";import{_ as Be,a as Ve,c as He,d as Ue,f as We,g as Ge,h as Ke,i as qe,l as Je,m as Ye,n as Xe,p as Ze,r as Qe,u as $e}from"./WindowedPane-Bl60nHe4.js";import"./paging-CZR9Tg8m.js";import{a as et,c as tt,i as nt,l as rt,n as it,o as at,r as ot,s as st,u as ct}from"./input-7d4ZlAGD.js";import{Ct as lt,Pt as ut,St as dt,bt as ft,xt as pt}from"./index-DaM0mXP1.js";var R=e(t(),1),mt=e(n(),1),z=Re();function ht(e,t,n,r,i,a,o,s,c,l=2){let u=k(n.current,{event:e,orientation:r,loopFocus:i,rtl:a,cols:l,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:t>c?s:t,stopEvent:!0});return De(n.current,u)?void 0:u}var gt=R.createContext(void 0),_t=R.createContext(void 0),vt=R.createContext(void 0),yt=R.createContext(!1),bt=R.createContext(``);function B(){let e=R.useContext(gt);if(!e)throw Error(v(22));return e}function xt(){let e=R.useContext(_t);if(!e)throw Error(v(23));return e}function V(){let e=R.useContext(vt);if(!e)throw Error(v(24));return e}function St(){return R.useContext(bt)}function Ct(){return R.useContext(yt)}var H={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectionChips:e=>{let t=e.selectedValue;return Array.isArray(t)&&t.length>0},hasSelectedValue:e=>{let{selectedValue:t,selectionMode:n}=e;return t==null?!1:n===`multiple`&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?qe(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(e=>$e(t,e,n)):$e(t,r,n)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemProps:e=>e.itemProps,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight};function wt(e){return e==null?void 0:`${e}-popup`}function Tt(e,t){return(n,r)=>n!=null&&e.contains(n,r,t)}function Et(e){return Array.isArray(e)?e.map(e=>Et(e)).join(`,`):e==null?``:String(e)}var Dt=new Map;function Ot(e={}){let t={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...e},n=`${Et(e.locale)}|${JSON.stringify(t)}`,r=Dt.get(n);if(r)return r;let i=new Intl.Collator(e.locale,t),a={contains(e,t,n){if(!t)return!0;let r=He(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(i.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=He(e,n);return i.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=He(e,n),a=t.length;return r.length>=a&&i.compare(r.slice(r.length-a),t)===0}};return Dt.set(n,a),a}var kt=Ot;function At(e,t=!1){let{overflowY:n}=y(e);return n!==`auto`&&n!==`scroll`?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}var jt=Symbol(`none`),Mt={value:jt,index:-1};function Nt(e){let{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:s,onSelectedValueChange:c,defaultInputValue:ee,inputValue:te,open:f,defaultOpen:m=!1,selectionMode:h,onItemHighlighted:_,name:v,form:y,disabled:C=!1,readOnly:w=!1,required:T=!1,inputRef:E,grid:D=!1,items:k,filteredItems:ie,filter:se,openOnInputClick:de=!0,autoHighlight:fe=!1,keepHighlight:pe=!1,highlightItemOnHover:me=!0,loopFocus:he=!0,itemToStringLabel:N,itemToStringValue:F,isItemEqualToValue:I=Ue,virtualized:we=!1,inline:Te=!1,fillInputOnItemPress:De=!0,modal:Oe=!1,limit:L=-1,autoComplete:Ae=`list`,formAutoComplete:je,locale:Me,submitOnItemClick:Fe=!1}=e,{clearErrors:Ie}=et(),{setDirty:Le,validityData:Re,setFilled:ze,name:We,disabled:qe,setTouched:Xe,setFocused:nt,validationMode:rt,validation:at}=tt(),st=oe(),ct=ot({id:t}),lt=kt({locale:Me}),[ut,dt]=R.useState(!1),[ft,pt]=R.useState(null),mt=R.useRef([]),B=R.useRef([]),xt=R.useRef(null),V=R.useRef(null),St=R.useRef(null),Ct=R.useRef(null),wt=R.useRef(null),Et=R.useRef(!0),Dt=R.useRef(!1),Ot=R.useRef(null),Nt=R.useRef(null),Pt=R.useRef(null),Ft=R.useRef(Mt),It=R.useRef(null),Lt=R.useRef([]),Rt=R.useRef(null),U=qe||C,zt=We??v,W=h===`multiple`,Bt=h===`single`,Vt=te!==void 0||ee!==void 0,G=k!==void 0,Ht=ie!==void 0,K;K=fe===`always`?`always`:fe?`input-change`:!1;let[q,Ut]=u({controlled:s,default:W?r??g:r,name:`Combobox`,state:`selectedValue`}),Wt=R.useMemo(()=>se===null?()=>!0:se===void 0?Tt(lt,N):se,[se,lt,N]),Gt=i(()=>Vt?ee??``:Bt?He(q,N):``).current,[J,Kt]=u({controlled:te,default:Gt,name:`Combobox`,state:`inputValue`}),[Y,qt]=u({controlled:f,default:m,name:`Combobox`,state:`open`}),Jt=Ve(k),X=ft??String(J).trim(),Yt=Bt?He(q,N):``,Xt=Bt&&!ut&&X!==``&&Yt.length===X.length&&lt.contains(Yt,X),Zt=Xt?``:X,Qt=G&&Ht&&Xt,$t=R.useMemo(()=>k?Jt?k.flatMap(e=>e.items):k:g,[k,Jt]),en=R.useMemo(()=>{if(ie&&!Qt)return ie;if(!k)return g;if(Jt){let e=k,t=[],n=0;for(let r of e){if(L>-1&&n>=L)break;let e=L>-1?L-n:1/0,i=Zt===``?r.items.slice(0,e):[];if(Zt!==``)for(let t of r.items){if(i.length>=e)break;Wt(t,Zt,N)&&i.push(t)}if(i.length>0){let e={...r,items:i};t.push(e),n+=i.length}}return t}if(Zt===``)return L>-1?$t.slice(0,L):$t;let e=[];for(let t of $t){if(L>-1&&e.length>=L)break;Wt(t,Zt,N)&&e.push(t)}return e},[ie,Qt,k,Jt,Zt,L,Wt,N,$t]),Z=R.useMemo(()=>Jt?en.flatMap(e=>e.items):en,[en,Jt]),Q=i(()=>{let e=null;return Te&&Y&&G&&h!==`none`&&(e=Ze(Z,q,I,W)),new xe({id:ct,labelId:void 0,selectedValue:q,open:Y,items:k,selectionMode:h,listRef:mt,labelsRef:B,popupRef:xt,emptyRef:wt,inputRef:V,startDismissRef:St,endDismissRef:Ct,keyboardActiveRef:Et,chipsContainerRef:Ot,clearRef:Nt,valuesRef:Lt,pointerDownItemRef:Rt,selectionEventRef:Pt,name:zt,form:y,disabled:U,readOnly:w,required:T,grid:D,virtualized:we,openOnInputClick:de,itemToStringLabel:N,isItemEqualToValue:I,modal:Oe,autoHighlight:K,submitOnItemClick:Fe,hasInputValue:Vt,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:Te,activeIndex:null,selectedIndex:e,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemProps:j,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:h===`none`,onOpenChangeComplete:A,setOpen:A,setInputValue:A,setSelectedValue:A,setIndices:A,handleSelection:A,forceMount:A,requestSubmit:A})}).current,tn=h===`none`?J:q,nn=R.useMemo(()=>h===`none`?tn:Array.isArray(q)?q.map(e=>Je(e,F)):Je(q,F),[tn,F,h,q]),rn=M(_),an=M(n),on=o(Q,H.activeIndex),sn=o(Q,H.selectedIndex),cn=o(Q,H.positionerElement),ln=o(Q,H.listElement),un=o(Q,H.triggerElement),dn=o(Q,H.inputElement),fn=o(Q,H.inputGroupElement),$=o(Q,H.inline),pn=o(Q,H.inputInsidePopup),mn=o(Q,H.inputOwnsFormValue),hn=ke(un),{mounted:gn,setMounted:_n,transitionStatus:vn}=d(Y),{openMethod:yn,triggerProps:bn}=ne(Y),xn=M(()=>nn);it(pn?hn:V,ct,tn,xn,!U,v);let Sn=M(()=>{k?B.current=Z.map(e=>He(e,N)):Q.set(`forceMounted`,!0)}),Cn=M((e,t,n)=>{if(t===-1){if(Ft.current===Mt)return;Ft.current=Mt}else Ft.current={value:e,index:t};rn(e,ue(n,void 0,{index:t}))}),wn=M(e=>{Q.update(e);let t=e.activeIndex;if(t===void 0)return;let n=e.type||`none`;t===null?Cn(void 0,-1,n):Cn(Lt.current[t],t,n)}),Tn=M((t,n)=>{if(Dt.current=n.reason===_e,e.onInputValueChange?.(t,n),!n.isCanceled){if(n.reason===`input-change`){Y&&ft!==null&&pt(null);let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&dt(!0),It.current={hasQuery:e};let n=Q.state.listElement;if(!Q.state.virtualized&&n){let e=xt.current;for(let t of x(n.firstElementChild??n)){if(!p(t)||(e?!a(e,t):t.getAttribute(`role`)===`dialog`))break;if(At(t)){t.scrollTop=0;break}}}e&&K&&Q.state.activeIndex==null&&(Y||$)&&Q.set(`activeIndex`,0)}}else n.reason===`input-clear`&&t===``&&Q.state.inputInsidePopup&&(It.current={hasQuery:!1,selection:!0});Kt(t)}}),En=M((t,n)=>{if(Y!==t&&(n.reason===`escape-key`&&G&&Z.length===0&&!wt.current&&n.allowPropagation(),e.onOpenChange?.(t,n),!n.isCanceled&&(t&&pn&&!$&&ft!==null&&(dt(!1),pt(null),J!==``&&n.reason!==`input-change`&&Tn(``,P(_e,n.event))),!t&&ut&&(Bt?($||pt(X),X===``&&dt(!1)):W&&($||pt(X),pn&&wn({activeIndex:null}),(!pn||$)&&Tn(``,P(_e,n.event)))),qt(t),!t&&pn&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(Xe(!0),nt(!1),rt===`onBlur`)))){let e=h===`none`?J:q;at.commit(e)}}),Dn=M((e,t)=>{c?.(e,t),!t.isCanceled&&(Ut(e),(h===`none`&&xt.current&&De||Bt&&!Q.state.inputInsidePopup)&&Tn(He(e,N),P(t.reason,t.event)))}),On=M((e,t)=>{let n=ye(e),r=Pt.current??e;Pt.current=null;let i=P(le,r),a=n?.closest(`a`)?.getAttribute(`href`);if(a){a.startsWith(`#`)&&En(!1,i);return}if(W){let e=Array.isArray(q)?q:[],n=Ke(e,t,I)?Ye(e,t,I):[...e,t];if(Dn(n,i),i.isCanceled||!(V.current&&V.current.value.trim()!==``))return;Q.state.inputInsidePopup?Tn(``,P(_e,i.event)):En(!1,i)}else{if(Dn(t,i),i.isCanceled)return;En(!1,i)}}),kn=M(()=>{let e=at.inputRef.current?.form??Q.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),An=M(()=>{if(_n(!1),an?.(!1),dt(!1),pt(null),wn(h===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),W&&V.current&&V.current.value!==``&&!Dt.current&&Tn(``,P(_e)),Bt){if(Q.state.inputInsidePopup)V.current&&V.current.value!==``&&Tn(``,P(_e));else{let e=He(q,N);V.current&&V.current.value!==e&&Tn(e,P(e===``?_e:Pe))}}}),jn=R.useMemo(()=>$&&cn?{current:cn.closest(`[role="dialog"]`)}:xt,[$,cn]);re({enabled:!e.actionsRef,open:Y,ref:jn,onComplete(){Y||An()}}),R.useImperativeHandle(e.actionsRef,()=>({unmount:An}),[An]),Ee(function(){if(Y||(Rt.current=null,h===`none`))return;let e=G?$t:Lt.current;wn({selectedIndex:Ze(e,q,I,W)})},[Y,q,h,W,G,$t,I,wn]),Ee(()=>{k&&(Lt.current=Z,mt.current.length=Z.length)},[k,Z]),Ee(()=>{let e=It.current;if(e){let t=Y||$||Q.state.positionerElement?.hidden===!1;if(e.hasQuery)K&&t&&Q.set(`activeIndex`,0),It.current=null;else if(String(J).trim()===``&&(It.current=null,t)){let t=e.selection;K===`always`&&!t&&Q.state.selectionMode===`none`&&Q.set(`activeIndex`,0),queueMicrotask(()=>{if(!Q.state.open&&!Q.state.inline||V.current&&V.current.value.trim()!==``)return;let e=Q.state.selectedValue,n=Q.state.selectionMode===`multiple`,r=n&&Array.isArray(e)?e[e.length-1]:e,i=Q.state.selectionMode!==`none`&&r!=null;if(i||t){let t=G||Ht?Z:Lt.current;Q.set(`activeIndex`,i?Ze(t,e,Q.state.isItemEqualToValue,n):null)}else K===`always`&&Q.set(`activeIndex`,0)})}}if(!Y&&!$)return;let t=G||Ht?Z:Lt.current,n=Q.state.activeIndex;if(n==null){if(K===`always`&&t.length>0){Q.set(`activeIndex`,0);return}Cn(void 0,-1,Pe);return}if(n>=t.length){Cn(void 0,-1,Pe),Q.set(`activeIndex`,null);return}let r=t[n],i=Ft.current.value,a=i!==jt&&$e(r,i,Q.state.isItemEqualToValue);(Ft.current.index!==n||!a)&&Cn(r,n,Pe)},[on,K,Cn,Ht,G,Z,$,Y,Q,J]),Ee(()=>{if(h===`none`){ze(String(J)!==``);return}ze(W?Array.isArray(q)&&q.length>0:q!=null)},[ze,h,J,q,W]),R.useEffect(()=>{G&&K&&Z.length===0&&wn({activeIndex:null})},[G,K,Z.length,wn]);function Mn(e){let t=Re.initialValue;return Array.isArray(e)&&Array.isArray(t)?!Qe(e,t,(e,t)=>$e(e,t,I)):e!==t}be(X,()=>{!Y||X===``||X===String(Gt)||dt(!0)});function Nn(){let e=He(q,N);J!==e&&Tn(e,P(Pe))}be(q,()=>{h!==`none`&&(Ie(zt),Le(Mn(q)),at.change(q),Bt&&!Vt&&!pn&&Nn())}),be(J,()=>{h===`none`&&(Ie(zt),Le(J!==Re.initialValue),at.change(J))}),be(k,()=>{!Bt||Vt||pn||ut||Nn()});let Pn=Be({open:$?!0:Y,onOpenChange:En,elements:{reference:pn?un:dn,floating:cn}}),Fn=D?`grid`:`listbox`,In=Y||$,Ln=In?`true`:`false`,Rn=R.useMemo(()=>{let e=dn?.tagName===`INPUT`,t=dn==null||e,n=t||In,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=Ln,r[`aria-haspopup`]=Fn,r[`aria-controls`]=In?ln?.id:void 0,r[`aria-autocomplete`]=Ae),{reference:r,floating:{role:`presentation`}}},[dn,In,Ln,Fn,ln?.id,Ae]),zn=S(Pn,{enabled:!w&&!U&&de,event:`mousedown-only`,toggle:!1,touchOpenDelay:pn?0:100,reason:ge}),Bn=b(Pn,{enabled:!w&&!U&&!$,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:$?!0:void 0,outsidePress(e){let t=ye(e);return!a(un,t)&&!a(Nt.current,t)&&!a(Ot.current,t)&&!a(fn,t)}}),Vn=ve(Pn,{enabled:!w&&!U,id:ct,listRef:mt,activeIndex:on,selectedIndex:sn,virtual:!0,loopFocus:he,allowEscape:he&&!K,focusItemOnOpen:ut||h===`none`&&!K?!1:`auto`,focusItemOnHover:me,resetOnPointerLeave:!pe,orientation:D?`horizontal`:void 0,rtl:st===`rtl`,disabledIndices:g,grid:D?ht:void 0,onNavigate(e,t){!t&&!Y||vn===`ending`||wn(t?{activeIndex:e,type:Et.current?Ne:l}:{activeIndex:e})}}),Hn=R.useMemo(()=>O(Vn.reference,{onKeyDown(e){D&&Q.state.activeIndex==null&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&e.preventBaseUIHandler()}},Bn.reference,zn.reference,Rn.reference),[Vn.reference,Bn.reference,zn.reference,Rn.reference,D,Q]),Un=R.useMemo(()=>O(Se,Bn.floating),[Bn.floating]),Wn=R.useMemo(()=>O(Vn.floating,Rn.floating),[Vn.floating,Rn.floating]),Gn=R.useMemo(()=>{let e=Vn.item;return e?{...e,onFocus:void 0}:j},[Vn.item]);Ge(()=>{Q.update({inline:Te,popupProps:Un,listProps:Wn,inputProps:Hn,triggerProps:bn,itemProps:Gn,setOpen:En,setInputValue:Tn,setSelectedValue:Dn,setIndices:wn,handleSelection:On,forceMount:Sn,requestSubmit:kn,onOpenChangeComplete:an})}),Ee(()=>{Q.update({id:ct,selectedValue:q,open:Y,mounted:gn,transitionStatus:vn,items:k,inline:Te,popupProps:Un,listProps:Wn,inputProps:Hn,triggerProps:bn,openMethod:yn,itemProps:Gn,selectionMode:h,name:zt,form:y,disabled:U,readOnly:w,required:T,grid:D,virtualized:we,openOnInputClick:de,itemToStringLabel:N,modal:Oe,autoHighlight:K,isItemEqualToValue:I,submitOnItemClick:Fe,hasInputValue:Vt,inputOwnsFormValue:h===`none`&&(Te||!Q.state.inputInsidePopup)})},[Q,ct,q,Y,gn,vn,k,Un,Wn,Hn,Gn,yn,bn,h,zt,U,w,T,D,we,de,N,Oe,I,Fe,Vt,Te,K,y]);let Kn=Ce(E,at.inputRef),qn=R.useMemo(()=>({query:X,hasItems:G,filteredItems:en,flatFilteredItems:Z}),[X,G,en,Z]),Jn=R.useMemo(()=>Array.isArray(tn)?``:Je(tn,F),[tn,F]),Yn=W&&Array.isArray(q)&&q.length>0,Xn=W||h===`none`&&mn?void 0:zt,Zn=R.useMemo(()=>!W||!Array.isArray(q)||!zt?null:q.map(e=>{let t=Je(e,F);return(0,z.jsx)(`input`,{type:`hidden`,form:y,name:zt,value:t,disabled:U},t)}),[W,q,y,zt,F,U]),Qn=(0,z.jsxs)(R.Fragment,{children:[e.children,(0,z.jsx)(`input`,{...at.getValidationProps(U,{onFocus(){if(pn){un?.focus();return}(V.current||un)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||U||w)return;let t=e.currentTarget.value,n=t.toLowerCase(),r=P(Pe,e.nativeEvent),i=()=>Lt.current.findIndex(e=>Je(e,F).toLowerCase()===n||He(e,N).toLowerCase()===n);function a(){if(W)return;if(h===`none`){Tn(t,r);return}let e=i();e===-1&&(e=Lt.current.findIndex((e,t)=>{let r=B.current[t];return r!=null&&r.toLowerCase()===n}));let a=e===-1?void 0:Lt.current[e];a!=null&&Dn?.(a,r)}Bt&&(Sn(),k&&i()===-1&&Q.set(`forceMounted`,!0)),queueMicrotask(a)}}),id:ct&&Xn==null?`${ct}-hidden-input`:void 0,form:y,name:Xn,autoComplete:je,disabled:U,required:T&&!Yn,readOnly:w,value:Jn,ref:Kn,style:Xn?ce:ae,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Zn]});return(0,z.jsx)(gt.Provider,{value:Q,children:(0,z.jsx)(_t.Provider,{value:Pn,children:(0,z.jsx)(yt.Provider,{value:G,children:(0,z.jsx)(vt.Provider,{value:qn,children:(0,z.jsx)(bt.Provider,{value:J,children:Qn})})})})})}var Pt={...r,...ct,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":``}:null};function Ft(e){let t=o(e,H.mounted),n=o(e,H.popupSide),r=o(e,H.positionerElement);return t&&r?n:null}function It(){return V().filteredItems.length===0}function Lt(e){return e===`rtl`?[`ArrowRight`,`ArrowLeft`]:[`ArrowLeft`,`ArrowRight`]}function Rt(e,t){let n=e>=t-1?t-2:e;return n>=0?n:void 0}function U(e,t,n){let r=e.state.listRef.current[t];r&&(e.state.selectionEventRef.current=n,r.click(),e.state.selectionEventRef.current=null)}var zt=R.forwardRef(function(e,t){let{render:n,className:r,nativeButton:i=!0,disabled:s=!1,id:l,style:u,...d}=e,{state:ee,disabled:f,setTouched:p,setFocused:m,validationMode:h,validation:g}=tt(),{labelId:_}=nt(),v=B(),y=o(v,H.selectionMode),b=o(v,H.disabled),x=o(v,H.readOnly),ne=o(v,H.required),C=o(v,H.positionerElement),T=o(v,H.listElement),re=o(v,H.popupId),E=o(v,H.triggerProps),O=o(v,H.inputInsidePopup),k=o(v,H.id),ie=o(v,H.labelId),A=o(v,H.open),ae=o(v,H.selectedValue),oe=o(v,H.activeIndex),j=o(v,H.selectedIndex),se=o(v,H.hasSelectedValue),ce=xt(),le=St(),ue=te(),de=f||b||s,pe=It(),me=Ft(v);ot({id:O?l:void 0});let he=O?l??k:l,ge=Xe(_,ie),N;A&&O?N=re??wt(k):A&&(N=T?.id);let _e=R.useRef(``);function ve(e){_e.current=e.pointerType}let{reference:F}=Oe(ce,{enabled:!A&&!x&&!b&&y===`single`,listRef:v.state.labelsRef,activeIndex:oe,selectedIndex:j,onMatch(e){let t=v.state.valuesRef.current[e];t!==void 0&&v.state.setSelectedValue(t,P(Pe))}}),{reference:be}=S(ce,{enabled:!x&&!b,event:`mousedown`}),{buttonRef:xe,getButtonProps:I}=D({native:i,disabled:de}),Se={...ee,open:A,disabled:de,popupSide:me,listEmpty:pe,placeholder:y!==`none`&&!se},Ce=M(e=>{v.set(`triggerElement`,e)});return c(`button`,e,{ref:[t,xe,Ce],state:Se,props:[E,be,F,{id:he,tabIndex:O?0:-1,role:O?`combobox`:void 0,"aria-expanded":A,"aria-haspopup":O?`dialog`:`listbox`,"aria-controls":N,"aria-required":O&&ne||void 0,"aria-labelledby":ge,onPointerDown:ve,onPointerEnter:ve,onFocus(){m(!0),!(de||x)&&ue.start(0,v.state.forceMount)},onBlur(e){if(!a(C,e.relatedTarget)&&(p(!0),m(!1),h===`onBlur`)){let e=y===`none`?le:ae;g.commit(e)}},onMouseDown(e){if(de||x||(O||ce.set(`domReferenceElement`,e.currentTarget),v.state.forceMount(),_e.current!==`touch`&&(v.state.inputRef.current?.focus(),O||e.preventDefault()),A))return;let t=w(e.currentTarget);function n(e){let t=v.state.triggerElement;if(!t)return;let n=ye(e),r=v.state.positionerElement,i=v.state.listElement;a(t,n)||a(r,n)||a(i,n)||fe(e,t)||v.state.setOpen(!1,P(we,e))}O&&t.addEventListener(`mouseup`,n,{once:!0})},onKeyDown(e){x||(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(Ie(e),v.state.setOpen(!0,P(Fe,e.nativeEvent)),v.state.inputRef.current?.focus())}},g.getValidationProps(de,d),I],stateAttributesMapping:Pt})}),W=R.createContext(void 0);function Bt(){return R.useContext(W)}var Vt=R.createContext(void 0);function G(e){let t=R.useContext(Vt);if(t===void 0&&!e)throw Error(v(21));return t}var Ht=R.forwardRef(function(e,t){let n=B(),{buttonRef:r,getButtonProps:i}=D({native:!1}),a=Ce(t,r);function o(e){n.state.setOpen(!1,P(de,e.nativeEvent,e.currentTarget))}let s=i({onClick:o});return(0,z.jsx)(`span`,{ref:a,...s,"aria-label":`Dismiss`,tabIndex:void 0,style:ce})}),K=R.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,id:a,style:u,...d}=e,{state:ee,disabled:te,setTouched:p,setFocused:m,validationMode:h,validation:g}=tt(),{labelId:_}=nt(),v=Bt(),y=!!G(!0),b=B(),x=St(),S=oe(),ne=o(b,H.required),C=o(b,H.disabled),w=o(b,H.readOnly),T=o(b,H.name),re=o(b,H.form),E=o(b,H.selectionMode),D=o(b,H.autoHighlight),O=o(b,H.inputProps),k=o(b,H.triggerProps),A=o(b,H.open),ae=o(b,H.mounted),j=o(b,H.selectedValue),se=o(b,H.id),ce=o(b,H.inline),le=o(b,H.modal),ue=!!D,de=Ft(b),fe=te||C||i,pe=It(),me=y||ce,he=!me||le,ge=ie(a??(me?void 0:se)),N=y?rt:ee,[ve,F]=R.useState(null),ye=R.useRef(!1),be=R.useRef(null),xe=R.useRef(!1),Se=E===`none`&&!y,Ce=M(e=>{let t=y||b.state.inline;t&&!b.state.hasInputValue&&b.state.setInputValue(``,P(Pe)),b.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:Se})}),we=y?d:g.getValidationProps(fe,d);function Te(){b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?Ne:l})}function Ee(){b.state.keyboardActiveRef.current=!1}let De={...N,open:A,disabled:fe,readOnly:w,popupSide:de,listEmpty:pe};function Oe(e){if(!v)return;let t,{highlightedChipIndex:n}=v,r=v.chipsRef.current.length,[i,a]=Lt(S);return n===void 0?(e.key===i&&(e.currentTarget.selectionStart??0)===0&&j.length>0&&(e.preventDefault(),t=r>0?r-1:void 0),t):(e.key===i?(e.preventDefault(),t=n>0?n-1:void 0):e.key===a?(e.preventDefault(),t=n<r-1?n+1:void 0):(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),t=Rt(n,j.length),Te()),t)}let L=c(`input`,e,{state:De,ref:[t,b.state.inputRef,Ce],props:[O,k,{value:ve??x,"aria-readonly":w||void 0,"aria-required":ne||void 0,"aria-labelledby":_,disabled:fe,readOnly:w,required:E===`none`?ne:void 0,form:re,...Se&&T&&{name:T},id:ge,onFocus(){if(m(!0),!ce||!xe.current)return;xe.current=!1;let e=be.current;e==null||!Object.hasOwn(b.state.valuesRef.current,e)||b.state.setIndices({activeIndex:e})},onBlur(){p(!0),m(!1);let e=b.state.activeIndex;if(ce&&e!==null&&D!==`always`&&(be.current=e,xe.current=!0,b.state.setIndices({activeIndex:null})),h===`onBlur`){let e=E===`none`?x:j;g.commit(e)}},onCompositionStart(e){f||(ye.current=!0,F(e.currentTarget.value))},onCompositionEnd(e){ye.current=!1;let t=e.currentTarget.value;F(null),b.state.setInputValue(t,P(I,e.nativeEvent))},onChange(e){let t=e.nativeEvent,n=t.inputType,r=!n||n===`insertReplacementText`,i=ye.current||!r;function a(e){w||fe||!e||!i||(b.state.setOpen(!0,P(I,t)),ue||Te())}if(ye.current){let n=e.currentTarget.value;F(n),n===``&&!b.state.openOnInputClick&&!b.state.inputInsidePopup&&b.state.setOpen(!1,P(_e,t));let r=n.trim(),i=ue&&r!==``;a(r),A&&b.state.activeIndex!==null&&!i&&Te();return}let o=P(I,t);if(b.state.setInputValue(e.currentTarget.value,o),o.isCanceled)return;let s=e.currentTarget.value===``,c=P(_e,t);s&&!b.state.inputInsidePopup&&(E===`single`&&b.state.setSelectedValue(null,c),b.state.openOnInputClick||b.state.setOpen(!1,c)),a(e.currentTarget.value.trim()),A&&b.state.activeIndex!==null&&!ue&&Te()},onKeyDown(e){if(fe||w||e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;b.state.keyboardActiveRef.current=!0;let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,r=S===`rtl`;if(e.key===`Home`){Ie(e);let n=s&&r?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){Ie(e);let i=s&&r?0:t.value.length;t.setSelectionRange(i,i),t.scrollLeft=r?-n:n;return}if(!ae&&e.key===`Escape`){let t=E===`multiple`&&Array.isArray(j)?j.length===0:j===null,n=P(Me,e.nativeEvent),r=E===`multiple`?[]:null;b.state.setInputValue(``,n),b.state.setSelectedValue(r,n),!t&&!b.state.inline&&!n.isPropagationAllowed&&e.stopPropagation();return}if(v&&e.key===`Backspace`&&t.value===``&&v.highlightedChipIndex===void 0&&Array.isArray(j)&&j.length>0){let t=v.chipsRef.current.length,n=t>0?t-1:j.length-1,r=j.filter((e,t)=>t!==n);Te(),b.state.setSelectedValue(r,P(Pe,e.nativeEvent));return}let i=v?.highlightedChipIndex!==void 0,a=Oe(e);if(v?.setHighlightedChipIndex(a),a===void 0?i&&b.state.inputRef.current?.focus():v?.chipsRef.current[a]?.focus(),e.which!==229&&e.key===`Enter`&&A){let t=b.state.activeIndex,n=e.nativeEvent;if(t===null){if(ce)return;b.state.setOpen(!1,P(Pe,n));return}Ie(e),U(b,t,n)}},onPointerMove:Ee,onPointerDown:Ee},we],stateAttributesMapping:Pt}),ke=y?(0,z.jsx)(st.Provider,{value:at,children:L}):L;return(0,z.jsxs)(R.Fragment,{children:[A&&he&&(0,z.jsx)(Ht,{ref:b.state.startDismissRef}),ke]})}),q={...je,...pe},Ut=R.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,keepMounted:s=!1,style:u,...ee}=e,{disabled:te}=tt(),f=B(),p=o(f,H.selectionMode),m=o(f,H.disabled),h=o(f,H.readOnly),g=o(f,H.open),_=o(f,H.selectedValue),v=o(f,H.hasSelectionChips),y=St(),b=!1;b=p===`none`?y!==``:p===`single`?_!=null:v;let x=te||m||i,{buttonRef:S,getButtonProps:ne}=D({native:a,disabled:x}),{mounted:C,transitionStatus:w,setMounted:T}=d(b),E={disabled:x,visible:b,open:g,transitionStatus:w};re({open:b,ref:f.state.clearRef,onComplete(){b||T(!1)}});let O=c(`button`,e,{state:E,ref:[t,S,f.state.clearRef],props:[{tabIndex:-1,children:`x`,onMouseDown(e){e.preventDefault()},onClick(e){if(x||h)return;let t=f.state.keyboardActiveRef.current?Ne:l;f.state.setInputValue(``,P(L,e.nativeEvent)),p===`none`?f.state.setIndices({activeIndex:null,type:t}):(f.state.setSelectedValue(Array.isArray(_)?[]:null,P(L,e.nativeEvent)),f.state.setIndices({activeIndex:null,selectedIndex:null,type:t})),f.state.inputRef.current?.focus()}},ee,ne],stateAttributesMapping:q});return s||C?O:null}),Wt=R.createContext(null);function Gt(){return R.useContext(Wt)}function J(e){let{children:t}=e,{filteredItems:n}=V(),r=Gt(),i=r?r.items:n;return(0,z.jsx)(R.Fragment,{children:i.map(t)})}var Kt=R.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:s,...l}=e,u=B(),d=xt(),ee=!!G(!0),{filteredItems:te,hasItems:f}=V(),p=o(u,H.selectionMode),m=o(u,H.grid),h=o(u,H.listProps),g=o(u,H.virtualized),_=o(u,H.forceMounted),v=p===`multiple`,y=te.length===0,b=M(e=>{u.set(`positionerElement`,e)}),x=M(e=>{u.set(`listElement`,e)}),S=R.useMemo(()=>typeof s==`function`?n||=(0,z.jsx)(J,{children:s}):s,[s]),ne={empty:y},C=d.useState(`floatingId`),w=c(`div`,e,{state:ne,ref:[t,x,ee?null:b],props:[h,{children:S,tabIndex:-1,id:C,role:m?`grid`:`listbox`,"aria-multiselectable":v?`true`:void 0,onKeyDown(e){if(!(u.state.disabled||u.state.readOnly)&&e.key===`Enter`){let t=u.state.activeIndex;if(t==null)return;Ie(e),U(u,t,e.nativeEvent)}},onKeyDownCapture(){u.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){u.state.keyboardActiveRef.current=!1}},l]});if(g)return w;let T=f&&!_?void 0:u.state.labelsRef;return(0,z.jsx)(he,{elementsRef:u.state.listRef,labelsRef:T,children:w})}),Y=`⁠`;function qt(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null;for(;t.nextNode();){let e=t.currentNode;e.nodeValue!==``&&(n=e)}return n}function Jt(){let e=te(),t=R.useRef(null);return R.useEffect(()=>{if(E)return;let n=t.current;if(n==null)return;let r=qt(n);if(r==null)return;let i=r.data,a=`${i}${Y}`;return r.nodeValue=a,e.start(200,()=>{r.nodeValue===a&&(r.nodeValue=i)}),()=>{e.clear(),r.nodeValue===a&&(r.nodeValue=i)}},[t,e]),t}var X=R.createContext(void 0);function Yt(){let e=R.useContext(X);if(e===void 0)throw Error(v(20));return e}var Xt=R.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=B(),a=o(i,H.mounted),s=o(i,H.forceMounted);return a||n||s?(0,z.jsx)(X.Provider,{value:n,children:(0,z.jsx)(m,{ref:t,...r})}):null}),Zt=R.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:te,arrowPadding:f,sticky:p,disableAnchorTracking:m=!1,collisionAvoidance:g=T,style:v,...y}=e,b=B(),x=xt(),S=Yt(),ne=o(b,H.modal),C=o(b,H.open),w=o(b,H.mounted),re=o(b,H.openMethod),E=o(b,H.positionerElement),D=o(b,H.triggerElement),O=o(b,H.inputElement),k=o(b,H.inputGroupElement),ie=o(b,H.inputInsidePopup),A=o(b,H.transitionStatus),ae=It(),oe=h({anchor:i??(ie?D:k??O),floatingRootContext:x,positionMethod:a,mounted:w,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:d,collisionPadding:te,sticky:p,disableAnchorTracking:m,keepMounted:S,collisionAvoidance:g,lazyFlip:!0});me(C&&ne,re===`touch`,E,D);let j={open:C,side:oe.side,align:oe.align,anchorHidden:oe.anchorHidden,empty:ae};Ee(()=>{b.set(`popupSide`,oe.side)},[b,oe.side]);let se=M(e=>{b.set(`positionerElement`,e)}),ce=_(e,j,{styles:oe.positionerStyles,transitionStatus:A,props:y,refs:[t,se],hidden:!w,inert:!C});return(0,z.jsxs)(Vt.Provider,{value:oe,children:[w&&ne&&(0,z.jsx)(F,{inert:ee(!C),cutout:k??O??D}),ce]})}),Qt={...se,...je},$t=R.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:s,finalFocus:l,...u}=e,d=B(),ee=G(),te=xt(),f=o(d,H.mounted),p=o(d,H.open),m=o(d,H.openMethod),h=o(d,H.popupProps),g=o(d,H.transitionStatus),_=o(d,H.inputInsidePopup),v=o(d,H.inputElement),y=o(d,H.modal),b=o(d,H.id),x=It(),S=u.id??(_?wt(b):void 0);Ee(()=>(d.set(`popupId`,d.state.popupRef.current?.id||S),()=>{d.set(`popupId`,void 0)}),[d,S]),re({open:p,ref:d.state.popupRef,onComplete(){p&&d.state.onOpenChangeComplete(!0)}});let ne={open:p,side:ee.side,align:ee.align,anchorHidden:ee.anchorHidden,transitionStatus:g,empty:x},w=c(`div`,e,{state:ne,ref:[t,d.state.popupRef],props:[h,{id:S,role:_?`dialog`:`presentation`,onFocus(e){let t=ye(e.nativeEvent);m!==`touch`&&(a(d.state.listElement,t)||t===e.currentTarget)&&d.state.inputRef.current?.focus()}},Te(g),u],stateAttributesMapping:Qt}),T=s===void 0?_?e=>e===`touch`?d.state.popupRef.current:v:!1:s,E;E=l??(_?void 0:!1);let D=!_||y;return(0,z.jsx)(C,{context:te,disabled:!f,modal:D,openInteractionType:m,initialFocus:T,returnFocus:E,getInsideElements:()=>[d.state.startDismissRef.current,d.state.endDismissRef.current],children:(0,z.jsxs)(R.Fragment,{children:[w,D&&(0,z.jsx)(Ht,{ref:d.state.endDismissRef})]})})}),en=R.createContext(void 0);function Z(){let e=R.useContext(en);if(!e)throw Error(v(19));return e}var Q=R.createContext(!1);function tn(){return R.useContext(Q)}function nn(e){let{componentProps:t,forwardedRef:n,virtualized:r,indexFromFilter:i}=e,{render:a,className:s,style:l,value:u=null,index:d,disabled:ee=!1,nativeButton:te=!1,...f}=t,p=R.useRef(null),m=N({guess:!0,index:d,textRef:p}),h=B(),g=tn(),_=Ct(),v=o(h,H.selectionMode),y=o(h,H.disabled),b=o(h,H.readOnly),x=o(h,H.isItemEqualToValue),S=y||ee,ne=v!==`none`,C=d??i??m.index,w=C!==-1,T=o(h,H.id),re=o(h,H.isActive,C),E=o(h,H.isSelected,u),O=o(h,H.itemProps),k=R.useRef(null),ie=T!=null&&w?`${T}-${C}`:void 0,A=E&&ne;Ee(()=>{if(!(w&&(r||d!=null)))return;let e=h.state.listRef.current;return e[C]=k.current,()=>{delete e[C]}},[w,r,C,d,h]),Ee(()=>{if(!w||_)return;let e=h.state.valuesRef.current;return e[C]=u,()=>{delete e[C]}},[w,_,C,u,h]),Ee(()=>{if(!w||_)return;let e=h.state.selectedValue,t=Array.isArray(e)?e[e.length-1]:e;$e(u,t,x)&&h.set(`selectedIndex`,C)},[w,_,h,C,u,x]);let{getButtonProps:ae,buttonRef:oe}=D({disabled:S,focusableWhenDisabled:!0,native:te,composite:!0}),j={disabled:S,selected:A,highlighted:re};function se(e){function t(){h.state.handleSelection(e,u)}h.state.submitOnItemClick?(mt.flushSync(t),h.state.requestSubmit()):t()}let ce={id:ie,role:g?`gridcell`:`option`,"aria-selected":ne?A:void 0,tabIndex:void 0,onPointerDownCapture(e){e.isPrimary&&(h.state.pointerDownItemRef.current=e.currentTarget),e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){S||b||se(e.nativeEvent)},onMouseUp(e){let t=h.state.pointerDownItemRef.current===e.currentTarget;h.state.pointerDownItemRef.current=null,!(S||b||e.button!==0||t||!re)&&se(e.nativeEvent)}},le=c(`div`,t,{ref:[oe,n,m.ref,k],state:j,props:[O,ce,f,ae]}),ue=R.useMemo(()=>({selected:A,textRef:p}),[A,p]);return(0,z.jsx)(en.Provider,{value:ue,children:le})}function rn(e){let{componentProps:t,forwardedRef:n}=e,r=B(),i=o(r,H.isItemEqualToValue),{flatFilteredItems:a}=V(),s=We(a,t.value??null,i);return(0,z.jsx)(nn,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:s})}var an=R.memo(R.forwardRef(function(e,t){let n=B(),r=o(n,H.virtualized);return r&&e.index==null?(0,z.jsx)(rn,{componentProps:e,forwardedRef:t}):(0,z.jsx)(nn,{componentProps:e,forwardedRef:t,virtualized:r,indexFromFilter:void 0})})),on=R.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=V(),l=B(),u=Jt(),d=s.length===0?a:null;return c(`div`,e,{ref:[t,l.state.emptyRef,u],props:[{children:d,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})});function sn(e){let{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,autoComplete:a,...o}=e;return(0,z.jsx)(Nt,{...o,selectionMode:t?`multiple`:`single`,selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i,formAutoComplete:a})}var cn=R.forwardRef(function(e,t){let{selected:n}=Z();return e.keepMounted||n?(0,z.jsx)(ln,{...e,ref:t}):null}),ln=R.memo(R.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=Z(),l=R.useRef(null),{transitionStatus:u,setMounted:ee}=d(s),te=c(`span`,e,{ref:[t,l],state:{selected:s,transitionStatus:u},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:je});return re({open:s,ref:l,onComplete(){s||ee(!1)}}),te})),un=sn;function dn({className:e,children:t,...n}){return(0,z.jsxs)(zt,{"data-slot":`combobox-trigger`,className:ze(`[&_svg:not([class*='size-'])]:size-4`,e),...n,children:[t,(0,z.jsx)(Le,{className:`pointer-events-none size-4 text-muted-foreground`})]})}function fn({className:e,...t}){return(0,z.jsx)(Ut,{"data-slot":`combobox-clear`,render:(0,z.jsx)(dt,{variant:`ghost`,size:`icon-xs`}),className:ze(e),...t,children:(0,z.jsx)(ut,{className:`pointer-events-none`})})}function $({className:e,children:t,disabled:n=!1,showTrigger:r=!0,showClear:i=!1,...a}){return(0,z.jsxs)(ft,{className:ze(`w-auto`,e),children:[(0,z.jsx)(K,{render:(0,z.jsx)(lt,{disabled:n}),...a}),(0,z.jsxs)(pt,{align:`inline-end`,children:[r&&(0,z.jsx)(dt,{size:`icon-xs`,variant:`ghost`,render:(0,z.jsx)(dn,{}),"data-slot":`input-group-button`,className:`group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent`,disabled:n}),i&&(0,z.jsx)(fn,{disabled:n})]}),t]})}function pn({className:e,side:t=`bottom`,sideOffset:n=6,align:r=`start`,alignOffset:i=0,anchor:a,...o}){return(0,z.jsx)(Xt,{children:(0,z.jsx)(Zt,{side:t,sideOffset:n,align:r,alignOffset:i,anchor:a,className:`isolate z-50`,children:(0,z.jsx)($t,{"data-slot":`combobox-content`,"data-chips":!!a,className:ze(`group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o})})})}function mn({className:e,...t}){return(0,z.jsx)(Kt,{"data-slot":`combobox-list`,className:ze(`no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0`,e),...t})}function hn({className:e,children:t,...n}){return(0,z.jsxs)(an,{"data-slot":`combobox-item`,className:ze(`relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[t,(0,z.jsx)(cn,{render:(0,z.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,z.jsx)(Ae,{className:`pointer-events-none`})})]})}function gn({className:e,...t}){return(0,z.jsx)(on,{"data-slot":`combobox-empty`,className:ze(`hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex`,e),...t})}function _n(e,t){let n=t.toLowerCase().split(/\s+/u).filter(Boolean),r=`${e.label} ${e.aside}`.toLowerCase();return n.every(e=>r.includes(e))}function vn({id:e,value:t,options:n,placeholder:r,label:i,onChange:a}){let o=n.find(e=>e.value===t)??null;return(0,z.jsxs)(un,{items:n,value:o,itemToStringLabel:e=>e.label,filter:(e,t)=>_n(e,t),onValueChange:e=>{a(e===null?``:e.value)},children:[(0,z.jsx)($,{id:e,"aria-label":i,placeholder:r,className:`bg-field dark:bg-field`,showTrigger:!1,children:(0,z.jsxs)(pt,{align:`inline-end`,children:[o!==null&&o.aside!==``&&(0,z.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:o.aside}),(0,z.jsx)(dt,{size:`icon-xs`,variant:`ghost`,render:(0,z.jsx)(dn,{})})]})}),(0,z.jsxs)(pn,{children:[(0,z.jsx)(gn,{children:`No match.`}),(0,z.jsx)(mn,{children:e=>(0,z.jsxs)(hn,{value:e,children:[(0,z.jsx)(`span`,{className:`truncate`,children:e.label}),e.aside!==``&&(0,z.jsx)(`span`,{className:`ml-auto font-mono text-xs whitespace-nowrap text-muted-foreground`,children:e.aside})]},e.value)})]})]})}export{vn as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PipelineGraph-BPtZkp6B.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/react-BatatxyT.js","assets/store-CVrCnru0.js","assets/dropdown-menu-B9iU0HGD.js","assets/utils-CRMSf51M.js","assets/StepPorts-CtcvnIvJ.js","assets/maximize-2-B2tdtoC6.js","assets/input-7d4ZlAGD.js","assets/use-store-CgWwefFs.js","assets/status-Ctx8x8Mf.js","assets/index-DaM0mXP1.js","assets/dist-BWSEJlfk.js","assets/preload-helper-Czpn1I53.js","assets/chunk-BV7QT456-Bfa1dvOx.js","assets/chevron-down-CrkpqUMs.js","assets/PageState-CTB50fRO.js","assets/paging-CZR9Tg8m.js","assets/textarea-XMYmRm72.js","assets/auth-DZcJKVvz.js","assets/format-CR2ze2LO.js","assets/use-heartbeat-ByRKom_T.js","assets/identity-BNZxCf_y.js","assets/pipelines-D_CSKLu-.js","assets/index-DPOCILN_.css","assets/KindChip-CuBFi3X9.js","assets/PipelineTab-ePfoBa3H.js","assets/Description-DVFPKyRO.js","assets/Instant-C9TZFyg5.js","assets/Panel-Bk3CoJZ6.js","assets/copy-r6NpGwbU.js","assets/schema-form-dcZ8A0M1.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-BatatxyT.js";import{i as n,t as r}from"./store-CVrCnru0.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{c as a,l as o,s}from"./chunk-BV7QT456-Bfa1dvOx.js";import{_ as c}from"./dropdown-menu-B9iU0HGD.js";import{a as l,i as u,n as d,r as f,t as p}from"./select-BAmX8M_l.js";import{a as m,c as ee,n as h,o as g}from"./PageState-CTB50fRO.js";import{r as _}from"./utils-CRMSf51M.js";import{t as v}from"./WindowedPane-Bl60nHe4.js";import{d as y,f as b}from"./paging-CZR9Tg8m.js";import{t as te}from"./input-7d4ZlAGD.js";import{t as x}from"./SchemaForm-CBmpygQH.js";import{t as S}from"./use-store-CgWwefFs.js";import{t as C}from"./auth-DZcJKVvz.js";import{b as w,l as ne,x as T,y as re}from"./format-CR2ze2LO.js";import{r as ie,t as ae}from"./identity-BNZxCf_y.js";import{a as oe,c as se,h as ce,l as le,p as ue,t as E}from"./pipelines-D_CSKLu-.js";import{At as D,Bt as de,Dt as O,Et as fe,Lt as pe,O as k,Ot as A,Pt as j,Rt as me,Vt as M,_t as he,b as N,dt as P,k as F,kt as I,l as ge,lt as _e,nt as L,rt as ve,st as R,t as ye,wt as be,y as xe}from"./index-DaM0mXP1.js";import{t as z}from"./KindChip-CuBFi3X9.js";import{c as Se,i as Ce,s as we,t as B}from"./blocks-CPJMNxIu.js";import{A as Te,C as Ee,D as De,E as Oe,M as ke,O as Ae,S as je,T as Me,_ as Ne,a as Pe,b as V,c as H,d as Fe,f as Ie,g as Le,h as Re,i as ze,j as Be,k as Ve,l as He,n as Ue,o as We,p as Ge,s as Ke,t as qe,u as U,v as Je,w as W,x as Ye}from"./PipelineTab-ePfoBa3H.js";import{r as Xe}from"./Panel-Bk3CoJZ6.js";import{d as G,f as Ze,o as K,r as q,u as Qe}from"./schema-form-dcZ8A0M1.js";import{l as $e}from"./connections-CdL8xQGj.js";import{t as J}from"./Refusal-TkoEvvgs.js";import{t as et}from"./Segmented-DvCzioEn.js";import{t as Y}from"./ProgramReference-qv2Y4zei.js";import{t as tt}from"./Breadcrumb-KS3i4O6Q.js";var nt=n(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),rt=n(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),X=e(t(),1),Z=_(),it=/^[a-z][a-z0-9_]*$/,at={sensor:`sensor`,sensors:`sensor`,operator:`operator`,operators:`operator`};function ot(e){let t=Ce(e.id),n=e.id.indexOf(`.`);return{entry:e,family:t,rest:n===-1?e.id:e.id.slice(n+1)}}function st(e){return B(e).map(([e,t])=>({shelf:e,blocks:t}))}function ct(e,t){let n=t.toLowerCase().split(/\s+/).filter(e=>e!==``);return n.length===0?[]:e.filter(e=>n.every(t=>lt(e,t))).toSorted((e,t)=>e.id.localeCompare(t.id)).map(ot)}function lt(e,t){return at[t]===e.kind||`${e.id} ${e.summary}`.toLowerCase().includes(t)}function ut(e,t){let n=dt(e);if(!t.includes(n))return n;for(let e=2;;e+=1){let r=`${n}_${String(e)}`;if(!t.includes(r))return r}}function dt(e){let t=e.indexOf(`.`),n=(t===-1?e:e.slice(t+1)).toLowerCase().replaceAll(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``);return n===``||!it.test(n)?`step_${n}`.replace(/_$/,``):n}var ft=r(0);function pt(){ft.set(ft.get()+1)}var mt=r(0);function ht(){mt.set(mt.get()+1)}var gt=`dirigent.layout.`;function _t(e){return`${gt}${e}`}var Q=r({pipeline:null,placements:{}});function vt(e){let t=null;try{t=localStorage.getItem(_t(e))}catch{return{}}if(t===null)return{};let n;try{n=JSON.parse(t)}catch{return{}}if(typeof n!=`object`||!n||Array.isArray(n))return{};let r={};for(let[e,t]of Object.entries(n)){let n=t;typeof n!=`object`||!n||typeof n.x==`number`&&typeof n.y==`number`&&(!Number.isFinite(n.x)||!Number.isFinite(n.y)||(r[e]={x:n.x,y:n.y}))}return r}function yt(e,t){try{Object.keys(t).length===0?localStorage.removeItem(_t(e)):localStorage.setItem(_t(e),JSON.stringify(t))}catch{}}function bt(e){Q.set({pipeline:e,placements:vt(e)})}function xt(e,t){Q.update(n=>({...n,placements:{...n.placements,[e]:t}}))}function St(){let e=Q.get();e.pipeline!==null&&yt(e.pipeline,e.placements)}function Ct(e,t){xt(e,t),St()}function wt(){let e=Q.get();e.pipeline!==null&&yt(e.pipeline,{}),Q.set({pipeline:e.pipeline,placements:{}})}function Tt(e,t){return e.map(e=>{let n=t[e.id];return n===void 0?e:{...e,x:n.x,y:n.y}})}function Et({view:e}){return(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(`p`,{className:e.tone===`critical`?`text-sm text-critical`:`text-sm`,children:e.headline}),e.changes.length>0&&(0,Z.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-4 text-xs text-muted-foreground`,children:e.changes.map(e=>(0,Z.jsx)(`li`,{children:e},e))}),e.issues.length>0&&(0,Z.jsxs)(`div`,{className:`space-y-1 rounded-md border border-critical/40 p-2`,role:`alert`,children:[(0,Z.jsxs)(`p`,{className:`text-xs font-medium text-critical`,children:[e.issues.length,` issue`,e.issues.length===1?``:`s`,` — apply will refuse`]}),(0,Z.jsx)(`ul`,{className:`space-y-0.5 text-xs`,children:e.issues.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.location}),` `,(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:e.message})]},`${e.location}:${e.message}`))})]}),e.issues.length===0&&e.changes.length===0&&e.tone!==`critical`&&(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No changes from the stored version.`})]})}function Dt(e){let t=e.issues;switch(e.action){case`invalid`:return{headline:`Apply will refuse ${e.code}`,tone:`critical`,changes:[],issues:t,applicable:!1};case`unchanged`:return{headline:`Apply writes nothing — ${e.code} is already at this document`,tone:`quiet`,changes:[],issues:t,applicable:!1};case`create`:return{headline:`Apply creates ${e.code} at version 1`,tone:`good`,changes:Ot(e.diff),issues:t,applicable:!0};case`update`:return{headline:`Apply writes version ${String(e.next_version??0)} of ${e.code}`,tone:`good`,changes:Ot(e.diff),issues:t,applicable:!0}}}function Ot(e){if(e===null)return[];let t=[];return e.steps_added.length>0&&t.push(`steps added: ${e.steps_added.join(`, `)}`),e.steps_removed.length>0&&t.push(`steps removed: ${e.steps_removed.join(`, `)}`),e.steps_changed.length>0&&t.push(`steps changed: ${e.steps_changed.join(`, `)}`),e.params_changed&&t.push(`the parameter schema changed`),e.triggers_changed&&t.push(`the triggers changed`),e.settings_changed&&t.push(`the name, description, or concurrency policy changed`),t}function kt(e){return e.length===0?null:`${String(e.length)} issue${e.length===1?``:`s`} — apply will refuse`}var At=`Apply document`,jt=`Validate document`,Mt=`Apply`;function Nt({open:e,mode:t,document:n,onOpenChange:r,onPlan:i,onApplied:a}){let[o,s]=(0,X.useState)(null),[c,l]=(0,X.useState)(null),[u,d]=(0,X.useState)(!1),f=xe();return(0,X.useEffect)(()=>{if(!e)return;let t=!1;return s(null),l(null),E(n,!0).then(e=>{t||(s(Dt(e.plan)),i?.(e.plan))},e=>{t||l(y(e))}),()=>{t=!0}},[n,e]),(0,Z.jsx)(be,{open:e,onOpenChange:r,children:(0,Z.jsxs)(fe,{className:`sm:max-w-lg`,children:[(0,Z.jsxs)(I,{children:[(0,Z.jsx)(D,{children:t===`apply`?At:jt}),t===`validate`&&(0,Z.jsx)(O,{children:`Nothing was written.`})]}),c!==null&&(0,Z.jsx)(J,{problem:c}),c===null&&o===null&&(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Checking the document.`}),o!==null&&(0,Z.jsx)(Et,{view:o}),(0,Z.jsxs)(A,{children:[(0,Z.jsx)(b,{variant:`outline`,onClick:()=>r(!1),children:t===`apply`?`Cancel`:`Close`}),t===`apply`&&(0,Z.jsx)(Ft,{why:N(f.why,Pt(o)),busy:u,onApply:()=>{d(!0),E(n,!1).then(e=>{d(!1),a(e),r(!1)},e=>{d(!1),l(y(e))})}})]})]})})}function Pt(e){return e===null?`The document has not been checked yet.`:e.applicable?void 0:`This document is not one the instance would accept.`}function Ft({why:e,busy:t,onApply:n}){return(0,Z.jsx)(g,{why:e,children:(0,Z.jsx)(b,{disabled:t||e!==void 0,title:e,onClick:n,children:Mt})})}var It=`report/template`,Lt=`report.template`,Rt=[{value:`none`,label:`No report`},{value:`builtin`,label:`Built-in template`},{value:`own`,label:`Own template`}];function zt({document:e,disabled:t,onChange:n}){let r=Ne(e),i=r.declared?r.template===null?`builtin`:`own`:`none`,a=(0,X.useRef)(``);return e===null?(0,Z.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`This pipeline has no version, so there is no document to read.`}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(et,{label:`What a run of this pipeline reports`,size:`md`,value:i,options:Rt,disabled:t!==void 0,onChoose:e=>{r.template!==null&&(a.current=r.template),n(e,a.current)}}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i===`none`?`A run of this pipeline writes no report document.`:(0,Z.jsxs)(Z.Fragment,{children:[i===`builtin`?`The built-in document is the run's facts, a table of its steps, and its error. It is not part of this document.`:`This template is rendered against the run's facts when the run settles.`,` `,(0,Z.jsx)(`a`,{className:`text-primary-ink hover:underline`,href:k,target:`_blank`,rel:`noreferrer`,children:`What a template may read`})]})})]}),t!==void 0&&(0,Z.jsx)(`p`,{className:`rounded-md border border-warning/40 p-2 text-xs text-warning`,children:t}),i===`own`&&(0,Z.jsx)(v,{name:Lt,className:`overflow-hidden rounded-md border border-border`,aside:(0,Z.jsx)(Y,{mediaType:`text/x-jinja`}),windowed:(0,Z.jsx)(R,{value:r.template??``,mediaType:`text/x-jinja`,path:It,label:`${Lt}, in a window`,className:`min-h-0 flex-1`,readOnly:t!==void 0,onChange:e=>{n(`own`,e)}}),children:(0,Z.jsx)(R,{value:r.template??``,mediaType:`text/x-jinja`,path:It,label:Lt,placeholder:`# {{ pipeline.code }} {{ run.status }}`,className:`h-64 min-h-40`,readOnly:t!==void 0,onChange:e=>{n(`own`,e)}})})]})}var Bt=`run.window`,Vt=`This pipeline needs a window`,Ht=`A window has two ends: give both, or neither.`,Ut=`A window runs forwards: the start is before the end.`,Wt=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/;function Gt(e){return Kt(e)}function Kt(e){return typeof e==`string`?e.includes(Bt):Array.isArray(e)?e.some(Kt):typeof e==`object`&&e?Object.values(e).some(Kt):!1}function qt(e,t){return Wt.test(e)?`${e}:00${Jt(t)}`:null}function Jt(e){if(e===0)return`Z`;let t=e<0?`-`:`+`,n=Math.abs(e);return`${t}${Yt(Math.floor(n/60))}:${Yt(n%60)}`}function Yt(e){return String(e).padStart(2,`0`)}function Xt(e,t,n,r){let i=qt(e,r(e)),a=qt(t,r(t));return i===null||a===null?i===null&&a===null?n?{kind:`unready`,why:Vt}:{kind:`none`}:{kind:`unready`,why:n?Vt:Ht}:Date.parse(i)>=Date.parse(a)?{kind:`unready`,why:n?Vt:Ut}:{kind:`window`,window:{window_start:i,window_end:a}}}var Zt=`Run now`;function Qt({open:e,pipeline:t,document:n,username:r,warnings:i,onOpenChange:a,onStarted:o}){let s=(0,X.useMemo)(()=>q(oe(n)),[n]),c=(0,X.useMemo)(()=>Gt(n),[n]),[m,ee]=(0,X.useState)({}),[h,_]=(0,X.useState)(``),[v,te]=(0,X.useState)(``),[C,ne]=(0,X.useState)(!1),ie=S(w),[se,le]=(0,X.useState)(()=>new Set),[ue,E]=(0,X.useState)(()=>new Set),[de,pe]=(0,X.useState)(!1),[k,j]=(0,X.useState)(null),[me,M]=(0,X.useState)(!1),[he,N]=(0,X.useState)(`info`),P=xe(),ge=G(s,m),_e=de?void 0:se,L=Xt(h,v,c,e=>re(ie,new Date(`${e}:00`))),ve=(0,X.useRef)(null),R=()=>{pe(!0),M(!0),ce(t.code,m,he===`debug`?{"*":`debug`}:null,L.kind===`window`?L.window:null).then(e=>{M(!1),o(e),a(!1)},e=>{M(!1),j(y(e))})},ye=ae(t),z=P.why??(L.kind===`unready`?L.why:void 0);return(0,Z.jsx)(be,{open:e,onOpenChange:a,children:(0,Z.jsxs)(fe,{className:`sm:max-w-lg`,initialFocus:s.length===0?ve:void 0,children:[(0,Z.jsxs)(I,{children:[(0,Z.jsx)(D,{children:`Run`}),(0,Z.jsxs)(O,{children:[(0,Z.jsx)(`span`,{className:`text-foreground`,children:ye.title}),ye.code!==null&&(0,Z.jsxs)(`span`,{className:`font-mono`,children:[` `,ye.code]})]})]}),s.length>0&&(0,Z.jsx)(`div`,{className:`max-h-[50vh] overflow-y-auto`,children:(0,Z.jsx)(x,{fields:s,values:m,problems:ge,stated:_e,onChange:(e,t)=>{ee(n=>{let r={...n};return t===void 0?delete r[e]:r[e]=t,r})},onTouch:e=>{le(t=>t.has(e)?t:new Set(t).add(e))},onUnreadable:(e,t)=>{E(n=>Ze(n,e,t))}})}),c||C?(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,Z.jsx)(F,{children:`Window`}),(0,Z.jsx)(`span`,{className:`font-mono text-xs text-faint`,children:T(ie)})]}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,Z.jsx)($t,{id:`run-window-start`,label:`Start`,value:h,onChange:_}),(0,Z.jsx)($t,{id:`run-window-end`,label:`End`,value:v,onChange:te})]})]}):(0,Z.jsx)(b,{variant:`link`,className:`w-fit px-0 text-primary-ink`,onClick:()=>{ne(!0)},children:`Add a window`}),i.length>0&&(0,Z.jsx)(`div`,{className:`space-y-0.5 rounded-md border border-warning/40 bg-warning/10 p-2`,children:i.map(e=>(0,Z.jsx)(`p`,{className:`text-xs text-warning-ink`,children:e},e))}),k!==null&&(0,Z.jsx)(`p`,{className:`text-xs text-critical`,role:`alert`,children:k.detail}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`log`}),(0,Z.jsxs)(p,{value:he,onValueChange:e=>{N(e===`debug`?`debug`:`info`)},children:[(0,Z.jsx)(u,{size:`sm`,className:`w-40`,"aria-label":`log level`,children:(0,Z.jsx)(l,{})}),(0,Z.jsxs)(d,{children:[(0,Z.jsx)(f,{value:`info`,children:`info and up`}),(0,Z.jsx)(f,{value:`debug`,children:`debug too`})]})]})]}),(0,Z.jsxs)(`p`,{className:`text-xs text-faint`,children:[`runs as `,r??`this session`,` · adhoc`]}),(0,Z.jsxs)(A,{children:[(0,Z.jsx)(b,{variant:`outline`,onClick:()=>a(!1),children:`Cancel`}),(0,Z.jsx)(g,{why:z,children:(0,Z.jsx)(b,{ref:ve,disabled:me||!P.may||!K(ge,ue)||z!==void 0,title:z,onClick:R,children:Zt})})]})]})})}function $t({id:e,label:t,value:n,onChange:r}){return(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(F,{htmlFor:e,children:t}),(0,Z.jsx)(te,{id:e,type:`datetime-local`,className:`font-mono`,value:n,onChange:e=>{r(e.target.value)}})]})}var en=`document`,tn=`The document`,nn=250;function rn({document:e,schema:t,parseError:n,onWrite:r,readOnly:i=!1}){let a=(0,X.useMemo)(()=>e===null?``:Me(e),[e]),[o,s]=(0,X.useState)(a),c=(0,X.useRef)(!1),l=(0,X.useRef)(null);return(0,X.useEffect)(()=>{c.current||s(a)},[a]),(0,X.useEffect)(()=>()=>{l.current!==null&&clearTimeout(l.current)},[]),e===null?(0,Z.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`This pipeline has no version, so there is no document to read.`}):(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[n!==null&&(0,Z.jsxs)(`div`,{className:`border-b border-border p-2 text-xs text-critical`,role:`alert`,children:[(0,Z.jsx)(`pre`,{className:`overflow-x-auto font-mono whitespace-pre-wrap`,children:n}),(0,Z.jsx)(`p`,{className:`mt-1`,children:`The other tabs are showing the last document that parsed.`})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(R,{value:o,schema:t,path:en,label:tn,readOnly:i,onChange:e=>{c.current=!0,s(e),l.current!==null&&clearTimeout(l.current),l.current=setTimeout(()=>{c.current=!1,r(e)},nn)}})})]})}var an=[`rule`,`for_each`,`items`,`timeout`,`poll`,`deadline`,`on_timeout`,`continue_on_failure`],$={type:`string`,format:`duration`},on={type:`object`,properties:{rule:{type:`string`,enum:[`all_success`,`all_done`,`one_failed`,`always`],default:`all_success`,description:`When this step becomes ready, over the steps it waits for.`},for_each:{anyOf:[{type:`string`},{type:`array`,items:{}}],description:"A reference to a list, or a literal list: one run item per element. A reference may read params, run, and an upstream fan-out's grid as ${steps.<name>.items}, which maps this step over that step's items.",examples:["${params.regions}","${steps.spread.items}"]},items:{type:`string`,enum:[`fail_fast`,`continue`],default:`fail_fast`,description:`Whether one failed item stops the batch, or the rest carry on.`},timeout:{...$,description:`How long one attempt may take.`},poll:{...$,description:`How often a sensor checks. Defaults to the sensor's own cadence.`},deadline:{...$,description:`How long the step may wait before the timeout applies.`},on_timeout:{type:`string`,enum:[`fail`,`skip`],default:`fail`,description:`What an expired deadline does to the step.`},continue_on_failure:{type:`boolean`,default:!1,description:`Dependents still run when this step fails, and the run completes with errors.`}}},sn={type:`object`,properties:{max_attempts:{type:`integer`,minimum:1,maximum:100,default:1,description:`Total attempts, including the first.`},backoff:{...$,default:`30s`,description:`The delay after the first failure.`},max_backoff:{...$,default:`1h`,description:`The longest delay between attempts.`},multiplier:{type:`number`,minimum:1,maximum:10,default:2,description:`What each delay is multiplied by.`},jitter:{type:`number`,minimum:0,maximum:1,default:.2,description:`How much of the delay is spread randomly.`}}},cn=q(on),ln=q(sn);function un(e,t){let n=W(e)[t]??{},r={};for(let e of an){let t=n[e];t!==void 0&&(r[e]=e===`for_each`?fn(t):t)}return r}function dn(e,t){let n=W(e)[t]?.retry;return typeof n!=`object`||!n||Array.isArray(n)?{}:n}function fn(e){return typeof e==`string`?e:JSON.stringify(e)??``}function pn(e){if(typeof e!=`string`)return e;let t=e.trim();if(!t.startsWith(`[`))return e;try{let n=JSON.parse(t);return Array.isArray(n)?n:e}catch{return e}}function mn(e,t,n,r){let i=cn.find(e=>e.name===n),a=n===`for_each`?pn(r):r;return gn(e,t,n,a==null||a===``||Qe(a,i?.fallback)?void 0:a)}function hn(e,t,n,r){let i=ln.find(e=>e.name===n),a={...dn(e,t)};return r==null||r===``||Qe(r,i?.fallback)?delete a[n]:a[n]=r,gn(e,t,`retry`,Object.keys(a).length===0?void 0:a)}function gn(e,t,n,r){let i=W(e),a=i[t];if(a===void 0)return e;let o={...a};return r===void 0?delete o[n]:o[n]=r,{...e,steps:{...i,[t]:o}}}function _n({step:e,document:t,block:n,blockProblem:r,disabled:i,onConfig:a,onDependsOn:o,onName:s}){let c=V(t,e),[m,ee]=(0,X.useState)(Ye(t,e)??``),h=He(t,e),g=(0,X.useMemo)(()=>q(n?.config_schema),[n]),_=(0,X.useMemo)(()=>G(g,h),[g,h]),v=U(t,e),y=je(t).filter(t=>t!==e&&!v.includes(t)),S=un(t,e),C=dn(t,e),w=G(cn,S),ne=G(ln,C),T=Object.entries({...w,...ne,..._});return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`h2`,{className:c.named?`text-sm font-semibold`:`font-mono text-sm font-semibold`,children:c.title}),(0,Z.jsxs)(`p`,{className:`flex items-center gap-2`,children:[c.code!==null&&(0,Z.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:c.code}),(0,Z.jsx)(`span`,{className:`font-mono text-xs`,children:Ke(t,e)??`no block`}),n!==null&&(0,Z.jsx)(z,{kind:n.kind})]}),n!==null&&(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n.summary})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(F,{htmlFor:`step-display-name`,children:`Name`}),(0,Z.jsx)(te,{id:`step-display-name`,value:m,disabled:i!==void 0,onChange:e=>{ee(e.target.value),s(e.target.value)},placeholder:`What to call this step on screen`}),(0,Z.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Display only. Every reference to this step is by its key, `,e,`.`]})]}),i!==void 0&&(0,Z.jsx)(`p`,{className:`rounded-md border border-warning/40 p-2 text-xs text-warning`,children:i}),(0,Z.jsxs)(Xe,{title:`Waits for`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[v.length===0&&(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`nothing; this step is a root`}),v.map(e=>(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 rounded-sm border border-border bg-secondary px-1.5 py-0.5 text-xs`,children:[e,(0,Z.jsx)(b,{variant:`ghost`,size:`icon-xs`,"aria-label":`Stop waiting for ${e}`,disabled:i!==void 0,onClick:()=>{o(v.filter(t=>t!==e))},children:(0,Z.jsx)(j,{className:`size-3`,"aria-hidden":!0})})]},e))]}),y.length>0&&(0,Z.jsxs)(p,{value:``,disabled:i!==void 0,onValueChange:e=>{let t=String(e);t!==``&&o([...v,t])},children:[(0,Z.jsx)(u,{size:`sm`,className:`w-full`,"aria-label":`Add a prerequisite`,children:(0,Z.jsx)(l,{placeholder:`Add a prerequisite`})}),(0,Z.jsx)(d,{children:y.map(e=>(0,Z.jsx)(f,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(Xe,{title:`Step`,children:[(0,Z.jsx)(x,{fields:cn,values:S,problems:w,disabled:i,onChange:(t,n)=>{H(r=>mn(r,e,t,n))}},`step-${e}`),(0,Z.jsxs)(`div`,{className:`space-y-4 border-l border-border pl-3`,children:[(0,Z.jsx)(`p`,{className:`font-mono text-sm font-medium`,children:`retry`}),(0,Z.jsx)(x,{fields:ln,values:C,problems:ne,disabled:i,onChange:(t,n)=>{H(r=>hn(r,e,t,n))}},`retry-${e}`)]})]}),(0,Z.jsx)(Xe,{title:`Config`,children:r===null?n===null?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Reading this block's schema.`}):(0,Z.jsx)(x,{fields:g,values:h,problems:_,disabled:i,fold:!0,onChange:(e,t)=>{let n={...h};t===void 0?delete n[e]:n[e]=t,a(n)}},e):(0,Z.jsx)(`p`,{className:`text-xs text-critical`,children:r.detail})}),T.length>0&&(0,Z.jsxs)(`div`,{className:`space-y-1 rounded-md border border-critical/40 p-2`,role:`alert`,children:[(0,Z.jsx)(`p`,{className:`text-xs font-medium text-critical`,children:`This step will be refused at apply.`}),(0,Z.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-4 text-xs text-muted-foreground`,children:T.map(([e,t])=>(0,Z.jsx)(`li`,{children:t},e))})]})]})}function vn(e,t,n){let r=U(e,n);return r.includes(t)?e:Oe(e,n,[...r,t])}function yn(e,t,n){let r=U(e,n);return r.includes(t)?Oe(e,n,r.filter(e=>e!==t)):e}function bn(e,t){let n=W(e);if(!(t in n))return e;let r=Object.fromEntries(Object.entries(n).filter(([e])=>e!==t)),i={...e,steps:r};for(let e of Object.keys(r)){let n=U(i,e);n.includes(t)&&(i=Oe(i,e,n.filter(e=>e!==t)))}return i}function xn(e,t,n){if(t===n)return[n,n];let r=new Map;for(let[t,n]of Ie(e))r.set(t,[...r.get(t)??[],n]);let i=new Set([n]),a=[[n]];for(;a.length>0;){let e=[];for(let o of a)for(let a of r.get(o[o.length-1]??``)??[]){if(a===t)return[...o,t,n];i.has(a)||(i.add(a),e.push([...o,a]))}a=e}return null}function Sn(e,t,n){return`${t} cannot wait for ${e}: that closes a loop, ${n.join(` → `)}`}var Cn=(0,X.lazy)(()=>i(()=>import(`./PipelineGraph-BPtZkp6B.js`).then(e=>({default:e.PipelineGraph})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]))),wn=`Validate document`,Tn=`Run pipeline`,En=`Apply document`,Dn=3,On=5,kn=`new pipeline`,An=`Apply this document before running it.`,jn=`Read only on a small screen`;function Mn(){let{code:e}=o(),t=e===void 0,n=e??`new`,r=a(),i=s().state?.document,l=S(C),u=ee(),d=xe(),f=d.may,p=S(Fe),[g,_]=(0,X.useState)({of:``,detail:null,problem:null}),[v,y]=(0,X.useState)([]),[b,te]=(0,X.useState)(null),[x,w]=(0,X.useState)([]),[T,re]=(0,X.useState)([]),[oe,ce]=(0,X.useState)(null),[E,D]=(0,X.useState)(null),[O,fe]=(0,X.useState)({of:null,block:null,problem:null}),[k,A]=(0,X.useState)(`none`),[j,F]=(0,X.useState)(null),I=p.code===n?p.local:null,R=(0,X.useMemo)(()=>Ge(p.applied,I),[p.applied,I]),be=(0,X.useMemo)(()=>p.applied===null?{...R,steps:[]}:R,[R,p.applied]);(0,X.useEffect)(()=>{if(t){Je(i),P(i===void 0?`step`:`source`);return}let e=!1;return le(n).then(t=>{e||(_({of:n,detail:t,problem:null}),Le(n,t.document))},t=>{e||_({of:n,detail:null,problem:t instanceof c?t.problem:null})}),()=>{e=!0}},[n,t,i]);let z=g.of===n?g.detail:null,Ce=g.of===n?g.problem:null;(0,X.useEffect)(()=>Re,[]),(0,X.useEffect)(()=>{let e=!1,r=(t,n)=>{t.then(t=>{e||n(t)},()=>{})};return t||(r(ue(n,On),e=>{y(e.items)}),r(ge({...ye,pipeline:n},null,Dn),e=>{w(e.items)})),r($e(),e=>{te(e.items)}),r(Se(),e=>{re(e.blocks)}),r(se(),ce),()=>{e=!0}},[n,t]);let B=E===null?null:Ke(I,E);(0,X.useEffect)(()=>{if(B===null)return;let e=!1;return we(B).then(t=>{e||fe({of:B,block:t,problem:null})},t=>{e||fe({of:B,block:null,problem:t instanceof c?t.problem:null})}),()=>{e=!0}},[B]);let Me=(0,X.useMemo)(()=>O.of===B?O:{of:B,block:null,problem:null},[B,O]),Ne=je(I),V=v[0]??null,Ie=(0,X.useMemo)(()=>T.length===0?null:T.map(e=>e.id),[T]),He=(0,X.useMemo)(()=>b?.map(e=>e.code)??null,[b]),U=(0,X.useMemo)(()=>ze(I,Ie,He),[Ie,He,I]),W=(0,X.useMemo)(()=>Pe(U),[U]);(0,X.useEffect)(()=>{let e=[Ue(U)?`${String(W.length)} unmet here`:null,j].filter(e=>e!==null);return ve({note:e.length===0?null:e.join(` · `),tone:e.length===0?`quiet`:`warn`,identifier:V===null?null:`v${String(V.version)} · applied ${ne(V.created_at)}${V.applied_by===null?``:` by ${V.applied_by}`}`}),L},[V,j,U,W.length]);let Ye=(0,X.useCallback)((e,t)=>{let n=xn(I,e,t);if(n!==null){M.warning(Sn(e,t,n));return}H(n=>vn(n,e,t))},[I]),Xe=(0,X.useCallback)((e,t)=>{H(n=>yn(n,e,t))},[]),G=(0,X.useCallback)(e=>{H(t=>bn(t,e)),D(t=>t===e?null:t)},[]),Ze=(e,t,n)=>{let r=ut(e,Ne);H(n=>{let i=Ae(n,r,e);return t===null?i:vn(i,t,r)})&&(n!==null&&Ct(r,n),D(r),P(`step`))},K=u?jn:p.parseError===null?void 0:`The source pane holds text that is not a document.`,q=N(d.why,K),Qe=t?N(d.why,An):q,J=`Run — ${t?kn:z===null?n:ie(z)}`;(0,X.useEffect)(()=>he([...f&&!u?[{id:`pipeline:validate`,title:wn,group:J,screen:!0,icon:rt,keywords:[`check`,`dry run`,`plan`],run:()=>{A(`validate`)}},{id:`pipeline:apply`,title:En,group:J,screen:!0,icon:de,keywords:[`write`,`version`,`save`],run:()=>{A(`apply`)}}]:[],...t||!f||u?[]:[{id:`pipeline:run`,title:Tn,group:J,screen:!0,icon:me,keywords:[`start`,`adhoc`],run:()=>{A(`run`)}}],...u?[]:[{id:`pipeline:add-step`,title:`Add step`,group:J,screen:!0,icon:pe,keywords:[`block`,`new`,`insert`],run:pt}],{id:`pipeline:relayout`,title:`Re-layout the graph`,group:J,screen:!0,icon:nt,keywords:[`tidy`,`arrange`,`elk`],run:ht}]),[t,f,J,u]);let et=(0,X.useMemo)(()=>I===null&&z===null?[]:[{id:`step`,label:Ee(E),render:()=>E===null||I===null?(0,Z.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`No step chosen.`}):(0,Z.jsx)(_n,{step:E,document:I,block:Me.block,blockProblem:Me.problem,disabled:K,onConfig:e=>{H(t=>Ve(t,E,e))},onDependsOn:e=>{H(t=>Oe(t,E,e))},onName:e=>{H(t=>Te(t,E,e))}},E)},...z===null?[]:[{id:`pipeline`,label:`Pipeline`,render:()=>(0,Z.jsx)(qe,{pipeline:z,document:I,versions:v,connections:b,runs:x,unmet:U})}],{id:`report`,label:`Report`,render:()=>(0,Z.jsx)(zt,{document:I,disabled:K,onChange:(e,t)=>{H(n=>e===`none`?Be(n):De(n,e===`own`?t:null))}})},{id:`source`,label:`Source`,render:()=>(0,Z.jsx)(rn,{document:I,schema:oe,parseError:p.parseError,readOnly:u,onWrite:ke})}],[b,K,I,z,x,oe,E,u,p.parseError,Me,U,v]);if((0,X.useEffect)(()=>_e(et,{screen:`editor:${n}`,open:t&&i!==void 0?`source`:`step`}),[et,n,t,i]),!t&&z===null)return(0,Z.jsx)(h,{loading:Ce===null,problem:Ce,empty:!1,children:null});let Y=z===null?null:ae(z);return(0,Z.jsxs)(`div`,{className:`-mx-1 -my-3 flex min-h-0 flex-1 flex-col gap-3 md:-mx-5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-x-2 md:gap-x-3`,children:[(0,Z.jsx)(tt,{trail:[{label:`Pipelines`,to:`/pipelines`},Y===null?{label:kn}:{label:Y.title,mono:!Y.named}],code:Y?.code}),(0,Z.jsx)(`span`,{className:`hidden shrink-0 rounded-sm border border-border px-1.5 py-0.5 font-mono text-xs md:inline-block`,title:z===null||z.current_version===null?`No version of this pipeline has been applied.`:`Version ${String(z.current_version)} of this pipeline, counting the applies that changed it.`,children:z===null||z.current_version===null?`no version`:`v${String(z.current_version)}`}),(0,Z.jsx)(`div`,{className:`flex-1`}),u&&(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:jn}),(0,Z.jsx)(m,{actions:u?[]:[{id:`validate`,label:`Validate`,icon:rt,disabled:q!==void 0,why:q,onClick:()=>{A(`validate`)}},{id:`run`,label:`Run`,icon:me,disabled:Qe!==void 0,why:Qe,onClick:()=>{A(`run`)}},{id:`apply`,label:`Apply`,icon:de,variant:We(R,t),disabled:q!==void 0,why:q,onClick:()=>{A(`apply`)}}]})]}),(0,Z.jsxs)(`div`,{className:`relative min-h-96 flex-1 overflow-hidden rounded-md border border-border-strong bg-background`,children:[Ne.length===0&&I!==null&&(0,Z.jsx)(`p`,{className:`pointer-events-none absolute top-4 left-4 z-10 text-sm text-muted-foreground`,children:`No steps.`}),I===null?(0,Z.jsx)(`div`,{className:`flex flex-col items-start gap-3 p-4`,children:(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No version to draw.`})}):(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(h,{loading:!0,problem:null,empty:!1,children:null}),children:(0,Z.jsx)(Cn,{pipeline:n,document:I,blocks:T,edits:be,unmet:U,selected:E,onSelect:e=>{D(e),e!==null&&P(`step`)},onAddStep:e=>{Ze(e,null,null)},onConnect:Ye,onDisconnect:Xe,onAddStepAfter:(e,t,n)=>{Ze(t,e,n)},onRemoveStep:G,readOnly:u})})]}),I!==null&&(0,Z.jsx)(Nt,{open:k===`apply`||k===`validate`,mode:k===`validate`?`validate`:`apply`,document:I,onOpenChange:e=>{e||A(`none`)},onPlan:e=>{F(kt(e.issues))},onApplied:e=>{if(F(kt(e.plan.issues)),M.success(e.version===null?`${e.plan.code} was left as it was`:`${e.plan.code} is at version ${String(e.version)}`),t){r(`/pipelines/${encodeURIComponent(e.plan.code)}`);return}le(n).then(e=>{_({of:n,detail:e,problem:null}),Le(n,e.document)},()=>{}),ue(n,On).then(e=>{y(e.items)},()=>{})}}),z!==null&&(0,Z.jsx)(Qt,{open:k===`run`,pipeline:z,document:p.applied,username:l.identity?.username??null,warnings:W,onOpenChange:e=>{e||A(`none`)},onStarted:e=>{if(e.run_id===null){M.warning(e.detail??`nothing started: ${e.status}`);return}r(`/runs/${e.run_id}`)}})]})}export{Mn as PipelineEditor,bt as a,mt as c,St as i,st as l,Q as n,Tt as o,xt as r,ft as s,wt as t,ct as u};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-BatatxyT.js";import{i as n}from"./store-CVrCnru0.js";import{c as r,i,l as a,r as o,s,t as c,u as l}from"./dropdown-menu-B9iU0HGD.js";import{a as u,c as d,i as f,l as p,n as m,r as h,s as g,t as _}from"./StepPorts-CtcvnIvJ.js";import{r as v,t as y}from"./utils-CRMSf51M.js";import{t as b}from"./input-7d4ZlAGD.js";import{t as x}from"./use-store-CgWwefFs.js";import{a as S}from"./status-Ctx8x8Mf.js";import{Lt as C}from"./index-CeUoyQJy.js";import{t as w}from"./KindChip-CuBFi3X9.js";import{S as T,b as E,f as D,m as O,r as k,s as A,y as j}from"./PipelineTab-B_LAnOAD.js";import{a as ee,c as te,i as M,l as N,n as P,o as F,r as I,s as L,t as R,u as z}from"./PipelineEditor-6pcE1OrR.js";var B=n(`layers-2`,[[`path`,{d:`M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74z`,key:`15q6uc`}],[`path`,{d:`m20 14.285 1.5.845a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74l1.5-.845`,key:`byia6g`}]]),V=e(t(),1),H=v(),U=`Add step`,W=`Search blocks by id, summary or kind`;function G({blocks:e,onChoose:t}){let[n,r]=(0,V.useState)(!1);return(0,H.jsxs)(c,{open:n,onOpenChange:r,children:[(0,H.jsx)(l,{render:(0,H.jsx)(g,{title:U,"aria-label":U,children:(0,H.jsx)(C,{})})}),n&&(0,H.jsx)(q,{blocks:e,after:null,onChoose:t,onClose:()=>{r(!1)}})]})}function K({blocks:e,at:t,after:n=null,onChoose:r,onClose:i}){return(0,H.jsxs)(c,{open:!0,onOpenChange:e=>{e||i()},children:[(0,H.jsx)(l,{"aria-label":U,tabIndex:-1,className:`pointer-events-none fixed size-0`,style:{left:t.x,top:t.y}}),(0,H.jsx)(q,{blocks:e,after:n,onChoose:r,onClose:i})]})}function q({blocks:e,after:t,onChoose:n,onClose:i}){let[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(0),f=(0,V.useRef)(null),p=(0,V.useMemo)(()=>N(e),[e]),m=(0,V.useMemo)(()=>z(e,c),[e,c]),h=c.trim()!==``;(0,V.useEffect)(()=>{let e=requestAnimationFrame(()=>{f.current?.focus()});return()=>{cancelAnimationFrame(e)}},[]);let g=e=>{n(e),i()};return(0,H.jsxs)(o,{className:`w-80 p-0`,align:`start`,children:[(0,H.jsxs)(`div`,{className:`sticky top-0 z-10 flex flex-col gap-1.5 bg-popover p-2`,children:[(0,H.jsx)(`p`,{className:`text-xs font-semibold tracking-wide text-faint uppercase`,children:t===null?U:`${U} after ${t}`}),(0,H.jsx)(b,{ref:f,value:c,autoFocus:!0,spellCheck:!1,placeholder:`Search`,"aria-label":W,onKeyDown:e=>{if(e.key!==`Tab`){if(e.key===`Escape`){if(c===``)return;l(``),d(0),e.preventDefault(),e.stopPropagation();return}if(c===``){e.key!==`ArrowDown`&&e.key!==`ArrowUp`&&e.stopPropagation();return}if(e.stopPropagation(),e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),m.length===0)return;let t=e.key===`ArrowDown`?1:m.length-1;d(e=>(e+t)%m.length);return}if(e.key===`Enter`){e.preventDefault();let t=m[u];t!==void 0&&g(t.entry.id)}}},onChange:e=>{l(e.target.value),d(0)}})]}),(0,H.jsx)(`div`,{className:`p-1 pt-0`,children:h?(0,H.jsx)(J,{found:m,active:u,onChoose:g}):p.map(e=>(0,H.jsx)(V.Fragment,{children:(0,H.jsxs)(s,{children:[(0,H.jsx)(a,{className:`font-mono`,children:e.shelf}),(0,H.jsx)(r,{className:`w-72`,children:e.blocks.map(e=>(0,H.jsx)(Y,{entry:e,onChoose:g,children:(0,H.jsx)(`span`,{className:`font-mono text-sm font-semibold`,children:e.id})},e.id))})]})},e.shelf))})]})}function J({found:e,active:t,onChoose:n}){return e.length===0?(0,H.jsx)(`p`,{className:`px-1.5 py-2 text-sm text-muted-foreground`,children:`No block matches that.`}):(0,H.jsx)(H.Fragment,{children:e.map((e,r)=>(0,H.jsx)(Y,{entry:e.entry,active:r===t,onChoose:n,children:(0,H.jsxs)(`span`,{className:`font-mono text-sm`,children:[(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:e.family}),(0,H.jsx)(`span`,{className:`text-faint`,children:` ▸ `}),(0,H.jsx)(`span`,{className:`font-semibold`,children:e.rest})]})},e.entry.id))})}function Y({entry:e,active:t=!1,onChoose:n,children:r}){return(0,H.jsxs)(i,{className:y(`flex-col items-start gap-0.5`,t&&`bg-accent text-accent-foreground`),"data-active":t||void 0,onClick:()=>{n(e.id)},children:[(0,H.jsxs)(`span`,{className:`flex w-full items-center gap-2`,children:[r,e.kind===`sensor`&&(0,H.jsx)(w,{kind:e.kind,className:`ml-auto`})]}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.summary})]})}function X({data:e,selected:t}){let n=S(`pending`);return(0,H.jsxs)(`div`,{className:`step-node`,style:n,"data-document":`true`,"data-selected":t===!0,"data-editable":e.editable,children:[(0,H.jsx)(_,{editable:e.editable}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{"data-testid":`step-title`,className:y(`truncate text-sm`,!e.named&&`font-mono`,t===!0?`font-bold text-foreground`:`font-semibold`),children:e.title}),e.missing&&(0,H.jsx)(`span`,{className:`ml-auto shrink-0 rounded-sm border border-critical px-1 text-xs text-critical`,title:`${e.block} is not installed on this instance, so this step will fail`,children:`not installed`}),e.edited&&!e.missing&&(0,H.jsx)(`span`,{className:`ml-auto shrink-0 rounded-sm border border-primary px-1 text-xs text-primary`,children:`edited`})]}),(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{"data-testid":`step-line`,className:`truncate font-mono text-xs text-muted-foreground`,children:e.code===null?e.block:`${e.code} · ${e.block}`}),e.fanOut&&(0,H.jsxs)(`span`,{"data-testid":`step-fan-out`,className:`ml-auto flex shrink-0 items-center gap-1 font-mono text-xs text-faint`,title:e.fanOutItems===null?`for_each: runs once per item of the list it is given`:`for_each: runs once per item, ${String(e.fanOutItems)} of them`,children:[(0,H.jsx)(B,{className:`size-3`,"aria-hidden":!0}),e.fanOutItems===null?`each`:`×${String(e.fanOutItems)}`]})]})]})}var ne={step:X},Z=`Add step after`,Q=`Delete step`,re={};function $(e){return(0,H.jsx)(d,{children:(0,H.jsx)(ie,{...e})})}function ie({pipeline:e,document:t,blocks:n,edits:r,unmet:i,selected:a,onSelect:o,onAddStep:s,onConnect:c,onDisconnect:l,onAddStepAfter:d,onRemoveStep:g,readOnly:_=!1}){let v=p(),y=x(P),[b,S]=(0,V.useState)(null),[C,w]=(0,V.useState)(null),[N,z]=(0,V.useState)(null),[B,U]=(0,V.useState)(null);(0,V.useEffect)(()=>{ee(e)},[e]);let W=x(L);(0,V.useEffect)(()=>{if(W===0)return;let e=globalThis.document.querySelector(`[data-canvas-host]`);if(e===null)return;let t=e.getBoundingClientRect();w({x:t.x+t.width/2,y:t.y+t.height/3})},[W]);let q=x(te);(0,V.useEffect)(()=>{q!==0&&(R(),f(v))},[q,v]);let J=(0,V.useMemo)(()=>({nodes:T(t).map(e=>({id:e,height:54})),edges:D(t)}),[t]),Y=m(J),X=y.pipeline===e?y.placements:re,Z=(0,V.useMemo)(()=>Y===null?[]:F(Y.nodes,X).map(e=>{let n=O(t,e.id);return{id:e.id,type:`step`,position:{x:e.x,y:e.y},width:e.width,height:e.height,measured:u(e),selected:e.id===a,data:{...E(t,e.id),block:A(t,e.id)??`no block`,edited:j(r,e.id),missing:k(i,e.id),fanOut:n.fanOut,fanOutItems:n.items,editable:!0}}}),[t,r,Y,X,a,i]),Q=(0,V.useMemo)(()=>Y===null?[]:Y.edges.map(e=>({id:e.id,source:e.source,target:e.target,selected:e.id===b})),[b,Y]),$=(0,V.useMemo)(()=>({onConnect:c,onDisconnect:l,onChooseEdge:e=>{S(e),e!==null&&o(null)},onMove:(e,t)=>{I(e,t)},onMoveEnd:M,onDropped:(e,t)=>{z({from:e,at:v.screenToFlowPosition({x:t.clientX,y:t.clientY}),over:{x:t.clientX,y:t.clientY}})},onRemove:g,onNodeMenu:(e,t)=>{w(null),z(null),U({step:e,over:{x:t.clientX,y:t.clientY}})}}),[v,c,l,g,o]);return(0,H.jsxs)(`div`,{className:`absolute inset-0`,"data-canvas-host":!0,onContextMenu:e=>{_||e.target instanceof Element&&e.target.closest(`.react-flow__node`)!==null||(e.preventDefault(),z(null),U(null),w({x:e.clientX,y:e.clientY}))},children:[(0,H.jsx)(h,{nodes:Z,edges:Q,nodeTypes:ne,editing:_?void 0:$,onSelect:e=>{S(null),o(e)},control:_?void 0:(0,H.jsx)(G,{blocks:n,onChoose:s})}),C!==null&&(0,H.jsx)(K,{blocks:n,at:C,onChoose:s,onClose:()=>{w(null)}}),B!==null&&(0,H.jsx)(ae,{step:B.step,at:B.over,onAddAfter:()=>{let e=v.getNode(B.step);U(null),e!==void 0&&z({from:B.step,at:{x:e.position.x+200+44,y:e.position.y},over:B.over})},onRemove:()=>{U(null),g(B.step)},onClose:()=>{U(null)}}),N!==null&&(0,H.jsx)(K,{blocks:n,at:N.over,after:N.from,onChoose:e=>{d(N.from,e,N.at)},onClose:()=>{z(null)}})]})}function ae({step:e,at:t,onAddAfter:n,onRemove:r,onClose:a}){return(0,H.jsxs)(c,{open:!0,onOpenChange:e=>{e||a()},children:[(0,H.jsx)(l,{"aria-label":e,tabIndex:-1,className:`pointer-events-none fixed size-0`,style:{left:t.x,top:t.y}}),(0,H.jsxs)(o,{align:`start`,className:`w-56`,children:[(0,H.jsx)(`p`,{className:`truncate px-2 py-1.5 font-mono text-xs text-faint`,children:e}),(0,H.jsx)(i,{onClick:n,children:Z}),(0,H.jsx)(i,{className:`destructive-action`,onClick:r,children:Q})]})]})}export{$ as PipelineGraph};
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-BatatxyT.js";import{i as n}from"./store-CVrCnru0.js";import{c as r,i,l as a,r as o,s,t as c,u as l}from"./dropdown-menu-B9iU0HGD.js";import{a as u,c as d,i as f,l as p,n as m,r as h,s as g,t as _}from"./StepPorts-CtcvnIvJ.js";import{r as v,t as y}from"./utils-CRMSf51M.js";import{t as b}from"./input-7d4ZlAGD.js";import{t as x}from"./use-store-CgWwefFs.js";import{a as S}from"./status-Ctx8x8Mf.js";import{Lt as C}from"./index-DaM0mXP1.js";import{t as w}from"./KindChip-CuBFi3X9.js";import{S as T,b as E,f as D,m as O,r as k,s as A,y as j}from"./PipelineTab-ePfoBa3H.js";import{a as ee,c as te,i as M,l as N,n as P,o as F,r as I,s as L,t as R,u as z}from"./PipelineEditor-DDZwROr9.js";var B=n(`layers-2`,[[`path`,{d:`M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74z`,key:`15q6uc`}],[`path`,{d:`m20 14.285 1.5.845a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74l1.5-.845`,key:`byia6g`}]]),V=e(t(),1),H=v(),U=`Add step`,W=`Search blocks by id, summary or kind`;function G({blocks:e,onChoose:t}){let[n,r]=(0,V.useState)(!1);return(0,H.jsxs)(c,{open:n,onOpenChange:r,children:[(0,H.jsx)(l,{render:(0,H.jsx)(g,{title:U,"aria-label":U,children:(0,H.jsx)(C,{})})}),n&&(0,H.jsx)(q,{blocks:e,after:null,onChoose:t,onClose:()=>{r(!1)}})]})}function K({blocks:e,at:t,after:n=null,onChoose:r,onClose:i}){return(0,H.jsxs)(c,{open:!0,onOpenChange:e=>{e||i()},children:[(0,H.jsx)(l,{"aria-label":U,tabIndex:-1,className:`pointer-events-none fixed size-0`,style:{left:t.x,top:t.y}}),(0,H.jsx)(q,{blocks:e,after:n,onChoose:r,onClose:i})]})}function q({blocks:e,after:t,onChoose:n,onClose:i}){let[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(0),f=(0,V.useRef)(null),p=(0,V.useMemo)(()=>N(e),[e]),m=(0,V.useMemo)(()=>z(e,c),[e,c]),h=c.trim()!==``;(0,V.useEffect)(()=>{let e=requestAnimationFrame(()=>{f.current?.focus()});return()=>{cancelAnimationFrame(e)}},[]);let g=e=>{n(e),i()};return(0,H.jsxs)(o,{className:`w-80 p-0`,align:`start`,children:[(0,H.jsxs)(`div`,{className:`sticky top-0 z-10 flex flex-col gap-1.5 bg-popover p-2`,children:[(0,H.jsx)(`p`,{className:`text-xs font-semibold tracking-wide text-faint uppercase`,children:t===null?U:`${U} after ${t}`}),(0,H.jsx)(b,{ref:f,value:c,autoFocus:!0,spellCheck:!1,placeholder:`Search`,"aria-label":W,onKeyDown:e=>{if(e.key!==`Tab`){if(e.key===`Escape`){if(c===``)return;l(``),d(0),e.preventDefault(),e.stopPropagation();return}if(c===``){e.key!==`ArrowDown`&&e.key!==`ArrowUp`&&e.stopPropagation();return}if(e.stopPropagation(),e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),m.length===0)return;let t=e.key===`ArrowDown`?1:m.length-1;d(e=>(e+t)%m.length);return}if(e.key===`Enter`){e.preventDefault();let t=m[u];t!==void 0&&g(t.entry.id)}}},onChange:e=>{l(e.target.value),d(0)}})]}),(0,H.jsx)(`div`,{className:`p-1 pt-0`,children:h?(0,H.jsx)(J,{found:m,active:u,onChoose:g}):p.map(e=>(0,H.jsx)(V.Fragment,{children:(0,H.jsxs)(s,{children:[(0,H.jsx)(a,{className:`font-mono`,children:e.shelf}),(0,H.jsx)(r,{className:`w-72`,children:e.blocks.map(e=>(0,H.jsx)(Y,{entry:e,onChoose:g,children:(0,H.jsx)(`span`,{className:`font-mono text-sm font-semibold`,children:e.id})},e.id))})]})},e.shelf))})]})}function J({found:e,active:t,onChoose:n}){return e.length===0?(0,H.jsx)(`p`,{className:`px-1.5 py-2 text-sm text-muted-foreground`,children:`No block matches that.`}):(0,H.jsx)(H.Fragment,{children:e.map((e,r)=>(0,H.jsx)(Y,{entry:e.entry,active:r===t,onChoose:n,children:(0,H.jsxs)(`span`,{className:`font-mono text-sm`,children:[(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:e.family}),(0,H.jsx)(`span`,{className:`text-faint`,children:` ▸ `}),(0,H.jsx)(`span`,{className:`font-semibold`,children:e.rest})]})},e.entry.id))})}function Y({entry:e,active:t=!1,onChoose:n,children:r}){return(0,H.jsxs)(i,{className:y(`flex-col items-start gap-0.5`,t&&`bg-accent text-accent-foreground`),"data-active":t||void 0,onClick:()=>{n(e.id)},children:[(0,H.jsxs)(`span`,{className:`flex w-full items-center gap-2`,children:[r,e.kind===`sensor`&&(0,H.jsx)(w,{kind:e.kind,className:`ml-auto`})]}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.summary})]})}function X({data:e,selected:t}){let n=S(`pending`);return(0,H.jsxs)(`div`,{className:`step-node`,style:n,"data-document":`true`,"data-selected":t===!0,"data-editable":e.editable,children:[(0,H.jsx)(_,{editable:e.editable}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{"data-testid":`step-title`,className:y(`truncate text-sm`,!e.named&&`font-mono`,t===!0?`font-bold text-foreground`:`font-semibold`),children:e.title}),e.missing&&(0,H.jsx)(`span`,{className:`ml-auto shrink-0 rounded-sm border border-critical px-1 text-xs text-critical`,title:`${e.block} is not installed on this instance, so this step will fail`,children:`not installed`}),e.edited&&!e.missing&&(0,H.jsx)(`span`,{className:`ml-auto shrink-0 rounded-sm border border-primary px-1 text-xs text-primary`,children:`edited`})]}),(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{"data-testid":`step-line`,className:`truncate font-mono text-xs text-muted-foreground`,children:e.code===null?e.block:`${e.code} · ${e.block}`}),e.fanOut&&(0,H.jsxs)(`span`,{"data-testid":`step-fan-out`,className:`ml-auto flex shrink-0 items-center gap-1 font-mono text-xs text-faint`,title:e.fanOutItems===null?`for_each: runs once per item of the list it is given`:`for_each: runs once per item, ${String(e.fanOutItems)} of them`,children:[(0,H.jsx)(B,{className:`size-3`,"aria-hidden":!0}),e.fanOutItems===null?`each`:`×${String(e.fanOutItems)}`]})]})]})}var ne={step:X},Z=`Add step after`,Q=`Delete step`,re={};function $(e){return(0,H.jsx)(d,{children:(0,H.jsx)(ie,{...e})})}function ie({pipeline:e,document:t,blocks:n,edits:r,unmet:i,selected:a,onSelect:o,onAddStep:s,onConnect:c,onDisconnect:l,onAddStepAfter:d,onRemoveStep:g,readOnly:_=!1}){let v=p(),y=x(P),[b,S]=(0,V.useState)(null),[C,w]=(0,V.useState)(null),[N,z]=(0,V.useState)(null),[B,U]=(0,V.useState)(null);(0,V.useEffect)(()=>{ee(e)},[e]);let W=x(L);(0,V.useEffect)(()=>{if(W===0)return;let e=globalThis.document.querySelector(`[data-canvas-host]`);if(e===null)return;let t=e.getBoundingClientRect();w({x:t.x+t.width/2,y:t.y+t.height/3})},[W]);let q=x(te);(0,V.useEffect)(()=>{q!==0&&(R(),f(v))},[q,v]);let J=(0,V.useMemo)(()=>({nodes:T(t).map(e=>({id:e,height:54})),edges:D(t)}),[t]),Y=m(J),X=y.pipeline===e?y.placements:re,Z=(0,V.useMemo)(()=>Y===null?[]:F(Y.nodes,X).map(e=>{let n=O(t,e.id);return{id:e.id,type:`step`,position:{x:e.x,y:e.y},width:e.width,height:e.height,measured:u(e),selected:e.id===a,data:{...E(t,e.id),block:A(t,e.id)??`no block`,edited:j(r,e.id),missing:k(i,e.id),fanOut:n.fanOut,fanOutItems:n.items,editable:!0}}}),[t,r,Y,X,a,i]),Q=(0,V.useMemo)(()=>Y===null?[]:Y.edges.map(e=>({id:e.id,source:e.source,target:e.target,selected:e.id===b})),[b,Y]),$=(0,V.useMemo)(()=>({onConnect:c,onDisconnect:l,onChooseEdge:e=>{S(e),e!==null&&o(null)},onMove:(e,t)=>{I(e,t)},onMoveEnd:M,onDropped:(e,t)=>{z({from:e,at:v.screenToFlowPosition({x:t.clientX,y:t.clientY}),over:{x:t.clientX,y:t.clientY}})},onRemove:g,onNodeMenu:(e,t)=>{w(null),z(null),U({step:e,over:{x:t.clientX,y:t.clientY}})}}),[v,c,l,g,o]);return(0,H.jsxs)(`div`,{className:`absolute inset-0`,"data-canvas-host":!0,onContextMenu:e=>{_||e.target instanceof Element&&e.target.closest(`.react-flow__node`)!==null||(e.preventDefault(),z(null),U(null),w({x:e.clientX,y:e.clientY}))},children:[(0,H.jsx)(h,{nodes:Z,edges:Q,nodeTypes:ne,editing:_?void 0:$,onSelect:e=>{S(null),o(e)},control:_?void 0:(0,H.jsx)(G,{blocks:n,onChoose:s})}),C!==null&&(0,H.jsx)(K,{blocks:n,at:C,onChoose:s,onClose:()=>{w(null)}}),B!==null&&(0,H.jsx)(ae,{step:B.step,at:B.over,onAddAfter:()=>{let e=v.getNode(B.step);U(null),e!==void 0&&z({from:B.step,at:{x:e.position.x+200+44,y:e.position.y},over:B.over})},onRemove:()=>{U(null),g(B.step)},onClose:()=>{U(null)}}),N!==null&&(0,H.jsx)(K,{blocks:n,at:N.over,after:N.from,onChoose:e=>{d(N.from,e,N.at)},onClose:()=>{z(null)}})]})}function ae({step:e,at:t,onAddAfter:n,onRemove:r,onClose:a}){return(0,H.jsxs)(c,{open:!0,onOpenChange:e=>{e||a()},children:[(0,H.jsx)(l,{"aria-label":e,tabIndex:-1,className:`pointer-events-none fixed size-0`,style:{left:t.x,top:t.y}}),(0,H.jsxs)(o,{align:`start`,className:`w-56`,children:[(0,H.jsx)(`p`,{className:`truncate px-2 py-1.5 font-mono text-xs text-faint`,children:e}),(0,H.jsx)(i,{onClick:n,children:Z}),(0,H.jsx)(i,{className:`destructive-action`,onClick:r,children:Q})]})]})}export{$ as PipelineGraph};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-BatatxyT.js";import{n}from"./PageState-CTB50fRO.js";import{r}from"./utils-CRMSf51M.js";import{l as i,p as a}from"./pipelines-D_CSKLu-.js";import{_ as o,l as s,t as c}from"./index-CeUoyQJy.js";import{c as l}from"./blocks-CPJMNxIu.js";import{i as u,t as d}from"./PipelineTab-B_LAnOAD.js";import{l as f}from"./connections-BNOH5aGu.js";var p=e(t(),1),m=r(),h=5,g=3;function _({pipeline:e}){let t=e.code,r=o((0,p.useCallback)(()=>i(t),[t])),_=o((0,p.useCallback)(()=>a(t,h),[t])),v=o((0,p.useCallback)(()=>s({...c,pipeline:t},null,g),[t])),y=o(f),b=o(l),x=r.value?.document??null,S=(0,p.useMemo)(()=>{let e=b.value?.blocks??[];return e.length===0?null:e.map(e=>e.id)},[b.value]),C=(0,p.useMemo)(()=>y.value?.items.map(e=>e.code)??null,[y.value]),w=(0,p.useMemo)(()=>u(x,S,C),[x,C,S]),T=!r.read||!_.read||!v.read;return T||r.value===null?(0,m.jsx)(`div`,{className:`p-4`,children:(0,m.jsx)(n,{loading:T,problem:r.problem,empty:!1,children:null})}):(0,m.jsx)(d,{pipeline:r.value,document:x,versions:_.value?.items??[],connections:y.value?.items??null,runs:v.value?.items??[],unmet:w})}export{_ as PipelinePreview};
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-BatatxyT.js";import{n}from"./PageState-CTB50fRO.js";import{r}from"./utils-CRMSf51M.js";import{l as i,p as a}from"./pipelines-D_CSKLu-.js";import{_ as o,l as s,t as c}from"./index-DaM0mXP1.js";import{c as l}from"./blocks-CPJMNxIu.js";import{i as u,t as d}from"./PipelineTab-ePfoBa3H.js";import{l as f}from"./connections-CdL8xQGj.js";var p=e(t(),1),m=r(),h=5,g=3;function _({pipeline:e}){let t=e.code,r=o((0,p.useCallback)(()=>i(t),[t])),_=o((0,p.useCallback)(()=>a(t,h),[t])),v=o((0,p.useCallback)(()=>s({...c,pipeline:t},null,g),[t])),y=o(f),b=o(l),x=r.value?.document??null,S=(0,p.useMemo)(()=>{let e=b.value?.blocks??[];return e.length===0?null:e.map(e=>e.id)},[b.value]),C=(0,p.useMemo)(()=>y.value?.items.map(e=>e.code)??null,[y.value]),w=(0,p.useMemo)(()=>u(x,S,C),[x,C,S]),T=!r.read||!_.read||!v.read;return T||r.value===null?(0,m.jsx)(`div`,{className:`p-4`,children:(0,m.jsx)(n,{loading:T,problem:r.problem,empty:!1,children:null})}):(0,m.jsx)(d,{pipeline:r.value,document:x,versions:_.value?.items??[],connections:y.value?.items??null,runs:v.value?.items??[],unmet:w})}export{_ as PipelinePreview};
@@ -1,4 +1,4 @@
1
- import{t as e}from"./store-CVrCnru0.js";import{n as t}from"./chunk-BV7QT456-Bfa1dvOx.js";import{r as n}from"./utils-CRMSf51M.js";import{f as r}from"./format-CR2ze2LO.js";import{t as i}from"./identity-BNZxCf_y.js";import{C as a,x as o}from"./index-CeUoyQJy.js";import{t as s}from"./Description-DVFPKyRO.js";import{t as c}from"./Instant-C9TZFyg5.js";import{n as l,r as u}from"./Panel-Bk3CoJZ6.js";import{r as d}from"./schema-form-FkbdR3oI.js";var f=Symbol.for(`yaml.alias`),p=Symbol.for(`yaml.document`),m=Symbol.for(`yaml.map`),h=Symbol.for(`yaml.pair`),g=Symbol.for(`yaml.scalar`),_=Symbol.for(`yaml.seq`),v=Symbol.for(`yaml.node.type`),y=e=>!!e&&typeof e==`object`&&e[v]===f,b=e=>!!e&&typeof e==`object`&&e[v]===p,x=e=>!!e&&typeof e==`object`&&e[v]===m,S=e=>!!e&&typeof e==`object`&&e[v]===h,C=e=>!!e&&typeof e==`object`&&e[v]===g,ee=e=>!!e&&typeof e==`object`&&e[v]===_;function w(e){if(e&&typeof e==`object`)switch(e[v]){case m:case _:return!0}return!1}function T(e){if(e&&typeof e==`object`)switch(e[v]){case f:case m:case g:case _:return!0}return!1}var te=e=>(C(e)||w(e))&&!!e.anchor,E=Symbol(`break visit`),ne=Symbol(`skip children`),re=Symbol(`remove node`);function D(e,t){let n=ie(t);b(e)?O(null,e.contents,n,Object.freeze([e]))===re&&(e.contents=null):O(null,e,n,Object.freeze([]))}D.BREAK=E,D.SKIP=ne,D.REMOVE=re;function O(e,t,n,r){let i=ae(e,t,n,r);if(T(i)||S(i))return oe(e,r,i),O(e,i,n,r);if(typeof i!=`symbol`){if(w(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=O(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===E)return E;else i===re&&(t.items.splice(e,1),--e)}}else if(S(t)){r=Object.freeze(r.concat(t));let e=O(`key`,t.key,n,r);if(e===E)return E;e===re&&(t.key=null);let i=O(`value`,t.value,n,r);if(i===E)return E;i===re&&(t.value=null)}}return i}function ie(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function ae(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(x(t))return n.Map?.(e,t,r);if(ee(t))return n.Seq?.(e,t,r);if(S(t))return n.Pair?.(e,t,r);if(C(t))return n.Scalar?.(e,t,r);if(y(t))return n.Alias?.(e,t,r)}function oe(e,t,n){let r=t[t.length-1];if(w(r))r.items[e]=n;else if(S(r))e===`key`?r.key=n:r.value=n;else if(b(r))r.contents=n;else{let e=y(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var se={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},ce=e=>e.replace(/[!,[\]{}]/g,e=>se[e]),k=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+ce(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&T(e.contents)){let t={};D(e.contents,(e,n)=>{T(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)(i!==`!!`||a!==`tag:yaml.org,2002:`)&&(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
1
+ import{t as e}from"./store-CVrCnru0.js";import{n as t}from"./chunk-BV7QT456-Bfa1dvOx.js";import{r as n}from"./utils-CRMSf51M.js";import{f as r}from"./format-CR2ze2LO.js";import{t as i}from"./identity-BNZxCf_y.js";import{C as a,x as o}from"./index-DaM0mXP1.js";import{t as s}from"./Description-DVFPKyRO.js";import{t as c}from"./Instant-C9TZFyg5.js";import{n as l,r as u}from"./Panel-Bk3CoJZ6.js";import{r as d}from"./schema-form-dcZ8A0M1.js";var f=Symbol.for(`yaml.alias`),p=Symbol.for(`yaml.document`),m=Symbol.for(`yaml.map`),h=Symbol.for(`yaml.pair`),g=Symbol.for(`yaml.scalar`),_=Symbol.for(`yaml.seq`),v=Symbol.for(`yaml.node.type`),y=e=>!!e&&typeof e==`object`&&e[v]===f,b=e=>!!e&&typeof e==`object`&&e[v]===p,x=e=>!!e&&typeof e==`object`&&e[v]===m,S=e=>!!e&&typeof e==`object`&&e[v]===h,C=e=>!!e&&typeof e==`object`&&e[v]===g,ee=e=>!!e&&typeof e==`object`&&e[v]===_;function w(e){if(e&&typeof e==`object`)switch(e[v]){case m:case _:return!0}return!1}function T(e){if(e&&typeof e==`object`)switch(e[v]){case f:case m:case g:case _:return!0}return!1}var te=e=>(C(e)||w(e))&&!!e.anchor,E=Symbol(`break visit`),ne=Symbol(`skip children`),re=Symbol(`remove node`);function D(e,t){let n=ie(t);b(e)?O(null,e.contents,n,Object.freeze([e]))===re&&(e.contents=null):O(null,e,n,Object.freeze([]))}D.BREAK=E,D.SKIP=ne,D.REMOVE=re;function O(e,t,n,r){let i=ae(e,t,n,r);if(T(i)||S(i))return oe(e,r,i),O(e,i,n,r);if(typeof i!=`symbol`){if(w(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=O(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===E)return E;else i===re&&(t.items.splice(e,1),--e)}}else if(S(t)){r=Object.freeze(r.concat(t));let e=O(`key`,t.key,n,r);if(e===E)return E;e===re&&(t.key=null);let i=O(`value`,t.value,n,r);if(i===E)return E;i===re&&(t.value=null)}}return i}function ie(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function ae(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(x(t))return n.Map?.(e,t,r);if(ee(t))return n.Seq?.(e,t,r);if(S(t))return n.Pair?.(e,t,r);if(C(t))return n.Scalar?.(e,t,r);if(y(t))return n.Alias?.(e,t,r)}function oe(e,t,n){let r=t[t.length-1];if(w(r))r.items[e]=n;else if(S(r))e===`key`?r.key=n:r.value=n;else if(b(r))r.contents=n;else{let e=y(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var se={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},ce=e=>e.replace(/[!,[\]{}]/g,e=>se[e]),k=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+ce(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&T(e.contents)){let t={};D(e.contents,(e,n)=>{T(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)(i!==`!!`||a!==`tag:yaml.org,2002:`)&&(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
2
2
  `)}};k.defaultYaml={explicit:!1,version:`1.2`},k.defaultTags={"!!":`tag:yaml.org,2002:`};function le(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function ue(e){let t=new Set;return D(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function de(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function fe(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=ue(e);let a=de(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(C(t.node)||w(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function A(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=A(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=A(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=A(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=A(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function j(e,t,n){if(Array.isArray(e))return e.map((e,t)=>j(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!te(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var pe=class{constructor(e){Object.defineProperty(this,v,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!b(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=j(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?A(i,{"":o},``,o):o}},me=class extends pe{constructor(e){super(f),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],D(e,{Node:(e,t)=>{(y(t)||te(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(j(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=he(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(le(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function he(e,t,n){if(y(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(w(t)){let r=0;for(let i of t.items){let t=he(e,i,n);t>r&&(r=t)}return r}if(S(t)){let r=he(e,t.key,n),i=he(e,t.value,n);return Math.max(r,i)}return 1}var ge=e=>!e||typeof e!=`function`&&typeof e!=`object`,M=class extends pe{constructor(e){super(g),this.value=e}toJSON(e,t){return t?.keep?this.value:j(this.value,e,t)}toString(){return String(this.value)}};M.BLOCK_FOLDED=`BLOCK_FOLDED`,M.BLOCK_LITERAL=`BLOCK_LITERAL`,M.PLAIN=`PLAIN`,M.QUOTE_DOUBLE=`QUOTE_DOUBLE`,M.QUOTE_SINGLE=`QUOTE_SINGLE`;var _e=`tag:yaml.org,2002:`;function ve(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function ye(e,t,n){if(b(e)&&(e=e.contents),T(e))return e;if(S(e)){let t=n.schema[m].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new me(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=_e+t.slice(2));let l=ve(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new M(e);return c&&(c.node=t),t}l=e instanceof Map?o[m]:Symbol.iterator in Object(e)?o[_]:o[m]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new M(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function be(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return ye(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var xe=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,Se=class extends pe{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>T(t)||S(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(xe(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(w(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,be(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(w(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&C(i)?i.value:i:w(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!S(t))return!1;let n=t.value;return n==null||e&&C(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return w(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(w(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,be(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},Ce=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function N(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var P=(e,t,n)=>e.endsWith(`
3
3
  `)?N(n,t):n.includes(`
4
4
  `)?`
@@ -0,0 +1 @@
1
+ import{r as e}from"./utils-CRMSf51M.js";import{O as t}from"./index-DaM0mXP1.js";var n=e(),r={"application/jq":{title:`jq`,groups:[{title:`Paths`,entries:[{form:`.a.b`,says:`a field of a field`},{form:`.[0] .[-1]`,says:`first and last of a list`},{form:`.[]`,says:`each element in turn`},{form:`.a?`,says:`null instead of an error when it is not there`},{form:`.. | .id?`,says:`every id, anywhere in the value`}]},{title:`Shape`,entries:[{form:`{code: .id, name}`,says:`an object from picked fields`},{form:`[.[] | .value]`,says:`a list from each element`},{form:`. + {seen: true}`,says:`an object with one more field`},{form:`to_entries from_entries`,says:`an object as {key, value} pairs and back`}]},{title:`Filter and reduce`,entries:[{form:`map(f) select(cond)`,says:`apply to each; keep the ones that match`},{form:`add length min max`,says:`sum, count, extremes`},{form:`group_by(.k) sort_by(.k)`,says:`lists by a key`},{form:`unique_by(.k) min_by(.k)`,says:`one per key; the smallest by key`},{form:`reduce .[] as $x (0; . + $x)`,says:`a fold, with the state as .`}]},{title:`Strings and dates`,entries:[{form:`ascii_downcase ltrimstr("x")`,says:`case and trimming`},{form:`split(",") join(",")`,says:`a string as a list and back`},{form:`tostring tonumber`,says:`across the string boundary`},{form:`@csv @tsv @base64`,says:`a list encoded for another program`},{form:`now | todate`,says:`the moment as ISO 8601`},{form:`strptime("%Y-%m-%d") | mktime`,says:`a date string as seconds`}]},{title:`Missing values`,entries:[{form:`.a // "default"`,says:`the right side when the left is null or false`},{form:`has("a") in(.)`,says:`whether a key is there`},{form:`if . == null then empty else . end`,says:`drop a null from a stream`}]},{title:`In this runtime`,entries:[{form:`. as $rows | ...`,says:`the input, bound for the rest of the program`},{form:`env $ENV`,says:`an empty object here: the worker keeps its environment`},{form:`input inputs`,says:`not available: the whole input is .`}]}],manual:{label:`The jq manual`,href:`https://jqlang.org/manual/`}},"application/sql":{title:`SQL`,groups:[{title:`In this runtime`,entries:[{form:`select ... where day = :day`,says:`a value bound by name from params, never interpolated`},{form:`one statement`,says:`sql.query runs one; sql.execute runs several as one transaction`},{form:`max_rows`,says:`the cap on what the output carries`}]}],manual:null},"text/x-shellscript":{title:`shell`,groups:[{title:`In this runtime`,entries:[{form:`argv: [cmd, arg]`,says:`no shell: each argument as written`},{form:`command: "a | b"`,says:`/bin/sh -c, for a pipe or a redirect`},{form:`env env_allowlist`,says:`variables set here, and the worker variables let through`},{form:`cwd`,says:`relative to the run’s work directory, never absolute`}]}],manual:null},"text/x-jinja":{title:`Jinja`,groups:[{title:`The facts`,entries:[{form:`run.status run.params.x`,says:`the run and what it was started with`},{form:`pipeline.name pipeline.code`,says:`what ran`},{form:`step.name.output.value`,says:`one step by name, its last output`},{form:`steps items items_failed`,says:`every step in order; the fan-out items`},{form:`rendered_at url`,says:`when this page was written, and the run’s address`}]},{title:`Filters`,entries:[{form:`{{ s.duration_ms | duration }}`,says:`1s34ms`},{form:`{{ s.output_bytes | bytes }}`,says:`1.2KB`},{form:`{{ run.started_at | iso }}`,says:`ISO 8601`},{form:`{{ x | round(1) }} {{ xs | join(", ") }}`,says:`Jinja’s own`}]},{title:`Control`,entries:[{form:`{% for name, s in step.items() %}`,says:`a table row per step`},{form:`{% if step.keep.output %}`,says:`a section only when a step ran`},{form:`{{ missing }}`,says:`renders as nothing, never an error`}]}],manual:{label:`What a template may read`,href:t}}};function i(e){return e==null?null:r[e]??null}function a({mediaType:e}){let t=i(e);return t===null?null:(0,n.jsxs)(`div`,{className:`flex flex-col gap-4 text-sm`,children:[(0,n.jsxs)(`p`,{className:`text-xs tracking-wide text-muted-foreground uppercase`,children:[t.title,` reference`]}),t.groups.map(e=>(0,n.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[(0,n.jsx)(`h3`,{className:`text-xs font-medium text-foreground`,children:e.title}),(0,n.jsx)(`dl`,{className:`flex flex-col gap-1.5`,children:e.entries.map(e=>(0,n.jsxs)(`div`,{className:`flex flex-col`,children:[(0,n.jsx)(`dt`,{className:`font-mono text-xs text-foreground`,children:e.form}),(0,n.jsx)(`dd`,{className:`text-xs text-muted-foreground`,children:e.says})]},e.form))})]},e.title)),t.manual!==null&&(0,n.jsx)(`a`,{href:t.manual.href,target:`_blank`,rel:`noopener`,className:`text-xs text-primary-ink underline-offset-2 hover:underline`,children:t.manual.label})]})}export{a as t};
@@ -1 +1 @@
1
- import{r as e}from"./utils-CRMSf51M.js";import{d as t,l as n,u as r}from"./paging-CZR9Tg8m.js";import{Vt as i}from"./index-CeUoyQJy.js";var a=e();function o({problem:e}){let t=r(e);return(0,a.jsxs)(`div`,{className:`space-y-1 rounded-md border border-critical/40 p-2`,role:`alert`,children:[t.detail!==null&&(0,a.jsx)(`p`,{className:`text-sm break-words text-critical`,children:t.detail}),t.problems.length>0&&(0,a.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-4 text-xs text-critical`,children:t.problems.map(e=>(0,a.jsx)(`li`,{className:`font-mono break-all`,children:e},e))})]})}function s(e){i.error(n(t(e)))}export{s as n,o as t};
1
+ import{r as e}from"./utils-CRMSf51M.js";import{d as t,l as n,u as r}from"./paging-CZR9Tg8m.js";import{Vt as i}from"./index-DaM0mXP1.js";var a=e();function o({problem:e}){let t=r(e);return(0,a.jsxs)(`div`,{className:`space-y-1 rounded-md border border-critical/40 p-2`,role:`alert`,children:[t.detail!==null&&(0,a.jsx)(`p`,{className:`text-sm break-words text-critical`,children:t.detail}),t.problems.length>0&&(0,a.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-4 text-xs text-critical`,children:t.problems.map(e=>(0,a.jsx)(`li`,{className:`font-mono break-all`,children:e},e))})]})}function s(e){i.error(n(t(e)))}export{s as n,o as t};