@protobase/ui 0.120.0 → 0.121.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/dist/account/messages.d.ts +2 -2
  2. package/dist/app/charts/messages.d.ts +2 -2
  3. package/dist/app/comments/messages.d.ts +2 -2
  4. package/dist/app/conversation/thread-state.d.ts +1 -1
  5. package/dist/app/create/messages.d.ts +2 -2
  6. package/dist/app/custom-section.d.ts +1 -1
  7. package/dist/app/delete/messages.d.ts +2 -2
  8. package/dist/app/displays/list-cards.d.ts +1 -1
  9. package/dist/app/displays/messages.d.ts +2 -2
  10. package/dist/app/embedded-list/messages.d.ts +2 -2
  11. package/dist/app/export/messages.d.ts +2 -2
  12. package/dist/app/field-types/runner-install/messages.d.ts +2 -2
  13. package/dist/app/field-types/widget-part.d.ts +1 -1
  14. package/dist/app/field-types/workflow/cache-field.js +1 -1
  15. package/dist/app/field-types/workflow/definition.d.ts +1 -1
  16. package/dist/app/field-types/workflow/flow-elements.js +2 -2
  17. package/dist/app/field-types/workflow/flow-nodes.js +2 -2
  18. package/dist/app/field-types/workflow/messages.d.ts +2 -2
  19. package/dist/app/field-types/workflow/node-panel.js +2 -2
  20. package/dist/app/field-types/workflow/pins/data-edits.js +1 -1
  21. package/dist/app/field-types/workflow/pins/pin-text.js +1 -1
  22. package/dist/app/field-types/workflow/task-fields.js +2 -2
  23. package/dist/app/field-types/workflow/trigger-fields.js +1 -1
  24. package/dist/app/field-types/workflow/workflow-canvas.js +3 -3
  25. package/dist/app/field-types/workflow/workflow-field.js +1 -1
  26. package/dist/app/field-types/workflow/workflow-graph-editor.js +3 -3
  27. package/dist/app/field-types/workflow-page/insert-value-view.js +3 -3
  28. package/dist/app/field-types/workflow-page/messages.d.ts +2 -2
  29. package/dist/app/field-types/workflow-page/publish-panel.js +2 -2
  30. package/dist/app/field-types/workflow-page/rerun-panel.js +1 -1
  31. package/dist/app/field-types/workflow-page/run-notice.js +1 -1
  32. package/dist/app/field-types/workflow-page/runs-panel.js +1 -1
  33. package/dist/app/field-types/workflow-page/test-run-panel.js +2 -2
  34. package/dist/app/field-types/workflow-page/use-workflow-page.js +2 -2
  35. package/dist/app/field-types/workflow-page/workbench-bar.js +1 -1
  36. package/dist/app/field-types/workflow-page/workflow-workbench.js +12 -12
  37. package/dist/app/field-types/workflow-run/messages.d.ts +2 -2
  38. package/dist/app/field-types/workflow-run/run-trace-view.js +4 -4
  39. package/dist/app/field-types/workflow-run/step-card.js +1 -1
  40. package/dist/app/field-types/workflow-run/step-panel.js +1 -1
  41. package/dist/app/file-viewers/messages.d.ts +2 -2
  42. package/dist/app/focus/messages.d.ts +2 -2
  43. package/dist/app/gallery/messages.d.ts +2 -2
  44. package/dist/app/hand-order/messages.d.ts +2 -2
  45. package/dist/app/history/messages.d.ts +2 -2
  46. package/dist/app/import/messages.d.ts +2 -2
  47. package/dist/app/list-edit/messages.d.ts +2 -2
  48. package/dist/app/list-messages.d.ts +2 -2
  49. package/dist/app/messages.d.ts +2 -2
  50. package/dist/app/pages/custom-boundary.d.ts +1 -1
  51. package/dist/app/pages/custom-chosen.d.ts +1 -1
  52. package/dist/app/pages/messages.d.ts +2 -2
  53. package/dist/app/record-messages.d.ts +2 -2
  54. package/dist/app/record-mode/shown-layout.d.ts +1 -1
  55. package/dist/app/record-row/messages.d.ts +2 -2
  56. package/dist/app/related-cards/messages.d.ts +2 -2
  57. package/dist/app/saved/messages.d.ts +2 -2
  58. package/dist/app/saved/saved-list.d.ts +1 -1
  59. package/dist/app/searches/messages.d.ts +2 -2
  60. package/dist/app-shell/messages.d.ts +2 -2
  61. package/dist/auth/messages.d.ts +2 -2
  62. package/dist/calls/messages.d.ts +2 -2
  63. package/dist/filter-panel/messages.d.ts +2 -2
  64. package/dist/forms/messages.d.ts +2 -2
  65. package/dist/inline-child-table/messages.d.ts +2 -2
  66. package/dist/invitations/messages.d.ts +2 -2
  67. package/dist/locale/texts-gate.d.ts +1 -1
  68. package/dist/mailbox/messages.d.ts +2 -2
  69. package/dist/mocks/customers.d.ts +1 -1
  70. package/dist/mocks/invoices.d.ts +2 -2
  71. package/dist/mocks/orders.d.ts +2 -2
  72. package/dist/organizations/messages.d.ts +2 -2
  73. package/dist/package.js +1 -1
  74. package/dist/plugins/before-sign-in.d.ts +1 -1
  75. package/dist/plugins/messages.d.ts +2 -2
  76. package/dist/shell/assets/{account-page-D0LQgPBu.js → account-page-DIIa49Sf.js} +2 -2
  77. package/dist/shell/assets/{app-CK_M0TgA.js → app-B8KcM2Z-.js} +5 -5
  78. package/dist/shell/assets/{assistant-shell-t6EYCEG6.js → assistant-shell-CLGyb2ss.js} +2 -2
  79. package/dist/shell/assets/{board-display-BF6sraBq.js → board-display-DJJD_jjY.js} +2 -2
  80. package/dist/shell/assets/{calendar-display-DdgRC4MC.js → calendar-display-7R7Vz5Vm.js} +2 -2
  81. package/dist/shell/assets/{call-rings-C5ud3oUx.js → call-rings-AviIOqM7.js} +2 -2
  82. package/dist/shell/assets/{calls-5vjQEKRi.js → calls-C2CUgWkn.js} +2 -2
  83. package/dist/shell/assets/{circle-alert-D4sTiwNu.js → circle-alert-DOaXkZQv.js} +2 -2
  84. package/dist/shell/assets/{composed-page-BWauYpuf.js → composed-page-DjGZy9C7.js} +2 -2
  85. package/dist/shell/assets/{composer-section-Dp-xM9-b.js → composer-section-BLqTkqi8.js} +2 -2
  86. package/dist/shell/assets/{connect-route-DkjLawxM.js → connect-route-41MPQMtp.js} +2 -2
  87. package/dist/shell/assets/{copy-field-B14w71cy.js → copy-field-Ct-6xn8T.js} +2 -2
  88. package/dist/shell/assets/{create-route-DGBe6c9T.js → create-route-CRZSYoTi.js} +2 -2
  89. package/dist/shell/assets/{custom-step-container-field-CXzhDKB8.js → custom-step-container-field-C0uZrHjV.js} +2 -2
  90. package/dist/shell/assets/{embedded-list-COr7SEcU.js → embedded-list-C3nd1V5o.js} +3 -3
  91. package/dist/shell/assets/{export-dialog-CCnbhHYq.js → export-dialog-BerhgfFO.js} +2 -2
  92. package/dist/shell/assets/{first-organization-page-NFqF-XyH.js → first-organization-page-CKYevHep.js} +2 -2
  93. package/dist/shell/assets/{graph-view-CnMNqiV4.js → graph-view-CoLu3Uhs.js} +2 -2
  94. package/dist/shell/assets/{group-donut-BbP0DJKg.js → group-donut-B8v2SWzP.js} +2 -2
  95. package/dist/shell/assets/{guest-call-page-R7GFfBV-.js → guest-call-page-DqQMPCVU.js} +3 -3
  96. package/dist/shell/assets/{html-viewer-DoOxyTcM.js → html-viewer-BntGWVRA.js} +2 -2
  97. package/dist/shell/assets/{import-dialog-_5Szg-jU.js → import-dialog-DThTUXFS.js} +2 -2
  98. package/dist/shell/assets/{import-table-dialog-njI8BoS4.js → import-table-dialog-C-XIx1Dd.js} +2 -2
  99. package/dist/shell/assets/{index-BbZazL12.js → index-CI7L8s0t.js} +1 -1
  100. package/dist/shell/assets/{invitations-page-EV-UUQ6b.js → invitations-page-COFjv2AV.js} +2 -2
  101. package/dist/shell/assets/{layout-grid-B0-CJOlT.js → layout-grid-CvCNKDtn.js} +2 -2
  102. package/dist/shell/assets/{legend-item-DlKFFY7e.js → legend-item-9nkaAII6.js} +2 -2
  103. package/dist/shell/assets/{list-page-aYSJ3PHa.js → list-page-D3nIEwGf.js} +4 -4
  104. package/dist/shell/assets/{maplibre-B6nwN1UZ.js → maplibre-5GcVztUc.js} +2 -2
  105. package/dist/shell/assets/{markdown-content-C8sLopWJ.js → markdown-content-DVmg_kx3.js} +2 -2
  106. package/dist/shell/assets/{members-page-CgBOboZQ.js → members-page-DoRl-b9K.js} +2 -2
  107. package/dist/shell/assets/{message-content-BkvkBtPr.js → message-content-BpfTrsWh.js} +2 -2
  108. package/dist/shell/assets/{messages-CqYTV98f.js → messages-CZQvPUZQ.js} +2 -2
  109. package/dist/shell/assets/{organization-page-CUBsrNzR.js → organization-page-DeaQlPop.js} +2 -2
  110. package/dist/shell/assets/{organizations-page-D_imfTUa.js → organizations-page-Dlosll2b.js} +2 -2
  111. package/dist/shell/assets/{pending-invitation-row-D4gFapdv.js → pending-invitation-row-t63yAwI8.js} +2 -2
  112. package/dist/shell/assets/{period-chart-ChFHNTEE.js → period-chart-BVv9kC_E.js} +2 -2
  113. package/dist/shell/assets/{person-row-YwRtkzbb.js → person-row-CgvcHRmL.js} +2 -2
  114. package/dist/shell/assets/{public-form-page-oyX-a-KA.js → public-form-page-CruNnqqc.js} +2 -2
  115. package/dist/shell/assets/{record-lines-D1wftBQA.js → record-lines-Dts68Cfq.js} +2 -2
  116. package/dist/shell/assets/{record-map-BEOxTNu4.js → record-map-BO9rZaxg.js} +2 -2
  117. package/dist/shell/assets/{record-opens-C9579izg.js → record-opens-Ds9nDyw1.js} +2 -2
  118. package/dist/shell/assets/{record-page-Dhb9gzfJ.js → record-page-DJgscks5.js} +3 -3
  119. package/dist/shell/assets/{record-preview-eCoWviA9.js → record-preview-CwySCCRj.js} +2 -2
  120. package/dist/shell/assets/{records-map-DVETi1eC.js → records-map-Bq_dBgiT.js} +2 -2
  121. package/dist/shell/assets/{render-node-CSjGRPb0.js → render-node-zjMYynnA.js} +3 -3
  122. package/dist/shell/assets/{reorder-button-1ikk6wTV.js → reorder-button-BGgoLDx3.js} +2 -2
  123. package/dist/shell/assets/{run-trace-view-DC8UUfeb.js → run-trace-view-BtyPPUyt.js} +2 -2
  124. package/dist/shell/assets/{runner-install-field-BmVLaBtB.js → runner-install-field-DvuPCX28.js} +2 -2
  125. package/dist/shell/assets/{runtime-update-CTsM8FBn.js → runtime-update-e56Spv--.js} +2 -2
  126. package/dist/shell/assets/{shared-protobase-ui-DkBQh22L.js → shared-protobase-ui-QP42FY24.js} +1 -1
  127. package/dist/shell/assets/{sheet-source-BbBLftOM.js → sheet-source-Cenf8A74.js} +2 -2
  128. package/dist/shell/assets/{sign-in-policy-page-BrVvhdS0.js → sign-in-policy-page-CUiU8ZIN.js} +2 -2
  129. package/dist/shell/assets/{start-block-queries-B1m-VmpK.js → start-block-queries-DUvYFyeX.js} +2 -2
  130. package/dist/shell/assets/{step-catalog-DXkb5LNi.js → step-catalog-CKmRa3SA.js} +2 -2
  131. package/dist/shell/assets/{step-panel-CEluX3Jl.js → step-panel-DD821ue5.js} +2 -2
  132. package/dist/shell/assets/{timeline-display-C1OXwJcu.js → timeline-display-ChPHZfO_.js} +2 -2
  133. package/dist/shell/assets/{trash-Ba3Y5_30.js → trash-Ch2JFURM.js} +2 -2
  134. package/dist/shell/assets/{update-set-D2mI0J7M.js → update-set-Zch9kB-u.js} +2 -2
  135. package/dist/shell/assets/{use-calendar-move-BENhrEOz.js → use-calendar-move-Cl14_xWL.js} +2 -2
  136. package/dist/shell/assets/{use-display-rows-DIoyxucI.js → use-display-rows-s-zuk4Lc.js} +2 -2
  137. package/dist/shell/assets/{use-my-invitations-B4h6GyJO.js → use-my-invitations-APXH_Xf1.js} +2 -2
  138. package/dist/shell/assets/{use-paged-search-DjnlXbQ5.js → use-paged-search-CxaSlMkh.js} +2 -2
  139. package/dist/shell/assets/{use-run-trace-2fQX9FeC.js → use-run-trace-CRG2_uVq.js} +2 -2
  140. package/dist/shell/assets/{use-workflow-page-D8Vn1I90.js → use-workflow-page-BPZWN9Iv.js} +2 -2
  141. package/dist/shell/assets/{use-workflow-types-DpNGPeuE.js → use-workflow-types-Dk4FOVoz.js} +2 -2
  142. package/dist/shell/assets/{workflow-canvas-CZ6QjuM6.js → workflow-canvas-DBlvFI_n.js} +2 -2
  143. package/dist/shell/assets/{workflow-field-CLeslVkB.js → workflow-field-DXiYYH5X.js} +3 -3
  144. package/dist/shell/assets/{workflow-graph-editor-CirmaYcy.js → workflow-graph-editor-BtNoPI_a.js} +2 -2
  145. package/dist/shell/assets/{workflow-run-field-DgVAi0nl.js → workflow-run-field-CztPPLbi.js} +3 -3
  146. package/dist/shell/assets/{workflow-status-field-CD4Npg78.js → workflow-status-field-K3DE4tPj.js} +2 -2
  147. package/dist/shell/assets/{workflow-workbench-Dy2EmMb7.js → workflow-workbench-CAz04v9t.js} +2 -2
  148. package/dist/shell/index.html +3 -3
  149. package/dist/shell/protobase.shell.json +2 -2
  150. package/dist/shell/protobase.sw.js +2 -2
  151. package/dist/shell-source-maps/assets/{account-page-D0LQgPBu.js.map → account-page-DIIa49Sf.js.map} +1 -1
  152. package/dist/shell-source-maps/assets/{app-CK_M0TgA.js.map → app-B8KcM2Z-.js.map} +1 -1
  153. package/dist/shell-source-maps/assets/{assistant-shell-t6EYCEG6.js.map → assistant-shell-CLGyb2ss.js.map} +1 -1
  154. package/dist/shell-source-maps/assets/{board-display-BF6sraBq.js.map → board-display-DJJD_jjY.js.map} +1 -1
  155. package/dist/shell-source-maps/assets/{calendar-display-DdgRC4MC.js.map → calendar-display-7R7Vz5Vm.js.map} +1 -1
  156. package/dist/shell-source-maps/assets/{call-rings-C5ud3oUx.js.map → call-rings-AviIOqM7.js.map} +1 -1
  157. package/dist/shell-source-maps/assets/{calls-5vjQEKRi.js.map → calls-C2CUgWkn.js.map} +1 -1
  158. package/dist/shell-source-maps/assets/{circle-alert-D4sTiwNu.js.map → circle-alert-DOaXkZQv.js.map} +1 -1
  159. package/dist/shell-source-maps/assets/{composed-page-BWauYpuf.js.map → composed-page-DjGZy9C7.js.map} +1 -1
  160. package/dist/shell-source-maps/assets/{composer-section-Dp-xM9-b.js.map → composer-section-BLqTkqi8.js.map} +1 -1
  161. package/dist/shell-source-maps/assets/{connect-route-DkjLawxM.js.map → connect-route-41MPQMtp.js.map} +1 -1
  162. package/dist/shell-source-maps/assets/{copy-field-B14w71cy.js.map → copy-field-Ct-6xn8T.js.map} +1 -1
  163. package/dist/shell-source-maps/assets/{create-route-DGBe6c9T.js.map → create-route-CRZSYoTi.js.map} +1 -1
  164. package/dist/shell-source-maps/assets/{custom-step-container-field-CXzhDKB8.js.map → custom-step-container-field-C0uZrHjV.js.map} +1 -1
  165. package/dist/shell-source-maps/assets/{embedded-list-COr7SEcU.js.map → embedded-list-C3nd1V5o.js.map} +1 -1
  166. package/dist/shell-source-maps/assets/{export-dialog-CCnbhHYq.js.map → export-dialog-BerhgfFO.js.map} +1 -1
  167. package/dist/shell-source-maps/assets/{first-organization-page-NFqF-XyH.js.map → first-organization-page-CKYevHep.js.map} +1 -1
  168. package/dist/shell-source-maps/assets/{graph-view-CnMNqiV4.js.map → graph-view-CoLu3Uhs.js.map} +1 -1
  169. package/dist/shell-source-maps/assets/{group-donut-BbP0DJKg.js.map → group-donut-B8v2SWzP.js.map} +1 -1
  170. package/dist/shell-source-maps/assets/{guest-call-page-R7GFfBV-.js.map → guest-call-page-DqQMPCVU.js.map} +1 -1
  171. package/dist/shell-source-maps/assets/{html-viewer-DoOxyTcM.js.map → html-viewer-BntGWVRA.js.map} +1 -1
  172. package/dist/shell-source-maps/assets/{import-dialog-_5Szg-jU.js.map → import-dialog-DThTUXFS.js.map} +1 -1
  173. package/dist/shell-source-maps/assets/{import-table-dialog-njI8BoS4.js.map → import-table-dialog-C-XIx1Dd.js.map} +1 -1
  174. package/dist/shell-source-maps/assets/{invitations-page-EV-UUQ6b.js.map → invitations-page-COFjv2AV.js.map} +1 -1
  175. package/dist/shell-source-maps/assets/{layout-grid-B0-CJOlT.js.map → layout-grid-CvCNKDtn.js.map} +1 -1
  176. package/dist/shell-source-maps/assets/{legend-item-DlKFFY7e.js.map → legend-item-9nkaAII6.js.map} +1 -1
  177. package/dist/shell-source-maps/assets/{list-page-aYSJ3PHa.js.map → list-page-D3nIEwGf.js.map} +1 -1
  178. package/dist/shell-source-maps/assets/{maplibre-B6nwN1UZ.js.map → maplibre-5GcVztUc.js.map} +1 -1
  179. package/dist/shell-source-maps/assets/{markdown-content-C8sLopWJ.js.map → markdown-content-DVmg_kx3.js.map} +1 -1
  180. package/dist/shell-source-maps/assets/{members-page-CgBOboZQ.js.map → members-page-DoRl-b9K.js.map} +1 -1
  181. package/dist/shell-source-maps/assets/{message-content-BkvkBtPr.js.map → message-content-BpfTrsWh.js.map} +1 -1
  182. package/dist/shell-source-maps/assets/{messages-CqYTV98f.js.map → messages-CZQvPUZQ.js.map} +1 -1
  183. package/dist/shell-source-maps/assets/{organization-page-CUBsrNzR.js.map → organization-page-DeaQlPop.js.map} +1 -1
  184. package/dist/shell-source-maps/assets/{organizations-page-D_imfTUa.js.map → organizations-page-Dlosll2b.js.map} +1 -1
  185. package/dist/shell-source-maps/assets/{pending-invitation-row-D4gFapdv.js.map → pending-invitation-row-t63yAwI8.js.map} +1 -1
  186. package/dist/shell-source-maps/assets/{period-chart-ChFHNTEE.js.map → period-chart-BVv9kC_E.js.map} +1 -1
  187. package/dist/shell-source-maps/assets/{person-row-YwRtkzbb.js.map → person-row-CgvcHRmL.js.map} +1 -1
  188. package/dist/shell-source-maps/assets/{public-form-page-oyX-a-KA.js.map → public-form-page-CruNnqqc.js.map} +1 -1
  189. package/dist/shell-source-maps/assets/{record-lines-D1wftBQA.js.map → record-lines-Dts68Cfq.js.map} +1 -1
  190. package/dist/shell-source-maps/assets/{record-map-BEOxTNu4.js.map → record-map-BO9rZaxg.js.map} +1 -1
  191. package/dist/shell-source-maps/assets/{record-opens-C9579izg.js.map → record-opens-Ds9nDyw1.js.map} +1 -1
  192. package/dist/shell-source-maps/assets/{record-page-Dhb9gzfJ.js.map → record-page-DJgscks5.js.map} +1 -1
  193. package/dist/shell-source-maps/assets/{record-preview-eCoWviA9.js.map → record-preview-CwySCCRj.js.map} +1 -1
  194. package/dist/shell-source-maps/assets/{records-map-DVETi1eC.js.map → records-map-Bq_dBgiT.js.map} +1 -1
  195. package/dist/shell-source-maps/assets/{render-node-CSjGRPb0.js.map → render-node-zjMYynnA.js.map} +1 -1
  196. package/dist/shell-source-maps/assets/{reorder-button-1ikk6wTV.js.map → reorder-button-BGgoLDx3.js.map} +1 -1
  197. package/dist/shell-source-maps/assets/{run-trace-view-DC8UUfeb.js.map → run-trace-view-BtyPPUyt.js.map} +1 -1
  198. package/dist/shell-source-maps/assets/{runner-install-field-BmVLaBtB.js.map → runner-install-field-DvuPCX28.js.map} +1 -1
  199. package/dist/shell-source-maps/assets/{runtime-update-CTsM8FBn.js.map → runtime-update-e56Spv--.js.map} +1 -1
  200. package/dist/shell-source-maps/assets/{sheet-source-BbBLftOM.js.map → sheet-source-Cenf8A74.js.map} +1 -1
  201. package/dist/shell-source-maps/assets/{sign-in-policy-page-BrVvhdS0.js.map → sign-in-policy-page-CUiU8ZIN.js.map} +1 -1
  202. package/dist/shell-source-maps/assets/{start-block-queries-B1m-VmpK.js.map → start-block-queries-DUvYFyeX.js.map} +1 -1
  203. package/dist/shell-source-maps/assets/{step-catalog-DXkb5LNi.js.map → step-catalog-CKmRa3SA.js.map} +1 -1
  204. package/dist/shell-source-maps/assets/{step-panel-CEluX3Jl.js.map → step-panel-DD821ue5.js.map} +1 -1
  205. package/dist/shell-source-maps/assets/{timeline-display-C1OXwJcu.js.map → timeline-display-ChPHZfO_.js.map} +1 -1
  206. package/dist/shell-source-maps/assets/{trash-Ba3Y5_30.js.map → trash-Ch2JFURM.js.map} +1 -1
  207. package/dist/shell-source-maps/assets/{update-set-D2mI0J7M.js.map → update-set-Zch9kB-u.js.map} +1 -1
  208. package/dist/shell-source-maps/assets/{use-calendar-move-BENhrEOz.js.map → use-calendar-move-Cl14_xWL.js.map} +1 -1
  209. package/dist/shell-source-maps/assets/{use-display-rows-DIoyxucI.js.map → use-display-rows-s-zuk4Lc.js.map} +1 -1
  210. package/dist/shell-source-maps/assets/{use-my-invitations-B4h6GyJO.js.map → use-my-invitations-APXH_Xf1.js.map} +1 -1
  211. package/dist/shell-source-maps/assets/{use-paged-search-DjnlXbQ5.js.map → use-paged-search-CxaSlMkh.js.map} +1 -1
  212. package/dist/shell-source-maps/assets/{use-run-trace-2fQX9FeC.js.map → use-run-trace-CRG2_uVq.js.map} +1 -1
  213. package/dist/shell-source-maps/assets/{use-workflow-page-D8Vn1I90.js.map → use-workflow-page-BPZWN9Iv.js.map} +1 -1
  214. package/dist/shell-source-maps/assets/{use-workflow-types-DpNGPeuE.js.map → use-workflow-types-Dk4FOVoz.js.map} +1 -1
  215. package/dist/shell-source-maps/assets/{workflow-canvas-CZ6QjuM6.js.map → workflow-canvas-DBlvFI_n.js.map} +1 -1
  216. package/dist/shell-source-maps/assets/{workflow-field-CLeslVkB.js.map → workflow-field-DXiYYH5X.js.map} +1 -1
  217. package/dist/shell-source-maps/assets/{workflow-graph-editor-CirmaYcy.js.map → workflow-graph-editor-BtNoPI_a.js.map} +1 -1
  218. package/dist/shell-source-maps/assets/{workflow-run-field-DgVAi0nl.js.map → workflow-run-field-CztPPLbi.js.map} +1 -1
  219. package/dist/shell-source-maps/assets/{workflow-status-field-CD4Npg78.js.map → workflow-status-field-K3DE4tPj.js.map} +1 -1
  220. package/dist/shell-source-maps/assets/{workflow-workbench-Dy2EmMb7.js.map → workflow-workbench-CAz04v9t.js.map} +1 -1
  221. package/dist/status/messages.d.ts +2 -2
  222. package/dist/users/messages.d.ts +2 -2
  223. package/package.json +5 -5
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$c as r,Br as i,Ca as a,Ja as o,Jr as s,Js as c,La as l,Pa as u,Ql as d,Wc as f,Xl as p,Xn as m,Ys as h,Zn as g,as as _,bn as v,cc as y,cn as b,ei as x,el as S,fl as C,fs as w,gl as T,gr as E,ll as D,sc as O,uc as k,vi as A,wa as j,zc as M}from"./app-CK_M0TgA.js";import{h as N,o as P}from"./vendor-t7Q7QbPu.js";import{Q as F}from"./embedded-list-COr7SEcU.js";import{n as I}from"./lib-dnd-kit-sortable-CNDSKqCD.js";import{a as L,i as R,n as z,o as B,r as ee,s as V,t as H}from"./messages-CqYTV98f.js";var U={name:`arrow-up-down`,size:24,node:[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]};U.node;var W=f(U),G={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};G.node;var K=f(G),q=e(t(),1),J=S(`app/delete`),Y=p(),X=({blockingPlural:e,noun:t})=>J(`stillPointAt`,{plural:e,noun:t}),Z=({blockedBy:e,resources:t,views:n,noun:r,key:i})=>{let{resource:a,field:o}=e;if(!t[a])return;let s=n[a]?.names?.plural??C(a),c=X({blockingPlural:s,noun:r});if(!o||i===void 0)return{text:c};let l={kind:`list`,resource:a,filter:d(Y.eq(o,i))};return{text:c,link:{label:J(`show`,{plural:s}),to:l}}},Q=e(n(),1),te=({title:e,noun:t,busy:n,onConfirm:r,onCancel:i})=>(0,Q.jsx)(y,{title:J(`confirmTitle`,{title:e}),description:J(`confirmDescription`,{noun:t,title:e}),onClose:i,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{onClick:i,children:J(`cancel`)}),(0,Q.jsx)(k,{variant:`primary`,className:`bg-danger hover:bg-danger/90`,loading:n,onClick:r,children:J(`delete`)})]})}),ne=({title:e,changes:t,busy:n,onReview:r,onDeleteAnyway:i,onCancel:a})=>(0,Q.jsx)(y,{title:J(`changedTitle`,{title:e}),description:J(`changedDescription`),onClose:a,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{onClick:r,children:J(`reviewChanges`)}),(0,Q.jsx)(k,{variant:`primary`,className:`bg-danger hover:bg-danger/90`,loading:n,onClick:i,children:J(`deleteAnyway`)})]}),children:t.length===0?(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:J(`noVisibleChanges`)}):(0,Q.jsx)(`ul`,{className:`divide-y rounded-md border`,children:t.map(e=>(0,Q.jsxs)(`li`,{className:`grid grid-cols-[96px_1fr] gap-3 px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:e.label}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground line-through`,children:e.before}),` `,(0,Q.jsx)(`span`,{className:`font-medium`,children:e.after})]})]},e.field))})}),$=e=>{if(e.stage===`confirm`)return(0,Q.jsx)(y,{title:J(`bulkConfirmTitle`,{count:e.count,noun:e.noun,plural:e.plural}),description:J(`bulkConfirmDescription`),onClose:e.onCancel,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{onClick:e.onCancel,children:J(`cancel`)}),(0,Q.jsx)(k,{variant:`primary`,className:`bg-danger hover:bg-danger/90`,onClick:e.onConfirm,children:J(`deleteCount`,{count:e.count})})]})});if(e.stage===`running`)return(0,Q.jsx)(y,{title:J(`deleting`),description:J(`progress`,{done:e.done,total:e.total}),onClose:()=>void 0,actions:(0,Q.jsx)(k,{loading:!0,disabled:!0,children:J(`working`)})});let t=e.total-e.failures.length;return(0,Q.jsx)(y,{title:e.failures.length===0?J(`deleted`,{count:t}):J(`deletedOf`,{count:t,total:e.total}),description:e.failures.length===0?void 0:J(`kept`,{count:e.failures.length}),onClose:e.onClose,actions:(0,Q.jsx)(k,{variant:`primary`,onClick:e.onClose,children:J(`done`)}),children:e.failures.length>0&&(0,Q.jsx)(`ul`,{className:`max-h-48 divide-y overflow-y-auto rounded-md border`,children:e.failures.map(e=>(0,Q.jsxs)(`li`,{className:`px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.title}),(0,Q.jsx)(`span`,{className:`block text-xs text-danger-text`,children:e.message})]},e.title))})})},re=new Set([`updated_at`,`updatedAt`]),ie=(e,t,n,r)=>Object.values(e.fields).flatMap(e=>{if(re.has(e.name)||JSON.stringify(n[e.name]??null)===JSON.stringify(r[e.name]??null))return[];let i=t?.fields[e.name];return[{field:e.name,label:i?.label??C(e.name),before:A(e,n[e.name],i),after:A(e,r[e.name],i)}]}),ae=4,oe=({model:e,view:t,onDeleted:n,onReview:r,restore:a})=>{let o=w(),s=N(),u=l(),[d,f]=(0,q.useState)(),[p,m]=(0,q.useState)(!1),g=t?.names?.singular??C(e.name),v=t?.names?.plural??C(e.name),{resources:y,views:b}=_(),{href:x,open:S}=i(),T=(t,n)=>t.blockedBy&&Z({blockedBy:t.blockedBy,resources:y,views:b,noun:g,...e.primaryKey.length===1&&{key:n.key}}),E=()=>{for(let t of[`page`,`list`,`first-page`,`map`])s.invalidateQueries({queryKey:[t,e.name]});for(let t of[`facets`,`series`,`aggregate`,`histogram`,`count`])s.invalidateQueries({queryKey:[t,e.name]})},D=async(t,n)=>{let r=n??(await o.get(e.name,t.key)).etag;try{await o.remove(e.name,t.key,{etag:r})}catch(e){if(!(e instanceof c))throw e;return e}},O=t=>{E(),f(void 0),n?.(t),u.show({state:`success`,title:J(`deletedToast`,{title:t.title}),...e.softDelete&&a&&{action:{label:J(`undo`),onClick:()=>{a(t).then(()=>{E(),u.show({state:`success`,title:J(`restored`,{title:t.title})})},e=>{if(!h(e))throw e;E(),u.show({state:e.status===409?`success`:`error`,title:e.status===409?J(`alreadyBack`,{title:t.title}):J(`couldNotRestore`,{title:t.title}),description:e.status===409?void 0:e.message})})}}}})},k=async(n,r)=>{m(!0);try{if(!await D(n,r))return O(n);let i=(await o.get(e.name,n.key)).record;f({kind:`conflict`,target:n,fresh:i,changes:ie(e,t,n.snapshot,i)})}catch(e){if(!h(e))throw e;f(void 0);let t=T(e,n);u.show({state:`error`,title:J(`couldNotDelete`,{title:n.title}),description:t?.text??e.message,...t?.link&&{action:{label:t.link.label,href:x(t.link.to),onNavigate:S}}})}finally{m(!1)}},A=async e=>{try{return await D(e,e.etag)?{title:e.title,message:J(`changedSinceLoaded`)}:void 0}catch(t){if(!h(t))throw t;return{title:e.title,message:T(t,e)?.text??t.message}}},j=async e=>{let t=[],n=[],r=0;f({kind:`bulk-running`,done:r,total:e.length});let i=[...e];return await Promise.all(Array.from({length:Math.min(ae,e.length)},async()=>{for(let a=i.shift();a;a=i.shift()){let i=await A(a);i&&(t.push(i),n.push(a)),r+=1,f({kind:`bulk-running`,done:r,total:e.length})}})),E(),f({kind:`bulk-done`,total:e.length,failures:t}),n},M=()=>f(void 0);return{dialogs:d&&(0,Q.jsxs)(Q.Fragment,{children:[d.kind===`confirm`&&(0,Q.jsx)(te,{title:d.target.title,noun:g,busy:p,onCancel:M,onConfirm:()=>void k(d.target,d.target.etag)}),d.kind===`conflict`&&(0,Q.jsx)(ne,{title:d.target.title,changes:d.changes,busy:p,onCancel:M,onReview:()=>{M(),r?.(d.target,d.fresh)},onDeleteAnyway:()=>void k(d.target,`*`)}),d.kind===`bulk-confirm`&&(0,Q.jsx)($,{stage:`confirm`,count:d.targets.length,noun:g,plural:v,onCancel:()=>{M(),d.settle(d.targets)},onConfirm:()=>d.settle(j(d.targets))}),d.kind===`bulk-running`&&(0,Q.jsx)($,{stage:`running`,done:d.done,total:d.total}),d.kind===`bulk-done`&&(0,Q.jsx)($,{stage:`done`,total:d.total,failures:d.failures,onClose:M})]}),start:t=>e.softDelete?k(t,t.etag):f({kind:`confirm`,target:t}),startBulk:e=>new Promise(t=>f({kind:`bulk-confirm`,targets:e,settle:t}))}},se=e=>{let t=w();return e.softDelete?async n=>void await t.undelete(e.name,n.key):void 0},ce=(e,t,n)=>({order:r,index:i})=>{let a=t=>r.findIndex(n=>T(j(e,n))===t),o=t.after.find(e=>a(e.key)>i);if(o)return H(`dependsOn`,{record:n,other:o.title});let s=t.before.find(e=>a(e.key)!==-1&&a(e.key)<i);return s?H(`dependsOn`,{record:s.title,other:n}):void 0},le=(e,t,n,r)=>{let i=e[t],a;for(let o=n;o<e.length;o++){let n=r({record:i,order:I(e,t,o),index:o});if(n===void 0)return{to:o,...a!==void 0&&{reason:a}};a??=n}return{to:t,reason:a}},ue=({model:e,view:t,field:n,filter:i,fields:o,rule:c})=>{let u=w(),d=l(),f=v(),{resources:p,views:h}=_(),y=`${n} asc`,b=P({queryKey:[...r.list(e.name,i,y,500,`hand-order`),o.join(`,`)],queryFn:async()=>{let t=m(p,h,e,o),n=[],r=``;do{let s=await u.search(e.name,{filter:i||void 0,orderBy:y,pageSize:500,labels:t,...r&&{pageToken:r}});n.push(...g(p,e,o,s.items,s.labels).map((t,n)=>({...t,id:a(e,s.items[n])}))),r=s.nextPageToken}while(r);return n}}),[x,S]=(0,q.useState)(),C=(0,q.useRef)(void 0),T=(0,q.useRef)([]),E=(0,q.useRef)(void 0),O=(0,q.useRef)(Promise.resolve()),k=(0,q.useRef)(0),A=(0,q.useRef)(void 0),j=async()=>{let t=C.current,r=T.current;if(T.current=[],!t||r.length===0)return;let i=await u.batchWrite(r),o=new Map(i.results.flatMap(e=>e.op===`move`?e.records:[]).map(t=>[a(e,t.record),t])),s=z(i.results,t=>a(e,t)),c=L(e,[...o].map(([e,t])=>({...t,before:{[n]:s.get(e)}})),[n]);A.current!==void 0&&d.dismiss(A.current),A.current=d.show({state:`success`,title:V(`orderChanged`),action:{label:V(`undo`),onClick:()=>W(c)}}),C.current&&=C.current.map(e=>{let t=o.get(e.id);return t?{...e,[n]:t.record[n],etag:t.etag}:e})},M=(e,t)=>n=>{C.current=void 0,T.current=[],S(void 0),d.show(B(n,e,{place:`list`,title:t?E.current:void 0}))},N=async()=>{--k.current,!(k.current>0)&&(await f(e.name),!(k.current>0)&&(C.current=void 0,S(void 0)))},F=(n,r)=>{let i=C.current??b.data;if(!i||n===r)return;if(!e.position?.after)return H(i,n,r,c);let a=s(e,i[n]).record,o=i[n].id;R(u,e,t,a).then(n=>{let i=C.current??b.data,s=ce(e,n,D(e,t,a,o));H(i,i.findIndex(e=>e.id===o),r,e=>s(e)??c?.(e))},M(V(`couldNotChange`),!1))},H=(r,a,o,c)=>{if(a===-1||a===o)return;let l=c?U(r,a,o,c):o;a!==l&&(C.current=I(r,a,l),T.current=[...T.current,ee(e,n,i,C.current,l)],S(C.current),k.current+=1,E.current=D(e,t,s(e,r[a]).record,r[a].id),O.current=O.current.then(j).catch(M(V(`couldNotChange`),!0)).then(N))},U=(t,n,r,i)=>{let a=le(t.map(t=>s(e,t).record),n,r,i);return a.reason!==void 0&&d.show({state:`warning`,title:a.to===n?V(`notMoved`):V(`movedToPlace`,{place:a.to+1}),description:a.reason}),a.to},W=e=>{A.current!==void 0&&d.dismiss(A.current),A.current=void 0,k.current+=1,O.current=O.current.then(async()=>{await u.batchWrite(e),C.current=void 0,T.current=[],S(void 0)}).catch(M(V(`couldNotUndo`),!1)).then(N)};return{rows:x??b.data,loading:b.isPending,error:b.error,move:F}},de=({model:e,view:t,field:n,filter:r,columns:a,sort:s})=>{let{resources:c,views:l}=_(),{fields:d,dropRules:f}=u(),{go:p,href:m}=i(),h=s!==void 0,g=(0,q.useMemo)(()=>b(e,t,a,{resources:c,views:l,fieldTypes:d}).map(e=>h?e:{...e,sortable:!1}),[e,t,a.join(`,`),c,l,d,h]),v=(0,q.useMemo)(()=>x(e,t,g.map(e=>e.id)),[e,t,g]),y=t?.list?.drag?.rule,S=y===void 0?void 0:f?.[y],C=ue({model:e,view:t,field:n,filter:r,fields:v,...S&&{rule:S}}),w=C.rows,T=(0,q.useMemo)(()=>w&&{total:w.length,rowAt:e=>w[e]},[w]);if(y!==void 0&&!S)return(0,Q.jsx)(o,{children:V.rich(`noRule`,{rule:y})});if(C.loading)return(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:Array.from({length:3},(e,t)=>(0,Q.jsx)(O,{className:`h-4 w-full`},t))});if(C.error)return(0,Q.jsx)(E,{title:V(`couldNotLoad`),error:C.error});if(!T||T.total===0)return(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:V(`nothingYet`)});let k=t=>p({kind:`record`,resource:e.name,key:j(e,t)});return(0,Q.jsx)(F,{fit:!0,scroll:`parent`,columns:g,source:T,latencyMs:0,onOpenRow:k,rowLink:t=>({href:m({kind:`record`,resource:e.name,key:j(e,t)}),onFollow:()=>k(t)}),...s&&{sort:s.value,onSortChange:s.onChange},rowNumbers:!1,reorder:{label:n=>D(e,t,n,n.id),onMove:C.move}})},fe=({sorting:e,onChange:t,size:n,iconOnly:r=!1})=>{let i=V(e?`done`:`reorder`);return(0,Q.jsxs)(k,{size:n,variant:e?`primary`:`secondary`,onClick:()=>t(!e),...r&&{"aria-label":i,title:i},children:[e?(0,Q.jsx)(M,{className:`size-3.5`}):(0,Q.jsx)(W,{className:`size-3.5`}),!r&&i]})};export{K as a,oe as i,de as n,se as r,fe as t};
2
- //# debugId=358a493a-c135-4c71-a90c-785ebbaab446
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$c as r,Br as i,Ca as a,Ja as o,Jr as s,Js as c,La as l,Pa as u,Ql as d,Wc as f,Xl as p,Xn as m,Ys as h,Zn as g,as as _,bn as v,cc as y,cn as b,ei as x,el as S,fl as C,fs as w,gl as T,gr as E,ll as D,sc as O,uc as k,vi as A,wa as j,zc as M}from"./app-B8KcM2Z-.js";import{h as N,o as P}from"./vendor-t7Q7QbPu.js";import{Q as F}from"./embedded-list-C3nd1V5o.js";import{n as I}from"./lib-dnd-kit-sortable-CNDSKqCD.js";import{a as L,i as R,n as z,o as B,r as ee,s as V,t as H}from"./messages-CZQvPUZQ.js";var U={name:`arrow-up-down`,size:24,node:[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]};U.node;var W=f(U),G={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};G.node;var K=f(G),q=e(t(),1),J=S(`app/delete`),Y=p(),X=({blockingPlural:e,noun:t})=>J(`stillPointAt`,{plural:e,noun:t}),Z=({blockedBy:e,resources:t,views:n,noun:r,key:i})=>{let{resource:a,field:o}=e;if(!t[a])return;let s=n[a]?.names?.plural??C(a),c=X({blockingPlural:s,noun:r});if(!o||i===void 0)return{text:c};let l={kind:`list`,resource:a,filter:d(Y.eq(o,i))};return{text:c,link:{label:J(`show`,{plural:s}),to:l}}},Q=e(n(),1),te=({title:e,noun:t,busy:n,onConfirm:r,onCancel:i})=>(0,Q.jsx)(y,{title:J(`confirmTitle`,{title:e}),description:J(`confirmDescription`,{noun:t,title:e}),onClose:i,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{onClick:i,children:J(`cancel`)}),(0,Q.jsx)(k,{variant:`primary`,className:`bg-danger hover:bg-danger/90`,loading:n,onClick:r,children:J(`delete`)})]})}),ne=({title:e,changes:t,busy:n,onReview:r,onDeleteAnyway:i,onCancel:a})=>(0,Q.jsx)(y,{title:J(`changedTitle`,{title:e}),description:J(`changedDescription`),onClose:a,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{onClick:r,children:J(`reviewChanges`)}),(0,Q.jsx)(k,{variant:`primary`,className:`bg-danger hover:bg-danger/90`,loading:n,onClick:i,children:J(`deleteAnyway`)})]}),children:t.length===0?(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:J(`noVisibleChanges`)}):(0,Q.jsx)(`ul`,{className:`divide-y rounded-md border`,children:t.map(e=>(0,Q.jsxs)(`li`,{className:`grid grid-cols-[96px_1fr] gap-3 px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:e.label}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground line-through`,children:e.before}),` `,(0,Q.jsx)(`span`,{className:`font-medium`,children:e.after})]})]},e.field))})}),$=e=>{if(e.stage===`confirm`)return(0,Q.jsx)(y,{title:J(`bulkConfirmTitle`,{count:e.count,noun:e.noun,plural:e.plural}),description:J(`bulkConfirmDescription`),onClose:e.onCancel,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{onClick:e.onCancel,children:J(`cancel`)}),(0,Q.jsx)(k,{variant:`primary`,className:`bg-danger hover:bg-danger/90`,onClick:e.onConfirm,children:J(`deleteCount`,{count:e.count})})]})});if(e.stage===`running`)return(0,Q.jsx)(y,{title:J(`deleting`),description:J(`progress`,{done:e.done,total:e.total}),onClose:()=>void 0,actions:(0,Q.jsx)(k,{loading:!0,disabled:!0,children:J(`working`)})});let t=e.total-e.failures.length;return(0,Q.jsx)(y,{title:e.failures.length===0?J(`deleted`,{count:t}):J(`deletedOf`,{count:t,total:e.total}),description:e.failures.length===0?void 0:J(`kept`,{count:e.failures.length}),onClose:e.onClose,actions:(0,Q.jsx)(k,{variant:`primary`,onClick:e.onClose,children:J(`done`)}),children:e.failures.length>0&&(0,Q.jsx)(`ul`,{className:`max-h-48 divide-y overflow-y-auto rounded-md border`,children:e.failures.map(e=>(0,Q.jsxs)(`li`,{className:`px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.title}),(0,Q.jsx)(`span`,{className:`block text-xs text-danger-text`,children:e.message})]},e.title))})})},re=new Set([`updated_at`,`updatedAt`]),ie=(e,t,n,r)=>Object.values(e.fields).flatMap(e=>{if(re.has(e.name)||JSON.stringify(n[e.name]??null)===JSON.stringify(r[e.name]??null))return[];let i=t?.fields[e.name];return[{field:e.name,label:i?.label??C(e.name),before:A(e,n[e.name],i),after:A(e,r[e.name],i)}]}),ae=4,oe=({model:e,view:t,onDeleted:n,onReview:r,restore:a})=>{let o=w(),s=N(),u=l(),[d,f]=(0,q.useState)(),[p,m]=(0,q.useState)(!1),g=t?.names?.singular??C(e.name),v=t?.names?.plural??C(e.name),{resources:y,views:b}=_(),{href:x,open:S}=i(),T=(t,n)=>t.blockedBy&&Z({blockedBy:t.blockedBy,resources:y,views:b,noun:g,...e.primaryKey.length===1&&{key:n.key}}),E=()=>{for(let t of[`page`,`list`,`first-page`,`map`])s.invalidateQueries({queryKey:[t,e.name]});for(let t of[`facets`,`series`,`aggregate`,`histogram`,`count`])s.invalidateQueries({queryKey:[t,e.name]})},D=async(t,n)=>{let r=n??(await o.get(e.name,t.key)).etag;try{await o.remove(e.name,t.key,{etag:r})}catch(e){if(!(e instanceof c))throw e;return e}},O=t=>{E(),f(void 0),n?.(t),u.show({state:`success`,title:J(`deletedToast`,{title:t.title}),...e.softDelete&&a&&{action:{label:J(`undo`),onClick:()=>{a(t).then(()=>{E(),u.show({state:`success`,title:J(`restored`,{title:t.title})})},e=>{if(!h(e))throw e;E(),u.show({state:e.status===409?`success`:`error`,title:e.status===409?J(`alreadyBack`,{title:t.title}):J(`couldNotRestore`,{title:t.title}),description:e.status===409?void 0:e.message})})}}}})},k=async(n,r)=>{m(!0);try{if(!await D(n,r))return O(n);let i=(await o.get(e.name,n.key)).record;f({kind:`conflict`,target:n,fresh:i,changes:ie(e,t,n.snapshot,i)})}catch(e){if(!h(e))throw e;f(void 0);let t=T(e,n);u.show({state:`error`,title:J(`couldNotDelete`,{title:n.title}),description:t?.text??e.message,...t?.link&&{action:{label:t.link.label,href:x(t.link.to),onNavigate:S}}})}finally{m(!1)}},A=async e=>{try{return await D(e,e.etag)?{title:e.title,message:J(`changedSinceLoaded`)}:void 0}catch(t){if(!h(t))throw t;return{title:e.title,message:T(t,e)?.text??t.message}}},j=async e=>{let t=[],n=[],r=0;f({kind:`bulk-running`,done:r,total:e.length});let i=[...e];return await Promise.all(Array.from({length:Math.min(ae,e.length)},async()=>{for(let a=i.shift();a;a=i.shift()){let i=await A(a);i&&(t.push(i),n.push(a)),r+=1,f({kind:`bulk-running`,done:r,total:e.length})}})),E(),f({kind:`bulk-done`,total:e.length,failures:t}),n},M=()=>f(void 0);return{dialogs:d&&(0,Q.jsxs)(Q.Fragment,{children:[d.kind===`confirm`&&(0,Q.jsx)(te,{title:d.target.title,noun:g,busy:p,onCancel:M,onConfirm:()=>void k(d.target,d.target.etag)}),d.kind===`conflict`&&(0,Q.jsx)(ne,{title:d.target.title,changes:d.changes,busy:p,onCancel:M,onReview:()=>{M(),r?.(d.target,d.fresh)},onDeleteAnyway:()=>void k(d.target,`*`)}),d.kind===`bulk-confirm`&&(0,Q.jsx)($,{stage:`confirm`,count:d.targets.length,noun:g,plural:v,onCancel:()=>{M(),d.settle(d.targets)},onConfirm:()=>d.settle(j(d.targets))}),d.kind===`bulk-running`&&(0,Q.jsx)($,{stage:`running`,done:d.done,total:d.total}),d.kind===`bulk-done`&&(0,Q.jsx)($,{stage:`done`,total:d.total,failures:d.failures,onClose:M})]}),start:t=>e.softDelete?k(t,t.etag):f({kind:`confirm`,target:t}),startBulk:e=>new Promise(t=>f({kind:`bulk-confirm`,targets:e,settle:t}))}},se=e=>{let t=w();return e.softDelete?async n=>void await t.undelete(e.name,n.key):void 0},ce=(e,t,n)=>({order:r,index:i})=>{let a=t=>r.findIndex(n=>T(j(e,n))===t),o=t.after.find(e=>a(e.key)>i);if(o)return H(`dependsOn`,{record:n,other:o.title});let s=t.before.find(e=>a(e.key)!==-1&&a(e.key)<i);return s?H(`dependsOn`,{record:s.title,other:n}):void 0},le=(e,t,n,r)=>{let i=e[t],a;for(let o=n;o<e.length;o++){let n=r({record:i,order:I(e,t,o),index:o});if(n===void 0)return{to:o,...a!==void 0&&{reason:a}};a??=n}return{to:t,reason:a}},ue=({model:e,view:t,field:n,filter:i,fields:o,rule:c})=>{let u=w(),d=l(),f=v(),{resources:p,views:h}=_(),y=`${n} asc`,b=P({queryKey:[...r.list(e.name,i,y,500,`hand-order`),o.join(`,`)],queryFn:async()=>{let t=m(p,h,e,o),n=[],r=``;do{let s=await u.search(e.name,{filter:i||void 0,orderBy:y,pageSize:500,labels:t,...r&&{pageToken:r}});n.push(...g(p,e,o,s.items,s.labels).map((t,n)=>({...t,id:a(e,s.items[n])}))),r=s.nextPageToken}while(r);return n}}),[x,S]=(0,q.useState)(),C=(0,q.useRef)(void 0),T=(0,q.useRef)([]),E=(0,q.useRef)(void 0),O=(0,q.useRef)(Promise.resolve()),k=(0,q.useRef)(0),A=(0,q.useRef)(void 0),j=async()=>{let t=C.current,r=T.current;if(T.current=[],!t||r.length===0)return;let i=await u.batchWrite(r),o=new Map(i.results.flatMap(e=>e.op===`move`?e.records:[]).map(t=>[a(e,t.record),t])),s=z(i.results,t=>a(e,t)),c=L(e,[...o].map(([e,t])=>({...t,before:{[n]:s.get(e)}})),[n]);A.current!==void 0&&d.dismiss(A.current),A.current=d.show({state:`success`,title:V(`orderChanged`),action:{label:V(`undo`),onClick:()=>W(c)}}),C.current&&=C.current.map(e=>{let t=o.get(e.id);return t?{...e,[n]:t.record[n],etag:t.etag}:e})},M=(e,t)=>n=>{C.current=void 0,T.current=[],S(void 0),d.show(B(n,e,{place:`list`,title:t?E.current:void 0}))},N=async()=>{--k.current,!(k.current>0)&&(await f(e.name),!(k.current>0)&&(C.current=void 0,S(void 0)))},F=(n,r)=>{let i=C.current??b.data;if(!i||n===r)return;if(!e.position?.after)return H(i,n,r,c);let a=s(e,i[n]).record,o=i[n].id;R(u,e,t,a).then(n=>{let i=C.current??b.data,s=ce(e,n,D(e,t,a,o));H(i,i.findIndex(e=>e.id===o),r,e=>s(e)??c?.(e))},M(V(`couldNotChange`),!1))},H=(r,a,o,c)=>{if(a===-1||a===o)return;let l=c?U(r,a,o,c):o;a!==l&&(C.current=I(r,a,l),T.current=[...T.current,ee(e,n,i,C.current,l)],S(C.current),k.current+=1,E.current=D(e,t,s(e,r[a]).record,r[a].id),O.current=O.current.then(j).catch(M(V(`couldNotChange`),!0)).then(N))},U=(t,n,r,i)=>{let a=le(t.map(t=>s(e,t).record),n,r,i);return a.reason!==void 0&&d.show({state:`warning`,title:a.to===n?V(`notMoved`):V(`movedToPlace`,{place:a.to+1}),description:a.reason}),a.to},W=e=>{A.current!==void 0&&d.dismiss(A.current),A.current=void 0,k.current+=1,O.current=O.current.then(async()=>{await u.batchWrite(e),C.current=void 0,T.current=[],S(void 0)}).catch(M(V(`couldNotUndo`),!1)).then(N)};return{rows:x??b.data,loading:b.isPending,error:b.error,move:F}},de=({model:e,view:t,field:n,filter:r,columns:a,sort:s})=>{let{resources:c,views:l}=_(),{fields:d,dropRules:f}=u(),{go:p,href:m}=i(),h=s!==void 0,g=(0,q.useMemo)(()=>b(e,t,a,{resources:c,views:l,fieldTypes:d}).map(e=>h?e:{...e,sortable:!1}),[e,t,a.join(`,`),c,l,d,h]),v=(0,q.useMemo)(()=>x(e,t,g.map(e=>e.id)),[e,t,g]),y=t?.list?.drag?.rule,S=y===void 0?void 0:f?.[y],C=ue({model:e,view:t,field:n,filter:r,fields:v,...S&&{rule:S}}),w=C.rows,T=(0,q.useMemo)(()=>w&&{total:w.length,rowAt:e=>w[e]},[w]);if(y!==void 0&&!S)return(0,Q.jsx)(o,{children:V.rich(`noRule`,{rule:y})});if(C.loading)return(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:Array.from({length:3},(e,t)=>(0,Q.jsx)(O,{className:`h-4 w-full`},t))});if(C.error)return(0,Q.jsx)(E,{title:V(`couldNotLoad`),error:C.error});if(!T||T.total===0)return(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:V(`nothingYet`)});let k=t=>p({kind:`record`,resource:e.name,key:j(e,t)});return(0,Q.jsx)(F,{fit:!0,scroll:`parent`,columns:g,source:T,latencyMs:0,onOpenRow:k,rowLink:t=>({href:m({kind:`record`,resource:e.name,key:j(e,t)}),onFollow:()=>k(t)}),...s&&{sort:s.value,onSortChange:s.onChange},rowNumbers:!1,reorder:{label:n=>D(e,t,n,n.id),onMove:C.move}})},fe=({sorting:e,onChange:t,size:n,iconOnly:r=!1})=>{let i=V(e?`done`:`reorder`);return(0,Q.jsxs)(k,{size:n,variant:e?`primary`:`secondary`,onClick:()=>t(!e),...r&&{"aria-label":i,title:i},children:[e?(0,Q.jsx)(M,{className:`size-3.5`}):(0,Q.jsx)(W,{className:`size-3.5`}),!r&&i]})};export{K as a,oe as i,de as n,se as r,fe as t};
2
+ //# debugId=468282c3-c779-4aeb-9de2-2310809f625e
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{gr as r,sc as i}from"./app-CK_M0TgA.js";import{t as a}from"./workflow-canvas-CZ6QjuM6.js";import{a as o,i as s,n as c}from"./step-panel-CEluX3Jl.js";import{t as l}from"./use-run-trace-2fQX9FeC.js";import{t as u}from"./use-workflow-types-DpNGPeuE.js";import{n as d,t as f}from"./graph-frame-PVfWqgbJ.js";var p=e(t(),1),m=e(n(),1),h=new Map,g=({trace:e,types:t,notice:n,idle:l})=>{let{definition:u,steps:g,going:_,place:v}=e,y=(0,p.useMemo)(()=>v&&o(g,{inProgress:_,...v}),[v,g,_]),[b,x]=(0,p.useState)();if(e.error)return(0,m.jsx)(r,{error:e.error,title:s(`loadFailed`)});if(!e.run||!e.id||!u||!y)return(0,m.jsx)(i,{className:`h-[28rem] w-full max-sm:h-[22rem]`});let S=[...y].filter(([,e])=>e.status===`failed`).map(([e])=>e).sort((e,t)=>t.split(`/`).length-e.split(`/`).length)[0],C=b===void 0?S:b??void 0,w={...e.run,id:e.id,created_at:String(e.run.created_at)};return(0,m.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[!_&&g.length===0&&(0,m.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`noTrace`)}),(0,m.jsx)(f,{canvas:(0,m.jsx)(a,{definition:u,problems:h,selected:C,onSelect:e=>x(e??null),traces:y,...t&&{types:t}}),panel:(0,m.jsxs)(m.Fragment,{children:[n,C===void 0?l??(0,m.jsx)(d,{children:s(`pickNode`)}):(0,m.jsx)(c,{definition:u,run:w,selected:C,...t&&{types:t}})]})})]})},_=({runId:e})=>{let t=l(e),n=u().data;return(0,m.jsx)(g,{trace:t,...n&&{types:n}})};export{_ as RunTrace};
2
- //# debugId=c2f1451f-79b7-4b2d-8c30-d4434fae87c6
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{gr as r,sc as i}from"./app-B8KcM2Z-.js";import{t as a}from"./workflow-canvas-DBlvFI_n.js";import{a as o,i as s,n as c}from"./step-panel-DD821ue5.js";import{t as l}from"./use-run-trace-CRG2_uVq.js";import{t as u}from"./use-workflow-types-Dk4FOVoz.js";import{n as d,t as f}from"./graph-frame-PVfWqgbJ.js";var p=e(t(),1),m=e(n(),1),h=new Map,g=({trace:e,types:t,notice:n,idle:l})=>{let{definition:u,steps:g,going:_,place:v}=e,y=(0,p.useMemo)(()=>v&&o(g,{inProgress:_,...v}),[v,g,_]),[b,x]=(0,p.useState)();if(e.error)return(0,m.jsx)(r,{error:e.error,title:s(`loadFailed`)});if(!e.run||!e.id||!u||!y)return(0,m.jsx)(i,{className:`h-[28rem] w-full max-sm:h-[22rem]`});let S=[...y].filter(([,e])=>e.status===`failed`).map(([e])=>e).sort((e,t)=>t.split(`/`).length-e.split(`/`).length)[0],C=b===void 0?S:b??void 0,w={...e.run,id:e.id,created_at:String(e.run.created_at)};return(0,m.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[!_&&g.length===0&&(0,m.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`noTrace`)}),(0,m.jsx)(f,{canvas:(0,m.jsx)(a,{definition:u,problems:h,selected:C,onSelect:e=>x(e??null),traces:y,...t&&{types:t}}),panel:(0,m.jsxs)(m.Fragment,{children:[n,C===void 0?l??(0,m.jsx)(d,{children:s(`pickNode`)}):(0,m.jsx)(c,{definition:u,run:w,selected:C,...t&&{types:t}})]})})]})},_=({runId:e})=>{let t=l(e),n=u().data;return(0,m.jsx)(g,{trace:t,...n&&{types:n}})};export{_ as RunTrace};
2
+ //# debugId=6dc8f3d4-cadf-47c2-973f-4ba3885cf90c
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Qi as r,el as i,fs as a,ol as o,qs as s,uc as c}from"./app-CK_M0TgA.js";import{t as l}from"./copy-field-B14w71cy.js";var u=e(t(),1),d=i(`app/field-types/runner-install`),f=e(n(),1),p=e=>e instanceof s?e.slug===`runner-registered`?d(`registered`):e.slug===`runner-revoked`?d(`revoked`):e.status===404?d(`notYours`):d(`failed`):d(`failed`),m=({value:e})=>{let t=a(),[n,i]=(0,u.useState)(),[o,s]=(0,u.useState)(!1),[m,h]=(0,u.useState)();if(e===null)return null;let g=async()=>{s(!0),h(void 0),await t.runnerRegistration(e).then(i,e=>h(p(e))),s(!1)};return(0,f.jsxs)(`div`,{className:`grid gap-2`,children:[n&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l,{value:n.command,copyLabel:d(`copy`)}),(0,f.jsx)(`p`,{className:`text-body text-muted-foreground`,children:d(`shownOnce`,{until:r(Date.parse(n.expires_at))})})]}),m&&(0,f.jsx)(`p`,{role:`alert`,className:`text-body text-danger-text`,children:m}),(0,f.jsx)(c,{size:`sm`,variant:n?`secondary`:`primary`,className:`justify-self-start`,loading:o,onClick:()=>void g(),children:d(n?`again`:`issue`)})]})},h={of:[...o.runner_install],display:m,cell:()=>null};export{h as runnerInstallField};
2
- //# debugId=6654b681-b416-4e29-a6f5-f2643ab6d294
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Qi as r,el as i,fs as a,ol as o,qs as s,uc as c}from"./app-B8KcM2Z-.js";import{t as l}from"./copy-field-Ct-6xn8T.js";var u=e(t(),1),d=i(`app/field-types/runner-install`),f=e(n(),1),p=e=>e instanceof s?e.slug===`runner-registered`?d(`registered`):e.slug===`runner-revoked`?d(`revoked`):e.status===404?d(`notYours`):d(`failed`):d(`failed`),m=({value:e})=>{let t=a(),[n,i]=(0,u.useState)(),[o,s]=(0,u.useState)(!1),[m,h]=(0,u.useState)();if(e===null)return null;let g=async()=>{s(!0),h(void 0),await t.runnerRegistration(e).then(i,e=>h(p(e))),s(!1)};return(0,f.jsxs)(`div`,{className:`grid gap-2`,children:[n&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l,{value:n.command,copyLabel:d(`copy`)}),(0,f.jsx)(`p`,{className:`text-body text-muted-foreground`,children:d(`shownOnce`,{until:r(Date.parse(n.expires_at))})})]}),m&&(0,f.jsx)(`p`,{role:`alert`,className:`text-body text-danger-text`,children:m}),(0,f.jsx)(c,{size:`sm`,variant:n?`secondary`:`primary`,className:`justify-self-start`,loading:o,onClick:()=>void g(),children:d(n?`again`:`issue`)})]})},h={of:[...o.runner_install],display:m,cell:()=>null};export{h as runnerInstallField};
2
+ //# debugId=efb8f097-dbca-4c41-bc93-5a6ecda167e8
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Qi as r,Wa as i,Wc as a,Xi as o,Xs as s,Ys as c,cc as l,da as u,el as d,fc as f,qs as p,uc as m}from"./app-CK_M0TgA.js";var h={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]],aliases:[`arrow-up-circle`]};h.node;var g=a(h),_=e=>typeof e==`object`&&!!e&&`error`in e&&typeof e.error==`object`&&e.error!==null&&`code`in e.error&&`message`in e.error,v=async e=>{let t=e.headers.get(`content-type`)?.includes(`json`)??!1?await e.clone().json():void 0;return _(t)?new p({type:`urn:protobase:problem:${t.error.code}`,title:e.statusText||`Request failed`,status:e.status,detail:t.error.message}):s(e)},y=e=>{let t=e.url.replace(/\/+$/,``),n=e.fetch??((e,t)=>fetch(e,t)),r=async(r,i)=>{let a=await e.token(),o=await n(`${t}${r}`,{method:i,headers:{accept:`application/json`,...a&&{authorization:`Bearer ${a}`}}});if(!o.ok)throw await v(o);return await o.json()};return{status:()=>r(``,`GET`),update:()=>r(`/update`,`POST`)}},b=e(t(),1),x=d(`app/runtime`),S=e=>!!(e?.updateAvailable&&e.indicator),C=e=>e?5e3:18e5,w=(e,t)=>{if(!e.updateStage)return x(`updatingNow`);let n=x(e.updateStage);if(!e.updateStartedAt)return n;let r=Math.max(0,Math.floor((t-Date.parse(e.updateStartedAt))/1e3));return x(`started`,{stage:n,ago:o(r)})},T=(e,t=Date.now(),n=u())=>e.updating?w(e,t):e.nextUpdateAt?x(`nextOn`,{policy:x(e.policy),when:r(Date.parse(e.nextUpdateAt),n)}):x(e.policy),E=(e,t=u())=>{let n=r(Date.parse(e.finishedAt),t),i=x(e.outcome,{version:e.toVersion,when:n});return e.message?`${i}: ${e.message}`:`${i}.`},D=e=>c(e)&&e.status<500&&e.problem.detail?e.problem.detail:c(e)&&e.status===409?x(`alreadyLatest`):c(e)&&e.status===403?x(`onlyAdmin`):x(`couldNotStart`),O=e(n(),1),k=({label:e,value:t})=>(0,O.jsxs)(`div`,{className:`flex justify-between gap-4 py-1`,children:[(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,O.jsx)(`span`,{className:`font-medium tabular-nums`,children:t})]}),A=({status:e,requesting:t,error:n,checkError:r,onUpdate:i,onClose:a})=>{let o=e.updating?void 0:e.lastUpdate;return(0,O.jsxs)(l,{title:x(`runtimeUpdate`),description:e.updating?(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,O.jsx)(f,{className:`size-3.5`}),T(e)]}):T(e),onClose:a,actions:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(m,{onClick:a,children:x(`close`)}),(0,O.jsx)(m,{variant:`primary`,loading:t,disabled:e.updating||!e.updateAvailable,onClick:i,children:e.updating?x(`updating`):x(`updateNow`)})]}),children:[(0,O.jsx)(k,{label:x(`currentVersion`),value:e.version}),(0,O.jsx)(k,{label:x(`latestVersion`),value:e.latest}),o&&(0,O.jsx)(`p`,{className:o.outcome===`failed`?`mt-3 text-danger-text`:`mt-3 text-muted-foreground`,children:E(o)}),n!==void 0&&(0,O.jsx)(`p`,{role:`alert`,className:`mt-3 text-danger-text`,children:D(n)}),r!==void 0&&(0,O.jsx)(`p`,{className:`mt-3 text-muted-foreground`,children:x(`checkFailed`)})]})},j=e=>{let t=i(),n=(0,b.useRef)(t);n.current=t;let r=t!==void 0;return(0,b.useMemo)(()=>r?y({url:e,token:()=>n.current}):void 0,[e,r])},M=e=>{let[t,n]=(0,b.useState)(),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(),[s,c]=(0,b.useState)(),l=t?.updating??!1;return(0,b.useEffect)(()=>{if(!e)return;let t=!0,r=()=>e.status().then(e=>{t&&(n(e),c(void 0))},e=>t&&c(e));r();let i=setInterval(()=>void r(),C(l));return()=>{t=!1,clearInterval(i)}},[e,l]),{status:t,update:(0,b.useCallback)(async()=>{e&&(i(!0),o(void 0),await e.update().then(n,o),i(!1))},[e]),requesting:r,error:a,checkError:s}},N=({client:e})=>{let{status:t,update:n,requesting:r,error:i,checkError:a}=M(e),[o,s]=(0,b.useState)(!1);return!t||!o&&!S(t)?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(m,{size:`sm`,variant:`ghost`,"aria-label":x(`updateAvailable`),title:x(`updateAvailable`),onClick:()=>s(!0),className:`max-md:size-9 max-md:p-0`,children:[(0,O.jsx)(g,{className:`size-3.5 text-primary`}),(0,O.jsx)(`span`,{className:`max-md:sr-only`,children:x(`update`)})]}),o&&(0,O.jsx)(A,{status:t,requesting:r,error:i,checkError:a,onUpdate:()=>void n(),onClose:()=>s(!1)})]})},P=({url:e})=>(0,O.jsx)(N,{client:j(e)}),F=({url:e,client:t})=>t?(0,O.jsx)(N,{client:t}):(0,O.jsx)(P,{url:e});export{F as RuntimeUpdateButton};
2
- //# debugId=93b0cf05-0675-4b72-967d-b9878e9f6d60
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Qi as r,Wa as i,Wc as a,Xi as o,Xs as s,Ys as c,cc as l,da as u,el as d,fc as f,qs as p,uc as m}from"./app-B8KcM2Z-.js";var h={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]],aliases:[`arrow-up-circle`]};h.node;var g=a(h),_=e=>typeof e==`object`&&!!e&&`error`in e&&typeof e.error==`object`&&e.error!==null&&`code`in e.error&&`message`in e.error,v=async e=>{let t=e.headers.get(`content-type`)?.includes(`json`)??!1?await e.clone().json():void 0;return _(t)?new p({type:`urn:protobase:problem:${t.error.code}`,title:e.statusText||`Request failed`,status:e.status,detail:t.error.message}):s(e)},y=e=>{let t=e.url.replace(/\/+$/,``),n=e.fetch??((e,t)=>fetch(e,t)),r=async(r,i)=>{let a=await e.token(),o=await n(`${t}${r}`,{method:i,headers:{accept:`application/json`,...a&&{authorization:`Bearer ${a}`}}});if(!o.ok)throw await v(o);return await o.json()};return{status:()=>r(``,`GET`),update:()=>r(`/update`,`POST`)}},b=e(t(),1),x=d(`app/runtime`),S=e=>!!(e?.updateAvailable&&e.indicator),C=e=>e?5e3:18e5,w=(e,t)=>{if(!e.updateStage)return x(`updatingNow`);let n=x(e.updateStage);if(!e.updateStartedAt)return n;let r=Math.max(0,Math.floor((t-Date.parse(e.updateStartedAt))/1e3));return x(`started`,{stage:n,ago:o(r)})},T=(e,t=Date.now(),n=u())=>e.updating?w(e,t):e.nextUpdateAt?x(`nextOn`,{policy:x(e.policy),when:r(Date.parse(e.nextUpdateAt),n)}):x(e.policy),E=(e,t=u())=>{let n=r(Date.parse(e.finishedAt),t),i=x(e.outcome,{version:e.toVersion,when:n});return e.message?`${i}: ${e.message}`:`${i}.`},D=e=>c(e)&&e.status<500&&e.problem.detail?e.problem.detail:c(e)&&e.status===409?x(`alreadyLatest`):c(e)&&e.status===403?x(`onlyAdmin`):x(`couldNotStart`),O=e(n(),1),k=({label:e,value:t})=>(0,O.jsxs)(`div`,{className:`flex justify-between gap-4 py-1`,children:[(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,O.jsx)(`span`,{className:`font-medium tabular-nums`,children:t})]}),A=({status:e,requesting:t,error:n,checkError:r,onUpdate:i,onClose:a})=>{let o=e.updating?void 0:e.lastUpdate;return(0,O.jsxs)(l,{title:x(`runtimeUpdate`),description:e.updating?(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,O.jsx)(f,{className:`size-3.5`}),T(e)]}):T(e),onClose:a,actions:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(m,{onClick:a,children:x(`close`)}),(0,O.jsx)(m,{variant:`primary`,loading:t,disabled:e.updating||!e.updateAvailable,onClick:i,children:e.updating?x(`updating`):x(`updateNow`)})]}),children:[(0,O.jsx)(k,{label:x(`currentVersion`),value:e.version}),(0,O.jsx)(k,{label:x(`latestVersion`),value:e.latest}),o&&(0,O.jsx)(`p`,{className:o.outcome===`failed`?`mt-3 text-danger-text`:`mt-3 text-muted-foreground`,children:E(o)}),n!==void 0&&(0,O.jsx)(`p`,{role:`alert`,className:`mt-3 text-danger-text`,children:D(n)}),r!==void 0&&(0,O.jsx)(`p`,{className:`mt-3 text-muted-foreground`,children:x(`checkFailed`)})]})},j=e=>{let t=i(),n=(0,b.useRef)(t);n.current=t;let r=t!==void 0;return(0,b.useMemo)(()=>r?y({url:e,token:()=>n.current}):void 0,[e,r])},M=e=>{let[t,n]=(0,b.useState)(),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(),[s,c]=(0,b.useState)(),l=t?.updating??!1;return(0,b.useEffect)(()=>{if(!e)return;let t=!0,r=()=>e.status().then(e=>{t&&(n(e),c(void 0))},e=>t&&c(e));r();let i=setInterval(()=>void r(),C(l));return()=>{t=!1,clearInterval(i)}},[e,l]),{status:t,update:(0,b.useCallback)(async()=>{e&&(i(!0),o(void 0),await e.update().then(n,o),i(!1))},[e]),requesting:r,error:a,checkError:s}},N=({client:e})=>{let{status:t,update:n,requesting:r,error:i,checkError:a}=M(e),[o,s]=(0,b.useState)(!1);return!t||!o&&!S(t)?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(m,{size:`sm`,variant:`ghost`,"aria-label":x(`updateAvailable`),title:x(`updateAvailable`),onClick:()=>s(!0),className:`max-md:size-9 max-md:p-0`,children:[(0,O.jsx)(g,{className:`size-3.5 text-primary`}),(0,O.jsx)(`span`,{className:`max-md:sr-only`,children:x(`update`)})]}),o&&(0,O.jsx)(A,{status:t,requesting:r,error:i,checkError:a,onUpdate:()=>void n(),onClose:()=>s(!1)})]})},P=({url:e})=>(0,O.jsx)(N,{client:j(e)}),F=({url:e,client:t})=>t?(0,O.jsx)(N,{client:t}):(0,O.jsx)(P,{url:e});export{F as RuntimeUpdateButton};
2
+ //# debugId=1ee7a4a9-bfef-4447-ab64-8a737dc6fbd7
@@ -1 +1 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{$ as e,$t as t,Ao as n,At as r,B as ee,Bn as te,Br as i,Bt as a,Co as o,Cr as s,Ct as c,Dr as l,Dt as u,Er as d,Et as f,Fo as p,Ft as m,G as h,Gi as g,H as _,Hi as v,Ht as y,Ia as b,Ir as x,It as S,Jc as C,Ji as w,K as T,Kc as E,Ki as D,Lr as O,Lt as k,Ma as A,Mo as j,Mr as M,Mt as N,N as P,Na as F,No as I,Nr as L,Nt as R,P as z,Po as B,Pt as V,Q as H,Qc as U,R as W,Rr as G,Sr as K,St as q,Tn as J,Tt as Y,U as X,Ua as Z,Ui as Q,Ut as ne,V as re,Va as ie,Vo as ae,Vt as oe,W as se,Wa as ce,Wi as le,Wt as ue,X as de,Xc as fe,Xt as pe,Yc as me,Yi as he,Yt as ge,Zc as _e,Zt as ve,_r as $,_t as ye,ac as be,bt as xe,cc as Se,cr as Ce,dc as we,do as Te,ds as Ee,dt as De,en as Oe,et as ke,fc as Ae,fs as je,ft as Me,go as Ne,gt as Pe,ho as Fe,ht as Ie,it as Le,jr as Re,lo as ze,ma as Be,mt as Ve,n as He,nt as Ue,ot as We,ps as Ge,pt as Ke,qc as qe,qi as Je,qt as Ye,r as Xe,rt as Ze,t as Qe,tl as $e,tt as et,uc as tt,uo as nt,us as rt,ut as it,vo as at,vr as ot,vt as st,wr as ct,wt as lt,xo as ut,xr as dt,xt as ft,yo as pt,yr as mt,yt as ht,z as gt,zr as _t}from"./app-CK_M0TgA.js";import{h as vt,o as yt}from"./vendor-t7Q7QbPu.js";export{q as ActionCard,ct as ActionInputError,Ee as ApiProvider,O as App,_t as AppLink,B as AppMark,Me as AssistantDock,Te as AuthLayout,at as AvailabilityMark,tt as Button,a as CallMark,ue as CallView,T as Carousel,V as ChatDivider,R as ChatMessage,N as ChatThread,gt as Choices,ze as CodeForm,xe as CompactTable,lt as Composer,Se as Dialog,ye as DiffView,W as Field,ve as FieldBadge,ft as FieldList,ot as FileReadError,e as FocusActions,ke as FocusNotice,Le as FocusPage,et as FocusPanel,Ue as FocusSlot,P as Form,K as HtmlFrame,He as InPlaceForm,n as Input,p as LogoMark,J as Markdown,f as MentionBox,Y as MentionedText,ee as MenuSelect,ut as MenuSurface,Fe as OtpInput,Ve as PartView,y as RecordCall,Ye as RecordLink,Qe as RecordPicker,nt as ResendCodeButton,D as ResponsiveDialog,be as RouteLink,de as SearchPicker,z as Section,o as Segmented,re as Select,c as SidePanel,k as SignInPrompt,Ae as Spinner,pt as StatusMark,Ie as StepList,te as Textarea,pe as ToneEdge,_ as allowDelayMs,we as buttonClass,m as chatDayLabel,ae as closeSidebarEvent,A as definePlugin,F as defineUi,st as diffStats,u as emptyDraft,qe as extensionPointsOf,s as fileNamed,d as isConflict,X as isFramed,I as logoTapEvent,r as mentionedIds,me as mergeUi,ht as parseDiff,Pe as parsePatch,_e as pluginApi,E as pluginsChangedEvent,U as protobaseVersion,S as sameChatDay,$e as showTextsIn,dt as siblingPage,Ne as signedOutEvent,Q as statusRefreshMs,fe as uiFromModule,G as uiReadyEvent,ce as useApiToken,i as useAppAddress,se as useArmedAfterFocus,De as useAssistant,it as useAssistantClient,Ke as useBackendData,je as useClient,t as useComponentReads,Oe as useComponentSelect,Xe as useCreateForm,Re as useFacets,j as useFieldControl,mt as useFileText,We as useFocusPage,H as useFocusRecord,Ze as useFocusZoneFilled,h as useGuardedPress,M as useHistogram,Je as useInbox,Ce as useLayoutRecord,x as useList,ge as useListDisplay,w as useMarkNotificationsRead,v as useMembers,rt as useMeta,le as useOwnStatus,C as usePlugin,b as usePresence,Be as usePushNotifications,yt as useQuery,vt as useQueryClient,ie as useRecord,ne as useRecordCallAddress,oe as useRecordCalls,Ge as useResourceClient,L as useSeries,$ as useSiblingPage,Z as useSignedInUser,g as useStatuses,he as useUnreadNotifications,l as useUpdateRecord};
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{$ as e,$t as t,Ao as n,At as r,B as ee,Bn as te,Br as i,Bt as a,Co as o,Cr as s,Ct as c,Dr as l,Dt as u,Er as d,Et as f,Fo as p,Ft as m,G as h,Gi as g,H as _,Hi as v,Ht as y,Ia as b,Ir as x,It as S,Jc as C,Ji as w,K as T,Kc as E,Ki as D,Lr as O,Lt as k,Ma as A,Mo as j,Mr as M,Mt as N,N as P,Na as F,No as I,Nr as L,Nt as R,P as z,Po as B,Pt as V,Q as H,Qc as U,R as W,Rr as G,Sr as K,St as q,Tn as J,Tt as Y,U as X,Ua as Z,Ui as Q,Ut as ne,V as re,Va as ie,Vo as ae,Vt as oe,W as se,Wa as ce,Wi as le,Wt as ue,X as de,Xc as fe,Xt as pe,Yc as me,Yi as he,Yt as ge,Zc as _e,Zt as ve,_r as $,_t as ye,ac as be,bt as xe,cc as Se,cr as Ce,dc as we,do as Te,ds as Ee,dt as De,en as Oe,et as ke,fc as Ae,fs as je,ft as Me,go as Ne,gt as Pe,ho as Fe,ht as Ie,it as Le,jr as Re,lo as ze,ma as Be,mt as Ve,n as He,nt as Ue,ot as We,ps as Ge,pt as Ke,qc as qe,qi as Je,qt as Ye,r as Xe,rt as Ze,t as Qe,tl as $e,tt as et,uc as tt,uo as nt,us as rt,ut as it,vo as at,vr as ot,vt as st,wr as ct,wt as lt,xo as ut,xr as dt,xt as ft,yo as pt,yr as mt,yt as ht,z as gt,zr as _t}from"./app-B8KcM2Z-.js";import{h as vt,o as yt}from"./vendor-t7Q7QbPu.js";export{q as ActionCard,ct as ActionInputError,Ee as ApiProvider,O as App,_t as AppLink,B as AppMark,Me as AssistantDock,Te as AuthLayout,at as AvailabilityMark,tt as Button,a as CallMark,ue as CallView,T as Carousel,V as ChatDivider,R as ChatMessage,N as ChatThread,gt as Choices,ze as CodeForm,xe as CompactTable,lt as Composer,Se as Dialog,ye as DiffView,W as Field,ve as FieldBadge,ft as FieldList,ot as FileReadError,e as FocusActions,ke as FocusNotice,Le as FocusPage,et as FocusPanel,Ue as FocusSlot,P as Form,K as HtmlFrame,He as InPlaceForm,n as Input,p as LogoMark,J as Markdown,f as MentionBox,Y as MentionedText,ee as MenuSelect,ut as MenuSurface,Fe as OtpInput,Ve as PartView,y as RecordCall,Ye as RecordLink,Qe as RecordPicker,nt as ResendCodeButton,D as ResponsiveDialog,be as RouteLink,de as SearchPicker,z as Section,o as Segmented,re as Select,c as SidePanel,k as SignInPrompt,Ae as Spinner,pt as StatusMark,Ie as StepList,te as Textarea,pe as ToneEdge,_ as allowDelayMs,we as buttonClass,m as chatDayLabel,ae as closeSidebarEvent,A as definePlugin,F as defineUi,st as diffStats,u as emptyDraft,qe as extensionPointsOf,s as fileNamed,d as isConflict,X as isFramed,I as logoTapEvent,r as mentionedIds,me as mergeUi,ht as parseDiff,Pe as parsePatch,_e as pluginApi,E as pluginsChangedEvent,U as protobaseVersion,S as sameChatDay,$e as showTextsIn,dt as siblingPage,Ne as signedOutEvent,Q as statusRefreshMs,fe as uiFromModule,G as uiReadyEvent,ce as useApiToken,i as useAppAddress,se as useArmedAfterFocus,De as useAssistant,it as useAssistantClient,Ke as useBackendData,je as useClient,t as useComponentReads,Oe as useComponentSelect,Xe as useCreateForm,Re as useFacets,j as useFieldControl,mt as useFileText,We as useFocusPage,H as useFocusRecord,Ze as useFocusZoneFilled,h as useGuardedPress,M as useHistogram,Je as useInbox,Ce as useLayoutRecord,x as useList,ge as useListDisplay,w as useMarkNotificationsRead,v as useMembers,rt as useMeta,le as useOwnStatus,C as usePlugin,b as usePresence,Be as usePushNotifications,yt as useQuery,vt as useQueryClient,ie as useRecord,ne as useRecordCallAddress,oe as useRecordCalls,Ge as useResourceClient,L as useSeries,$ as useSiblingPage,Z as useSignedInUser,g as useStatuses,he as useUnreadNotifications,l as useUpdateRecord};
@@ -1,3 +1,3 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Gc as r,Ql as i,Wc as a,Xl as o,Ys as s,dl as c,fc as l,fl as u,gr as d,j as f,jc as p,nl as m,rl as h,so as g,uc as _,vi as ee}from"./app-CK_M0TgA.js";import{c as v,d as y,l as te,o as b,u as x}from"./list-page-aYSJ3PHa.js";var S={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};S.node;var ne=a(S),C=e(t(),1),w=e(n(),1),re=e=>/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e,ie=(e,t)=>{let n=[...t].sort((e,t)=>e.line-t.line).map(t=>[...e.map((e,n)=>b(t.cells[n]??null)),String(t.line),t.problems.join(`; `)]);return`${[[...e,y(`line`),y(`problems`)],...n].map(e=>e.map(re).join(`,`)).join(`\r
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Gc as r,Ql as i,Wc as a,Xl as o,Ys as s,dl as c,fc as l,fl as u,gr as d,j as f,jc as p,nl as m,rl as h,so as g,uc as _,vi as ee}from"./app-B8KcM2Z-.js";import{c as v,d as y,l as te,o as b,u as x}from"./list-page-D3nIEwGf.js";var S={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};S.node;var ne=a(S),C=e(t(),1),w=e(n(),1),re=e=>/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e,ie=(e,t)=>{let n=[...t].sort((e,t)=>e.line-t.line).map(t=>[...e.map((e,n)=>b(t.cells[n]??null)),String(t.line),t.problems.join(`; `)]);return`${[[...e,y(`line`),y(`problems`)],...n].map(e=>e.map(re).join(`,`)).join(`\r
2
2
  `)}\r\n`},T=({label:e,counts:t})=>(0,w.jsx)(`dl`,{"aria-label":e,className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:t.map(([e,t])=>(0,w.jsxs)(`div`,{className:`rounded-lg border px-3 py-2`,children:[(0,w.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:e}),(0,w.jsx)(`dd`,{className:`text-lg font-semibold tabular-nums`,children:t.toLocaleString(h())})]},e))}),E=(e,t)=>e?.fields[t]?.label??u(t),ae=new Set([`text`,`integer`,`bigint`,`decimal`,`boolean`,`date`,`timestamp`,`uuid`,`enum`,`relation`,`currency`,`country`]),D=(e,t)=>{let n=e.relation?t[e.relation.resource]:void 0;return n?.primaryKey.length===1?n:void 0},oe=(e,t,{json:n=!1}={})=>Object.values(e.fields).filter(r=>r.readOnly||r.name===e.tenant?!1:r.type===`json`?n:ae.has(r.type)?r.type!==`relation`||D(r,t)!==void 0:!1),se=new Set([`text`,`integer`,`bigint`,`uuid`,`date`,`currency`,`country`,`enum`]),ce=e=>{let t=e.primaryKey.length===1?[e.fields[e.primaryKey[0]]]:[],n=Object.values(e.fields).filter(t=>t.filterable&&!t.sensitive&&se.has(t.type)&&!e.primaryKey.includes(t.name));return[...t,...n]},O=(e,t)=>D(e,t),k=e=>!e.nullable&&!e.default,A=e=>e.toLowerCase().replace(/[\s_-]+/g,``),le=(e,t,n)=>{let r=new Set;return e.flatMap((e,i)=>{let a=A(e);if(a===``)return[];let o=t.find(e=>!r.has(e.name)&&(A(E(n,e.name))===a||A(e.name)===a));return o?(r.add(o.name),[{column:i,field:o.name}]):[]})},ue=(e,t,n)=>{if(e===`update`)return[];let r=new Set(n.map(e=>e.field));return t.filter(e=>k(e)&&!r.has(e.name))},j=e=>({ok:!0,value:e}),M=e=>({ok:!1,problem:e}),N=e=>`“${b(e)}”`,P=(e,t)=>{if(typeof e==`number`)return String(e);if(typeof e==`string`)return f(e,t.decimal)},de=(e,t,n)=>{let r=P(t,n);if(r===void 0)return M(y(`notNumber`,{cell:N(t)}));let[i,a=``]=r.split(`.`);if(/[1-9]/.test(a)||/e/i.test(r))return M(y(`notWholeNumber`,{cell:N(t)}));if(e.type===`bigint`)return j(String(BigInt(i)));let o=Number(i);return Number.isSafeInteger(o)?j(o):M(y(`tooLarge`,{cell:N(t)}))},fe=(e,t)=>{let n=P(e,t);return n===void 0?M(y(`notNumber`,{cell:N(e)})):j(n)},pe=new Set([`true`,`yes`,`1`]),me=new Set([`false`,`no`,`0`]),he=e=>{if(typeof e==`boolean`)return j(e);let t=typeof e==`string`||typeof e==`number`?String(e).trim().toLowerCase():``;return pe.has(t)?j(!0):me.has(t)?j(!1):M(y(`notBoolean`,{cell:N(e)}))},F=e=>String(e).padStart(2,`0`),ge=(e,t,n)=>{let r=new Date(Date.UTC(e,t-1,n));if(r.getUTCFullYear()===e&&r.getUTCMonth()===t-1&&r.getUTCDate()===n)return`${e}-${F(t)}-${F(n)}`},I=`(\\d{1,2}):(\\d{2})(?::(\\d{2})(?:\\.\\d+)?)?`,L=(e,t)=>{let n=RegExp(`^(\\d{4})[-/](\\d{1,2})[-/](\\d{1,2})(?:[T ]${I}(Z|[+-]\\d{2}:?\\d{2})?)?$`).exec(e.trim()),r=RegExp(`^(\\d{1,2})[./-](\\d{1,2})[./-](\\d{4})(?: ${I})?$`).exec(e.trim());if(!n&&!r)return;let[i,a,o]=n?[n[1],n[2],n[3]].map(Number):t===`dmy`?[r[3],r[2],r[1]].map(Number):[r[3],r[1],r[2]].map(Number),s=ge(i,a,o);if(!s)return;let[c,l,u=`0`]=n?n.slice(4,7):r.slice(4,7);if(c===void 0)return{date:s};if(!(Number(c)>23||Number(l)>59||Number(u)>59))return{date:s,time:`${F(Number(c))}:${l}:${F(Number(u))}`,zone:n?.[7]}},R=(e,t)=>{if(te(e)){let[t,n]=e.date.split(`T`);return{date:t,time:n}}return typeof e==`string`?L(e,t.dateOrder):void 0},z=(e,t)=>M(y(`notDate`,{cell:N(e),dayFirst:t.dateOrder===`dmy`})),_e=(e,t)=>{let n=R(e,t);return n?n.time&&n.time!==`00:00:00`?M(y(`hasTime`,{cell:N(e)})):j(n.date):z(e,t)},ve=(e,t)=>{let n=R(e,t);if(!n)return z(e,t);if(n.zone)return j(new Date(`${n.date}T${n.time}${n.zone===`Z`?`Z`:n.zone.replace(/^([+-]\d{2})(\d{2})$/,`$1:$2`)}`).toISOString());let[r,i,a]=n.date.split(`-`).map(Number),[o,s,c]=(n.time??`00:00:00`).split(`:`).map(Number);return j(new Date(r,i-1,a,o,s,c).toISOString())},B=e=>e.trim().toLowerCase().replace(/\s+/g,` `),ye=(e,t,n)=>{let r=e.enumValues??[],i=B(b(n)),a=r.filter(e=>B(e)===i||B(c(e,t?.valueLabels))===i);return a.length===1?j(a[0]):a.length>1?M(y(`severalValues`,{cell:N(n),values:a.map(e=>c(e,t?.valueLabels)).join(`, `)})):M(y(`notOneOf`,{cell:N(n),values:r.map(e=>c(e,t?.valueLabels)).join(`, `)}))},be=(e,t)=>typeof e==`boolean`&&!t.booleanText?M(y(`notText`,{cell:N(e)})):j(b(e)),xe=e=>x(e)?j(e.json):j(e),V=(e,t,n,r)=>{if(v(n))return e.nullable?j(null):M(y(`emptyRequired`));if(e.type===`json`)return xe(n);if(x(n))return M(y(`nestedValue`,{cell:N(n)}));switch(e.type){case`integer`:case`bigint`:return de(e,n,r);case`decimal`:return fe(n,r);case`boolean`:return he(n);case`date`:return _e(n,r);case`timestamp`:return ve(n,r);case`enum`:return ye(e,t,n);case`text`:case`uuid`:case`currency`:case`country`:return be(n,r);default:throw Error(`Not implemented: importing ${e.type} fields, which importableFields leaves out`)}},Se=(e,t)=>e[t]?.names?.singular??u(t),Ce=(e,t)=>e[t]?.names?.plural??u(t),we=(e,t,n)=>{let{model:r,resources:i,views:a}=n,o=a[r.name],s={},c={},l=[],u=[];for(let{column:n,field:d,matchBy:f}of t.columns){let p=r.fields[d],m=e.cells[n]??null,h=E(o,d),g=O(p,i);if(g&&!v(m)){let e=f??g.primaryKey[0],n=V(g.fields[e],a[g.name]?.fields[e],m,t.options);n.ok?u.push({field:d,finding:{model:g,field:e,value:n.value}}):l.push(`${h}: ${n.problem}`),s[d]=b(m);continue}let _=V(p,o?.fields[d],m,t.options);_.ok?c[d]=s[d]=_.value:l.push(`${h}: ${_.problem}`)}let d;if(t.match&&t.mode!==`create`){let n=r.fields[t.match.field],i=V({...n,nullable:!1},o?.fields[n.name],e.cells[t.match.column]??null,t.options);i.ok?d={model:r,field:n.name,value:i.value}:l.push(`${E(o,n.name)}: ${i.problem}`)}return{values:s,data:c,problems:l,relations:u,match:d}},H=(e,t)=>{let n=e.lookups.keysOf(t.model.name,t.field,t.value),r=`${E(e.views[t.model.name],t.field).toLowerCase()} “${String(t.value)}”`;return n.length===1?{key:n[0]}:n.length===0?{none:y(`noneHas`,{singular:Se(e.views,t.model.name),named:r})}:{several:y(`severalHave`,{count:n.length,plural:Ce(e.views,t.model.name),named:r})}},Te=e=>e.cells.every(v),U=async(e,t,n)=>{let{model:r,views:i}=n,a=e.filter(e=>!Te(e)).map(e=>({row:e,...we(e,t,n)})),o=new Map;for(let e of a.flatMap(e=>[...e.relations.map(e=>e.finding),...e.match?[e.match]:[]])){let t=`${e.model.name}.${e.field}`;o.has(t)||o.set(t,{model:e.model,field:e.field,values:[]}),o.get(t).values.push(e.value)}for(let{model:e,field:t,values:r}of o.values())await n.lookups.load(e,t,r);return a.map(({row:e,values:a,data:o,problems:s,relations:c,match:l})=>{let u={...o};for(let{field:e,finding:t}of c){let a=H(n,t);`key`in a?u[e]=a.key:s.push(`${E(i[r.name],e)}: ${a.none??a.several}`)}let d=l&&H(n,l);d?.several&&s.push(y(`notOneRecord`,{found:d.several})),d?.none&&t.mode===`update`&&s.push(y(`nothingToUpdate`,{found:d.none}));let f={line:e.line,cells:e.cells,values:a,problems:s};return s.length>0?f:d&&`key`in d?{...f,op:{op:`update`,resource:r.name,key:d.key,etag:`*`,data:u}}:{...f,op:{op:`create`,resource:r.name,data:u}}})},Ee=5,De=5,Oe=async(e,t)=>{let n=e.rows(t),{value:r=[]}=await n.next();await n.return(void 0);let[i,...a]=r;return{headers:(i?.cells??[]).map(b),sample:a.slice(0,Ee)}};async function*W(e,t){let n=!0;for await(let r of e.rows(t))yield n?r.slice(1):r,n=!1}var ke=async(e,t,n,r,i,a)=>{let o={rows:0,creates:0,updates:0,problems:[],preview:[]};for await(let s of W(e,t)){a?.throwIfAborted();for(let e of await U(s,n,r))o.rows++,o.preview.length<De&&o.preview.push(e),e.op?.op===`create`?o.creates++:e.op?.op===`update`?o.updates++:o.problems.push({line:e.line,cells:e.cells,problems:e.problems});i(o.rows)}return o},Ae=(e,t)=>{if(!s(e))return[e.message];let n=e.errors.filter(e=>e.field);return n.length===0?[e.message]:n.map(e=>`${E(t.views[t.model.name],e.field)}: ${e.message}`)},je=async(e,t,n,r,{client:i,onProgress:a,cancelled:o})=>{let c={created:0,updated:0,skipped:0,failed:0,notWritten:[]},l=async e=>{let t=[...e];for(;t.length>0;){let e=t.map(e=>e.op);try{let{results:t}=await i.batchWrite(e);for(let e of t)e.op===`create`?c.created++:e.op===`update`&&c.updated++;return}catch(e){let n=s(e)?e.operation:void 0;if(n===void 0||!t[n])throw e;let[i]=t.splice(n,1);c.failed++,c.notWritten.push({line:i.line,cells:i.cells,problems:Ae(e,r)})}}},u=[],d=async e=>{for(;u.length>=100||e&&u.length>0;){if(o())return!1;await l(u.splice(0,100)),a({...c})}return!0};for await(let i of W(e,t)){for(let e of await U(i,n,r))e.op?u.push(e):(c.skipped++,c.notWritten.push({line:e.line,cells:e.cells,problems:e.problems}));if(!await d(!1))return{...c,cancelled:!0}}return await d(!0)?{...c,cancelled:!1}:{...c,cancelled:!0}},G=50,K=(e,t,n)=>g(ie(t,n),y(`notImportedFile`,{name:(e??`import`).replace(/\.[^.]+$/,``)}),`text/csv`),q=({rows:e})=>(0,w.jsxs)(`ul`,{"aria-label":y(`rowsNotImported`),className:`flex flex-col gap-1 text-body`,children:[e.slice(0,G).map(e=>(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`span`,{className:`font-medium`,children:y(`rowProblems`,{line:e.line})}),` `,e.problems.join(`; `)]},e.line)),e.length>G&&(0,w.jsx)(`li`,{className:`text-muted-foreground`,children:y(`andMore`,{count:(e.length-G).toLocaleString(h())})})]}),Me=({rows:e})=>(0,w.jsxs)(`p`,{className:`flex items-center gap-2 text-muted-foreground`,role:`status`,children:[(0,w.jsx)(l,{className:`size-3.5`}),y(`checkingRows`,{count:e.toLocaleString(h())})]}),Ne=({check:e,model:t,resources:n,views:r,columns:i,headers:a,fileName:o})=>{let s=r[t.name],c=i.map(e=>t.fields[e.field]);return(0,w.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,w.jsx)(T,{label:y(`check`),counts:[[y(`rows`),e.rows],[y(`toCreate`),e.creates],[y(`toUpdate`),e.updates],[y(`withProblems`),e.problems.length]]}),e.preview.length>0&&(0,w.jsx)(`div`,{className:`overflow-x-auto rounded-lg border`,children:(0,w.jsxs)(`table`,{"aria-label":y(`firstRows`),className:`w-full text-left text-body`,children:[(0,w.jsx)(`thead`,{className:`bg-muted text-muted-foreground`,children:(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`th`,{className:`px-2 py-1.5 font-medium`,children:y(`row`)}),c.map(e=>(0,w.jsx)(`th`,{className:`whitespace-nowrap px-2 py-1.5 font-medium`,children:E(s,e.name)},e.name))]})}),(0,w.jsx)(`tbody`,{className:`divide-y`,children:e.preview.map(e=>(0,w.jsxs)(`tr`,{className:e.problems.length>0?`bg-danger-soft`:void 0,children:[(0,w.jsx)(`td`,{className:`px-2 py-1.5 tabular-nums text-muted-foreground`,children:e.line}),c.map(t=>(0,w.jsx)(`td`,{className:`max-w-48 truncate px-2 py-1.5`,children:O(t,n)?String(e.values[t.name]??`—`):t.name in e.values?ee(t,e.values[t.name],s?.fields[t.name]):``},t.name))]},e.line))})]})}),e.problems.length>0&&(0,w.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,w.jsx)(`h3`,{className:`font-medium`,children:y(`problemRows`)}),(0,w.jsxs)(_,{size:`sm`,onClick:()=>K(o,a,e.problems),children:[(0,w.jsx)(p,{className:`size-3.5`}),y(`download`)]})]}),(0,w.jsx)(q,{rows:e.problems})]}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:y(`batches`,{size:100})})]})},Pe=[`.xlsx`,`.csv`,`.json`],Fe=[`text/csv`,`application/json`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`],Ie=[`text/comma-separated-values`,`application/csv`,`text/x-csv`,`application/vnd.ms-excel`,`text/plain`,`application/octet-stream`],Le=e=>/\bAndroid\b/.test(e),Re=e=>[...Pe,...Fe,...Le(e)?Ie:[]].join(`,`),J=({label:e,name:t,value:n,options:i,onChange:a,help:o,className:s})=>{let c=(0,C.useId)();return(0,w.jsxs)(`div`,{className:r(`flex min-w-0 flex-col gap-1.5`,s),children:[(0,w.jsx)(`label`,{htmlFor:c,className:`font-medium`,children:e}),(0,w.jsx)(`select`,{id:c,"aria-label":t,value:n,onChange:e=>a(e.target.value),className:`h-8 w-full min-w-0 rounded-md border border-border-strong bg-background px-2 shadow-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20 max-sm:min-h-11`,children:i.map(e=>(0,w.jsx)(`option`,{value:e.value,children:e.label},e.value))}),o&&(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o})]})},Y=({file:e,sheets:t,sheet:n,reading:r,onChoose:i,onSheet:a})=>{let o=(0,C.useId)();return(0,w.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,w.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,w.jsx)(`label`,{htmlFor:o,className:`font-medium`,children:y(`file`)}),(0,w.jsx)(`input`,{id:o,type:`file`,accept:Re(globalThis.navigator?.userAgent??``),disabled:r,onChange:e=>{let t=e.target.files?.[0];t&&i(t)},className:`file:mr-3 file:h-8 file:rounded-md file:border file:border-border-strong file:bg-background file:px-3 file:font-medium file:text-foreground max-sm:file:min-h-11`}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:y(`fileHint`)})]}),r&&(0,w.jsxs)(`p`,{className:`flex items-center gap-2 text-muted-foreground`,role:`status`,children:[(0,w.jsx)(l,{className:`size-3.5`}),y(`reading`,{name:e?.name??y(`theFile`)})]}),!r&&t.length>1&&(0,w.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,w.jsx)(ne,{className:`mb-2 size-4 shrink-0 text-muted-foreground`}),(0,w.jsx)(J,{className:`flex-1`,label:y(`sheet`),value:n??``,options:t.map(e=>({value:e,label:e})),onChange:a})]})]})},X=e=>e.toLocaleString(h()),ze=({progress:e,total:t,cancelling:n})=>{let r=e.created+e.updated+e.failed;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,w.jsx)(`span`,{className:`text-muted-foreground`,children:y(n?`stopping`:`saving`)}),(0,w.jsxs)(`span`,{className:`tabular-nums`,children:[X(r),` / `,X(t)]})]}),(0,w.jsx)(`div`,{role:`progressbar`,"aria-label":y(`rowsSaved`),"aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":t,className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,w.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-[width]`,style:{width:`${t>0?Math.min(100,r/t*100):0}%`}})})]})},Be=({result:e,stopped:t,headers:n,fileName:r})=>(0,w.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[t!==void 0&&(0,w.jsx)(d,{title:y(`stopped`),error:t}),e.cancelled&&(0,w.jsx)(`p`,{role:`status`,children:y(`cancelled`)}),(0,w.jsx)(T,{label:y(`summary`),counts:[[y(`created`),e.created],[y(`updated`),e.updated],[y(`skipped`),e.skipped],[y(`failed`),e.failed]]}),e.notWritten.length>0&&(0,w.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,w.jsx)(`h3`,{className:`font-medium`,children:y(`rowsNotImported`)}),(0,w.jsxs)(_,{size:`sm`,onClick:()=>K(r,n,e.notWritten),children:[(0,w.jsx)(p,{className:`size-3.5`}),y(`download`)]})]}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:y(`notWrittenHint`)}),(0,w.jsx)(q,{rows:[...e.notWritten].sort((e,t)=>e.line-t.line)})]})]}),Ve=o(),Z=100,Q=e=>String(e),He=e=>{let t=new Map,n=(e,n)=>{let r=`${e}.${n}`;return t.has(r)||t.set(r,new Map),t.get(r)};return{load:async(t,r,a)=>{let o=n(t.name,r),s=[...new Map(a.filter(e=>!o.has(Q(e))).map(e=>[Q(e),e])).values()],c=t.primaryKey[0];for(let n=0;n<s.length;n+=Z){let a=s.slice(n,n+Z);for(let e of a)o.set(Q(e),[]);let l=i(Ve.in(r,a)),u;do{let n=await e(t.name).list(t.name,{filter:l,fields:[...new Set([c,r])],pageSize:1e3,pageToken:u});for(let e of n.items)o.get(Q(e[r]))?.push(e[c]);u=n.nextPageToken||void 0}while(u)}},keysOf:(e,t,r)=>n(e,t).get(Q(r))??[]}},Ue=500,$=()=>{let e=new Worker(new URL(`/assets/parse-worker-CAcPVcu7.js`,``+import.meta.url),{type:`module`}),t=[],n;return e.onmessage=e=>{if(n){let t=n;n=void 0,t(e.data)}else t.push(e.data)},e.onerror=e=>{e.preventDefault();let r={type:`error`,message:y(`unreadable`)};n?n(r):t.push(r)},{send:t=>e.postMessage(t),receive:()=>t.length>0?Promise.resolve(t.shift()):new Promise(e=>n=e),stop:()=>e.terminate()}},We=e=>({sheets:async()=>{let t=$();try{t.send({type:`sheets`,file:e,locale:m()});let n=await t.receive();if(n.type===`error`)throw Error(n.message);if(n.type!==`sheets`)throw Error(`The parse worker answered ${n.type} to a request for sheets`);return n.sheets}finally{t.stop()}},rows:async function*(t){let n=$();try{for(n.send({type:`read`,file:e,sheet:t,chunk:Ue,locale:m()});;){let e=await n.receive();if(e.type===`error`)throw Error(e.message);if(e.type===`end`)return;if(e.type!==`rows`)throw Error(`The parse worker answered ${e.type} to a read`);yield e.rows,n.send({type:`next`})}}finally{n.stop()}}});export{k as _,Y as a,Me as c,je as d,le as f,O as g,ce as h,Be as i,ke as l,oe as m,He as n,J as o,E as p,ze as r,Ne as s,We as t,Oe as u,ue as v};
3
- //# debugId=5b04b7ed-38ca-45c4-a118-a4403d666f31
3
+ //# debugId=9e9dff00-ef8c-4520-905b-ddce7acd6fcd
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Gc as r,Qi as i,Qo as a,Ss as o,Ts as s,Zo as c,es as l,fc as u,ns as d,rl as f,uc as p,xs as m}from"./app-CK_M0TgA.js";import{t as h}from"./page-header-Ddz2r5ic.js";var g=e(t(),1),_=()=>[{value:`allowed`,label:m(`on`)},{value:`forbidden`,label:m(`off`)}],v=()=>[{value:`allowed`,label:m(`optional`)},{value:`required`,label:m(`required`)},{value:`forbidden`,label:m(`off`)}],y=()=>[{method:`password`,label:m(`password`),description:m(`passwordDescription`),rules:_()},{method:`emailCode`,label:m(`emailedSignInCode`),description:m(`emailedSignInCodeDescription`),rules:_()},{method:`passkey`,label:m(`passkeys`),description:m(`passkeysPolicyDescription`),rules:v()},{method:`twoFactor`,label:m(`twoFactor`),description:m(`twoFactorPolicyDescription`),rules:v()},{method:`staffAccess`,label:m(`staffAccess`),description:m(`staffAccessDescription`),rules:[{value:`allowed`,label:m(`on`)},{value:`notify`,label:m(`emailThePerson`)},{value:`forbidden`,label:m(`off`)}]},{method:`platformSignIn`,label:m(`platformSignIn`),description:m(`platformSignInDescription`),rules:_()}],b=(e,t)=>{let n=y().find(t=>t.method===e)?.rules.find(e=>e.value===t)?.label;if(n===void 0)throw Error(`No label for the ${t} rule of ${e}`);return n},x=e(n(),1),S=({row:e,value:t,onChange:n})=>(0,x.jsx)(`span`,{role:`radiogroup`,"aria-label":e.label,className:`inline-flex h-8 shrink-0 rounded-md bg-muted p-0.5`,children:e.rules.map(e=>(0,x.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e.value===t,onClick:()=>n(e.value),className:r(`rounded px-3 text-body font-medium transition-colors`,e.value===t?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:e.label},e.value))}),C=({method:e},t,{mail:n,effective:r,policy:i})=>{if(e===`emailCode`&&!n)return m(`codeNeedsMail`);if(e===`password`&&!n&&t.password===`forbidden`)return m(`passwordStaysOn`);if(e===`staffAccess`&&!n&&t.staffAccess===`notify`)return m(`staffNeedsMail`);if(e===`platformSignIn`&&t.platformSignIn===`allowed`&&t.passkey===`required`)return m(`platformOff`);if(t[e]===i[e]&&r[e]!==i[e])return m(`appliesAs`,{rule:b(e,r[e])})},w=({operator:e,platformProviders:t=[]})=>y().flatMap(n=>n.method===`staffAccess`&&!e?[]:n.method===`platformSignIn`?t.length>0?[{...n,label:m(`platformSignInWith`,{provider:new Intl.ListFormat(f(),{type:`conjunction`}).format(t)})}]:[]:[n]),T=({state:e,onSave:t,busy:n,error:r,notice:a})=>{let[o,s]=(0,g.useState)(e.policy),c=w(e),l=c.some(({method:t})=>o[t]!==e.policy[t]);return(0,x.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),t(o)},children:[(0,x.jsx)(`ul`,{className:`divide-y rounded-lg border bg-background`,children:c.map(t=>{let n=C(t,o,e);return(0,x.jsxs)(`li`,{className:`flex flex-col gap-3 p-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`h2`,{className:`font-semibold`,children:t.label}),(0,x.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:t.description}),n&&(0,x.jsx)(`p`,{className:`mt-1.5 text-xs font-medium text-warning-text`,children:n})]}),(0,x.jsx)(S,{row:t,value:o[t.method],onChange:e=>s({...o,[t.method]:e})})]},t.method)})}),r&&(0,x.jsx)(`p`,{role:`alert`,className:`rounded-md bg-danger-soft px-3 py-2 text-body font-medium text-danger-text`,children:r}),a&&!l&&(0,x.jsx)(`p`,{role:`status`,className:`rounded-md bg-success-soft px-3 py-2 text-body font-medium text-success-text`,children:a}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.savedAt?e.savedBy?m(`lastSavedBy`,{name:e.savedBy,time:i(Date.parse(e.savedAt))}):m(`lastSaved`,{time:i(Date.parse(e.savedAt))}):m(`neverChanged`)}),(0,x.jsxs)(`div`,{className:`flex gap-2`,children:[l&&(0,x.jsx)(p,{onClick:()=>s(e.policy),children:m(`reset`)}),(0,x.jsx)(p,{variant:`primary`,type:`submit`,loading:n,disabled:!l,children:m(`save`)})]})]})]})},E=(e,t)=>e.endedAt?(0,x.jsx)(l,{tone:`neutral`,children:m(`stopped`,{time:i(Date.parse(e.endedAt))})}):Date.parse(e.expiresAt)<=t?(0,x.jsx)(l,{tone:`neutral`,children:m(`ended`,{time:i(Date.parse(e.expiresAt))})}):(0,x.jsx)(l,{tone:`amber`,children:m(`signedInUntil`,{time:i(Date.parse(e.expiresAt))})}),D=({signIns:e,operator:t,error:n,now:r=Date.now()})=>(0,x.jsxs)(c,{title:m(`staffSignIns`),description:m(`staffSignInsDescription`,{operator:t}),children:[(0,x.jsx)(a,{message:n}),e&&e.length===0&&(0,x.jsx)(`p`,{className:`text-muted-foreground`,children:m(`noStaffSignIns`)}),e&&e.length>0&&(0,x.jsx)(`ul`,{className:`divide-y rounded-md border`,children:e.map(e=>(0,x.jsxs)(`li`,{className:`flex flex-col gap-1.5 p-3`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,x.jsx)(`span`,{className:`font-medium break-all`,children:e.staffName?`${e.staffName} (${e.staff})`:e.staff}),(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:m(`as`)}),(0,x.jsx)(`span`,{className:`font-medium break-all`,children:e.user})]}),(0,x.jsx)(`p`,{className:`break-words`,children:e.reason}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,x.jsx)(`span`,{children:i(Date.parse(e.startedAt))}),E(e,r)]})]},e.id))})]}),O=({operator:e})=>{let{session:t}=o(),[n,r]=(0,g.useState)(),[i,a]=(0,g.useState)();return(0,g.useEffect)(()=>{t.staff.log().then(r,e=>a(e instanceof s?d(e):m(`couldNotReadStaffSignIns`)))},[t]),(0,x.jsx)(D,{operator:e,signIns:n,error:i})},k=()=>{let{session:e}=o(),[t,n]=(0,g.useState)(),[r,i]=(0,g.useState)(!1),[a,c]=(0,g.useState)(),[l,f]=(0,g.useState)();(0,g.useEffect)(()=>{e.signInPolicy.read().then(n,e=>c(e instanceof s?d(e):m(`couldNotReadPolicy`)))},[e]);let p=async t=>{i(!0),c(void 0),f(void 0);try{n(await e.signInPolicy.save(t)),f(m(`policySaved`))}catch(e){if(!(e instanceof s))throw e;c(d(e))}i(!1)};return(0,x.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6`,children:[(0,x.jsx)(h,{title:m(`signInPolicy`),subtitle:m(`policySubtitle`)}),t?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{state:t,busy:r,error:a,notice:l,onSave:e=>void p(e)},t.savedAt??`default`),t.operator&&(0,x.jsx)(O,{operator:t.operator})]}):a?(0,x.jsx)(`p`,{role:`alert`,className:`text-danger-text`,children:a}):(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,x.jsx)(u,{}),` `,m(`loading`)]})]})};export{k as SignInPolicyPage};
2
- //# debugId=6b56f85d-4b43-4251-a908-28e80e662abf
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Gc as r,Qi as i,Qo as a,Ss as o,Ts as s,Zo as c,es as l,fc as u,ns as d,rl as f,uc as p,xs as m}from"./app-B8KcM2Z-.js";import{t as h}from"./page-header-Ddz2r5ic.js";var g=e(t(),1),_=()=>[{value:`allowed`,label:m(`on`)},{value:`forbidden`,label:m(`off`)}],v=()=>[{value:`allowed`,label:m(`optional`)},{value:`required`,label:m(`required`)},{value:`forbidden`,label:m(`off`)}],y=()=>[{method:`password`,label:m(`password`),description:m(`passwordDescription`),rules:_()},{method:`emailCode`,label:m(`emailedSignInCode`),description:m(`emailedSignInCodeDescription`),rules:_()},{method:`passkey`,label:m(`passkeys`),description:m(`passkeysPolicyDescription`),rules:v()},{method:`twoFactor`,label:m(`twoFactor`),description:m(`twoFactorPolicyDescription`),rules:v()},{method:`staffAccess`,label:m(`staffAccess`),description:m(`staffAccessDescription`),rules:[{value:`allowed`,label:m(`on`)},{value:`notify`,label:m(`emailThePerson`)},{value:`forbidden`,label:m(`off`)}]},{method:`platformSignIn`,label:m(`platformSignIn`),description:m(`platformSignInDescription`),rules:_()}],b=(e,t)=>{let n=y().find(t=>t.method===e)?.rules.find(e=>e.value===t)?.label;if(n===void 0)throw Error(`No label for the ${t} rule of ${e}`);return n},x=e(n(),1),S=({row:e,value:t,onChange:n})=>(0,x.jsx)(`span`,{role:`radiogroup`,"aria-label":e.label,className:`inline-flex h-8 shrink-0 rounded-md bg-muted p-0.5`,children:e.rules.map(e=>(0,x.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e.value===t,onClick:()=>n(e.value),className:r(`rounded px-3 text-body font-medium transition-colors`,e.value===t?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:e.label},e.value))}),C=({method:e},t,{mail:n,effective:r,policy:i})=>{if(e===`emailCode`&&!n)return m(`codeNeedsMail`);if(e===`password`&&!n&&t.password===`forbidden`)return m(`passwordStaysOn`);if(e===`staffAccess`&&!n&&t.staffAccess===`notify`)return m(`staffNeedsMail`);if(e===`platformSignIn`&&t.platformSignIn===`allowed`&&t.passkey===`required`)return m(`platformOff`);if(t[e]===i[e]&&r[e]!==i[e])return m(`appliesAs`,{rule:b(e,r[e])})},w=({operator:e,platformProviders:t=[]})=>y().flatMap(n=>n.method===`staffAccess`&&!e?[]:n.method===`platformSignIn`?t.length>0?[{...n,label:m(`platformSignInWith`,{provider:new Intl.ListFormat(f(),{type:`conjunction`}).format(t)})}]:[]:[n]),T=({state:e,onSave:t,busy:n,error:r,notice:a})=>{let[o,s]=(0,g.useState)(e.policy),c=w(e),l=c.some(({method:t})=>o[t]!==e.policy[t]);return(0,x.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),t(o)},children:[(0,x.jsx)(`ul`,{className:`divide-y rounded-lg border bg-background`,children:c.map(t=>{let n=C(t,o,e);return(0,x.jsxs)(`li`,{className:`flex flex-col gap-3 p-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`h2`,{className:`font-semibold`,children:t.label}),(0,x.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:t.description}),n&&(0,x.jsx)(`p`,{className:`mt-1.5 text-xs font-medium text-warning-text`,children:n})]}),(0,x.jsx)(S,{row:t,value:o[t.method],onChange:e=>s({...o,[t.method]:e})})]},t.method)})}),r&&(0,x.jsx)(`p`,{role:`alert`,className:`rounded-md bg-danger-soft px-3 py-2 text-body font-medium text-danger-text`,children:r}),a&&!l&&(0,x.jsx)(`p`,{role:`status`,className:`rounded-md bg-success-soft px-3 py-2 text-body font-medium text-success-text`,children:a}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.savedAt?e.savedBy?m(`lastSavedBy`,{name:e.savedBy,time:i(Date.parse(e.savedAt))}):m(`lastSaved`,{time:i(Date.parse(e.savedAt))}):m(`neverChanged`)}),(0,x.jsxs)(`div`,{className:`flex gap-2`,children:[l&&(0,x.jsx)(p,{onClick:()=>s(e.policy),children:m(`reset`)}),(0,x.jsx)(p,{variant:`primary`,type:`submit`,loading:n,disabled:!l,children:m(`save`)})]})]})]})},E=(e,t)=>e.endedAt?(0,x.jsx)(l,{tone:`neutral`,children:m(`stopped`,{time:i(Date.parse(e.endedAt))})}):Date.parse(e.expiresAt)<=t?(0,x.jsx)(l,{tone:`neutral`,children:m(`ended`,{time:i(Date.parse(e.expiresAt))})}):(0,x.jsx)(l,{tone:`amber`,children:m(`signedInUntil`,{time:i(Date.parse(e.expiresAt))})}),D=({signIns:e,operator:t,error:n,now:r=Date.now()})=>(0,x.jsxs)(c,{title:m(`staffSignIns`),description:m(`staffSignInsDescription`,{operator:t}),children:[(0,x.jsx)(a,{message:n}),e&&e.length===0&&(0,x.jsx)(`p`,{className:`text-muted-foreground`,children:m(`noStaffSignIns`)}),e&&e.length>0&&(0,x.jsx)(`ul`,{className:`divide-y rounded-md border`,children:e.map(e=>(0,x.jsxs)(`li`,{className:`flex flex-col gap-1.5 p-3`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,x.jsx)(`span`,{className:`font-medium break-all`,children:e.staffName?`${e.staffName} (${e.staff})`:e.staff}),(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:m(`as`)}),(0,x.jsx)(`span`,{className:`font-medium break-all`,children:e.user})]}),(0,x.jsx)(`p`,{className:`break-words`,children:e.reason}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,x.jsx)(`span`,{children:i(Date.parse(e.startedAt))}),E(e,r)]})]},e.id))})]}),O=({operator:e})=>{let{session:t}=o(),[n,r]=(0,g.useState)(),[i,a]=(0,g.useState)();return(0,g.useEffect)(()=>{t.staff.log().then(r,e=>a(e instanceof s?d(e):m(`couldNotReadStaffSignIns`)))},[t]),(0,x.jsx)(D,{operator:e,signIns:n,error:i})},k=()=>{let{session:e}=o(),[t,n]=(0,g.useState)(),[r,i]=(0,g.useState)(!1),[a,c]=(0,g.useState)(),[l,f]=(0,g.useState)();(0,g.useEffect)(()=>{e.signInPolicy.read().then(n,e=>c(e instanceof s?d(e):m(`couldNotReadPolicy`)))},[e]);let p=async t=>{i(!0),c(void 0),f(void 0);try{n(await e.signInPolicy.save(t)),f(m(`policySaved`))}catch(e){if(!(e instanceof s))throw e;c(d(e))}i(!1)};return(0,x.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6`,children:[(0,x.jsx)(h,{title:m(`signInPolicy`),subtitle:m(`policySubtitle`)}),t?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{state:t,busy:r,error:a,notice:l,onSave:e=>void p(e)},t.savedAt??`default`),t.operator&&(0,x.jsx)(O,{operator:t.operator})]}):a?(0,x.jsx)(`p`,{role:`alert`,className:`text-danger-text`,children:a}):(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,x.jsx)(u,{}),` `,m(`loading`)]})]})};export{k as SignInPolicyPage};
2
+ //# debugId=94894f19-20d1-4ef5-8aaf-2ab700c58138
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t}from"./react-CuiNlnus.js";import{As as n,Ds as r,Fr as i,Ms as a,Or as o,Pa as s,Uo as c,Us as l,Xn as u,an as d,as as f,ba as p,er as m,fn as h,fs as g,lr as _,mn as v,nr as y,on as b,pn as x,sn as S,sr as C}from"./app-CK_M0TgA.js";import{h as w}from"./vendor-t7Q7QbPu.js";import{S as T,ht as E,r as D}from"./embedded-list-COr7SEcU.js";import{n as O}from"./record-preview-eCoWviA9.js";var k=e(t(),1),A=e=>({queryKey:e.queryKey,start:t=>t.prefetchQuery(e)}),j=e=>({queryKey:e.queryKey,start:t=>t.prefetchInfiniteQuery(e)}),M={Table:(e,t,n)=>{let{resource:r,filter:i=``,sort:o=``,columns:s,button:c,bulk:l=!1,limit:u=10,select:f}=b(e),m=r===void 0?void 0:n.resources[r];if(!m)return[];if(t.part===`chosen`){let e=f===void 0?void 0:n.given[f];return e?[A(x(n.client,m,{key:e}))]:[]}let h=n.views[m.name],{fields:g,read:_}=S({...n,model:m,view:h,columns:s?.map(a),button:c,bulk:l,phoneColumns:d(s)});return[A(D(n,{model:m,filter:i,orderBy:o||p(m,h),limit:u,fields:g,read:_}))]},Chart:(e,t,{client:n,resources:r,views:i})=>{let{resource:a,groupBy:s,splitBy:c,sum:l,average:u,filter:d,granularity:f,range:p,limit:m}=b(e),h=r[a],g=h&&E({model:h,groupBy:s,splitBy:c,sum:l,average:u,filter:d,granularity:f,range:p,limit:m},r,i);return h&&g?[A(o(n,h.name,g))]:[]},RecordCards:(e,t,{client:n,resources:r,views:i})=>{let{resource:a,filter:o=``,sort:s=``,limit:c=10}=b(e),l=r[a];if(!l)return[];let u=s||p(l,i[l.name]);return[A(v(n,l,{filter:o,sort:u,pageSize:c})),A(h(n,l,o))]},RecordRow:(e,t,{client:n,queryClient:r,resources:i,views:a})=>{let{resource:o,filter:s=``,sort:c=``}=b(e),l=i[o];if(!l)return[];let u=a[l.name];return u?.searchesOf||u?.listOf!==void 0?[]:[A(O({queryClient:r,client:n,resources:i,views:a,model:l,...T(l,u,{filter:s,sort:c})}))]},Thread:(e,t,{client:n,resources:r,views:a})=>{let{resource:o,filter:s,sender:c,time:d,calls:f,limit:p=50}=b(e);if(t.part===`calls`){let e=f&&r[f.resource];return e?[j(i(n,e.name,{filter:f.filter,orderBy:l(f.time),pageSize:p}))]:[]}let m=r[o];if(!m)return[];let h=u(r,a,m,c===void 0?[]:[c]);return[j(i(n,m.name,{filter:s,orderBy:l(d),pageSize:p,labels:h}))]}},N=(e,t,{client:n,resources:r})=>{let i=r[t.resource];return i?[A(h(n,i))]:[]},P=(e,t,i)=>(i?.reads??[]).flatMap(i=>{let a=n(t,i.block);if(!a||a.custom)return[];if(i.part===`condition`)return N(a,i,e);if(i.split)return[];let o=M[a.type];return o?o(r(a,{stack:[],params:e.params,...e.root&&{root:e.root}}),i,e):[]}),F=({tree:e,plan:t})=>{let n=g(),r=w(),{resources:i,views:a}=f(),o=s().fields,l=c(),u=m(),d=y(),p=C(_()),h=(0,k.useMemo)(()=>P({client:n,queryClient:r,resources:i,views:a,fieldTypes:o,xs:l,params:u,given:d,...p&&{root:p}},e,t),[n,r,i,a,o,l,u,d,p,e,t]);return(0,k.useEffect)(()=>{for(let e of h)e.start(r)},[h,r]),null};export{F as t};
2
- //# debugId=759be566-a4a5-40a4-aa16-d6dce753e478
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t}from"./react-CuiNlnus.js";import{As as n,Ds as r,Fr as i,Ms as a,Or as o,Pa as s,Uo as c,Us as l,Xn as u,an as d,as as f,ba as p,er as m,fn as h,fs as g,lr as _,mn as v,nr as y,on as b,pn as x,sn as S,sr as C}from"./app-B8KcM2Z-.js";import{h as w}from"./vendor-t7Q7QbPu.js";import{S as T,ht as E,r as D}from"./embedded-list-C3nd1V5o.js";import{n as O}from"./record-preview-CwySCCRj.js";var k=e(t(),1),A=e=>({queryKey:e.queryKey,start:t=>t.prefetchQuery(e)}),j=e=>({queryKey:e.queryKey,start:t=>t.prefetchInfiniteQuery(e)}),M={Table:(e,t,n)=>{let{resource:r,filter:i=``,sort:o=``,columns:s,button:c,bulk:l=!1,limit:u=10,select:f}=b(e),m=r===void 0?void 0:n.resources[r];if(!m)return[];if(t.part===`chosen`){let e=f===void 0?void 0:n.given[f];return e?[A(x(n.client,m,{key:e}))]:[]}let h=n.views[m.name],{fields:g,read:_}=S({...n,model:m,view:h,columns:s?.map(a),button:c,bulk:l,phoneColumns:d(s)});return[A(D(n,{model:m,filter:i,orderBy:o||p(m,h),limit:u,fields:g,read:_}))]},Chart:(e,t,{client:n,resources:r,views:i})=>{let{resource:a,groupBy:s,splitBy:c,sum:l,average:u,filter:d,granularity:f,range:p,limit:m}=b(e),h=r[a],g=h&&E({model:h,groupBy:s,splitBy:c,sum:l,average:u,filter:d,granularity:f,range:p,limit:m},r,i);return h&&g?[A(o(n,h.name,g))]:[]},RecordCards:(e,t,{client:n,resources:r,views:i})=>{let{resource:a,filter:o=``,sort:s=``,limit:c=10}=b(e),l=r[a];if(!l)return[];let u=s||p(l,i[l.name]);return[A(v(n,l,{filter:o,sort:u,pageSize:c})),A(h(n,l,o))]},RecordRow:(e,t,{client:n,queryClient:r,resources:i,views:a})=>{let{resource:o,filter:s=``,sort:c=``}=b(e),l=i[o];if(!l)return[];let u=a[l.name];return u?.searchesOf||u?.listOf!==void 0?[]:[A(O({queryClient:r,client:n,resources:i,views:a,model:l,...T(l,u,{filter:s,sort:c})}))]},Thread:(e,t,{client:n,resources:r,views:a})=>{let{resource:o,filter:s,sender:c,time:d,calls:f,limit:p=50}=b(e);if(t.part===`calls`){let e=f&&r[f.resource];return e?[j(i(n,e.name,{filter:f.filter,orderBy:l(f.time),pageSize:p}))]:[]}let m=r[o];if(!m)return[];let h=u(r,a,m,c===void 0?[]:[c]);return[j(i(n,m.name,{filter:s,orderBy:l(d),pageSize:p,labels:h}))]}},N=(e,t,{client:n,resources:r})=>{let i=r[t.resource];return i?[A(h(n,i))]:[]},P=(e,t,i)=>(i?.reads??[]).flatMap(i=>{let a=n(t,i.block);if(!a||a.custom)return[];if(i.part===`condition`)return N(a,i,e);if(i.split)return[];let o=M[a.type];return o?o(r(a,{stack:[],params:e.params,...e.root&&{root:e.root}}),i,e):[]}),F=({tree:e,plan:t})=>{let n=g(),r=w(),{resources:i,views:a}=f(),o=s().fields,l=c(),u=m(),d=y(),p=C(_()),h=(0,k.useMemo)(()=>P({client:n,queryClient:r,resources:i,views:a,fieldTypes:o,xs:l,params:u,given:d,...p&&{root:p}},e,t),[n,r,i,a,o,l,u,d,p,e,t]);return(0,k.useEffect)(()=>{for(let e of h)e.start(r)},[h,r]),null};export{F as t};
2
+ //# debugId=d4bd8172-7972-4d34-bccb-36bdb95e2d9e
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Ao as r,Bn as i,Hc as a,M as o,Nc as s,Pc as c,R as l,Sc as u,Tc as d,V as f,Wc as p,bc as ee,cc as m,el as te,fl as h,gc as ne,uc as g,us as re,wc as ie}from"./app-CK_M0TgA.js";import{t as ae}from"./circle-alert-D4sTiwNu.js";import{a as oe,c as se,d as ce,f as le,g as ue,h as de,i as fe,m as pe,o as me,p as he,r as ge,s as _e,u as ve}from"./workflow-canvas-CZ6QjuM6.js";import{t as _}from"./trash-Ba3Y5_30.js";import{A as ye,D as be,F as xe,M as Se,_ as Ce,a as we,c as v,f as Te,g as Ee,h as y,i as De,k as Oe,m as ke,n as Ae,o as b,s as x,u as S,x as je}from"./workflows-Bey4jszG.js";import{E as C,S as Me,T as w,_ as Ne,s as T,x as E}from"./use-run-trace-2fQX9FeC.js";import{n as D}from"./use-workflow-types-DpNGPeuE.js";var Pe={type:`object`,title:`File`,properties:{uri:{type:`string`},name:{type:`string`},type:{type:`string`},size:{type:`integer`}}},Fe=(e,t)=>e.relation&&t?.(e.relation.resource)===`integer`?{type:`integer`}:{type:`string`},Ie=(e,t,n)=>{if(e.file)return t===`read`?Pe:{type:`string`};switch(e.type){case`integer`:return{type:`integer`};case`boolean`:return{type:`boolean`};case`json`:return{};case`enum`:return{type:`string`,...e.enumValues&&{enum:e.enumValues}};case`relation`:return t===`read`?Fe(e,n):{type:[`string`,`integer`]};case`bigint`:return t===`read`?{type:`string`}:{type:[`string`,`integer`]};case`decimal`:return t===`read`?{type:`string`}:{type:[`string`,`number`]};default:return{type:`string`}}},Le=(e,t,n)=>{let r=Ie(e,t,n);if(t===`read`||!e.nullable||r.type===void 0)return r;let i=Array.isArray(r.type)?r.type:[r.type];return{...r,type:[...i,`null`],...Array.isArray(r.enum)&&{enum:[...r.enum,null]}}},Re=(e,t,n=e.name,r)=>({type:`object`,title:n,properties:Object.fromEntries(Object.values(e.fields).filter(e=>t===`read`||!e.readOnly).map(e=>[e.name,Le(e,t,r)]))}),ze=e=>t=>{let n=e(t);return n?.primaryKey.length===1?n.fields[n.primaryKey[0]]?.type:void 0},Be={name:`database`,size:24,node:[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]};Be.node;var O=p(Be),Ve={name:`flag`,size:24,node:[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]};Ve.node;var He=p(Ve),Ue={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};Ue.node;var We=p(Ue),Ge={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};Ge.node;var Ke=p(Ge),qe={name:`pen-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]],aliases:[`edit-3`]};qe.node;var Je=p(qe),Ye={name:`repeat`,size:24,node:[[`path`,{d:`m17 2 4 4-4 4`,key:`nntrym`}],[`path`,{d:`M3 11v-1a4 4 0 0 1 4-4h14`,key:`84bu3i`}],[`path`,{d:`m7 22-4-4 4-4`,key:`1wqhfi`}],[`path`,{d:`M21 13v1a4 4 0 0 1-4 4H3`,key:`1rx37r`}]]};Ye.node;var Xe=p(Ye),Ze={name:`timer`,size:24,node:[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]};Ze.node;var Qe=p(Ze),k=(e,t)=>{let n=structuredClone(e);return t(n),n},A=new Set([`Task`,`Pass`,`Wait`,`Map`,`Block`]),j=(e,t)=>{if(!A.has(e.Type))return;let n=e;delete n.End,n.Next=t},M=(e,t)=>{let n=E(e,t);if(!n)throw Error(`No Map or Block at ${t.join(`/`)}`);return n},$e=(e,t)=>{let n=new Set(Ne(e.stateMachine)),r=1;for(;n.has(`${t} ${r}`);)r++;return`${t} ${r}`},et=e=>`task`in e?{Type:`Task`,Resource:e.task,Arguments:{},End:!0}:e.type===`Choice`?{Type:`Choice`,Choices:[]}:e.type===`Wait`?{Type:`Wait`,Seconds:60,End:!0}:e.type===`Succeed`?{Type:`Succeed`}:e.type===`Fail`?{Type:`Fail`}:e.type===`Pass`?{Type:`Pass`,End:!0}:e.type===`Block`?{Type:`Block`,Processor:{StartAt:``,States:{}},Cache:{Ttl:`1 hour`},End:!0}:{Type:`Map`,Items:`{% [] %}`,ItemProcessor:{StartAt:``,States:{}},End:!0},N=(e,t,n,r,i)=>k(e,e=>{let a=M(e,t),o=y(e)===`data`,s=et(n);if(o&&delete s.End,a.States[r]=s,!o&&(a.StartAt===void 0||!Object.hasOwn(a.States,a.StartAt))&&(a.StartAt=r),s.Type!==`Map`&&s.Type!==`Block`)return;let c=$e(e,i),l=o?{States:{[c]:{Type:`Pass`}}}:{StartAt:c,States:{[c]:{Type:`Pass`,End:!0}}};s.Type===`Map`?s.ItemProcessor=l:s.Processor=l}),P=e=>e.Type===`Choice`||A.has(e.Type),tt=(e,t,n)=>{let r=e.States[t],i=e.States[n];if(!r||!A.has(r.Type))return;let a=r.Next;(a===void 0||P(i))&&(j(r,n),a!==void 0&&(i.Type===`Choice`?i.Default=a:A.has(i.Type)&&j(i,a)))},nt=(e,t,n)=>{let r=M(e,t);if(n!==void 0&&n!==t.join(`/`)){let{name:e}=w(n);return A.has(r.States[e]?.Type)?e:void 0}return Object.keys(r.States).reverse().find(e=>r.States[e].End===!0)},rt=e=>e.kind===`start`?[]:w(e.source).scope,it=e=>e.ErrorEquals.length===1&&e.ErrorEquals[0]===`States.ALL`,at=(e,t)=>{if(t.kind===`start`)return e.stateMachine.StartAt||void 0;let{scope:n,name:r}=w(t.source),i=E(e,n)?.States[r];if(i){if(t.kind===`next`)return i.Next;if(t.kind==="default")return i.Type===`Choice`?i.Default:void 0;if(t.kind===`catch`)return`Catch`in i?i.Catch?.find(it)?.Next:void 0}},ot=(e,t,n,r,i)=>{if(i.kind===`start`)return ct(e,t,n,r);let{scope:a,name:o}=w(i.source);if(i.kind===`next`)return st(e,a,t,n,r,o);let s=at(e,i);return k(N(e,a,t,n,r),e=>{let t=M(e,a),r=t.States[o],c=t.States[n];if(r&&(s===void 0||P(c))){if(i.kind===`rule`&&r.Type===`Choice`&&(r.Choices=[...r.Choices??[],{Condition:``,Next:n}]),i.kind==="default"&&r.Type===`Choice`&&(r.Default=n),i.kind===`catch`&&(r.Type===`Task`||r.Type===`Map`||r.Type===`Block`)){let e=r.Catch?.find(it);e?e.Next=n:r.Catch=[...r.Catch??[],{ErrorEquals:[`States.ALL`],Next:n}]}s!==void 0&&(c.Type===`Choice`?c.Default=s:A.has(c.Type)&&j(c,s))}})},st=(e,t,n,r,i,a)=>{let o=N(e,t,n,r,i);return a===void 0||y(e)===`data`?o:k(o,e=>tt(M(e,t),a,r))},ct=(e,t,n,r)=>{let i=e.stateMachine.StartAt??``,a=N(e,[],t,n,r);return y(e)===`data`?a:k(a,e=>{let t=e.stateMachine.States[n];(i===``||P(t))&&(e.stateMachine.StartAt=n,i!==``&&A.has(t.Type)&&j(t,i),i!==``&&t.Type===`Choice`&&(t.Default=i))})},lt=(e,t)=>{`Next`in e&&e.Next===t&&(delete e.Next,e.End=!0),e.Type===`Choice`&&(e.Choices=(e.Choices??[]).filter(e=>e.Next!==t),e.Default===t&&delete e.Default),`Catch`in e&&e.Catch&&(e.Catch=e.Catch.filter(e=>e.Next!==t),e.Catch.length===0&&delete e.Catch)},ut=(e,t)=>k(e,e=>{let{scope:n,name:r}=w(t),i=M(e,n);delete i.States[r];for(let e of Object.values(i.States))lt(e,r);i.StartAt===r&&(i.StartAt=Object.keys(i.States)[0]??``)}),dt=(e,t,n,r)=>k(e,e=>{let{scope:i,name:a}=w(r);if(t===`start`){e.stateMachine.StartAt=a;return}let o=w(n);if(o.scope.join(`/`)!==i.join(`/`))throw Error(`A state leads only to states of its own machine`);let s=M(e,i).States[o.name];s&&(t===`next`&&j(s,a),t===`rule`&&s.Type===`Choice`&&(s.Choices=[...s.Choices??[],{Condition:``,Next:a}]),t==="default"&&s.Type===`Choice`&&(s.Default=a),t===`catch`&&(s.Type===`Task`||s.Type===`Map`||s.Type===`Block`)&&(s.Catch=[...s.Catch??[],{ErrorEquals:[`States.ALL`],Next:a}]))}),ft=(e,t)=>k(e,e=>{if(t.kind===`start`)return;let{scope:n,name:r}=w(t.source),i=M(e,n).States[r];if(!i)return;let a=Number(/\[(\d+)\]/.exec(t.field)?.[1]);t.kind===`next`&&`Next`in i&&(delete i.Next,i.End=!0),t.kind===`rule`&&i.Type===`Choice`&&(i.Choices=i.Choices.filter((e,t)=>t!==a)),t.kind==="default"&&i.Type===`Choice`&&delete i.Default,t.kind===`catch`&&`Catch`in i&&i.Catch&&(i.Catch=i.Catch.filter((e,t)=>t!==a),i.Catch.length===0&&delete i.Catch)}),pt=(e,t,n)=>k(e,e=>{let{scope:r,name:i}=w(t);M(e,r).States[i]=n}),mt=(e,t,n)=>{e.States=Object.fromEntries(Object.entries(e.States).map(([e,r])=>[e===t?n:e,r])),e.StartAt===t&&(e.StartAt=n);for(let r of Object.values(e.States)){if(`Next`in r&&r.Next===t&&(r.Next=n),r.Type===`Choice`){for(let e of r.Choices??[])e.Next===t&&(e.Next=n);r.Default===t&&(r.Default=n)}if(`Catch`in r)for(let e of r.Catch??[])e.Next===t&&(e.Next=n)}},ht=e=>/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)&&![`true`,`false`,`null`].includes(e)?e:`\`${e}\``,gt=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),F=(e,t,n)=>{if(typeof e==`string`){if(!e.trimStart().startsWith(`{%`))return e;let r=RegExp(`\\$states\\.context\\.Steps\\.(?:${gt(t)}(?![A-Za-z0-9_])|\`${gt(t)}\`)`,`g`);return e.split(/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|\/\*[\s\S]*?\*\/)/).map((e,t)=>t%2==1?e:e.replace(r,()=>`$states.context.Steps.${ht(n)}`)).join(``)}return Array.isArray(e)?e.map(e=>F(e,t,n)):typeof e==`object`&&e?Object.fromEntries(Object.entries(e).map(([e,r])=>[e,F(r,t,n)])):e},_t=(e,t,n)=>k(e,e=>{let{scope:r,name:i}=w(t);mt(M(e,r),i,n),e.stateMachine=F(e.stateMachine,i,n)}),vt=(e,t)=>k(e,e=>{let{scope:n,name:r}=w(t);M(e,n).StartAt=r}),yt=(e,t)=>k(e,e=>{e.trigger=t}),I=e=>typeof e==`object`&&!!e&&!Array.isArray(e),bt=e=>Array.isArray(e.enum)&&e.enum.every(e=>typeof e==`string`)?{kind:`choice`,options:e.enum}:e.type===`string`?{kind:`text`}:e.type===`number`||e.type===`integer`||e.type===`boolean`?{kind:`value`}:e.type===`array`&&I(e.items)&&e.items.type===`string`?{kind:`names`}:{kind:`json`},L=e=>{let t=I(e.properties)?e.properties:{},n=Array.isArray(e.required)?e.required:[];return Object.entries(t).map(([e,t])=>{let r=I(t)?t:{},i=typeof r.title==`string`?r.title:void 0;return{name:e,...bt(r),required:n.includes(e),...i&&{title:i}}})},xt=e=>e.message.startsWith(`is missing`),St=e=>new Map([...e].map(([e,t])=>[e,t.filter(e=>!xt(e))])),Ct=e=>{let t=new Map,n=[],r=(e,n)=>t.set(e,[...t.get(e)??[],n]);for(let{state:t,field:i,message:a}of e){let e={...i!==void 0&&{field:i},message:a};t===void 0?i?.startsWith(`trigger`)||i===`StartAt`||i===`stateMachine.StartAt`?r(``,e):n.push(e):r(t,e)}return{byNode:t,whole:n}},wt=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),Tt=e=>t=>e.flatMap(e=>{let n=t[e.name];return n===void 0||n===``?e.required?[{field:e.name,message:`is missing`}]:[]:e.kind===`names`&&!wt(n)?[{field:e.name,message:`is a list of names, separated by commas`}]:[]}),Et=(e,t,n)=>{let r=t.step_types.filter(e=>e.available),i=t.triggers.filter(e=>e.available&&e.id!==`manual`),a=[...t.step_types,...t.triggers].filter(e=>!e.available);return Te(e,{resources:r.map(e=>e.id),required:Object.fromEntries(r.map(e=>[e.id,L(e.input).filter(e=>e.required).map(e=>e.name)])),triggers:Object.fromEntries(i.map(e=>[e.id,Tt(L(e.input))])),unavailable:Object.fromEntries(a.map(e=>[e.id,e.reason??``])),versioned:Ae(r.map(e=>e.id)),...n&&{pins:n}})},Dt=e=>{let t=new Map;for(let{state:n,field:r,message:i}of we(e))n!==void 0&&t.set(n,[...t.get(n)??[],{...r!==void 0&&{field:r},message:i}]);return t},R=e(n(),1),Ot=({problems:e})=>e.length>0&&(0,R.jsxs)(`div`,{className:`rounded-md border border-danger/30 bg-danger-soft px-3 py-2 text-body text-danger-text`,children:[(0,R.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,R.jsx)(ae,{className:`size-4`,"aria-hidden":`true`}),e.every(xt)?D(`fillInToSave`,{count:e.length}):D(`cannotSave`,{count:e.length})]}),(0,R.jsx)(`ul`,{className:`mt-1 list-disc pl-6`,children:e.map((e,t)=>(0,R.jsx)(`li`,{children:e.field?D(`fieldProblem`,{field:e.field,message:e.message}):e.message},t))})]}),kt=({warnings:e})=>e.length>0&&(0,R.jsxs)(`div`,{className:`rounded-md border border-warning/30 bg-warning-soft px-3 py-2 text-body text-warning-text`,children:[(0,R.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,R.jsx)(ne,{className:`size-4`,"aria-hidden":`true`}),D(`warningsSaveAnyway`,{count:e.length})]}),(0,R.jsx)(`ul`,{className:`mt-1 list-disc pl-6`,children:e.map((e,t)=>(0,R.jsx)(`li`,{children:e.field?D(`fieldProblem`,{field:e.field,message:e.message}):e.message},t))})]}),z=e(t(),1),At=({name:e,taken:t,disabled:n,onRename:i})=>{let[a,o]=(0,z.useState)(e),s=a.trim(),c=s===``?D(`nameNeeded`):s!==e&&t.includes(s)?D(`nameTaken`):void 0,u=()=>{!c&&s!==e&&i(s)};return(0,R.jsx)(l,{label:D(`name`),error:c,children:(0,R.jsx)(r,{value:a,invalid:!!c,disabled:n,onChange:e=>o(e.target.value),onBlur:u,onKeyDown:e=>{e.key===`Enter`&&u()}})})},B=(e,t)=>{let n=e.filter(e=>e.field===t||e.field?.startsWith(`${t}.`)||e.field?.startsWith(`${t}[`));return n.length>0?n.map(e=>e.message).join(`; `):void 0},V=({label:e,value:t,names:n,none:r,error:i,disabled:a,onChange:o})=>(0,R.jsx)(l,{label:e,error:i,children:(0,R.jsxs)(f,{invalid:!!i,value:t??``,disabled:a,onChange:e=>o(e.target.value===``?void 0:e.target.value),children:[(0,R.jsx)(`option`,{value:``,children:r}),t!==void 0&&!n.includes(t)&&(0,R.jsx)(`option`,{value:t,children:t}),n.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]})}),jt=e=>e===void 0?``:typeof e==`string`?e:JSON.stringify(e,null,2),Mt=e=>{if(e.trim()!==``)try{return JSON.parse(e)}catch(t){if(!(t instanceof SyntaxError))throw t;return e}},Nt=e=>{let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return t.length>0?t:void 0},Pt=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`)?e.join(`, `):jt(e),Ft=(0,z.createContext)(void 0),It=()=>(0,z.useContext)(Ft),Lt=e=>e===``?void 0:e,Rt={text:Lt,value:Mt,choice:Lt,json:Mt,names:Nt},H=({label:e,kind:t,options:n=[],required:a,help:o,value:s,error:c,onChange:u,disabled:d,read:p=Rt[t],write:ee=t===`names`?Pt:jt})=>{let[m,te]=(0,z.useState)(),h=m!==void 0&&JSON.stringify(p(m))===JSON.stringify(s)?m:ee(s),ne=It(),g=e=>{te(e),u(p(e))},re=ne!==void 0&&!d&&(s==null||typeof s==`string`)&&(t===`text`||t===`json`||t===`value`);return(0,R.jsxs)(l,{label:e,required:a,help:o,error:c,wide:t===`json`,children:[t===`choice`?(0,R.jsxs)(f,{invalid:!!c,value:h,disabled:d,onChange:e=>u(e.target.value===``?void 0:e.target.value),children:[(0,R.jsx)(`option`,{value:``,children:D(`defaultChoice`)}),n.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]}):t===`json`?(0,R.jsx)(i,{invalid:!!c,rows:2,className:`font-mono text-xs`,value:h,disabled:d,onChange:e=>g(e.target.value)}):(0,R.jsx)(r,{invalid:!!c,value:h,disabled:d,onChange:e=>g(e.target.value)}),re&&(0,R.jsx)(`button`,{type:`button`,"aria-label":D(`insertValueInto`,{field:e}),className:`mt-1 text-xs font-medium text-primary-text hover:underline max-md:min-h-11`,onClick:()=>ne({label:e,value:s,set:u}),children:D(`insertValue`)})]})},zt=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean),Bt=e=>Array.isArray(e)?e.join(`, `):``,U=({state:e,names:t,problems:n,disabled:r,onChange:i})=>{let a=e.Catch??[],o=t=>{let{Catch:n,...r}=e;i(t.length>0?{...r,Catch:t}:r)},s=(e,t)=>o(a.map((n,r)=>r===e?t:n));return(0,R.jsxs)(R.Fragment,{children:[a.map((e,i)=>(0,R.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-md border border-danger/40 p-3`,children:[(0,R.jsx)(`legend`,{className:`px-1 text-xs font-medium text-danger-text`,children:D(`errorPathNumber`,{number:i+1})}),(0,R.jsx)(H,{label:D(`errors`),kind:`text`,help:D(`errorsHelp`),value:e.ErrorEquals??[],read:zt,write:Bt,error:B(n,`Catch[${i}].ErrorEquals`),disabled:r,onChange:t=>s(i,{...e,ErrorEquals:t})}),(0,R.jsx)(V,{label:D(`thenGoesTo`),value:e.Next||void 0,names:t,none:D(`chooseStep`),error:B(n,`Catch[${i}].Next`),disabled:r,onChange:t=>s(i,{...e,Next:t??``})}),!r&&(0,R.jsxs)(g,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>o(a.filter((e,t)=>t!==i)),children:[(0,R.jsx)(_,{className:`size-3.5`}),D(`removeErrorPath`)]})]},i)),!r&&(0,R.jsx)(`div`,{children:(0,R.jsxs)(g,{size:`sm`,onClick:()=>o([...a,{ErrorEquals:[`States.ALL`],Next:``}]),children:[(0,R.jsx)(u,{className:`size-3.5`}),D(`addErrorPath`)]})})]})},Vt=({state:e,names:t,problems:n,disabled:r,onChange:i})=>{let a=e.Choices??[],o=(t,n)=>i({...e,Choices:a.map((e,r)=>r===t?n:e)});return(0,R.jsxs)(R.Fragment,{children:[a.map((s,c)=>(0,R.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-md border p-3`,children:[(0,R.jsx)(`legend`,{className:`px-1 text-xs font-medium text-muted-foreground`,children:D(`ruleNumber`,{number:c+1})}),(0,R.jsx)(H,{label:D(`condition`),kind:`text`,help:D(`conditionHelp`),value:s.Condition,error:B(n,`Choices[${c}].Condition`),disabled:r,onChange:e=>o(c,{...s,Condition:typeof e==`string`?e:``})}),(0,R.jsx)(V,{label:D(`thenGoesTo`),value:s.Next||void 0,names:t,none:D(`chooseStep`),error:B(n,`Choices[${c}].Next`),disabled:r,onChange:e=>o(c,{...s,Next:e??``})}),!r&&(0,R.jsxs)(g,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>i({...e,Choices:a.filter((e,t)=>t!==c)}),children:[(0,R.jsx)(_,{className:`size-3.5`}),D(`removeRule`)]})]},c)),!r&&(0,R.jsx)(`div`,{children:(0,R.jsxs)(g,{size:`sm`,onClick:()=>i({...e,Choices:[...a,{Condition:``,Next:``}]}),children:[(0,R.jsx)(u,{className:`size-3.5`}),D(`addRule`)]})}),(0,R.jsx)(V,{label:D(`otherwiseGoesTo`),value:e.Default,names:t,none:D(`noDefault`),error:B(n,`Default`),disabled:r,onChange:t=>{let{Default:n,...r}=e;i(t===void 0?r:{...r,Default:t})}})]})},W=(e,t)=>{let{Cache:n,...r}=e;return t===void 0?r:{...r,Cache:t}},Ht=({state:e,types:t,disabled:n,onChange:r})=>{let[i,a]=(0,z.useState)(!1),s=_e(e,t);return s?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(l,{label:D(`cacheResults`),help:D(s.forces?`cacheForceHelp`:`cacheHelp`),children:(0,R.jsx)(o,{checked:s.on,onChange:t=>{if(!n){if(!t)return r(W(e,s.offValue));if(s.disclaimer)return a(!0);r(W(e,!0))}}})}),i&&(0,R.jsx)(m,{title:D(`cacheConfirmTitle`),description:s.disclaimer,onClose:()=>a(!1),actions:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(g,{onClick:()=>a(!1),children:D(`cacheCancel`)}),(0,R.jsx)(g,{variant:`primary`,onClick:()=>(a(!1),r(W(e,!0))),children:D(`cacheConfirm`)})]})})]}):null},Ut=(e,t,n)=>{let{[t]:r,...i}=e;return n==null||n===``?i:{...i,[t]:n}},Wt=(e,t)=>{let{type:n}=Oe(e.Resource);if(t){let{Cache:t,...r}=e;return{...r,Resource:`${n}${ye}`}}let{HeartbeatSeconds:r,TimeoutSeconds:i,...a}=e;return{...a,Resource:n,...i!==void 0&&i<=xe.taskTimeoutSeconds&&{TimeoutSeconds:i}}},Gt=e=>ke(e)===void 0,Kt=(e,t)=>({...e,Resource:`${t}${Oe(e.Resource).waits&&Gt(t)?ye:``}`}),qt=(e,t,n)=>{let{[t]:r,...i}=typeof e.Arguments==`object`&&e.Arguments!==null?e.Arguments:{};return{...e,Arguments:n===void 0?i:{...i,[t]:n}}},Jt=({state:e,types:t,problems:n,disabled:r,onChange:i})=>{let a=t.step_types.filter(e=>e.available),{type:s,waits:c}=Oe(e.Resource),u=Gt(s),d=t.step_types.find(e=>e.id===s),p=typeof e.Arguments==`string`||!d;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(l,{label:D(`stepType`),error:B(n,`Resource`),children:(0,R.jsxs)(f,{value:s,disabled:r,onChange:t=>i(Kt(e,t.target.value)),children:[!a.some(e=>e.id===s)&&(0,R.jsx)(`option`,{value:s,children:he(s,d?.label)}),a.map(e=>(0,R.jsx)(`option`,{value:e.id,children:he(e.id,e.label)},e.id))]})}),p?(0,R.jsx)(H,{label:D(`arguments`),kind:`json`,value:e.Arguments,error:B(n,`Arguments`),disabled:r,onChange:t=>i({...e,Arguments:t??{}})}):L(d.input).map(t=>(0,R.jsx)(H,{label:se(t.name,t.title),kind:t.kind,options:t.options,required:t.required,...t.kind===`names`&&{help:D(`namesHelp`)},value:e.Arguments?.[t.name],error:B(n,`Arguments.${t.name}`),disabled:r,onChange:n=>i(qt(e,t.name,n))},`${s}:${t.name}`)),u&&(0,R.jsx)(l,{label:D(`waitsForResult`),help:D(`waitsForResultHelp`),children:(0,R.jsx)(o,{checked:c,onChange:t=>!r&&i(Wt(e,t))})}),c||!u?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(H,{label:D(`waitTimeout`),help:D(`waitTimeoutHelp`),kind:`json`,value:e.TimeoutSeconds,error:B(n,`TimeoutSeconds`),disabled:r,onChange:t=>i(Ut(e,`TimeoutSeconds`,t))}),(0,R.jsx)(H,{label:D(`heartbeatSeconds`),help:D(`heartbeatHelp`),kind:`json`,value:e.HeartbeatSeconds,error:B(n,`HeartbeatSeconds`),disabled:r,onChange:t=>i(Ut(e,`HeartbeatSeconds`,t))})]}):(0,R.jsx)(Ht,{state:e,types:t,disabled:r,onChange:i})]})},G=(e,t,n)=>{let{[t]:r,...i}=e;return n===void 0?i:{...i,[t]:n}},Yt=({state:e,problems:t,disabled:n,onChange:r})=>(0,R.jsx)(H,{label:D(`onlyWhen`),kind:`text`,help:D(`onlyWhenHelp`),value:e.Condition,error:B(t,`Condition`),disabled:n,onChange:t=>r(G(e,`Condition`,t))}),K=e=>{let{state:t,names:n,problems:r,disabled:i,onChange:a}=e;if(e.data)return(0,R.jsx)(Yt,{...e});let o=t;return(0,R.jsx)(V,{label:D(`goesOnTo`),value:o.Next,names:n,none:D(`endsHere`),error:B(r,`Next`)??B(r,`End`),disabled:i,onChange:e=>{let{Next:t,End:n,...r}=o;a(e===void 0?{...r,End:!0}:{...r,Next:e})}})},Xt=e=>{let{state:t,types:n,problems:r,disabled:i,onChange:a}=e,o=(e,n,o,s)=>(0,R.jsx)(H,{label:n,kind:o,help:s,value:t[e],error:B(r,e),disabled:i,onChange:n=>a(G(t,e,n))});if(t.Type===`Task`)return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Jt,{state:t,types:n,problems:r,disabled:i,onChange:a}),(0,R.jsx)(K,{...e}),!e.data&&(0,R.jsx)(U,{...e,state:t})]});if(t.Type===`Choice`)return(0,R.jsx)(Vt,{...e,state:t});if(t.Type===`Map`)return(0,R.jsxs)(R.Fragment,{children:[o(`Items`,D(`items`),`json`,D(`itemsHelp`)),o(`MaxConcurrency`,D(`maxConcurrency`),`json`),(0,R.jsx)(K,{...e}),!e.data&&(0,R.jsx)(U,{...e,state:t})]});if(t.Type===`Block`){let n=(e,n,o,s)=>(0,R.jsx)(H,{label:n,kind:o,help:s,value:t.Cache?.[e],error:B(r,`Cache.${e}`)??(e===`Ttl`?B(r,`Cache`):void 0),disabled:i,onChange:n=>a({...t,Cache:G(t.Cache??{Ttl:``},e,n)})});return(0,R.jsxs)(R.Fragment,{children:[o(`Arguments`,D(`blockArguments`),`json`,D(`blockArgumentsHelp`)),n(`Ttl`,D(`blockTtl`),`text`,D(`blockTtlHelp`)),n(`Key`,D(`blockKey`),`json`,D(`blockKeyHelp`)),(0,R.jsx)(K,{...e}),!e.data&&(0,R.jsx)(U,{...e,state:t})]})}return t.Type===`Wait`?(0,R.jsxs)(R.Fragment,{children:[o(`Seconds`,D(`seconds`),`json`),(0,R.jsx)(K,{...e})]}):t.Type===`Pass`?(0,R.jsxs)(R.Fragment,{children:[o(`Output`,D(`output`),`json`,D(`outputHelp`)),(0,R.jsx)(K,{...e})]}):t.Type===`Succeed`?o(`Output`,D(`output`),`json`,D(`outputHelp`)):t.Type===`Fail`?(0,R.jsxs)(R.Fragment,{children:[e.data&&(0,R.jsx)(Yt,{...e}),o(`Error`,D(`error`),`text`),o(`Cause`,D(`cause`),`text`)]}):null},Zt=(e,t,n,r)=>{let{[n]:i,...a}=t;return{[e]:r===void 0?a:{...a,[n]:r}}},Qt=({trigger:e,types:t,problems:n,disabled:r,onChange:i})=>{let a=de(e),o=t.triggers.filter(e=>e.available),s=o.find(e=>e.id===a),c=a!==void 0&&!s?a:void 0,u=a===void 0?{}:e[a]??{};return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(l,{label:D(`startsWhen`),error:B(n,`trigger`),help:c&&D(`triggerOtherHelp`),children:(0,R.jsxs)(f,{value:a??``,disabled:r,onChange:e=>i({[e.target.value]:{}}),children:[c!==void 0&&(0,R.jsx)(`option`,{value:c,children:ue(c,t.triggers.find(e=>e.id===c)?.label)}),a===void 0&&(0,R.jsx)(`option`,{value:``,children:D(`triggerUnknown`)}),o.map(e=>(0,R.jsx)(`option`,{value:e.id,children:ue(e.id,e.label)},e.id))]})}),s&&L(s.input).map(e=>(0,R.jsx)(H,{label:se(e.name,e.title),kind:e.kind,options:e.options,required:e.required,...e.kind===`names`&&{help:D(`namesHelp`)},value:u[e.name],error:B(n,`trigger.${s.id}.${e.name}`),disabled:r,onChange:t=>i(Zt(s.id,u,e.name,t))},`${s.id}:${e.name}`)),c!==void 0&&(0,R.jsx)(H,{label:D(`triggerInput`),kind:`json`,value:u,error:B(n,`trigger.${c}`),disabled:!0,onChange:()=>void 0})]})},$t=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&typeof e.Type==`string`,en=({kind:e,name:t})=>(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e}),(0,R.jsx)(`h3`,{className:`truncate font-semibold text-foreground`,children:t})]}),tn=({definition:e,types:t,selected:n,problems:r,warnings:i=[],onChange:a,onSelect:o})=>{let s=C(e,n);if(!s)return null;let{scope:c,name:l}=w(n),u=E(e,c),d=!a,f=e=>a?.(e);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(en,{kind:ve(s,t),name:l}),(0,R.jsx)(Ot,{problems:r}),(0,R.jsx)(kt,{warnings:i}),(0,R.jsx)(At,{name:l,taken:Ne(e.stateMachine),disabled:d,onRename:t=>{f(_t(e,n,t)),o(Me(c,t))}},n),(0,R.jsx)(Xt,{state:s,types:t,names:Object.keys(u.States),problems:r,disabled:d,data:y(e)===`data`,onChange:t=>f(pt(e,n,t))}),(0,R.jsxs)(`details`,{children:[(0,R.jsx)(`summary`,{className:`cursor-pointer text-body font-medium text-muted-foreground`,children:D(`asJson`)}),(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(H,{label:D(`stepJson`),kind:`json`,help:D(`stepJsonHelp`),value:s,disabled:d,onChange:t=>{$t(t)&&f(pt(e,n,t))}},n)})]}),a&&(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[y(e)===`sequence`&&u.StartAt!==l&&(0,R.jsxs)(g,{size:`sm`,onClick:()=>f(vt(e,n)),children:[(0,R.jsx)(He,{className:`size-3.5`}),D(`startHere`)]}),(0,R.jsxs)(g,{size:`sm`,variant:`danger`,onClick:()=>{f(ut(e,n)),o(void 0)},children:[(0,R.jsx)(_,{className:`size-3.5`}),D(`removeStep`)]})]})]})},nn=e=>{let{definition:t,types:n,selected:r,problems:i,onChange:a}=e;return(0,R.jsx)(`section`,{"aria-label":D(`chosenStep`),className:`flex flex-col gap-4 rounded-lg border bg-background p-4`,children:r===``?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(en,{kind:D(`trigger`),name:pe(t.trigger,n)}),(0,R.jsx)(Ot,{problems:i}),(0,R.jsx)(Qt,{trigger:t.trigger,types:n,problems:i,disabled:!a,onChange:e=>a?.(yt(t,e))})]}):(0,R.jsx)(tn,{...e,selected:r})})},rn=e=>typeof e==`object`&&!!e&&!Array.isArray(e),q=(e,t,n,r)=>{let i=structuredClone(e),{scope:a,name:o}=w(t),s=E(i,a)?.States[o];if(s&&n[0]===`#condition`)return r===void 0?delete s.Condition:s.Condition=r,i;if(!s||s.Type!==`Task`)return e;rn(s.Arguments)||(s.Arguments={});let c=s.Arguments;for(let e of n.slice(0,-1))rn(c[e])||(c[e]={}),c=c[e];let l=n.at(-1);return r===void 0?delete c[l]:c[l]=r,i},an=e=>[`=`,`!=`,`>`,`<`,`matches`,`and`,`or`,`not`,...e?[`expression`]:[]],on=e=>e.kind===`compare`||e.kind===`matches`?{value:``}:{value:e.kind===`logic`&&e.op===`and`},sn=e=>e===`not`?{kind:`not`,sides:[{value:!1}]}:e===`and`||e===`or`?{kind:`logic`,op:e,sides:[{value:e===`and`},{value:e===`and`}]}:e===`matches`?{kind:`matches`,sides:[{value:``},{pattern:`.*`,flags:``}]}:{kind:`compare`,op:e,sides:[{value:``},{value:``}]},cn=`{% true %}`,ln=(e,t)=>{if(t.length===0)return e;let n=e.sides[t[0]];return n&&v(n)?ln(n,t.slice(1)):void 0},J=(e,t,n)=>({...e,sides:e.sides.map((e,r)=>r===t?n:e)}),Y=(e,t,n)=>{if(t.length===0)return n(e);let r=e.sides[t[0]],i=r&&v(r)?Y(r,t.slice(1),n):void 0;return i&&J(e,t[0],i)},un=(e,t,n)=>{if(e.kind===`logic`&&t===e.sides.length)return{...e,sides:[...e.sides,n]};if(!(t>=e.sides.length)){if(e.kind===`matches`&&t===1)return!v(n)&&`value`in n&&typeof n.value==`string`?J(e,1,{pattern:n.value||`.*`,flags:e.sides[1].flags}):void 0;if(e.kind!==`compare`&&e.kind!==`matches`||!v(n))return J(e,t,n)}},X=(e,t,n,r)=>{let i=b(C(e,t)?.Condition),a=i&&n.length>0&&Y(i,n.slice(0,-1),e=>un(e,n.at(-1),r));return a&&b(x(a))?q(e,t,[T],x(a)):e},dn=(e,t,n,r)=>{let i=C(e,t)?.Condition;if(n.length===0)return i!==void 0&&i!==``?e:q(e,t,[T],r===`expression`?cn:x(sn(r)));let a=b(i),o=a&&ln(a,n.slice(0,-1)),s=n.at(-1),c=o?.sides[s],l=o?.kind===`logic`&&s===o.sides.length;return r===`expression`||!o||o.kind===`compare`||o.kind===`matches`||!l&&(!c||v(c)||!(`value`in c))?e:X(e,t,n,sn(r))},fn=(e,t,n)=>{if(n.length===0)return q(e,t,[T],void 0);let r=b(C(e,t)?.Condition),i=n.at(-1),a=r&&Y(r,n.slice(0,-1),e=>{if(!(i>=e.sides.length))return e.kind===`logic`&&e.sides.length>2?{...e,sides:e.sides.filter((e,t)=>t!==i)}:un(e,i,on(e))});return a?q(e,t,[T],x(a)):e},pn=e=>{let t=[];if(`Next`in e&&e.Next!==void 0&&t.push(e.Next),e.Type===`Choice`){for(let n of e.Choices??[])t.push(n.Next);e.Default!==void 0&&t.push(e.Default)}if(`Catch`in e)for(let n of e.Catch??[])n.Next!==void 0&&t.push(n.Next);return t},mn=(e,t)=>{let n=new Set,r=[t];for(;r.length>0;){let t=r.shift(),i=e.States[t];!n.has(t)&&i&&(n.add(t),r.push(...pn(i)))}return[...n]},hn=e=>e.StartAt===void 0?Object.keys(e.States):mn(e,e.StartAt),gn=e=>{if(e.Resource!==`app:http`||typeof e.Arguments!=`object`||e.Arguments===null)return!1;let t=e.Arguments.method;return t===void 0||typeof t==`string`&&t.toUpperCase()===`GET`},_n=(e,t,n)=>t.flatMap(t=>{let r=e.States[t];if(!r)return[];let i=Se(r),a=i?_n(i,hn(i),n):[];return r.Type===`Task`?(n?.step_types.find(e=>e.id===r.Resource)?.writes??!0)===!1||gn(r)?[]:[{name:t,kind:ve(r,n)}]:a}),vn=(e,t)=>{if(!e||t||!(`Assign`in e)||!e.Assign)return e;let n=Object.fromEntries(Object.entries(e.Assign).filter(([,e])=>e!==De)),{Assign:r,...i}=e;return Object.keys(n).length===0?i:{...i,Assign:n}},yn=(e,t,n)=>{let r=e?.stateMachine.States[n],i=r!==void 0&&`Output`in r;return JSON.stringify(vn(r,i))!==JSON.stringify(vn(t.stateMachine.States[n],i))},bn=(e,t)=>{let n=Ce(e),r=new Set([t]);for(let e=!0;e;){e=!1;for(let[t,i]of n)!r.has(t)&&[...Ee(i)].some(e=>r.has(e))&&(r.add(t),e=!0)}return Object.keys(e.States).filter(e=>r.has(e))},xn=(e,t,n=e.stateMachine.StartAt)=>{let r=e.stateMachine;return _n(r,y(e)===`data`?n===void 0?hn(r):bn(r,n):n===void 0?hn(r):mn(r,n),t)},Sn=/^[A-Za-z_][A-Za-z0-9_]*$/,Cn=e=>Sn.test(e)?e:`\`${e.replaceAll("`",``)}\``,wn=e=>{let t=JSON.stringify(e)??``;return t.length>60?`${t.slice(0,59)}…`:t},Tn=100,En=4,Dn=e=>{let t=[{path:``,sample:wn(e)}],n=(e,r,i)=>{if(!(i===En||typeof r!=`object`||!r||t.length>=Tn)){if(Array.isArray(r)){if(r.length===0)return;let a=`${e}[0]`;t.push({path:a,sample:wn(r[0])}),n(a,r[0],i+1);return}for(let[a,o]of Object.entries(r)){let r=e===``?Cn(a):`${e}.${Cn(a)}`;t.push({path:r,sample:wn(o)}),n(r,o,i+1)}}};return n(``,e,0),t.slice(0,Tn)},On=(e,t)=>t===``?e:`${e}${t.startsWith(`[`)?``:`.`}${t}`,kn=(e,t)=>{if(e==null||e===``)return`{% ${t} %}`;if(typeof e!=`string`)throw Error(`A value is inserted only into a field that holds text`);let n=/^\{%([\s\S]*)%\}$/.exec(e.trim());return n?`{% (${n[1].trim()}) & ${t} %}`:`{% ${JSON.stringify(e)} & ${t} %}`},An=(e,t)=>{let{scope:n,name:r}=w(t),i=(e,t,n)=>Object.keys(e.States).filter(n=>n!==t&&mn(e,n).includes(t)).filter(t=>[`Task`,`Map`,`Block`].includes(e.States[t].Type)).map(e=>[...n,e].join(`/`)),a=i(E(e,n),r,n),o=n.findLastIndex((t,r)=>E(e,n.slice(0,r))?.States[n[r]]?.Type===`Block`);return[...n.flatMap((t,r)=>r<=o?[]:i(E(e,n.slice(0,r)),t,n.slice(0,r))),...a]},jn=`{% $states.result %}`,Mn=(e,t)=>{let{scope:n,name:r}=w(t),i=E(e,n)?.States[r];return i!==void 0&&`Output`in i},Nn=e=>`Assign`in e&&e.Assign?e.Assign:{},Pn=e=>Object.values(e.States).flatMap(e=>[...Object.keys(Nn(e)),...Se(e)?Pn(Se(e)):[]]),Fn=(e,t)=>{let n=t.toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).replace(/^(\d)/,`step_$1`)||`value`,r=new Set(Pn(e.stateMachine));if(!r.has(n))return n;let i=2;for(;r.has(`${n}_${i}`);)i++;return`${n}_${i}`},In=(e,t)=>{let{scope:n,name:r}=w(t),i=E(e,n).States[r],a=Object.entries(Nn(i)).find(([,e])=>e===jn);if(a)return{definition:e,variable:a[0],added:!1};let o=Fn(e,r),s=structuredClone(e),c=E(s,n).States[r];return c.Assign={...c.Assign,[o]:jn},{definition:s,variable:o,added:!0}},Z=(e,t)=>e.pure.find(e=>e.id===t),Ln=(e,t)=>{let n=me(t.handle);if(!n)return;let r=Z(e,t.node);return r?r.kind===`break`?{node:r.source,path:[...r.path,...n]}:void 0:{node:t.node,path:n}},Q=(e,t)=>{let n=oe(t.handle);if(n===void 0)return;let r=Z(e,t.node);if(!r)return e.inputs.has(t.node)?{step:t.node,keys:[n]}:void 0;if(r.kind===`make`)return{step:r.target,keys:[r.key,n]};if(r.kind===`select`)return{step:r.target,keys:[r.key],select:r};if((r.kind!==`condition`||r.part.kind!==`matches`||n!==`1`)&&r.kind===`condition`&&r.part.kind!==`expression`)return{step:r.target,keys:[T],side:{node:r,at:[...r.at,Number(n)]}}},Rn=(e,t)=>e.path.length===1&&e.path[0]===`#status`&&t.keys.length===1&&t.keys[0]===`#condition`&&!t.side,zn=(e,t,n)=>{let r=Z(e,t.node);if(n===`out`){let n=me(t.handle);return(r?.kind===`break`?r.outputs:e.outputs.get(t.node)??[]).find(e=>JSON.stringify(e.path)===JSON.stringify(n))?.type}let i=oe(t.handle);if(!(r?.kind===`condition`&&r.part.kind===`compare`||r?.kind===`select`))return(r?.kind===`make`||r?.kind===`condition`?r.inputs:e.inputs.get(t.node)??[]).find(e=>e.key===i)?.type},Bn=(e,t)=>w(t).scope.some((t,n,r)=>C(e,r.slice(0,n+1).join(`/`))?.Type===`Block`),Vn=(e,t)=>{let{scope:n}=w(t);for(let t=n.length;t>0;t--)if(C(e,n.slice(0,t).join(`/`))?.Type===`Block`)return n.slice(0,t).join(`/`)},Hn=(e,t,n)=>{let{scope:r,name:i}=w(t);if(w(n).scope.join(`/`)!==r.join(`/`))return!1;let a=Ce(E(e,r)),o=new Set,s=[i];for(;s.length>0;){let e=s.pop();if(e===w(n).name)return!0;o.has(e)||(o.add(e),s.push(...Ee(a.get(e)??{data:new Set,status:new Set,handled:new Set})))}return!1},Un=(e,t,n,r)=>{let i=Ln(t,n),a=Q(t,r);if(!i||!a)return{reason:`notPins`};let o=Vn(e,a.step);if(o!==void 0&&i.node!==``&&!i.node.startsWith(`${o}/`))return{reason:`otherScope`,step:w(i.node).name};if(y(e)===`data`&&i.node!==``){let[t,n]=[w(i.node).scope.join(`/`),w(a.step).scope.join(`/`)];if(t!==``&&t!==n&&!n.startsWith(`${t}/`))return{reason:`otherScope`,step:w(i.node).name};if(Hn(e,i.node,a.step))return{reason:`notBefore`,step:w(i.node).name};if(i.path[0]!==`#status`&&Mn(e,i.node))return{reason:`shapesOutput`,step:w(i.node).name}}else if(i.node===``){if(Bn(e,a.step))return{reason:`notBefore`,step:w(a.step).name}}else{if(!An(e,a.step).includes(i.node))return{reason:`notBefore`,step:w(i.node).name};if(Mn(e,i.node))return{reason:`shapesOutput`,step:w(i.node).name}}if(Rn(i,a))return;let s=zn(t,n,`out`),c=zn(t,r,`in`);if(s&&c&&!be(s,c))return{reason:`type`,source:s,target:c}},Wn=(e,t,n,r)=>{if(Un(e,t,n,r))return e;let i=Ln(t,n),a=Q(t,r),o=e,s;if(i.node===``)s={base:{input:!0},path:i.path};else if(i.path[0]===`#status`)s={base:{step:w(i.node).name},path:i.path.slice(1)};else{let t=In(e,i.node);o=t.definition,s={base:{variable:t.variable},path:i.path}}let c=`step`in s.base&&s.path.length===0?{...s,path:[`Status`]}:s;return a.side?X(o,a.step,a.side.at,{read:c}):a.select?q(o,a.step,a.keys,S({...a.select.part,operand:{read:c}})):Rn(i,a)?q(o,a.step,a.keys,x({kind:`compare`,op:`=`,sides:[{read:c},{value:`SUCCEEDED`}]})):q(o,a.step,a.keys,je(s))},Gn=(e,t,n)=>{let r=Q(t,{node:n.target,handle:n.targetHandle});if(r?.side)return fn(e,r.step,r.side.at);if(r?.select)return q(e,r.step,r.keys,S({...r.select.part,operand:{value:``}}));if(r)return q(e,r.step,r.keys,void 0);let i=Z(t,n.target)??Z(t,n.source);return i?Kn(e,t,i):e},Kn=(e,t,n)=>{if(n.kind===`make`||n.kind===`select`)return q(e,n.target,[n.key],void 0);if(n.kind===`condition`)return fn(e,n.target,n.at);let r=e=>t.edges.filter(t=>t.source===e.id&&!t.expression).flatMap(e=>{let n=Z(t,e.target);return n?.kind===`break`?r(n):[e]});return ge(t,r(n),e=>fe(t,e)).reduce((e,n)=>Gn(e,t,n),e)},qn=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`,Jn={connect:dt,disconnect:ft,removeState:ut,setArgument:q,connectData:Wn,disconnectData:Gn,removePure:Kn,wireRefusal:Un,addCondition:dn,conditionChoices:an,setConditionSide:X,addSelect:(e,t,n)=>{let r=C(e,t)?.Arguments?.[n];if(r!==void 0&&!qn(r)||typeof r==`string`&&r.startsWith(`{%`))return e;let i=r??``;return q(e,t,[n],S({operand:{value:``},cases:[{when:``,then:i}],otherwise:i}))}},Yn=(e,t,n={})=>({inputs:Object.fromEntries(e.step_types.map(e=>[e.id,e.input])),outputs:Object.fromEntries([...e.step_types,...e.triggers].flatMap(e=>e.output?[[e.id,e.output]]:[])),records:(e,r)=>{let i=t[e];return i&&Re(i,r,n[e]?.names?.singular??h(e),ze(e=>t[e]))},emails:t=>{let n=e.templates?.find(e=>e.name===t);return n&&{schema:n.schema,languages:n.languages}}}),Xn=e=>{let{data:t}=re();return(0,z.useMemo)(()=>Yn(e,t?.resources??{},t?.views),[e,t?.resources,t?.views])},$=te(`app/field-types/workflow-page`),Zn={"app:http":{icon:Ke,keywords:[`api`,`fetch`,`url`,`webhook`,`get`,`post`]},"app:mail.send":{icon:d,keywords:[`email`,`send`,`message`]},"app:records.create":{icon:O,keywords:[`insert`,`add`,`new`,`row`]},"app:records.update":{icon:O,keywords:[`change`,`edit`,`row`]},"app:records.get":{icon:O,keywords:[`read`,`find`,`row`]},"app:records.list":{icon:O,keywords:[`read`,`find`,`query`,`rows`]}},Qn=[{type:`Choice`,icon:We,description:()=>$(`flowChoice`),keywords:[`if`,`branch`,`switch`,`condition`]},{type:`Map`,icon:Xe,description:()=>$(`flowMap`),keywords:[`loop`,`each`,`list`,`repeat`]},{type:`Block`,icon:ie,description:()=>$(`flowBlock`),keywords:[`cache`,`once`,`group`,`reuse`,`wrap`]},{type:`Wait`,icon:Qe,description:()=>$(`flowWait`),keywords:[`delay`,`sleep`,`pause`,`later`]},{type:`Pass`,icon:Je,description:()=>$(`flowPass`),keywords:[`variable`,`assign`,`transform`]},{type:`Succeed`,icon:c,description:()=>$(`flowSucceed`),keywords:[`end`,`stop`,`done`]},{type:`Fail`,icon:s,description:()=>$(`flowFail`),keywords:[`end`,`stop`,`error`]}],$n=e=>({id:`task:${e.id}`,title:le(e.id,e.label),description:e.description,keywords:[e.id,...Zn[e.id]?.keywords??[]],icon:Zn[e.id]?.icon??(e.id.startsWith(`app:`)?a:ee)}),er=e=>e.slice(0,Math.max(e.indexOf(`:`),0)),tr=e=>e===`custom`?$(`customSteps`):e,nr=e=>{let t=new Set(Object.values(Ae(e.step_types.map(e=>e.id)))),n=e.step_types.filter(e=>e.available&&(!ke(e.id)||t.has(e.id))),r=[...new Set(n.map(e=>er(e.id)).filter(e=>e!==`app`))];return[{title:$(`builtIn`),items:n.filter(e=>er(e.id)===`app`).map($n)},...r.map(e=>({title:tr(e),items:n.filter(t=>er(t.id)===e).map($n)})),{title:$(`flow`),items:Qn.map(e=>({id:`type:${e.type}`,title:ce(e.type),description:e.description(),keywords:e.keywords,icon:e.icon}))}].filter(e=>e.items.length>0)},rr=e=>e.startsWith(`task:`)?{task:e.slice(5)}:{type:e.slice(5)};export{ht as A,st as C,at as D,$e as E,nt as O,N as S,ct as T,Et as _,Jn as a,Dt as b,Dn as c,kn as d,yn as f,Ot as g,Ft as h,Xn as i,rt as k,Mn as l,nn as m,nr as n,An as o,xn as p,$ as r,On as s,rr as t,In as u,xt as v,ot as w,St as x,Ct as y};
2
- //# debugId=d791be4b-3628-4b7f-b48e-21e33c0ca002
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Ao as r,Bn as i,Hc as a,M as o,Nc as s,Pc as c,R as l,Sc as u,Tc as d,V as f,Wc as p,bc as ee,cc as m,el as te,fl as h,gc as ne,uc as g,us as re,wc as ie}from"./app-B8KcM2Z-.js";import{t as ae}from"./circle-alert-DOaXkZQv.js";import{a as oe,c as se,d as ce,f as le,g as ue,h as de,i as fe,m as pe,o as me,p as he,r as ge,s as _e,u as ve}from"./workflow-canvas-DBlvFI_n.js";import{t as _}from"./trash-Ch2JFURM.js";import{A as ye,D as be,F as xe,M as Se,_ as Ce,a as we,c as v,f as Te,g as Ee,h as y,i as De,k as Oe,m as ke,n as Ae,o as b,s as x,u as S,x as je}from"./workflows-Bey4jszG.js";import{E as C,S as Me,T as w,_ as Ne,s as T,x as E}from"./use-run-trace-CRG2_uVq.js";import{n as D}from"./use-workflow-types-Dk4FOVoz.js";var Pe={type:`object`,title:`File`,properties:{uri:{type:`string`},name:{type:`string`},type:{type:`string`},size:{type:`integer`}}},Fe=(e,t)=>e.relation&&t?.(e.relation.resource)===`integer`?{type:`integer`}:{type:`string`},Ie=(e,t,n)=>{if(e.file)return t===`read`?Pe:{type:`string`};switch(e.type){case`integer`:return{type:`integer`};case`boolean`:return{type:`boolean`};case`json`:return{};case`enum`:return{type:`string`,...e.enumValues&&{enum:e.enumValues}};case`relation`:return t===`read`?Fe(e,n):{type:[`string`,`integer`]};case`bigint`:return t===`read`?{type:`string`}:{type:[`string`,`integer`]};case`decimal`:return t===`read`?{type:`string`}:{type:[`string`,`number`]};default:return{type:`string`}}},Le=(e,t,n)=>{let r=Ie(e,t,n);if(t===`read`||!e.nullable||r.type===void 0)return r;let i=Array.isArray(r.type)?r.type:[r.type];return{...r,type:[...i,`null`],...Array.isArray(r.enum)&&{enum:[...r.enum,null]}}},Re=(e,t,n=e.name,r)=>({type:`object`,title:n,properties:Object.fromEntries(Object.values(e.fields).filter(e=>t===`read`||!e.readOnly).map(e=>[e.name,Le(e,t,r)]))}),ze=e=>t=>{let n=e(t);return n?.primaryKey.length===1?n.fields[n.primaryKey[0]]?.type:void 0},Be={name:`database`,size:24,node:[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]};Be.node;var O=p(Be),Ve={name:`flag`,size:24,node:[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]};Ve.node;var He=p(Ve),Ue={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};Ue.node;var We=p(Ue),Ge={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};Ge.node;var Ke=p(Ge),qe={name:`pen-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]],aliases:[`edit-3`]};qe.node;var Je=p(qe),Ye={name:`repeat`,size:24,node:[[`path`,{d:`m17 2 4 4-4 4`,key:`nntrym`}],[`path`,{d:`M3 11v-1a4 4 0 0 1 4-4h14`,key:`84bu3i`}],[`path`,{d:`m7 22-4-4 4-4`,key:`1wqhfi`}],[`path`,{d:`M21 13v1a4 4 0 0 1-4 4H3`,key:`1rx37r`}]]};Ye.node;var Xe=p(Ye),Ze={name:`timer`,size:24,node:[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]};Ze.node;var Qe=p(Ze),k=(e,t)=>{let n=structuredClone(e);return t(n),n},A=new Set([`Task`,`Pass`,`Wait`,`Map`,`Block`]),j=(e,t)=>{if(!A.has(e.Type))return;let n=e;delete n.End,n.Next=t},M=(e,t)=>{let n=E(e,t);if(!n)throw Error(`No Map or Block at ${t.join(`/`)}`);return n},$e=(e,t)=>{let n=new Set(Ne(e.stateMachine)),r=1;for(;n.has(`${t} ${r}`);)r++;return`${t} ${r}`},et=e=>`task`in e?{Type:`Task`,Resource:e.task,Arguments:{},End:!0}:e.type===`Choice`?{Type:`Choice`,Choices:[]}:e.type===`Wait`?{Type:`Wait`,Seconds:60,End:!0}:e.type===`Succeed`?{Type:`Succeed`}:e.type===`Fail`?{Type:`Fail`}:e.type===`Pass`?{Type:`Pass`,End:!0}:e.type===`Block`?{Type:`Block`,Processor:{StartAt:``,States:{}},Cache:{Ttl:`1 hour`},End:!0}:{Type:`Map`,Items:`{% [] %}`,ItemProcessor:{StartAt:``,States:{}},End:!0},N=(e,t,n,r,i)=>k(e,e=>{let a=M(e,t),o=y(e)===`data`,s=et(n);if(o&&delete s.End,a.States[r]=s,!o&&(a.StartAt===void 0||!Object.hasOwn(a.States,a.StartAt))&&(a.StartAt=r),s.Type!==`Map`&&s.Type!==`Block`)return;let c=$e(e,i),l=o?{States:{[c]:{Type:`Pass`}}}:{StartAt:c,States:{[c]:{Type:`Pass`,End:!0}}};s.Type===`Map`?s.ItemProcessor=l:s.Processor=l}),P=e=>e.Type===`Choice`||A.has(e.Type),tt=(e,t,n)=>{let r=e.States[t],i=e.States[n];if(!r||!A.has(r.Type))return;let a=r.Next;(a===void 0||P(i))&&(j(r,n),a!==void 0&&(i.Type===`Choice`?i.Default=a:A.has(i.Type)&&j(i,a)))},nt=(e,t,n)=>{let r=M(e,t);if(n!==void 0&&n!==t.join(`/`)){let{name:e}=w(n);return A.has(r.States[e]?.Type)?e:void 0}return Object.keys(r.States).reverse().find(e=>r.States[e].End===!0)},rt=e=>e.kind===`start`?[]:w(e.source).scope,it=e=>e.ErrorEquals.length===1&&e.ErrorEquals[0]===`States.ALL`,at=(e,t)=>{if(t.kind===`start`)return e.stateMachine.StartAt||void 0;let{scope:n,name:r}=w(t.source),i=E(e,n)?.States[r];if(i){if(t.kind===`next`)return i.Next;if(t.kind==="default")return i.Type===`Choice`?i.Default:void 0;if(t.kind===`catch`)return`Catch`in i?i.Catch?.find(it)?.Next:void 0}},ot=(e,t,n,r,i)=>{if(i.kind===`start`)return ct(e,t,n,r);let{scope:a,name:o}=w(i.source);if(i.kind===`next`)return st(e,a,t,n,r,o);let s=at(e,i);return k(N(e,a,t,n,r),e=>{let t=M(e,a),r=t.States[o],c=t.States[n];if(r&&(s===void 0||P(c))){if(i.kind===`rule`&&r.Type===`Choice`&&(r.Choices=[...r.Choices??[],{Condition:``,Next:n}]),i.kind==="default"&&r.Type===`Choice`&&(r.Default=n),i.kind===`catch`&&(r.Type===`Task`||r.Type===`Map`||r.Type===`Block`)){let e=r.Catch?.find(it);e?e.Next=n:r.Catch=[...r.Catch??[],{ErrorEquals:[`States.ALL`],Next:n}]}s!==void 0&&(c.Type===`Choice`?c.Default=s:A.has(c.Type)&&j(c,s))}})},st=(e,t,n,r,i,a)=>{let o=N(e,t,n,r,i);return a===void 0||y(e)===`data`?o:k(o,e=>tt(M(e,t),a,r))},ct=(e,t,n,r)=>{let i=e.stateMachine.StartAt??``,a=N(e,[],t,n,r);return y(e)===`data`?a:k(a,e=>{let t=e.stateMachine.States[n];(i===``||P(t))&&(e.stateMachine.StartAt=n,i!==``&&A.has(t.Type)&&j(t,i),i!==``&&t.Type===`Choice`&&(t.Default=i))})},lt=(e,t)=>{`Next`in e&&e.Next===t&&(delete e.Next,e.End=!0),e.Type===`Choice`&&(e.Choices=(e.Choices??[]).filter(e=>e.Next!==t),e.Default===t&&delete e.Default),`Catch`in e&&e.Catch&&(e.Catch=e.Catch.filter(e=>e.Next!==t),e.Catch.length===0&&delete e.Catch)},ut=(e,t)=>k(e,e=>{let{scope:n,name:r}=w(t),i=M(e,n);delete i.States[r];for(let e of Object.values(i.States))lt(e,r);i.StartAt===r&&(i.StartAt=Object.keys(i.States)[0]??``)}),dt=(e,t,n,r)=>k(e,e=>{let{scope:i,name:a}=w(r);if(t===`start`){e.stateMachine.StartAt=a;return}let o=w(n);if(o.scope.join(`/`)!==i.join(`/`))throw Error(`A state leads only to states of its own machine`);let s=M(e,i).States[o.name];s&&(t===`next`&&j(s,a),t===`rule`&&s.Type===`Choice`&&(s.Choices=[...s.Choices??[],{Condition:``,Next:a}]),t==="default"&&s.Type===`Choice`&&(s.Default=a),t===`catch`&&(s.Type===`Task`||s.Type===`Map`||s.Type===`Block`)&&(s.Catch=[...s.Catch??[],{ErrorEquals:[`States.ALL`],Next:a}]))}),ft=(e,t)=>k(e,e=>{if(t.kind===`start`)return;let{scope:n,name:r}=w(t.source),i=M(e,n).States[r];if(!i)return;let a=Number(/\[(\d+)\]/.exec(t.field)?.[1]);t.kind===`next`&&`Next`in i&&(delete i.Next,i.End=!0),t.kind===`rule`&&i.Type===`Choice`&&(i.Choices=i.Choices.filter((e,t)=>t!==a)),t.kind==="default"&&i.Type===`Choice`&&delete i.Default,t.kind===`catch`&&`Catch`in i&&i.Catch&&(i.Catch=i.Catch.filter((e,t)=>t!==a),i.Catch.length===0&&delete i.Catch)}),pt=(e,t,n)=>k(e,e=>{let{scope:r,name:i}=w(t);M(e,r).States[i]=n}),mt=(e,t,n)=>{e.States=Object.fromEntries(Object.entries(e.States).map(([e,r])=>[e===t?n:e,r])),e.StartAt===t&&(e.StartAt=n);for(let r of Object.values(e.States)){if(`Next`in r&&r.Next===t&&(r.Next=n),r.Type===`Choice`){for(let e of r.Choices??[])e.Next===t&&(e.Next=n);r.Default===t&&(r.Default=n)}if(`Catch`in r)for(let e of r.Catch??[])e.Next===t&&(e.Next=n)}},ht=e=>/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)&&![`true`,`false`,`null`].includes(e)?e:`\`${e}\``,gt=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),F=(e,t,n)=>{if(typeof e==`string`){if(!e.trimStart().startsWith(`{%`))return e;let r=RegExp(`\\$states\\.context\\.Steps\\.(?:${gt(t)}(?![A-Za-z0-9_])|\`${gt(t)}\`)`,`g`);return e.split(/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|\/\*[\s\S]*?\*\/)/).map((e,t)=>t%2==1?e:e.replace(r,()=>`$states.context.Steps.${ht(n)}`)).join(``)}return Array.isArray(e)?e.map(e=>F(e,t,n)):typeof e==`object`&&e?Object.fromEntries(Object.entries(e).map(([e,r])=>[e,F(r,t,n)])):e},_t=(e,t,n)=>k(e,e=>{let{scope:r,name:i}=w(t);mt(M(e,r),i,n),e.stateMachine=F(e.stateMachine,i,n)}),vt=(e,t)=>k(e,e=>{let{scope:n,name:r}=w(t);M(e,n).StartAt=r}),yt=(e,t)=>k(e,e=>{e.trigger=t}),I=e=>typeof e==`object`&&!!e&&!Array.isArray(e),bt=e=>Array.isArray(e.enum)&&e.enum.every(e=>typeof e==`string`)?{kind:`choice`,options:e.enum}:e.type===`string`?{kind:`text`}:e.type===`number`||e.type===`integer`||e.type===`boolean`?{kind:`value`}:e.type===`array`&&I(e.items)&&e.items.type===`string`?{kind:`names`}:{kind:`json`},L=e=>{let t=I(e.properties)?e.properties:{},n=Array.isArray(e.required)?e.required:[];return Object.entries(t).map(([e,t])=>{let r=I(t)?t:{},i=typeof r.title==`string`?r.title:void 0;return{name:e,...bt(r),required:n.includes(e),...i&&{title:i}}})},xt=e=>e.message.startsWith(`is missing`),St=e=>new Map([...e].map(([e,t])=>[e,t.filter(e=>!xt(e))])),Ct=e=>{let t=new Map,n=[],r=(e,n)=>t.set(e,[...t.get(e)??[],n]);for(let{state:t,field:i,message:a}of e){let e={...i!==void 0&&{field:i},message:a};t===void 0?i?.startsWith(`trigger`)||i===`StartAt`||i===`stateMachine.StartAt`?r(``,e):n.push(e):r(t,e)}return{byNode:t,whole:n}},wt=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),Tt=e=>t=>e.flatMap(e=>{let n=t[e.name];return n===void 0||n===``?e.required?[{field:e.name,message:`is missing`}]:[]:e.kind===`names`&&!wt(n)?[{field:e.name,message:`is a list of names, separated by commas`}]:[]}),Et=(e,t,n)=>{let r=t.step_types.filter(e=>e.available),i=t.triggers.filter(e=>e.available&&e.id!==`manual`),a=[...t.step_types,...t.triggers].filter(e=>!e.available);return Te(e,{resources:r.map(e=>e.id),required:Object.fromEntries(r.map(e=>[e.id,L(e.input).filter(e=>e.required).map(e=>e.name)])),triggers:Object.fromEntries(i.map(e=>[e.id,Tt(L(e.input))])),unavailable:Object.fromEntries(a.map(e=>[e.id,e.reason??``])),versioned:Ae(r.map(e=>e.id)),...n&&{pins:n}})},Dt=e=>{let t=new Map;for(let{state:n,field:r,message:i}of we(e))n!==void 0&&t.set(n,[...t.get(n)??[],{...r!==void 0&&{field:r},message:i}]);return t},R=e(n(),1),Ot=({problems:e})=>e.length>0&&(0,R.jsxs)(`div`,{className:`rounded-md border border-danger/30 bg-danger-soft px-3 py-2 text-body text-danger-text`,children:[(0,R.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,R.jsx)(ae,{className:`size-4`,"aria-hidden":`true`}),e.every(xt)?D(`fillInToSave`,{count:e.length}):D(`cannotSave`,{count:e.length})]}),(0,R.jsx)(`ul`,{className:`mt-1 list-disc pl-6`,children:e.map((e,t)=>(0,R.jsx)(`li`,{children:e.field?D(`fieldProblem`,{field:e.field,message:e.message}):e.message},t))})]}),kt=({warnings:e})=>e.length>0&&(0,R.jsxs)(`div`,{className:`rounded-md border border-warning/30 bg-warning-soft px-3 py-2 text-body text-warning-text`,children:[(0,R.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,R.jsx)(ne,{className:`size-4`,"aria-hidden":`true`}),D(`warningsSaveAnyway`,{count:e.length})]}),(0,R.jsx)(`ul`,{className:`mt-1 list-disc pl-6`,children:e.map((e,t)=>(0,R.jsx)(`li`,{children:e.field?D(`fieldProblem`,{field:e.field,message:e.message}):e.message},t))})]}),z=e(t(),1),At=({name:e,taken:t,disabled:n,onRename:i})=>{let[a,o]=(0,z.useState)(e),s=a.trim(),c=s===``?D(`nameNeeded`):s!==e&&t.includes(s)?D(`nameTaken`):void 0,u=()=>{!c&&s!==e&&i(s)};return(0,R.jsx)(l,{label:D(`name`),error:c,children:(0,R.jsx)(r,{value:a,invalid:!!c,disabled:n,onChange:e=>o(e.target.value),onBlur:u,onKeyDown:e=>{e.key===`Enter`&&u()}})})},B=(e,t)=>{let n=e.filter(e=>e.field===t||e.field?.startsWith(`${t}.`)||e.field?.startsWith(`${t}[`));return n.length>0?n.map(e=>e.message).join(`; `):void 0},V=({label:e,value:t,names:n,none:r,error:i,disabled:a,onChange:o})=>(0,R.jsx)(l,{label:e,error:i,children:(0,R.jsxs)(f,{invalid:!!i,value:t??``,disabled:a,onChange:e=>o(e.target.value===``?void 0:e.target.value),children:[(0,R.jsx)(`option`,{value:``,children:r}),t!==void 0&&!n.includes(t)&&(0,R.jsx)(`option`,{value:t,children:t}),n.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]})}),jt=e=>e===void 0?``:typeof e==`string`?e:JSON.stringify(e,null,2),Mt=e=>{if(e.trim()!==``)try{return JSON.parse(e)}catch(t){if(!(t instanceof SyntaxError))throw t;return e}},Nt=e=>{let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return t.length>0?t:void 0},Pt=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`)?e.join(`, `):jt(e),Ft=(0,z.createContext)(void 0),It=()=>(0,z.useContext)(Ft),Lt=e=>e===``?void 0:e,Rt={text:Lt,value:Mt,choice:Lt,json:Mt,names:Nt},H=({label:e,kind:t,options:n=[],required:a,help:o,value:s,error:c,onChange:u,disabled:d,read:p=Rt[t],write:ee=t===`names`?Pt:jt})=>{let[m,te]=(0,z.useState)(),h=m!==void 0&&JSON.stringify(p(m))===JSON.stringify(s)?m:ee(s),ne=It(),g=e=>{te(e),u(p(e))},re=ne!==void 0&&!d&&(s==null||typeof s==`string`)&&(t===`text`||t===`json`||t===`value`);return(0,R.jsxs)(l,{label:e,required:a,help:o,error:c,wide:t===`json`,children:[t===`choice`?(0,R.jsxs)(f,{invalid:!!c,value:h,disabled:d,onChange:e=>u(e.target.value===``?void 0:e.target.value),children:[(0,R.jsx)(`option`,{value:``,children:D(`defaultChoice`)}),n.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]}):t===`json`?(0,R.jsx)(i,{invalid:!!c,rows:2,className:`font-mono text-xs`,value:h,disabled:d,onChange:e=>g(e.target.value)}):(0,R.jsx)(r,{invalid:!!c,value:h,disabled:d,onChange:e=>g(e.target.value)}),re&&(0,R.jsx)(`button`,{type:`button`,"aria-label":D(`insertValueInto`,{field:e}),className:`mt-1 text-xs font-medium text-primary-text hover:underline max-md:min-h-11`,onClick:()=>ne({label:e,value:s,set:u}),children:D(`insertValue`)})]})},zt=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean),Bt=e=>Array.isArray(e)?e.join(`, `):``,U=({state:e,names:t,problems:n,disabled:r,onChange:i})=>{let a=e.Catch??[],o=t=>{let{Catch:n,...r}=e;i(t.length>0?{...r,Catch:t}:r)},s=(e,t)=>o(a.map((n,r)=>r===e?t:n));return(0,R.jsxs)(R.Fragment,{children:[a.map((e,i)=>(0,R.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-md border border-danger/40 p-3`,children:[(0,R.jsx)(`legend`,{className:`px-1 text-xs font-medium text-danger-text`,children:D(`errorPathNumber`,{number:i+1})}),(0,R.jsx)(H,{label:D(`errors`),kind:`text`,help:D(`errorsHelp`),value:e.ErrorEquals??[],read:zt,write:Bt,error:B(n,`Catch[${i}].ErrorEquals`),disabled:r,onChange:t=>s(i,{...e,ErrorEquals:t})}),(0,R.jsx)(V,{label:D(`thenGoesTo`),value:e.Next||void 0,names:t,none:D(`chooseStep`),error:B(n,`Catch[${i}].Next`),disabled:r,onChange:t=>s(i,{...e,Next:t??``})}),!r&&(0,R.jsxs)(g,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>o(a.filter((e,t)=>t!==i)),children:[(0,R.jsx)(_,{className:`size-3.5`}),D(`removeErrorPath`)]})]},i)),!r&&(0,R.jsx)(`div`,{children:(0,R.jsxs)(g,{size:`sm`,onClick:()=>o([...a,{ErrorEquals:[`States.ALL`],Next:``}]),children:[(0,R.jsx)(u,{className:`size-3.5`}),D(`addErrorPath`)]})})]})},Vt=({state:e,names:t,problems:n,disabled:r,onChange:i})=>{let a=e.Choices??[],o=(t,n)=>i({...e,Choices:a.map((e,r)=>r===t?n:e)});return(0,R.jsxs)(R.Fragment,{children:[a.map((s,c)=>(0,R.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-md border p-3`,children:[(0,R.jsx)(`legend`,{className:`px-1 text-xs font-medium text-muted-foreground`,children:D(`ruleNumber`,{number:c+1})}),(0,R.jsx)(H,{label:D(`condition`),kind:`text`,help:D(`conditionHelp`),value:s.Condition,error:B(n,`Choices[${c}].Condition`),disabled:r,onChange:e=>o(c,{...s,Condition:typeof e==`string`?e:``})}),(0,R.jsx)(V,{label:D(`thenGoesTo`),value:s.Next||void 0,names:t,none:D(`chooseStep`),error:B(n,`Choices[${c}].Next`),disabled:r,onChange:e=>o(c,{...s,Next:e??``})}),!r&&(0,R.jsxs)(g,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>i({...e,Choices:a.filter((e,t)=>t!==c)}),children:[(0,R.jsx)(_,{className:`size-3.5`}),D(`removeRule`)]})]},c)),!r&&(0,R.jsx)(`div`,{children:(0,R.jsxs)(g,{size:`sm`,onClick:()=>i({...e,Choices:[...a,{Condition:``,Next:``}]}),children:[(0,R.jsx)(u,{className:`size-3.5`}),D(`addRule`)]})}),(0,R.jsx)(V,{label:D(`otherwiseGoesTo`),value:e.Default,names:t,none:D(`noDefault`),error:B(n,`Default`),disabled:r,onChange:t=>{let{Default:n,...r}=e;i(t===void 0?r:{...r,Default:t})}})]})},W=(e,t)=>{let{Cache:n,...r}=e;return t===void 0?r:{...r,Cache:t}},Ht=({state:e,types:t,disabled:n,onChange:r})=>{let[i,a]=(0,z.useState)(!1),s=_e(e,t);return s?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(l,{label:D(`cacheResults`),help:D(s.forces?`cacheForceHelp`:`cacheHelp`),children:(0,R.jsx)(o,{checked:s.on,onChange:t=>{if(!n){if(!t)return r(W(e,s.offValue));if(s.disclaimer)return a(!0);r(W(e,!0))}}})}),i&&(0,R.jsx)(m,{title:D(`cacheConfirmTitle`),description:s.disclaimer,onClose:()=>a(!1),actions:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(g,{onClick:()=>a(!1),children:D(`cacheCancel`)}),(0,R.jsx)(g,{variant:`primary`,onClick:()=>(a(!1),r(W(e,!0))),children:D(`cacheConfirm`)})]})})]}):null},Ut=(e,t,n)=>{let{[t]:r,...i}=e;return n==null||n===``?i:{...i,[t]:n}},Wt=(e,t)=>{let{type:n}=Oe(e.Resource);if(t){let{Cache:t,...r}=e;return{...r,Resource:`${n}${ye}`}}let{HeartbeatSeconds:r,TimeoutSeconds:i,...a}=e;return{...a,Resource:n,...i!==void 0&&i<=xe.taskTimeoutSeconds&&{TimeoutSeconds:i}}},Gt=e=>ke(e)===void 0,Kt=(e,t)=>({...e,Resource:`${t}${Oe(e.Resource).waits&&Gt(t)?ye:``}`}),qt=(e,t,n)=>{let{[t]:r,...i}=typeof e.Arguments==`object`&&e.Arguments!==null?e.Arguments:{};return{...e,Arguments:n===void 0?i:{...i,[t]:n}}},Jt=({state:e,types:t,problems:n,disabled:r,onChange:i})=>{let a=t.step_types.filter(e=>e.available),{type:s,waits:c}=Oe(e.Resource),u=Gt(s),d=t.step_types.find(e=>e.id===s),p=typeof e.Arguments==`string`||!d;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(l,{label:D(`stepType`),error:B(n,`Resource`),children:(0,R.jsxs)(f,{value:s,disabled:r,onChange:t=>i(Kt(e,t.target.value)),children:[!a.some(e=>e.id===s)&&(0,R.jsx)(`option`,{value:s,children:he(s,d?.label)}),a.map(e=>(0,R.jsx)(`option`,{value:e.id,children:he(e.id,e.label)},e.id))]})}),p?(0,R.jsx)(H,{label:D(`arguments`),kind:`json`,value:e.Arguments,error:B(n,`Arguments`),disabled:r,onChange:t=>i({...e,Arguments:t??{}})}):L(d.input).map(t=>(0,R.jsx)(H,{label:se(t.name,t.title),kind:t.kind,options:t.options,required:t.required,...t.kind===`names`&&{help:D(`namesHelp`)},value:e.Arguments?.[t.name],error:B(n,`Arguments.${t.name}`),disabled:r,onChange:n=>i(qt(e,t.name,n))},`${s}:${t.name}`)),u&&(0,R.jsx)(l,{label:D(`waitsForResult`),help:D(`waitsForResultHelp`),children:(0,R.jsx)(o,{checked:c,onChange:t=>!r&&i(Wt(e,t))})}),c||!u?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(H,{label:D(`waitTimeout`),help:D(`waitTimeoutHelp`),kind:`json`,value:e.TimeoutSeconds,error:B(n,`TimeoutSeconds`),disabled:r,onChange:t=>i(Ut(e,`TimeoutSeconds`,t))}),(0,R.jsx)(H,{label:D(`heartbeatSeconds`),help:D(`heartbeatHelp`),kind:`json`,value:e.HeartbeatSeconds,error:B(n,`HeartbeatSeconds`),disabled:r,onChange:t=>i(Ut(e,`HeartbeatSeconds`,t))})]}):(0,R.jsx)(Ht,{state:e,types:t,disabled:r,onChange:i})]})},G=(e,t,n)=>{let{[t]:r,...i}=e;return n===void 0?i:{...i,[t]:n}},Yt=({state:e,problems:t,disabled:n,onChange:r})=>(0,R.jsx)(H,{label:D(`onlyWhen`),kind:`text`,help:D(`onlyWhenHelp`),value:e.Condition,error:B(t,`Condition`),disabled:n,onChange:t=>r(G(e,`Condition`,t))}),K=e=>{let{state:t,names:n,problems:r,disabled:i,onChange:a}=e;if(e.data)return(0,R.jsx)(Yt,{...e});let o=t;return(0,R.jsx)(V,{label:D(`goesOnTo`),value:o.Next,names:n,none:D(`endsHere`),error:B(r,`Next`)??B(r,`End`),disabled:i,onChange:e=>{let{Next:t,End:n,...r}=o;a(e===void 0?{...r,End:!0}:{...r,Next:e})}})},Xt=e=>{let{state:t,types:n,problems:r,disabled:i,onChange:a}=e,o=(e,n,o,s)=>(0,R.jsx)(H,{label:n,kind:o,help:s,value:t[e],error:B(r,e),disabled:i,onChange:n=>a(G(t,e,n))});if(t.Type===`Task`)return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Jt,{state:t,types:n,problems:r,disabled:i,onChange:a}),(0,R.jsx)(K,{...e}),!e.data&&(0,R.jsx)(U,{...e,state:t})]});if(t.Type===`Choice`)return(0,R.jsx)(Vt,{...e,state:t});if(t.Type===`Map`)return(0,R.jsxs)(R.Fragment,{children:[o(`Items`,D(`items`),`json`,D(`itemsHelp`)),o(`MaxConcurrency`,D(`maxConcurrency`),`json`),(0,R.jsx)(K,{...e}),!e.data&&(0,R.jsx)(U,{...e,state:t})]});if(t.Type===`Block`){let n=(e,n,o,s)=>(0,R.jsx)(H,{label:n,kind:o,help:s,value:t.Cache?.[e],error:B(r,`Cache.${e}`)??(e===`Ttl`?B(r,`Cache`):void 0),disabled:i,onChange:n=>a({...t,Cache:G(t.Cache??{Ttl:``},e,n)})});return(0,R.jsxs)(R.Fragment,{children:[o(`Arguments`,D(`blockArguments`),`json`,D(`blockArgumentsHelp`)),n(`Ttl`,D(`blockTtl`),`text`,D(`blockTtlHelp`)),n(`Key`,D(`blockKey`),`json`,D(`blockKeyHelp`)),(0,R.jsx)(K,{...e}),!e.data&&(0,R.jsx)(U,{...e,state:t})]})}return t.Type===`Wait`?(0,R.jsxs)(R.Fragment,{children:[o(`Seconds`,D(`seconds`),`json`),(0,R.jsx)(K,{...e})]}):t.Type===`Pass`?(0,R.jsxs)(R.Fragment,{children:[o(`Output`,D(`output`),`json`,D(`outputHelp`)),(0,R.jsx)(K,{...e})]}):t.Type===`Succeed`?o(`Output`,D(`output`),`json`,D(`outputHelp`)):t.Type===`Fail`?(0,R.jsxs)(R.Fragment,{children:[e.data&&(0,R.jsx)(Yt,{...e}),o(`Error`,D(`error`),`text`),o(`Cause`,D(`cause`),`text`)]}):null},Zt=(e,t,n,r)=>{let{[n]:i,...a}=t;return{[e]:r===void 0?a:{...a,[n]:r}}},Qt=({trigger:e,types:t,problems:n,disabled:r,onChange:i})=>{let a=de(e),o=t.triggers.filter(e=>e.available),s=o.find(e=>e.id===a),c=a!==void 0&&!s?a:void 0,u=a===void 0?{}:e[a]??{};return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(l,{label:D(`startsWhen`),error:B(n,`trigger`),help:c&&D(`triggerOtherHelp`),children:(0,R.jsxs)(f,{value:a??``,disabled:r,onChange:e=>i({[e.target.value]:{}}),children:[c!==void 0&&(0,R.jsx)(`option`,{value:c,children:ue(c,t.triggers.find(e=>e.id===c)?.label)}),a===void 0&&(0,R.jsx)(`option`,{value:``,children:D(`triggerUnknown`)}),o.map(e=>(0,R.jsx)(`option`,{value:e.id,children:ue(e.id,e.label)},e.id))]})}),s&&L(s.input).map(e=>(0,R.jsx)(H,{label:se(e.name,e.title),kind:e.kind,options:e.options,required:e.required,...e.kind===`names`&&{help:D(`namesHelp`)},value:u[e.name],error:B(n,`trigger.${s.id}.${e.name}`),disabled:r,onChange:t=>i(Zt(s.id,u,e.name,t))},`${s.id}:${e.name}`)),c!==void 0&&(0,R.jsx)(H,{label:D(`triggerInput`),kind:`json`,value:u,error:B(n,`trigger.${c}`),disabled:!0,onChange:()=>void 0})]})},$t=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&typeof e.Type==`string`,en=({kind:e,name:t})=>(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e}),(0,R.jsx)(`h3`,{className:`truncate font-semibold text-foreground`,children:t})]}),tn=({definition:e,types:t,selected:n,problems:r,warnings:i=[],onChange:a,onSelect:o})=>{let s=C(e,n);if(!s)return null;let{scope:c,name:l}=w(n),u=E(e,c),d=!a,f=e=>a?.(e);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(en,{kind:ve(s,t),name:l}),(0,R.jsx)(Ot,{problems:r}),(0,R.jsx)(kt,{warnings:i}),(0,R.jsx)(At,{name:l,taken:Ne(e.stateMachine),disabled:d,onRename:t=>{f(_t(e,n,t)),o(Me(c,t))}},n),(0,R.jsx)(Xt,{state:s,types:t,names:Object.keys(u.States),problems:r,disabled:d,data:y(e)===`data`,onChange:t=>f(pt(e,n,t))}),(0,R.jsxs)(`details`,{children:[(0,R.jsx)(`summary`,{className:`cursor-pointer text-body font-medium text-muted-foreground`,children:D(`asJson`)}),(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(H,{label:D(`stepJson`),kind:`json`,help:D(`stepJsonHelp`),value:s,disabled:d,onChange:t=>{$t(t)&&f(pt(e,n,t))}},n)})]}),a&&(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[y(e)===`sequence`&&u.StartAt!==l&&(0,R.jsxs)(g,{size:`sm`,onClick:()=>f(vt(e,n)),children:[(0,R.jsx)(He,{className:`size-3.5`}),D(`startHere`)]}),(0,R.jsxs)(g,{size:`sm`,variant:`danger`,onClick:()=>{f(ut(e,n)),o(void 0)},children:[(0,R.jsx)(_,{className:`size-3.5`}),D(`removeStep`)]})]})]})},nn=e=>{let{definition:t,types:n,selected:r,problems:i,onChange:a}=e;return(0,R.jsx)(`section`,{"aria-label":D(`chosenStep`),className:`flex flex-col gap-4 rounded-lg border bg-background p-4`,children:r===``?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(en,{kind:D(`trigger`),name:pe(t.trigger,n)}),(0,R.jsx)(Ot,{problems:i}),(0,R.jsx)(Qt,{trigger:t.trigger,types:n,problems:i,disabled:!a,onChange:e=>a?.(yt(t,e))})]}):(0,R.jsx)(tn,{...e,selected:r})})},rn=e=>typeof e==`object`&&!!e&&!Array.isArray(e),q=(e,t,n,r)=>{let i=structuredClone(e),{scope:a,name:o}=w(t),s=E(i,a)?.States[o];if(s&&n[0]===`#condition`)return r===void 0?delete s.Condition:s.Condition=r,i;if(!s||s.Type!==`Task`)return e;rn(s.Arguments)||(s.Arguments={});let c=s.Arguments;for(let e of n.slice(0,-1))rn(c[e])||(c[e]={}),c=c[e];let l=n.at(-1);return r===void 0?delete c[l]:c[l]=r,i},an=e=>[`=`,`!=`,`>`,`<`,`matches`,`and`,`or`,`not`,...e?[`expression`]:[]],on=e=>e.kind===`compare`||e.kind===`matches`?{value:``}:{value:e.kind===`logic`&&e.op===`and`},sn=e=>e===`not`?{kind:`not`,sides:[{value:!1}]}:e===`and`||e===`or`?{kind:`logic`,op:e,sides:[{value:e===`and`},{value:e===`and`}]}:e===`matches`?{kind:`matches`,sides:[{value:``},{pattern:`.*`,flags:``}]}:{kind:`compare`,op:e,sides:[{value:``},{value:``}]},cn=`{% true %}`,ln=(e,t)=>{if(t.length===0)return e;let n=e.sides[t[0]];return n&&v(n)?ln(n,t.slice(1)):void 0},J=(e,t,n)=>({...e,sides:e.sides.map((e,r)=>r===t?n:e)}),Y=(e,t,n)=>{if(t.length===0)return n(e);let r=e.sides[t[0]],i=r&&v(r)?Y(r,t.slice(1),n):void 0;return i&&J(e,t[0],i)},un=(e,t,n)=>{if(e.kind===`logic`&&t===e.sides.length)return{...e,sides:[...e.sides,n]};if(!(t>=e.sides.length)){if(e.kind===`matches`&&t===1)return!v(n)&&`value`in n&&typeof n.value==`string`?J(e,1,{pattern:n.value||`.*`,flags:e.sides[1].flags}):void 0;if(e.kind!==`compare`&&e.kind!==`matches`||!v(n))return J(e,t,n)}},X=(e,t,n,r)=>{let i=b(C(e,t)?.Condition),a=i&&n.length>0&&Y(i,n.slice(0,-1),e=>un(e,n.at(-1),r));return a&&b(x(a))?q(e,t,[T],x(a)):e},dn=(e,t,n,r)=>{let i=C(e,t)?.Condition;if(n.length===0)return i!==void 0&&i!==``?e:q(e,t,[T],r===`expression`?cn:x(sn(r)));let a=b(i),o=a&&ln(a,n.slice(0,-1)),s=n.at(-1),c=o?.sides[s],l=o?.kind===`logic`&&s===o.sides.length;return r===`expression`||!o||o.kind===`compare`||o.kind===`matches`||!l&&(!c||v(c)||!(`value`in c))?e:X(e,t,n,sn(r))},fn=(e,t,n)=>{if(n.length===0)return q(e,t,[T],void 0);let r=b(C(e,t)?.Condition),i=n.at(-1),a=r&&Y(r,n.slice(0,-1),e=>{if(!(i>=e.sides.length))return e.kind===`logic`&&e.sides.length>2?{...e,sides:e.sides.filter((e,t)=>t!==i)}:un(e,i,on(e))});return a?q(e,t,[T],x(a)):e},pn=e=>{let t=[];if(`Next`in e&&e.Next!==void 0&&t.push(e.Next),e.Type===`Choice`){for(let n of e.Choices??[])t.push(n.Next);e.Default!==void 0&&t.push(e.Default)}if(`Catch`in e)for(let n of e.Catch??[])n.Next!==void 0&&t.push(n.Next);return t},mn=(e,t)=>{let n=new Set,r=[t];for(;r.length>0;){let t=r.shift(),i=e.States[t];!n.has(t)&&i&&(n.add(t),r.push(...pn(i)))}return[...n]},hn=e=>e.StartAt===void 0?Object.keys(e.States):mn(e,e.StartAt),gn=e=>{if(e.Resource!==`app:http`||typeof e.Arguments!=`object`||e.Arguments===null)return!1;let t=e.Arguments.method;return t===void 0||typeof t==`string`&&t.toUpperCase()===`GET`},_n=(e,t,n)=>t.flatMap(t=>{let r=e.States[t];if(!r)return[];let i=Se(r),a=i?_n(i,hn(i),n):[];return r.Type===`Task`?(n?.step_types.find(e=>e.id===r.Resource)?.writes??!0)===!1||gn(r)?[]:[{name:t,kind:ve(r,n)}]:a}),vn=(e,t)=>{if(!e||t||!(`Assign`in e)||!e.Assign)return e;let n=Object.fromEntries(Object.entries(e.Assign).filter(([,e])=>e!==De)),{Assign:r,...i}=e;return Object.keys(n).length===0?i:{...i,Assign:n}},yn=(e,t,n)=>{let r=e?.stateMachine.States[n],i=r!==void 0&&`Output`in r;return JSON.stringify(vn(r,i))!==JSON.stringify(vn(t.stateMachine.States[n],i))},bn=(e,t)=>{let n=Ce(e),r=new Set([t]);for(let e=!0;e;){e=!1;for(let[t,i]of n)!r.has(t)&&[...Ee(i)].some(e=>r.has(e))&&(r.add(t),e=!0)}return Object.keys(e.States).filter(e=>r.has(e))},xn=(e,t,n=e.stateMachine.StartAt)=>{let r=e.stateMachine;return _n(r,y(e)===`data`?n===void 0?hn(r):bn(r,n):n===void 0?hn(r):mn(r,n),t)},Sn=/^[A-Za-z_][A-Za-z0-9_]*$/,Cn=e=>Sn.test(e)?e:`\`${e.replaceAll("`",``)}\``,wn=e=>{let t=JSON.stringify(e)??``;return t.length>60?`${t.slice(0,59)}…`:t},Tn=100,En=4,Dn=e=>{let t=[{path:``,sample:wn(e)}],n=(e,r,i)=>{if(!(i===En||typeof r!=`object`||!r||t.length>=Tn)){if(Array.isArray(r)){if(r.length===0)return;let a=`${e}[0]`;t.push({path:a,sample:wn(r[0])}),n(a,r[0],i+1);return}for(let[a,o]of Object.entries(r)){let r=e===``?Cn(a):`${e}.${Cn(a)}`;t.push({path:r,sample:wn(o)}),n(r,o,i+1)}}};return n(``,e,0),t.slice(0,Tn)},On=(e,t)=>t===``?e:`${e}${t.startsWith(`[`)?``:`.`}${t}`,kn=(e,t)=>{if(e==null||e===``)return`{% ${t} %}`;if(typeof e!=`string`)throw Error(`A value is inserted only into a field that holds text`);let n=/^\{%([\s\S]*)%\}$/.exec(e.trim());return n?`{% (${n[1].trim()}) & ${t} %}`:`{% ${JSON.stringify(e)} & ${t} %}`},An=(e,t)=>{let{scope:n,name:r}=w(t),i=(e,t,n)=>Object.keys(e.States).filter(n=>n!==t&&mn(e,n).includes(t)).filter(t=>[`Task`,`Map`,`Block`].includes(e.States[t].Type)).map(e=>[...n,e].join(`/`)),a=i(E(e,n),r,n),o=n.findLastIndex((t,r)=>E(e,n.slice(0,r))?.States[n[r]]?.Type===`Block`);return[...n.flatMap((t,r)=>r<=o?[]:i(E(e,n.slice(0,r)),t,n.slice(0,r))),...a]},jn=`{% $states.result %}`,Mn=(e,t)=>{let{scope:n,name:r}=w(t),i=E(e,n)?.States[r];return i!==void 0&&`Output`in i},Nn=e=>`Assign`in e&&e.Assign?e.Assign:{},Pn=e=>Object.values(e.States).flatMap(e=>[...Object.keys(Nn(e)),...Se(e)?Pn(Se(e)):[]]),Fn=(e,t)=>{let n=t.toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).replace(/^(\d)/,`step_$1`)||`value`,r=new Set(Pn(e.stateMachine));if(!r.has(n))return n;let i=2;for(;r.has(`${n}_${i}`);)i++;return`${n}_${i}`},In=(e,t)=>{let{scope:n,name:r}=w(t),i=E(e,n).States[r],a=Object.entries(Nn(i)).find(([,e])=>e===jn);if(a)return{definition:e,variable:a[0],added:!1};let o=Fn(e,r),s=structuredClone(e),c=E(s,n).States[r];return c.Assign={...c.Assign,[o]:jn},{definition:s,variable:o,added:!0}},Z=(e,t)=>e.pure.find(e=>e.id===t),Ln=(e,t)=>{let n=me(t.handle);if(!n)return;let r=Z(e,t.node);return r?r.kind===`break`?{node:r.source,path:[...r.path,...n]}:void 0:{node:t.node,path:n}},Q=(e,t)=>{let n=oe(t.handle);if(n===void 0)return;let r=Z(e,t.node);if(!r)return e.inputs.has(t.node)?{step:t.node,keys:[n]}:void 0;if(r.kind===`make`)return{step:r.target,keys:[r.key,n]};if(r.kind===`select`)return{step:r.target,keys:[r.key],select:r};if((r.kind!==`condition`||r.part.kind!==`matches`||n!==`1`)&&r.kind===`condition`&&r.part.kind!==`expression`)return{step:r.target,keys:[T],side:{node:r,at:[...r.at,Number(n)]}}},Rn=(e,t)=>e.path.length===1&&e.path[0]===`#status`&&t.keys.length===1&&t.keys[0]===`#condition`&&!t.side,zn=(e,t,n)=>{let r=Z(e,t.node);if(n===`out`){let n=me(t.handle);return(r?.kind===`break`?r.outputs:e.outputs.get(t.node)??[]).find(e=>JSON.stringify(e.path)===JSON.stringify(n))?.type}let i=oe(t.handle);if(!(r?.kind===`condition`&&r.part.kind===`compare`||r?.kind===`select`))return(r?.kind===`make`||r?.kind===`condition`?r.inputs:e.inputs.get(t.node)??[]).find(e=>e.key===i)?.type},Bn=(e,t)=>w(t).scope.some((t,n,r)=>C(e,r.slice(0,n+1).join(`/`))?.Type===`Block`),Vn=(e,t)=>{let{scope:n}=w(t);for(let t=n.length;t>0;t--)if(C(e,n.slice(0,t).join(`/`))?.Type===`Block`)return n.slice(0,t).join(`/`)},Hn=(e,t,n)=>{let{scope:r,name:i}=w(t);if(w(n).scope.join(`/`)!==r.join(`/`))return!1;let a=Ce(E(e,r)),o=new Set,s=[i];for(;s.length>0;){let e=s.pop();if(e===w(n).name)return!0;o.has(e)||(o.add(e),s.push(...Ee(a.get(e)??{data:new Set,status:new Set,handled:new Set})))}return!1},Un=(e,t,n,r)=>{let i=Ln(t,n),a=Q(t,r);if(!i||!a)return{reason:`notPins`};let o=Vn(e,a.step);if(o!==void 0&&i.node!==``&&!i.node.startsWith(`${o}/`))return{reason:`otherScope`,step:w(i.node).name};if(y(e)===`data`&&i.node!==``){let[t,n]=[w(i.node).scope.join(`/`),w(a.step).scope.join(`/`)];if(t!==``&&t!==n&&!n.startsWith(`${t}/`))return{reason:`otherScope`,step:w(i.node).name};if(Hn(e,i.node,a.step))return{reason:`notBefore`,step:w(i.node).name};if(i.path[0]!==`#status`&&Mn(e,i.node))return{reason:`shapesOutput`,step:w(i.node).name}}else if(i.node===``){if(Bn(e,a.step))return{reason:`notBefore`,step:w(a.step).name}}else{if(!An(e,a.step).includes(i.node))return{reason:`notBefore`,step:w(i.node).name};if(Mn(e,i.node))return{reason:`shapesOutput`,step:w(i.node).name}}if(Rn(i,a))return;let s=zn(t,n,`out`),c=zn(t,r,`in`);if(s&&c&&!be(s,c))return{reason:`type`,source:s,target:c}},Wn=(e,t,n,r)=>{if(Un(e,t,n,r))return e;let i=Ln(t,n),a=Q(t,r),o=e,s;if(i.node===``)s={base:{input:!0},path:i.path};else if(i.path[0]===`#status`)s={base:{step:w(i.node).name},path:i.path.slice(1)};else{let t=In(e,i.node);o=t.definition,s={base:{variable:t.variable},path:i.path}}let c=`step`in s.base&&s.path.length===0?{...s,path:[`Status`]}:s;return a.side?X(o,a.step,a.side.at,{read:c}):a.select?q(o,a.step,a.keys,S({...a.select.part,operand:{read:c}})):Rn(i,a)?q(o,a.step,a.keys,x({kind:`compare`,op:`=`,sides:[{read:c},{value:`SUCCEEDED`}]})):q(o,a.step,a.keys,je(s))},Gn=(e,t,n)=>{let r=Q(t,{node:n.target,handle:n.targetHandle});if(r?.side)return fn(e,r.step,r.side.at);if(r?.select)return q(e,r.step,r.keys,S({...r.select.part,operand:{value:``}}));if(r)return q(e,r.step,r.keys,void 0);let i=Z(t,n.target)??Z(t,n.source);return i?Kn(e,t,i):e},Kn=(e,t,n)=>{if(n.kind===`make`||n.kind===`select`)return q(e,n.target,[n.key],void 0);if(n.kind===`condition`)return fn(e,n.target,n.at);let r=e=>t.edges.filter(t=>t.source===e.id&&!t.expression).flatMap(e=>{let n=Z(t,e.target);return n?.kind===`break`?r(n):[e]});return ge(t,r(n),e=>fe(t,e)).reduce((e,n)=>Gn(e,t,n),e)},qn=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`,Jn={connect:dt,disconnect:ft,removeState:ut,setArgument:q,connectData:Wn,disconnectData:Gn,removePure:Kn,wireRefusal:Un,addCondition:dn,conditionChoices:an,setConditionSide:X,addSelect:(e,t,n)=>{let r=C(e,t)?.Arguments?.[n];if(r!==void 0&&!qn(r)||typeof r==`string`&&r.startsWith(`{%`))return e;let i=r??``;return q(e,t,[n],S({operand:{value:``},cases:[{when:``,then:i}],otherwise:i}))}},Yn=(e,t,n={})=>({inputs:Object.fromEntries(e.step_types.map(e=>[e.id,e.input])),outputs:Object.fromEntries([...e.step_types,...e.triggers].flatMap(e=>e.output?[[e.id,e.output]]:[])),records:(e,r)=>{let i=t[e];return i&&Re(i,r,n[e]?.names?.singular??h(e),ze(e=>t[e]))},emails:t=>{let n=e.templates?.find(e=>e.name===t);return n&&{schema:n.schema,languages:n.languages}}}),Xn=e=>{let{data:t}=re();return(0,z.useMemo)(()=>Yn(e,t?.resources??{},t?.views),[e,t?.resources,t?.views])},$=te(`app/field-types/workflow-page`),Zn={"app:http":{icon:Ke,keywords:[`api`,`fetch`,`url`,`webhook`,`get`,`post`]},"app:mail.send":{icon:d,keywords:[`email`,`send`,`message`]},"app:records.create":{icon:O,keywords:[`insert`,`add`,`new`,`row`]},"app:records.update":{icon:O,keywords:[`change`,`edit`,`row`]},"app:records.get":{icon:O,keywords:[`read`,`find`,`row`]},"app:records.list":{icon:O,keywords:[`read`,`find`,`query`,`rows`]}},Qn=[{type:`Choice`,icon:We,description:()=>$(`flowChoice`),keywords:[`if`,`branch`,`switch`,`condition`]},{type:`Map`,icon:Xe,description:()=>$(`flowMap`),keywords:[`loop`,`each`,`list`,`repeat`]},{type:`Block`,icon:ie,description:()=>$(`flowBlock`),keywords:[`cache`,`once`,`group`,`reuse`,`wrap`]},{type:`Wait`,icon:Qe,description:()=>$(`flowWait`),keywords:[`delay`,`sleep`,`pause`,`later`]},{type:`Pass`,icon:Je,description:()=>$(`flowPass`),keywords:[`variable`,`assign`,`transform`]},{type:`Succeed`,icon:c,description:()=>$(`flowSucceed`),keywords:[`end`,`stop`,`done`]},{type:`Fail`,icon:s,description:()=>$(`flowFail`),keywords:[`end`,`stop`,`error`]}],$n=e=>({id:`task:${e.id}`,title:le(e.id,e.label),description:e.description,keywords:[e.id,...Zn[e.id]?.keywords??[]],icon:Zn[e.id]?.icon??(e.id.startsWith(`app:`)?a:ee)}),er=e=>e.slice(0,Math.max(e.indexOf(`:`),0)),tr=e=>e===`custom`?$(`customSteps`):e,nr=e=>{let t=new Set(Object.values(Ae(e.step_types.map(e=>e.id)))),n=e.step_types.filter(e=>e.available&&(!ke(e.id)||t.has(e.id))),r=[...new Set(n.map(e=>er(e.id)).filter(e=>e!==`app`))];return[{title:$(`builtIn`),items:n.filter(e=>er(e.id)===`app`).map($n)},...r.map(e=>({title:tr(e),items:n.filter(t=>er(t.id)===e).map($n)})),{title:$(`flow`),items:Qn.map(e=>({id:`type:${e.type}`,title:ce(e.type),description:e.description(),keywords:e.keywords,icon:e.icon}))}].filter(e=>e.items.length>0)},rr=e=>e.startsWith(`task:`)?{task:e.slice(5)}:{type:e.slice(5)};export{ht as A,st as C,at as D,$e as E,nt as O,N as S,ct as T,Et as _,Jn as a,Dt as b,Dn as c,kn as d,yn as f,Ot as g,Ft as h,Xn as i,rt as k,Mn as l,nn as m,nr as n,An as o,xn as p,$ as r,On as s,rr as t,In as u,xt as v,ot as w,St as x,Ct as y};
2
+ //# debugId=8a9916b7-4800-4aa7-8100-2924e7bd91a9
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Gc as r,Qi as i,Rn as a,as as o,dc as s,el as c,es as l,rl as u,uc as d,zr as f}from"./app-CK_M0TgA.js";import{l as p,m,n as h,u as g}from"./workflow-canvas-CZ6QjuM6.js";import{m as _}from"./workflows-Bey4jszG.js";import{E as v,T as y,n as b}from"./use-run-trace-2fQX9FeC.js";var x=e(t(),1),S=e=>e===``?[]:e.split(`/`).map(t=>{let n=/^(.*)\.\d+\[(\d+)\]$/.exec(t);if(!n)throw Error(`"${e}" is not a step's scope`);return{map:decodeURIComponent(n[1]),index:Number(n[2])}}),C=(e,t)=>[...S(e).map(e=>e.map),t].join(`/`),w={succeeded:0,caught:1,retrying:2,failed:3,current:4},T=(e,{inProgress:t,startAt:n,within:r=[]})=>{let i=(e,t)=>[...r,C(e,t)].join(`/`),a=new Map,o=new Map,s=new Map;for(let t of e){let e=i(t.scope,t.state);a.set(e,(a.get(e)??0)+1),o.set(`${t.scope}\n${t.state}`,t),s.set(t.scope,t)}let c=new Map,l=(e,t)=>{let n=c.get(e);(n===void 0||w[t]>w[n])&&c.set(e,t)};for(let e of o.values())l(i(e.scope,e.state),e.status);if(t){!s.has(``)&&n&&l([...r,n].join(`/`),`current`);for(let e of s.values())e.status!==`retrying`&&e.next!==null&&l(i(e.scope,e.next),`current`)}return new Map([...c].map(([e,t])=>[e,{status:t,steps:a.get(e)??0}]))},E=c(`app/field-types/workflow-run`),D=e(n(),1),O=({title:e,children:t})=>(0,D.jsxs)(`div`,{className:`grid gap-1`,children:[(0,D.jsx)(`h5`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]}),k=e=>new Intl.DateTimeFormat(u(),{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).format(Date.parse(e)),A=({logs:e})=>(0,D.jsx)(`ol`,{className:`grid gap-0.5 rounded-md bg-muted/60 px-3 py-2 font-mono text-xs`,children:e.map((e,t)=>(0,D.jsxs)(`li`,{className:`whitespace-pre-wrap break-words`,children:[(0,D.jsx)(`time`,{dateTime:e.at,className:`text-muted-foreground`,children:k(e.at)}),` `,e.message]},t))}),j=({step:e,runId:t,valueActions:n})=>{let c=o(),u=typeof e.type==`string`&&_(e.type)!==void 0&&c.resources.workflow_custom_step_jobs!==void 0&&c.permissions.workflow_custom_step_jobs?.read!==!1,d=e.logs?.some(e=>e.message===`Not sent: replay`)??!1,m=S(e.scope),g=e.output!==void 0&&e.output!==null&&(0,D.jsxs)(O,{title:E(`output`),children:[(0,D.jsx)(a,{value:e.output}),n?.(e.output,`output`)]});return(0,D.jsxs)(`article`,{"aria-label":E(`stepTry`,{attempt:e.attempt}),className:`grid gap-3 rounded-lg border bg-background p-3`,children:[(0,D.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-body`,children:[(0,D.jsx)(`span`,{className:`font-medium text-foreground`,children:E(`stepTry`,{attempt:e.attempt})}),m.map((e,t)=>(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:E(`itemOf`,{index:e.index+1,map:e.map})},t)),(0,D.jsx)(l,{tone:h[e.status],children:p(e.status)}),d&&(0,D.jsx)(l,{tone:`violet`,children:E(`notSent`)}),e.reused===!0&&(0,D.jsx)(l,{tone:`blue`,children:E(`reused`)}),e.joined===!0&&(0,D.jsx)(l,{tone:`blue`,children:E(`joined`)}),(0,D.jsx)(`time`,{dateTime:e.started_at,className:`text-muted-foreground`,children:i(Date.parse(e.started_at))}),(0,D.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:E(`duration`,{ms:Number(e.duration_ms??0)})})]}),e.error!=null&&(0,D.jsx)(O,{title:E(`error`),children:(0,D.jsxs)(`p`,{className:`text-body text-danger-text`,children:[(0,D.jsx)(`span`,{className:`font-mono`,children:String(e.error)}),e.cause!=null&&(0,D.jsxs)(`span`,{children:[`: `,String(e.cause)]})]})}),typeof e.run==`string`&&(0,D.jsxs)(`div`,{className:`grid gap-1`,children:[e.reused===!0&&(0,D.jsx)(`p`,{className:`text-body text-muted-foreground`,children:E(`reusedResult`)}),e.joined===!0&&(0,D.jsx)(`p`,{className:`text-body text-muted-foreground`,children:E(`joinedResult`)}),(0,D.jsx)(f,{to:{kind:`record`,resource:`workflow_runs`,key:e.run},className:r(s({size:`sm`}),`justify-self-start`),children:e.reused===!0?E(`openEarlierBlockRun`):E(`openBlockRun`)})]}),u&&(0,D.jsx)(f,{to:{kind:`list`,resource:`workflow_custom_step_jobs`,filter:`run_id = "${t}"`},className:r(s({size:`sm`}),`justify-self-start`),children:E(`openJobs`)}),e.status!==`failed`&&g,e.input!==void 0&&e.input!==null&&(0,D.jsxs)(O,{title:E(`input`),children:[(0,D.jsx)(a,{value:e.input}),n?.(e.input,`input`)]}),e.status===`failed`&&g,e.assigned!=null&&(0,D.jsx)(O,{title:E(`variables`),children:(0,D.jsx)(a,{value:e.assigned})}),e.logs&&e.logs.length>0&&(0,D.jsx)(O,{title:E(`logs`),children:(0,D.jsx)(A,{logs:e.logs})})]})},M=({kind:e,name:t})=>(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e}),(0,D.jsx)(`h4`,{className:`truncate font-semibold text-foreground`,children:t})]}),N=({run:e,name:t,block:n,valueActions:r})=>{let i=b(e.id,!1),[a,o]=(0,x.useState)(20);if(i.isPending)return null;let c=(i.data??[]).filter(e=>e.state===t),l=n===void 0?void 0:(i.data??[]).filter(e=>e.state===n&&typeof e.run==`string`).at(-1)?.run;return c.length===0&&typeof l==`string`?(0,D.jsxs)(`div`,{className:`grid gap-2 text-body text-muted-foreground`,children:[(0,D.jsx)(`p`,{children:E(`ranInBlockRun`,{block:n})}),(0,D.jsx)(f,{to:{kind:`record`,resource:`workflow_runs`,key:l},className:s({size:`sm`})+` justify-self-start`,children:E(`openBlockRun`)})]}):c.length===0?(0,D.jsx)(`p`,{className:`text-body text-muted-foreground`,children:E(`notRun`)}):(0,D.jsxs)(`div`,{className:`grid gap-3`,children:[c.slice(0,a).map(t=>(0,D.jsx)(j,{step:t,runId:e.id,...r&&{valueActions:r}},String(t.id))),c.length>a&&(0,D.jsx)(d,{size:`sm`,className:`justify-self-start`,onClick:()=>o(a+20),children:E(`showMore`)})]})},P=({definition:e,run:t,selected:n,types:r})=>{let i=n===``?void 0:v(e,n);return(0,D.jsx)(`section`,{"aria-label":E(`chosenStep`),className:`grid gap-3 rounded-lg border bg-surface p-4`,children:i?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(M,{kind:g(i,r),name:y(n).name}),(0,D.jsx)(N,{run:t,name:y(n).name})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(M,{kind:E(`trigger`),name:m(e.trigger,r)}),(0,D.jsx)(O,{title:E(`runInput`),children:(0,D.jsx)(a,{value:t.input??null})})]})})};export{T as a,E as i,P as n,C as o,O as r,N as t};
2
- //# debugId=8496e5f7-265a-49a5-872a-9f84f35aead8
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Gc as r,Qi as i,Rn as a,as as o,dc as s,el as c,es as l,rl as u,uc as d,zr as f}from"./app-B8KcM2Z-.js";import{l as p,m,n as h,u as g}from"./workflow-canvas-DBlvFI_n.js";import{m as _}from"./workflows-Bey4jszG.js";import{E as v,T as y,n as b}from"./use-run-trace-CRG2_uVq.js";var x=e(t(),1),S=e=>e===``?[]:e.split(`/`).map(t=>{let n=/^(.*)\.\d+\[(\d+)\]$/.exec(t);if(!n)throw Error(`"${e}" is not a step's scope`);return{map:decodeURIComponent(n[1]),index:Number(n[2])}}),C=(e,t)=>[...S(e).map(e=>e.map),t].join(`/`),w={succeeded:0,caught:1,retrying:2,failed:3,current:4},T=(e,{inProgress:t,startAt:n,within:r=[]})=>{let i=(e,t)=>[...r,C(e,t)].join(`/`),a=new Map,o=new Map,s=new Map;for(let t of e){let e=i(t.scope,t.state);a.set(e,(a.get(e)??0)+1),o.set(`${t.scope}\n${t.state}`,t),s.set(t.scope,t)}let c=new Map,l=(e,t)=>{let n=c.get(e);(n===void 0||w[t]>w[n])&&c.set(e,t)};for(let e of o.values())l(i(e.scope,e.state),e.status);if(t){!s.has(``)&&n&&l([...r,n].join(`/`),`current`);for(let e of s.values())e.status!==`retrying`&&e.next!==null&&l(i(e.scope,e.next),`current`)}return new Map([...c].map(([e,t])=>[e,{status:t,steps:a.get(e)??0}]))},E=c(`app/field-types/workflow-run`),D=e(n(),1),O=({title:e,children:t})=>(0,D.jsxs)(`div`,{className:`grid gap-1`,children:[(0,D.jsx)(`h5`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]}),k=e=>new Intl.DateTimeFormat(u(),{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).format(Date.parse(e)),A=({logs:e})=>(0,D.jsx)(`ol`,{className:`grid gap-0.5 rounded-md bg-muted/60 px-3 py-2 font-mono text-xs`,children:e.map((e,t)=>(0,D.jsxs)(`li`,{className:`whitespace-pre-wrap break-words`,children:[(0,D.jsx)(`time`,{dateTime:e.at,className:`text-muted-foreground`,children:k(e.at)}),` `,e.message]},t))}),j=({step:e,runId:t,valueActions:n})=>{let c=o(),u=typeof e.type==`string`&&_(e.type)!==void 0&&c.resources.workflow_custom_step_jobs!==void 0&&c.permissions.workflow_custom_step_jobs?.read!==!1,d=e.logs?.some(e=>e.message===`Not sent: replay`)??!1,m=S(e.scope),g=e.output!==void 0&&e.output!==null&&(0,D.jsxs)(O,{title:E(`output`),children:[(0,D.jsx)(a,{value:e.output}),n?.(e.output,`output`)]});return(0,D.jsxs)(`article`,{"aria-label":E(`stepTry`,{attempt:e.attempt}),className:`grid gap-3 rounded-lg border bg-background p-3`,children:[(0,D.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-body`,children:[(0,D.jsx)(`span`,{className:`font-medium text-foreground`,children:E(`stepTry`,{attempt:e.attempt})}),m.map((e,t)=>(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:E(`itemOf`,{index:e.index+1,map:e.map})},t)),(0,D.jsx)(l,{tone:h[e.status],children:p(e.status)}),d&&(0,D.jsx)(l,{tone:`violet`,children:E(`notSent`)}),e.reused===!0&&(0,D.jsx)(l,{tone:`blue`,children:E(`reused`)}),e.joined===!0&&(0,D.jsx)(l,{tone:`blue`,children:E(`joined`)}),(0,D.jsx)(`time`,{dateTime:e.started_at,className:`text-muted-foreground`,children:i(Date.parse(e.started_at))}),(0,D.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:E(`duration`,{ms:Number(e.duration_ms??0)})})]}),e.error!=null&&(0,D.jsx)(O,{title:E(`error`),children:(0,D.jsxs)(`p`,{className:`text-body text-danger-text`,children:[(0,D.jsx)(`span`,{className:`font-mono`,children:String(e.error)}),e.cause!=null&&(0,D.jsxs)(`span`,{children:[`: `,String(e.cause)]})]})}),typeof e.run==`string`&&(0,D.jsxs)(`div`,{className:`grid gap-1`,children:[e.reused===!0&&(0,D.jsx)(`p`,{className:`text-body text-muted-foreground`,children:E(`reusedResult`)}),e.joined===!0&&(0,D.jsx)(`p`,{className:`text-body text-muted-foreground`,children:E(`joinedResult`)}),(0,D.jsx)(f,{to:{kind:`record`,resource:`workflow_runs`,key:e.run},className:r(s({size:`sm`}),`justify-self-start`),children:e.reused===!0?E(`openEarlierBlockRun`):E(`openBlockRun`)})]}),u&&(0,D.jsx)(f,{to:{kind:`list`,resource:`workflow_custom_step_jobs`,filter:`run_id = "${t}"`},className:r(s({size:`sm`}),`justify-self-start`),children:E(`openJobs`)}),e.status!==`failed`&&g,e.input!==void 0&&e.input!==null&&(0,D.jsxs)(O,{title:E(`input`),children:[(0,D.jsx)(a,{value:e.input}),n?.(e.input,`input`)]}),e.status===`failed`&&g,e.assigned!=null&&(0,D.jsx)(O,{title:E(`variables`),children:(0,D.jsx)(a,{value:e.assigned})}),e.logs&&e.logs.length>0&&(0,D.jsx)(O,{title:E(`logs`),children:(0,D.jsx)(A,{logs:e.logs})})]})},M=({kind:e,name:t})=>(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e}),(0,D.jsx)(`h4`,{className:`truncate font-semibold text-foreground`,children:t})]}),N=({run:e,name:t,block:n,valueActions:r})=>{let i=b(e.id,!1),[a,o]=(0,x.useState)(20);if(i.isPending)return null;let c=(i.data??[]).filter(e=>e.state===t),l=n===void 0?void 0:(i.data??[]).filter(e=>e.state===n&&typeof e.run==`string`).at(-1)?.run;return c.length===0&&typeof l==`string`?(0,D.jsxs)(`div`,{className:`grid gap-2 text-body text-muted-foreground`,children:[(0,D.jsx)(`p`,{children:E(`ranInBlockRun`,{block:n})}),(0,D.jsx)(f,{to:{kind:`record`,resource:`workflow_runs`,key:l},className:s({size:`sm`})+` justify-self-start`,children:E(`openBlockRun`)})]}):c.length===0?(0,D.jsx)(`p`,{className:`text-body text-muted-foreground`,children:E(`notRun`)}):(0,D.jsxs)(`div`,{className:`grid gap-3`,children:[c.slice(0,a).map(t=>(0,D.jsx)(j,{step:t,runId:e.id,...r&&{valueActions:r}},String(t.id))),c.length>a&&(0,D.jsx)(d,{size:`sm`,className:`justify-self-start`,onClick:()=>o(a+20),children:E(`showMore`)})]})},P=({definition:e,run:t,selected:n,types:r})=>{let i=n===``?void 0:v(e,n);return(0,D.jsx)(`section`,{"aria-label":E(`chosenStep`),className:`grid gap-3 rounded-lg border bg-surface p-4`,children:i?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(M,{kind:g(i,r),name:y(n).name}),(0,D.jsx)(N,{run:t,name:y(n).name})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(M,{kind:E(`trigger`),name:m(e.trigger,r)}),(0,D.jsx)(O,{title:E(`runInput`),children:(0,D.jsx)(a,{value:t.input??null})})]})})};export{T as a,E as i,P as n,C as o,O as r,N as t};
2
+ //# debugId=c3f36d6e-7b92-4508-8d0f-2c26b050c7ac
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$i as r,Da as i,Gc as a,Zi as o,ca as s,da as c,fi as l,fl as u,gr as d,ka as ee,na as f,oa as p,os as te,ra as m,sc as h,ta as g,vi as _}from"./app-CK_M0TgA.js";import{_ as v,a as ne,i as re,n as y,o as b,t as ie,v as x}from"./lib-dnd-kit-core-xi-7xL_N.js";import{a as ae,g as S,h as C,i as w,l as oe,m as se,n as ce,o as T,r as le,t as ue,u as E,v as D}from"./use-calendar-move-BENhrEOz.js";var O=e(t(),1),k=864e5,A=e=>Date.parse(`${e}T00:00:00Z`),j=(e,t=0)=>{let n=new Date(A(e));return new Date(Date.UTC(n.getUTCFullYear(),Math.floor(n.getUTCMonth()/3)*3+3*t,1)).toISOString().slice(0,10)},M=({scale:e,day:t})=>({scale:e,day:e===`week`?C(t):e===`month`?S(t):j(t)}),N=(e,t,n=c())=>M(e??{scale:`month`,day:s(t,n)}),P=(e,t)=>{let{scale:n,day:r}=M(e);return{scale:n,day:n===`week`?E(r,7*t):n===`month`?S(r,t):j(r,t)}},F=e=>{let t=M(e).day,n=(A(P(e,1).day)-A(t))/k;return Array.from({length:n},(e,n)=>E(t,n))},de=e=>({from:M(e).day,to:P(e,1).day}),fe=(e,t,n,r=c())=>{let i=s(n,r),a=F(e);return M({scale:t,day:i>=a[0]&&i<=a.at(-1)?i:a[0]})},I=e=>{let t=F(e);return e.scale===`week`?r(A(t[0]),A(t.at(-1))):e.scale===`month`?g(A(t[0])):m(A(t[0]),A(S(t.at(-1))))},L=e=>{let t=F(e);if(e.scale===`week`)return t.map((e,t)=>({index:t,span:1,label:`${p(A(e))} ${Number(e.slice(8))}`}));if(e.scale===`month`)return t.map((e,t)=>({index:t,span:1,label:String(Number(e.slice(8))),...t%7!=0&&{minor:!0}}));let n=t.flatMap((e,t)=>e.endsWith(`-01`)?[t]:[]);return n.map((e,r)=>({index:e,span:(n[r+1]??t.length)-e,label:f(A(t[e]))}))},R=(e,t,n,r,i=c())=>{let a=D(e,t,n,i),o=r[0],s=r.at(-1);if(!(!a||o===void 0||s===void 0||a.last<o||a.first>s))return{first:a.first<o?0:r.indexOf(a.first),last:a.last>s?r.length-1:r.indexOf(a.last),before:a.first<o,after:a.last>s,start:a.first}},z=`none`,B=(e,t,n,r)=>{let i=r.group,a=i===void 0?void 0:t.fields[i];if(i===void 0||!a)return[{key:``,rows:e}];let o=n?.fields[i],s=new Map;for(let t of e){let e=t.record[i],n=e==null||e===``,r=n?z:`value:${String(e)}`,c=n?l(`noValue`,{label:o?.label??u(i)}):t.labels[i]??_(a,e,o),d=s.get(r)??{value:n?void 0:e,lane:{key:r,label:c,rows:[]}};d.lane.rows.push(t),s.set(r,d)}let c=a.enumValues??[],d=(e,t)=>e.value===void 0||t.value===void 0?Number(e.value===void 0)-Number(t.value===void 0):a.type===`enum`?c.indexOf(String(e.value))-c.indexOf(String(t.value)):a.type===`relation`?e.lane.label.localeCompare(t.lane.label):typeof e.value==`number`&&typeof t.value==`number`?e.value-t.value:String(e.value).localeCompare(String(t.value),void 0,{numeric:!0});return[...s.values()].toSorted(d).map(({lane:e})=>e)},V=e(n(),1),H=`grid grid-cols-1 sm:grid-cols-[12rem_minmax(0,1fr)]`,U=(e,t)=>`${e/t*100}%`,pe=({ticks:e,days:t,today:n,label:r,trackRef:i})=>(0,V.jsxs)(`div`,{className:a(H,`border-b border-border bg-surface`),children:[(0,V.jsx)(`span`,{className:`hidden truncate px-2 py-1 text-xs font-medium text-muted-foreground sm:block`,children:r}),(0,V.jsx)(`div`,{ref:i,"aria-hidden":!0,className:`relative h-6`,children:e.map(e=>(0,V.jsx)(`span`,{className:a(`absolute inset-y-0 items-center truncate px-1 text-xs tabular-nums text-muted-foreground`,e.index>0?`border-l border-border`:`border-border sm:border-l`,e.minor?`hidden sm:flex`:`flex`,e.span===1&&t[e.index]===n&&`font-medium text-primary`),style:{left:U(e.index,t.length),width:U(e.span,t.length)},children:e.label},e.index))})]}),me=({ticks:e,days:t,today:n})=>{let r=t.indexOf(n);return(0,V.jsxs)(`div`,{"aria-hidden":!0,className:a(H,`pointer-events-none absolute inset-0`),children:[(0,V.jsx)(`span`,{className:`hidden sm:block`}),(0,V.jsxs)(`div`,{className:`relative`,children:[r>=0&&(0,V.jsx)(`span`,{className:`absolute inset-y-0 bg-primary/10`,style:{left:U(r,t.length),width:U(1,t.length)}}),e.map(e=>(0,V.jsx)(`span`,{className:a(`absolute inset-y-0 w-px bg-border`,(e.minor||e.index===0)&&`hidden sm:block`),style:{left:U(e.index,t.length)}},e.index))]})]})},he=({model:e,view:t,display:n,row:r,days:i,movable:o,dragged:s})=>{let c=R(r.record,n,e,i);return(0,V.jsxs)(`div`,{className:a(H,`relative border-b border-border last:border-b-0`),children:[(0,V.jsx)(`span`,{"aria-hidden":!0,className:`truncate px-2 pt-1 text-body sm:py-1.5`,children:T(e,t,n,r)}),(0,V.jsx)(`div`,{className:`relative h-7`,children:c&&(0,V.jsx)(`div`,{className:`absolute top-1/2 -translate-y-1/2`,style:{left:U(c.first,i.length),width:U(c.last-c.first+1,i.length)},children:(0,V.jsx)(w,{model:e,view:t,display:n,row:r,day:c.start,movable:o,dragged:s,className:a(c.before&&`rounded-l-none border-l-0`,c.after&&`rounded-r-none border-r-0`)})})})]})},ge=()=>[{scale:`week`,label:l(`week`)},{scale:`month`,label:l(`month`)},{scale:`quarter`,label:l(`quarter`)}],W=({model:e,view:t,display:n,fields:r,filter:a,at:f,linkTo:p,now:m=Date.now()})=>{let[g,_]=(0,O.useState)(),S=N(p?f:g,m),C=F(S),w=L(S),k=le({model:e,display:n,range:de(S),fields:r,filter:a}),{moves:A,move:j}=ce(e,n),M=B(se(ue(k.rows,A),n),e,t,n),R=te(e.name),z=i(R,`update`)&&[n.start,n.end].every(t=>t===void 0||!e.fields[t]?.readOnly),[H,U]=(0,O.useState)(),W=(0,O.useRef)(!1),G=(0,O.useRef)(0),K=(0,O.useRef)(null),q=()=>(K.current?.getBoundingClientRect().width??0)/C.length,J=e=>{let t=q();return t>0?Math.round(e/t):0},_e=({transform:e})=>({...e,x:J(e.x)*q(),y:0}),ve=x(v(ne,{activationConstraint:{distance:4}}),v(b,{activationConstraint:{delay:250,tolerance:5}}),v(re,{keyboardCodes:{start:[`Space`],cancel:[`Escape`],end:[`Space`,`Enter`]},coordinateGetter:(e,{currentCoordinates:t})=>{let n=e.code===`ArrowLeft`?-1:+(e.code===`ArrowRight`);if(n!==0)return e.preventDefault(),{x:t.x+n*q(),y:t.y}}})),Y=s(m,c()),X=r=>T(e,t,n,r.row),Z=e=>o(Date.parse(`${E(e.day,G.current)}T00:00:00Z`)),Q={onDragStart:({active:e})=>l(`pickedUp`,{title:X(e.data.current)}),onDragMove:({active:e})=>l(`startsOn`,{title:X(e.data.current),day:Z(e.data.current)}),onDragOver:()=>void 0,onDragEnd:({active:e})=>G.current===0?l(`putBack`,{title:X(e.data.current)}):l(`wasMovedTo`,{title:X(e.data.current),to:Z(e.data.current)}),onDragCancel:({active:e})=>l(`cancelled`,{title:X(e.data.current)})},$=()=>{U(void 0),setTimeout(()=>W.current=!1)},ye=({active:e})=>{W.current=!0,G.current=0,U(e.data.current)},be=({delta:e})=>G.current=J(e.x),xe=({active:t,delta:r})=>{$(),G.current=J(r.x);let{row:i}=t.data.current,a=D(i.record,n,e);a&&G.current!==0&&j(i,a.first,E(a.first,G.current))},Se=n.group===void 0?t?.names?.plural??u(e.name):t?.fields[n.group]?.label??u(n.group),Ce=!k.loading&&!k.error&&k.rows.length===0;return(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3`,children:[(0,V.jsx)(oe,{heading:I(S),unit:S.scale,previous:P(S,-1),today:N({scale:S.scale,day:Y},m),next:P(S,1),scales:ge().map(({scale:e,label:t})=>({view:fe(S,e,m),label:t,current:S.scale===e})),scalesLabel:l(`timelineScale`),linkTo:p,onView:_}),k.error&&(0,V.jsx)(d,{title:l(`couldNotLoadRows`),error:k.error}),k.capped&&(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`capped`,{limit:500,unit:S.scale})}),(0,V.jsxs)(ie,{sensors:ve,modifiers:[_e],onDragStart:ye,onDragMove:be,onDragEnd:xe,onDragCancel:$,accessibility:{announcements:Q,screenReaderInstructions:{draggable:l(`timelineInstructions`)}},children:[(0,V.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-border`,children:[(0,V.jsx)(pe,{ticks:w,days:C,today:Y,label:Se,trackRef:K}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(me,{ticks:w,days:C,today:Y}),k.loading&&(0,V.jsxs)(`div`,{className:`relative flex flex-col gap-2 p-2`,children:[(0,V.jsx)(h,{className:`h-4`}),(0,V.jsx)(h,{className:`h-4`})]}),Ce&&(0,V.jsx)(`p`,{className:`relative px-2 py-3 text-xs text-muted-foreground`,children:l(`nothingIn`,{unit:S.scale})}),!k.loading&&M.map(r=>(0,V.jsxs)(`section`,{"aria-label":r.label,className:`relative border-b border-border last:border-b-0`,children:[r.label!==void 0&&(0,V.jsxs)(`h3`,{className:`flex items-center gap-1.5 border-b border-border bg-surface px-2 py-1 text-xs font-medium`,children:[r.label,(0,V.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:r.rows.length})]}),r.rows.map(r=>(0,V.jsx)(he,{model:e,view:t,display:n,row:r,days:C,movable:z&&ee(r.record,`update`),dragged:()=>W.current},r.key))]},r.key))]})]}),(0,V.jsx)(y,{children:H&&(0,V.jsx)(ae,{model:e,view:t,display:n,row:H.row,day:H.day})})]})]})};export{W as TimelineDisplay};
2
- //# debugId=b5397c09-72e0-4a0c-8f1e-6626849ec56f
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$i as r,Da as i,Gc as a,Zi as o,ca as s,da as c,fi as l,fl as u,gr as d,ka as ee,na as f,oa as p,os as te,ra as m,sc as h,ta as g,vi as _}from"./app-B8KcM2Z-.js";import{_ as v,a as ne,i as re,n as y,o as b,t as ie,v as x}from"./lib-dnd-kit-core-xi-7xL_N.js";import{a as ae,g as S,h as C,i as w,l as oe,m as se,n as ce,o as T,r as le,t as ue,u as E,v as D}from"./use-calendar-move-Cl14_xWL.js";var O=e(t(),1),k=864e5,A=e=>Date.parse(`${e}T00:00:00Z`),j=(e,t=0)=>{let n=new Date(A(e));return new Date(Date.UTC(n.getUTCFullYear(),Math.floor(n.getUTCMonth()/3)*3+3*t,1)).toISOString().slice(0,10)},M=({scale:e,day:t})=>({scale:e,day:e===`week`?C(t):e===`month`?S(t):j(t)}),N=(e,t,n=c())=>M(e??{scale:`month`,day:s(t,n)}),P=(e,t)=>{let{scale:n,day:r}=M(e);return{scale:n,day:n===`week`?E(r,7*t):n===`month`?S(r,t):j(r,t)}},F=e=>{let t=M(e).day,n=(A(P(e,1).day)-A(t))/k;return Array.from({length:n},(e,n)=>E(t,n))},de=e=>({from:M(e).day,to:P(e,1).day}),fe=(e,t,n,r=c())=>{let i=s(n,r),a=F(e);return M({scale:t,day:i>=a[0]&&i<=a.at(-1)?i:a[0]})},I=e=>{let t=F(e);return e.scale===`week`?r(A(t[0]),A(t.at(-1))):e.scale===`month`?g(A(t[0])):m(A(t[0]),A(S(t.at(-1))))},L=e=>{let t=F(e);if(e.scale===`week`)return t.map((e,t)=>({index:t,span:1,label:`${p(A(e))} ${Number(e.slice(8))}`}));if(e.scale===`month`)return t.map((e,t)=>({index:t,span:1,label:String(Number(e.slice(8))),...t%7!=0&&{minor:!0}}));let n=t.flatMap((e,t)=>e.endsWith(`-01`)?[t]:[]);return n.map((e,r)=>({index:e,span:(n[r+1]??t.length)-e,label:f(A(t[e]))}))},R=(e,t,n,r,i=c())=>{let a=D(e,t,n,i),o=r[0],s=r.at(-1);if(!(!a||o===void 0||s===void 0||a.last<o||a.first>s))return{first:a.first<o?0:r.indexOf(a.first),last:a.last>s?r.length-1:r.indexOf(a.last),before:a.first<o,after:a.last>s,start:a.first}},z=`none`,B=(e,t,n,r)=>{let i=r.group,a=i===void 0?void 0:t.fields[i];if(i===void 0||!a)return[{key:``,rows:e}];let o=n?.fields[i],s=new Map;for(let t of e){let e=t.record[i],n=e==null||e===``,r=n?z:`value:${String(e)}`,c=n?l(`noValue`,{label:o?.label??u(i)}):t.labels[i]??_(a,e,o),d=s.get(r)??{value:n?void 0:e,lane:{key:r,label:c,rows:[]}};d.lane.rows.push(t),s.set(r,d)}let c=a.enumValues??[],d=(e,t)=>e.value===void 0||t.value===void 0?Number(e.value===void 0)-Number(t.value===void 0):a.type===`enum`?c.indexOf(String(e.value))-c.indexOf(String(t.value)):a.type===`relation`?e.lane.label.localeCompare(t.lane.label):typeof e.value==`number`&&typeof t.value==`number`?e.value-t.value:String(e.value).localeCompare(String(t.value),void 0,{numeric:!0});return[...s.values()].toSorted(d).map(({lane:e})=>e)},V=e(n(),1),H=`grid grid-cols-1 sm:grid-cols-[12rem_minmax(0,1fr)]`,U=(e,t)=>`${e/t*100}%`,pe=({ticks:e,days:t,today:n,label:r,trackRef:i})=>(0,V.jsxs)(`div`,{className:a(H,`border-b border-border bg-surface`),children:[(0,V.jsx)(`span`,{className:`hidden truncate px-2 py-1 text-xs font-medium text-muted-foreground sm:block`,children:r}),(0,V.jsx)(`div`,{ref:i,"aria-hidden":!0,className:`relative h-6`,children:e.map(e=>(0,V.jsx)(`span`,{className:a(`absolute inset-y-0 items-center truncate px-1 text-xs tabular-nums text-muted-foreground`,e.index>0?`border-l border-border`:`border-border sm:border-l`,e.minor?`hidden sm:flex`:`flex`,e.span===1&&t[e.index]===n&&`font-medium text-primary`),style:{left:U(e.index,t.length),width:U(e.span,t.length)},children:e.label},e.index))})]}),me=({ticks:e,days:t,today:n})=>{let r=t.indexOf(n);return(0,V.jsxs)(`div`,{"aria-hidden":!0,className:a(H,`pointer-events-none absolute inset-0`),children:[(0,V.jsx)(`span`,{className:`hidden sm:block`}),(0,V.jsxs)(`div`,{className:`relative`,children:[r>=0&&(0,V.jsx)(`span`,{className:`absolute inset-y-0 bg-primary/10`,style:{left:U(r,t.length),width:U(1,t.length)}}),e.map(e=>(0,V.jsx)(`span`,{className:a(`absolute inset-y-0 w-px bg-border`,(e.minor||e.index===0)&&`hidden sm:block`),style:{left:U(e.index,t.length)}},e.index))]})]})},he=({model:e,view:t,display:n,row:r,days:i,movable:o,dragged:s})=>{let c=R(r.record,n,e,i);return(0,V.jsxs)(`div`,{className:a(H,`relative border-b border-border last:border-b-0`),children:[(0,V.jsx)(`span`,{"aria-hidden":!0,className:`truncate px-2 pt-1 text-body sm:py-1.5`,children:T(e,t,n,r)}),(0,V.jsx)(`div`,{className:`relative h-7`,children:c&&(0,V.jsx)(`div`,{className:`absolute top-1/2 -translate-y-1/2`,style:{left:U(c.first,i.length),width:U(c.last-c.first+1,i.length)},children:(0,V.jsx)(w,{model:e,view:t,display:n,row:r,day:c.start,movable:o,dragged:s,className:a(c.before&&`rounded-l-none border-l-0`,c.after&&`rounded-r-none border-r-0`)})})})]})},ge=()=>[{scale:`week`,label:l(`week`)},{scale:`month`,label:l(`month`)},{scale:`quarter`,label:l(`quarter`)}],W=({model:e,view:t,display:n,fields:r,filter:a,at:f,linkTo:p,now:m=Date.now()})=>{let[g,_]=(0,O.useState)(),S=N(p?f:g,m),C=F(S),w=L(S),k=le({model:e,display:n,range:de(S),fields:r,filter:a}),{moves:A,move:j}=ce(e,n),M=B(se(ue(k.rows,A),n),e,t,n),R=te(e.name),z=i(R,`update`)&&[n.start,n.end].every(t=>t===void 0||!e.fields[t]?.readOnly),[H,U]=(0,O.useState)(),W=(0,O.useRef)(!1),G=(0,O.useRef)(0),K=(0,O.useRef)(null),q=()=>(K.current?.getBoundingClientRect().width??0)/C.length,J=e=>{let t=q();return t>0?Math.round(e/t):0},_e=({transform:e})=>({...e,x:J(e.x)*q(),y:0}),ve=x(v(ne,{activationConstraint:{distance:4}}),v(b,{activationConstraint:{delay:250,tolerance:5}}),v(re,{keyboardCodes:{start:[`Space`],cancel:[`Escape`],end:[`Space`,`Enter`]},coordinateGetter:(e,{currentCoordinates:t})=>{let n=e.code===`ArrowLeft`?-1:+(e.code===`ArrowRight`);if(n!==0)return e.preventDefault(),{x:t.x+n*q(),y:t.y}}})),Y=s(m,c()),X=r=>T(e,t,n,r.row),Z=e=>o(Date.parse(`${E(e.day,G.current)}T00:00:00Z`)),Q={onDragStart:({active:e})=>l(`pickedUp`,{title:X(e.data.current)}),onDragMove:({active:e})=>l(`startsOn`,{title:X(e.data.current),day:Z(e.data.current)}),onDragOver:()=>void 0,onDragEnd:({active:e})=>G.current===0?l(`putBack`,{title:X(e.data.current)}):l(`wasMovedTo`,{title:X(e.data.current),to:Z(e.data.current)}),onDragCancel:({active:e})=>l(`cancelled`,{title:X(e.data.current)})},$=()=>{U(void 0),setTimeout(()=>W.current=!1)},ye=({active:e})=>{W.current=!0,G.current=0,U(e.data.current)},be=({delta:e})=>G.current=J(e.x),xe=({active:t,delta:r})=>{$(),G.current=J(r.x);let{row:i}=t.data.current,a=D(i.record,n,e);a&&G.current!==0&&j(i,a.first,E(a.first,G.current))},Se=n.group===void 0?t?.names?.plural??u(e.name):t?.fields[n.group]?.label??u(n.group),Ce=!k.loading&&!k.error&&k.rows.length===0;return(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3`,children:[(0,V.jsx)(oe,{heading:I(S),unit:S.scale,previous:P(S,-1),today:N({scale:S.scale,day:Y},m),next:P(S,1),scales:ge().map(({scale:e,label:t})=>({view:fe(S,e,m),label:t,current:S.scale===e})),scalesLabel:l(`timelineScale`),linkTo:p,onView:_}),k.error&&(0,V.jsx)(d,{title:l(`couldNotLoadRows`),error:k.error}),k.capped&&(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`capped`,{limit:500,unit:S.scale})}),(0,V.jsxs)(ie,{sensors:ve,modifiers:[_e],onDragStart:ye,onDragMove:be,onDragEnd:xe,onDragCancel:$,accessibility:{announcements:Q,screenReaderInstructions:{draggable:l(`timelineInstructions`)}},children:[(0,V.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-border`,children:[(0,V.jsx)(pe,{ticks:w,days:C,today:Y,label:Se,trackRef:K}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(me,{ticks:w,days:C,today:Y}),k.loading&&(0,V.jsxs)(`div`,{className:`relative flex flex-col gap-2 p-2`,children:[(0,V.jsx)(h,{className:`h-4`}),(0,V.jsx)(h,{className:`h-4`})]}),Ce&&(0,V.jsx)(`p`,{className:`relative px-2 py-3 text-xs text-muted-foreground`,children:l(`nothingIn`,{unit:S.scale})}),!k.loading&&M.map(r=>(0,V.jsxs)(`section`,{"aria-label":r.label,className:`relative border-b border-border last:border-b-0`,children:[r.label!==void 0&&(0,V.jsxs)(`h3`,{className:`flex items-center gap-1.5 border-b border-border bg-surface px-2 py-1 text-xs font-medium`,children:[r.label,(0,V.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:r.rows.length})]}),r.rows.map(r=>(0,V.jsx)(he,{model:e,view:t,display:n,row:r,days:C,movable:z&&ee(r.record,`update`),dragged:()=>W.current},r.key))]},r.key))]})]}),(0,V.jsx)(y,{children:H&&(0,V.jsx)(ae,{model:e,view:t,display:n,row:H.row,day:H.day})})]})]})};export{W as TimelineDisplay};
2
+ //# debugId=a13c765f-3bf7-4ad4-bd54-3e1e50bb4029
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{Wc as e}from"./app-CK_M0TgA.js";var t={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};t.node;var n=e(t);export{n as t};
2
- //# debugId=5add8e7f-df44-42d3-9119-30dd31d50b31
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{Wc as e}from"./app-B8KcM2Z-.js";var t={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};t.node;var n=e(t);export{n as t};
2
+ //# debugId=a1d89154-44c0-4f50-97b9-13851a81bb1f
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{$l as e,Wl as t,eu as n,nu as r,ru as i,tu as a}from"./app-CK_M0TgA.js";import{A as o}from"./vendor-t7Q7QbPu.js";var s=e=>()=>{throw Error(`Not implemented: ${e}() needs the database (the resource's search fields, trigram matching), so it cannot be evaluated against a record`)},c=(t,n,r)=>({...i,search:{...i.search,evaluate:r?t=>e(r,n,t):s(`search`)},similar:{...i.similar,evaluate:s(`similar`)},regex:{...i.regex,evaluate:(e,t)=>e.some(e=>typeof e==`string`&&new RegExp(t).test(e))},now:{...i.now,evaluate:t}}),l=(e,t,n={})=>o(a(e,{expand:!0}),t,{functions:c(n.now??(()=>new Date),t,n.search)}),u=(e,t,n,r={})=>({name:e,kind:t,label:n.label,required:t!==`boolean`&&!n.optional,...n.help!==void 0&&{help:n.help},...n.when!==void 0&&{when:n.when},...n.default!==void 0&&{default:n.default},...r}),d={text:(e,t)=>u(e,`text`,t,{...t.multiline&&{multiline:!0},...t.max!==void 0&&{max:t.max}}),integer:(e,t)=>u(e,`integer`,t),decimal:(e,t)=>u(e,`decimal`,t),boolean:(e,t)=>u(e,`boolean`,t),secret:(e,t)=>u(e,`secret`,t),date:(e,t)=>u(e,`date`,t),choice:(e,t)=>u(e,`choice`,t,`options`in t?{options:t.options.map(({value:e,label:t})=>({value:e,label:t}))}:{resource:t.resource}),checklist:(e,t)=>u(e,`checklist`,t,{...`items`in t&&{items:[...t.items]},...`from`in t&&{from:t.from}}),custom:(e,t)=>u(e,`custom`,t,{component:t.component,...t.props!==void 0&&{props:t.props}})},f={text:`text`,integer:`integer`,decimal:`decimal`,boolean:`boolean`,date:`date`,choice:`text`,secret:`text`,checklist:`json`,custom:`json`},p=e=>({name:e.name,column:e.name,type:e.options?`enum`:f[e.kind],nullable:!0,readOnly:!1,filterable:e.kind!==`custom`&&e.kind!==`checklist`&&e.kind!==`secret`,sortable:!1,aliases:[],...e.options&&{enumValues:e.options.map(e=>e.value)}}),m=e=>({name:`inputs`,table:{name:`inputs`},fields:Object.fromEntries(e.map(e=>[e.name,p(e)])),primaryKey:[]}),h=(e,t)=>{let i=e[t].when;if(i===void 0)return;let a=r(i);if(!a.ok)return a.errors.map(e=>e.message).join(`; `);if(!a.ast)return`it is empty`;let o=n(m(e.slice(0,t)),a.ast);return o.ok?o.filter:o.errors.map(e=>e.message).join(`; `)},g=e=>e.kind===`checklist`?e.items===void 0==(e.from===void 0)?[`input "${e.name}": a checklist takes either "items" or "from"`]:e.items&&e.items.length===0?[`input "${e.name}": a checklist needs at least one item`]:[]:[],_=e=>e.flatMap((t,n)=>{let r=[];e.findIndex(e=>e.name===t.name)!==n&&r.push(`input "${t.name}" is declared twice`),t.kind===`secret`&&t.default!==void 0&&r.push(`input "${t.name}": a secret takes no default`),t.kind!==`secret`&&t.options&&t.default!==void 0&&!t.options.some(e=>e.value===t.default)&&r.push(`input "${t.name}": default "${String(t.default)}" is not one of its options`);let i=h(e,n);return typeof i==`string`&&r.push(`input "${t.name}": "when" is not a valid condition over the inputs before it: ${i}`),[...r,...g(t)]}),v=(e,t)=>{let n=new Set,r={};return e.forEach((i,a)=>{let o=h(e,a);if(typeof o==`string`)throw Error(`Input "${i.name}": ${o}`);let s=o===void 0||l(o,r)===!0;s&&n.add(i.name),r[i.name]=s?t[i.name]??null:null}),n},y=(e,n=[])=>Object.entries(e).flatMap(([e,r])=>{let i=typeof r==`string`?t(r):void 0;if(i===void 0)return[];let a=n.find(e=>e.name===i);return a?a.kind===`secret`?[`set "${e}" names secret input "${i}", which an update never writes; take it in an action's handler`]:[]:[`set "${e}" names input "${i}", which it does not ask for`]}),b=(e,n)=>Object.fromEntries(Object.entries(e).flatMap(([e,r])=>{let i=typeof r==`string`?t(r):void 0;return i===void 0?[[e,r]]:Object.hasOwn(n,i)?[[e,n[i]]]:[]}));export{v as a,d as i,b as n,_ as r,y as t};
2
- //# debugId=f6988d09-eccf-49be-83da-c8b35caefb21
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{$l as e,Wl as t,eu as n,nu as r,ru as i,tu as a}from"./app-B8KcM2Z-.js";import{A as o}from"./vendor-t7Q7QbPu.js";var s=e=>()=>{throw Error(`Not implemented: ${e}() needs the database (the resource's search fields, trigram matching), so it cannot be evaluated against a record`)},c=(t,n,r)=>({...i,search:{...i.search,evaluate:r?t=>e(r,n,t):s(`search`)},similar:{...i.similar,evaluate:s(`similar`)},regex:{...i.regex,evaluate:(e,t)=>e.some(e=>typeof e==`string`&&new RegExp(t).test(e))},now:{...i.now,evaluate:t}}),l=(e,t,n={})=>o(a(e,{expand:!0}),t,{functions:c(n.now??(()=>new Date),t,n.search)}),u=(e,t,n,r={})=>({name:e,kind:t,label:n.label,required:t!==`boolean`&&!n.optional,...n.help!==void 0&&{help:n.help},...n.when!==void 0&&{when:n.when},...n.default!==void 0&&{default:n.default},...r}),d={text:(e,t)=>u(e,`text`,t,{...t.multiline&&{multiline:!0},...t.max!==void 0&&{max:t.max}}),integer:(e,t)=>u(e,`integer`,t),decimal:(e,t)=>u(e,`decimal`,t),boolean:(e,t)=>u(e,`boolean`,t),secret:(e,t)=>u(e,`secret`,t),date:(e,t)=>u(e,`date`,t),choice:(e,t)=>u(e,`choice`,t,`options`in t?{options:t.options.map(({value:e,label:t})=>({value:e,label:t}))}:{resource:t.resource}),checklist:(e,t)=>u(e,`checklist`,t,{...`items`in t&&{items:[...t.items]},...`from`in t&&{from:t.from}}),custom:(e,t)=>u(e,`custom`,t,{component:t.component,...t.props!==void 0&&{props:t.props}})},f={text:`text`,integer:`integer`,decimal:`decimal`,boolean:`boolean`,date:`date`,choice:`text`,secret:`text`,checklist:`json`,custom:`json`},p=e=>({name:e.name,column:e.name,type:e.options?`enum`:f[e.kind],nullable:!0,readOnly:!1,filterable:e.kind!==`custom`&&e.kind!==`checklist`&&e.kind!==`secret`,sortable:!1,aliases:[],...e.options&&{enumValues:e.options.map(e=>e.value)}}),m=e=>({name:`inputs`,table:{name:`inputs`},fields:Object.fromEntries(e.map(e=>[e.name,p(e)])),primaryKey:[]}),h=(e,t)=>{let i=e[t].when;if(i===void 0)return;let a=r(i);if(!a.ok)return a.errors.map(e=>e.message).join(`; `);if(!a.ast)return`it is empty`;let o=n(m(e.slice(0,t)),a.ast);return o.ok?o.filter:o.errors.map(e=>e.message).join(`; `)},g=e=>e.kind===`checklist`?e.items===void 0==(e.from===void 0)?[`input "${e.name}": a checklist takes either "items" or "from"`]:e.items&&e.items.length===0?[`input "${e.name}": a checklist needs at least one item`]:[]:[],_=e=>e.flatMap((t,n)=>{let r=[];e.findIndex(e=>e.name===t.name)!==n&&r.push(`input "${t.name}" is declared twice`),t.kind===`secret`&&t.default!==void 0&&r.push(`input "${t.name}": a secret takes no default`),t.kind!==`secret`&&t.options&&t.default!==void 0&&!t.options.some(e=>e.value===t.default)&&r.push(`input "${t.name}": default "${String(t.default)}" is not one of its options`);let i=h(e,n);return typeof i==`string`&&r.push(`input "${t.name}": "when" is not a valid condition over the inputs before it: ${i}`),[...r,...g(t)]}),v=(e,t)=>{let n=new Set,r={};return e.forEach((i,a)=>{let o=h(e,a);if(typeof o==`string`)throw Error(`Input "${i.name}": ${o}`);let s=o===void 0||l(o,r)===!0;s&&n.add(i.name),r[i.name]=s?t[i.name]??null:null}),n},y=(e,n=[])=>Object.entries(e).flatMap(([e,r])=>{let i=typeof r==`string`?t(r):void 0;if(i===void 0)return[];let a=n.find(e=>e.name===i);return a?a.kind===`secret`?[`set "${e}" names secret input "${i}", which an update never writes; take it in an action's handler`]:[]:[`set "${e}" names input "${i}", which it does not ask for`]}),b=(e,n)=>Object.fromEntries(Object.entries(e).flatMap(([e,r])=>{let i=typeof r==`string`?t(r):void 0;return i===void 0?[[e,r]]:Object.hasOwn(n,i)?[[e,n[i]]]:[]}));export{v as a,d as i,b as n,_ as r,y as t};
2
+ //# debugId=19721f64-07eb-40cc-a187-1b667c8ce20b