@protobase/ui 0.121.2 → 0.121.4
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.
- package/dist/account/messages.d.ts +2 -2
- package/dist/activity-chart/messages.d.ts +2 -2
- package/dist/app/change-confirm/messages.d.ts +2 -2
- package/dist/app/charts/messages.d.ts +2 -2
- package/dist/app/confirm-sign-in-messages.d.ts +2 -2
- package/dist/app/conversation/messages.d.ts +2 -2
- package/dist/app/conversation-page/messages.d.ts +2 -2
- package/dist/app/create/messages.d.ts +2 -2
- package/dist/app/custom-section.d.ts +1 -1
- package/dist/app/delete/messages.d.ts +2 -2
- package/dist/app/displays/list-cards.d.ts +1 -1
- package/dist/app/displays/messages.d.ts +2 -2
- package/dist/app/embedded-list/messages.d.ts +2 -2
- package/dist/app/export/messages.d.ts +2 -2
- package/dist/app/field-messages.d.ts +2 -2
- package/dist/app/field-types/custom-step-container/messages.d.ts +2 -2
- package/dist/app/field-types/runner-install/messages.d.ts +2 -2
- package/dist/app/field-types/widget-part.d.ts +1 -1
- package/dist/app/field-types/workflow/messages.d.ts +2 -2
- package/dist/app/field-types/workflow-page/messages.d.ts +2 -2
- package/dist/app/field-types/workflow-run/messages.d.ts +2 -2
- package/dist/app/file-viewers/messages.d.ts +2 -2
- package/dist/app/focus/messages.d.ts +2 -2
- package/dist/app/gallery/messages.d.ts +2 -2
- package/dist/app/hand-order/messages.d.ts +2 -2
- package/dist/app/import/messages.d.ts +2 -2
- package/dist/app/list-edit/messages.d.ts +2 -2
- package/dist/app/list-messages.d.ts +2 -2
- package/dist/app/messages.d.ts +2 -2
- package/dist/app/meta-gate-messages.d.ts +2 -2
- package/dist/app/new-version/messages.d.ts +2 -2
- package/dist/app/pages/custom-boundary.d.ts +1 -1
- package/dist/app/pages/custom-chosen.d.ts +1 -1
- package/dist/app/pages/messages.d.ts +2 -2
- package/dist/app/record-chart/messages.d.ts +2 -2
- package/dist/app/record-messages.d.ts +2 -2
- package/dist/app/record-mode/shown-layout.d.ts +1 -1
- package/dist/app/record-row/messages.d.ts +2 -2
- package/dist/app/related-cards/messages.d.ts +2 -2
- package/dist/app/saved/messages.d.ts +2 -2
- package/dist/app/saved/saved-list.d.ts +1 -1
- package/dist/app/searches/messages.d.ts +2 -2
- package/dist/app-shell/messages.d.ts +2 -2
- package/dist/assistant-dock/messages.d.ts +2 -2
- package/dist/auth/messages.d.ts +2 -2
- package/dist/calls/messages.d.ts +2 -2
- package/dist/data-grid/column-spec.d.ts +1 -1
- package/dist/data-grid/messages.d.ts +2 -2
- package/dist/filter-panel/messages.d.ts +2 -2
- package/dist/format/messages.d.ts +2 -2
- package/dist/forms/messages.d.ts +2 -2
- package/dist/inline-child-table/messages.d.ts +2 -2
- package/dist/invitations/messages.d.ts +2 -2
- package/dist/lib/lazy-part.d.ts +11 -0
- package/dist/lib/lazy-part.js +64 -0
- package/dist/locale/en.js +20 -1
- package/dist/locale/en.json.d.ts +19 -0
- package/dist/locale/messages.d.ts +38 -0
- package/dist/locale/nl.js +20 -1
- package/dist/locale/texts-gate.d.ts +1 -1
- package/dist/mailbox/messages.d.ts +2 -2
- package/dist/mentions/mentioned-text.d.ts +3 -0
- package/dist/mentions/mentioned-text.js +5 -7
- package/dist/mentions/messages.d.ts +2 -2
- package/dist/mocks/orders.d.ts +2 -2
- package/dist/notifications/bell/messages.d.ts +2 -2
- package/dist/organizations/messages.d.ts +2 -2
- package/dist/package.js +1 -1
- package/dist/plugins/before-sign-in.d.ts +1 -1
- package/dist/primitives/messages.d.ts +2 -2
- package/dist/record-view/messages.d.ts +2 -2
- package/dist/shell/assets/{account-page-BEMlob92.js → account-page-DUZhZTQe.js} +2 -2
- package/dist/shell/assets/app-CWCg5I0x.js +34 -0
- package/dist/shell/assets/{assistant-shell-D1PLZHeQ.js → assistant-shell-BB-qTSNN.js} +2 -2
- package/dist/shell/assets/{board-display-BZb6Av24.js → board-display-DxdFR3Wq.js} +2 -2
- package/dist/shell/assets/{calendar-display-CNFg47Me.js → calendar-display-uBGEfuIv.js} +2 -2
- package/dist/shell/assets/{call-rings-B0cAdcLq.js → call-rings-CMu9LCVA.js} +2 -2
- package/dist/shell/assets/{calls-CJX48uHr.js → calls-CAwUiNFC.js} +2 -2
- package/dist/shell/assets/{circle-alert-B-bmotNV.js → circle-alert-DBbXAqFr.js} +2 -2
- package/dist/shell/assets/{composed-page-itsBuYQN.js → composed-page-CDZcDEpb.js} +2 -2
- package/dist/shell/assets/{composer-section-CcOJo5ti.js → composer-section-BLXex8WX.js} +2 -2
- package/dist/shell/assets/{connect-route-CFKOOd6G.js → connect-route-DMz3C4cs.js} +2 -2
- package/dist/shell/assets/{copy-field-DOFRIY_Q.js → copy-field-D0wtSWzb.js} +2 -2
- package/dist/shell/assets/{create-route-Dv-SPGqY.js → create-route-BQoMwg6m.js} +2 -2
- package/dist/shell/assets/{custom-step-container-field-Cpk6ImRJ.js → custom-step-container-field-B2IfCGAR.js} +2 -2
- package/dist/shell/assets/{embedded-list-DoHDT3Av.js → embedded-list-BOlcwiiA.js} +3 -3
- package/dist/shell/assets/en-BED8S1rX.js +2 -0
- package/dist/shell/assets/{export-dialog-Ivzdiuhz.js → export-dialog-Ogugn53w.js} +2 -2
- package/dist/shell/assets/export-worker-S5xPFD_M.js +15 -0
- package/dist/shell/assets/{first-organization-page-in6WzIgy.js → first-organization-page-C4-rQ_I2.js} +2 -2
- package/dist/shell/assets/{graph-view-BRuO-SOE.js → graph-view-CzTg5srj.js} +2 -2
- package/dist/shell/assets/{group-donut-3NIqjraT.js → group-donut-3ebIs5gF.js} +2 -2
- package/dist/shell/assets/{guest-call-page-NZyVZiKI.js → guest-call-page-CD0LJIht.js} +3 -3
- package/dist/shell/assets/{html-viewer-C1KycBYl.js → html-viewer-BYJGABwQ.js} +2 -2
- package/dist/shell/assets/{import-dialog-CyB3vJn7.js → import-dialog-BpUqiIUH.js} +2 -2
- package/dist/shell/assets/{import-table-dialog-D8yGy95h.js → import-table-dialog-CYYjVijG.js} +2 -2
- package/dist/shell/assets/{index-CkkBg7C6.js → index-k2uQ-7c-.js} +1 -1
- package/dist/shell/assets/{invitations-page-BjEW7hIz.js → invitations-page-BsN4z7EC.js} +2 -2
- package/dist/shell/assets/{layout-grid-OO8eIGYq.js → layout-grid-DvW29fH0.js} +2 -2
- package/dist/shell/assets/{legend-item-eNQOaTxV.js → legend-item-CuD1ms2_.js} +2 -2
- package/dist/shell/assets/{list-page-bIQkpGOc.js → list-page-BtuFsbiK.js} +4 -4
- package/dist/shell/assets/{maplibre-DV3j-5Y6.js → maplibre-DWK2ok5e.js} +2 -2
- package/dist/shell/assets/{markdown-content-C08v-1FZ.js → markdown-content-HRnOc3WU.js} +2 -2
- package/dist/shell/assets/{members-page-B9hyyuVp.js → members-page-CXYBNAaR.js} +2 -2
- package/dist/shell/assets/{message-content-DLKHIzRa.js → message-content-ypqgAMEt.js} +2 -2
- package/dist/shell/assets/{messages-NBuAsjFr.js → messages-QTTbTkpW.js} +2 -2
- package/dist/shell/assets/nl-DjHVomkB.js +2 -0
- package/dist/shell/assets/{organization-page-DeTS9uAn.js → organization-page-C0iuWYaS.js} +2 -2
- package/dist/shell/assets/{organizations-page-qM5TQfyb.js → organizations-page-BOryGu_-.js} +2 -2
- package/dist/shell/assets/parse-worker-CO_GFfU7.js +35 -0
- package/dist/shell/assets/{pending-invitation-row-9-2Fmy3F.js → pending-invitation-row-1zBmAsKC.js} +2 -2
- package/dist/shell/assets/{period-chart-UOm7kPWB.js → period-chart-Mcf3pdtE.js} +2 -2
- package/dist/shell/assets/{person-row-DOXM02rY.js → person-row-Dg1T6u1A.js} +2 -2
- package/dist/shell/assets/{public-form-page-Bj9YxgGp.js → public-form-page-DKBrB0BB.js} +2 -2
- package/dist/shell/assets/{record-lines-PZ4g8sb5.js → record-lines-B4MMhxps.js} +2 -2
- package/dist/shell/assets/{record-map-CkWjStZn.js → record-map-C8o8jmlo.js} +2 -2
- package/dist/shell/assets/{record-opens-6vtBiJ2O.js → record-opens-Ds_etNOv.js} +2 -2
- package/dist/shell/assets/{record-page-DrQL98n9.js → record-page-DR3a2_Z8.js} +3 -3
- package/dist/shell/assets/{record-preview-BSqik7HQ.js → record-preview-C2bjzVoh.js} +2 -2
- package/dist/shell/assets/{records-map-CXBbBlYG.js → records-map-DT_SwhgY.js} +2 -2
- package/dist/shell/assets/{render-node-DEyR63E8.js → render-node-BKYZK3FU.js} +3 -3
- package/dist/shell/assets/{reorder-button-CdgrzXlf.js → reorder-button-DmgQZa3E.js} +2 -2
- package/dist/shell/assets/{run-trace-view-CqcgX5lE.js → run-trace-view-CScFddUb.js} +2 -2
- package/dist/shell/assets/{runner-install-field-Dm7GhYaF.js → runner-install-field-DyyHVUfd.js} +2 -2
- package/dist/shell/assets/{runtime-update-BdhyiFl9.js → runtime-update-CuLL4Qbm.js} +2 -2
- package/dist/shell/assets/{shared-protobase-ui-CDtJQrEp.js → shared-protobase-ui-DOsgmmrs.js} +1 -1
- package/dist/shell/assets/{sheet-source-NKu1Enl2.js → sheet-source-IXyzIyO8.js} +3 -3
- package/dist/shell/assets/{sign-in-policy-page-DINzAtyt.js → sign-in-policy-page-Dto5W87n.js} +2 -2
- package/dist/shell/assets/{start-block-queries-Bc743CdL.js → start-block-queries-DNegRXtD.js} +2 -2
- package/dist/shell/assets/{step-catalog-B9QbvZP_.js → step-catalog-Dw8bipyJ.js} +2 -2
- package/dist/shell/assets/{step-panel-C5Pnb-Vb.js → step-panel-CA5-2Doz.js} +2 -2
- package/dist/shell/assets/{timeline-display-hbo62z0J.js → timeline-display-BLF3onV2.js} +2 -2
- package/dist/shell/assets/{trash-YqRXn8JG.js → trash-Cd-g6Eyo.js} +2 -2
- package/dist/shell/assets/{update-set-DFWECx_E.js → update-set-DfPWNMBL.js} +2 -2
- package/dist/shell/assets/{use-calendar-move-D_6TlMr4.js → use-calendar-move-J9sB_jXo.js} +2 -2
- package/dist/shell/assets/{use-display-rows-1Xjy5pR2.js → use-display-rows-CYGJYJrz.js} +2 -2
- package/dist/shell/assets/{use-my-invitations-CrSF37dB.js → use-my-invitations-DZ0rA8RK.js} +2 -2
- package/dist/shell/assets/{use-paged-search-CtD7Lf-E.js → use-paged-search-cBs-xWuq.js} +2 -2
- package/dist/shell/assets/{use-run-trace-5H4UJvB-.js → use-run-trace-CSdKdxn9.js} +2 -2
- package/dist/shell/assets/{use-workflow-page-dAWuZvWk.js → use-workflow-page-DGd_5JMB.js} +2 -2
- package/dist/shell/assets/{use-workflow-types-Cjkw47Mf.js → use-workflow-types-BQl6tPM-.js} +2 -2
- package/dist/shell/assets/{workflow-canvas-BkFimRd2.js → workflow-canvas-DbLkc3zJ.js} +2 -2
- package/dist/shell/assets/{workflow-field-BQImywHx.js → workflow-field-DRAphvYG.js} +3 -3
- package/dist/shell/assets/{workflow-graph-editor-DYBqdH_O.js → workflow-graph-editor-CzgoB1_t.js} +2 -2
- package/dist/shell/assets/{workflow-run-field-CyxK0W7w.js → workflow-run-field-CQf9E5e1.js} +3 -3
- package/dist/shell/assets/{workflow-status-field-Bzri4NHN.js → workflow-status-field-CiaCtBkf.js} +2 -2
- package/dist/shell/assets/{workflow-workbench-DC2gtXz1.js → workflow-workbench-CMl69WwH.js} +2 -2
- package/dist/shell/index.html +3 -3
- package/dist/shell/protobase.shell.json +2 -2
- package/dist/shell/protobase.sw.js +2 -2
- package/dist/shell-source-maps/assets/{account-page-BEMlob92.js.map → account-page-DUZhZTQe.js.map} +1 -1
- package/dist/shell-source-maps/assets/app-CWCg5I0x.js.map +1 -0
- package/dist/shell-source-maps/assets/{assistant-shell-D1PLZHeQ.js.map → assistant-shell-BB-qTSNN.js.map} +1 -1
- package/dist/shell-source-maps/assets/{board-display-BZb6Av24.js.map → board-display-DxdFR3Wq.js.map} +1 -1
- package/dist/shell-source-maps/assets/{calendar-display-CNFg47Me.js.map → calendar-display-uBGEfuIv.js.map} +1 -1
- package/dist/shell-source-maps/assets/{call-rings-B0cAdcLq.js.map → call-rings-CMu9LCVA.js.map} +1 -1
- package/dist/shell-source-maps/assets/{calls-CJX48uHr.js.map → calls-CAwUiNFC.js.map} +1 -1
- package/dist/shell-source-maps/assets/{circle-alert-B-bmotNV.js.map → circle-alert-DBbXAqFr.js.map} +1 -1
- package/dist/shell-source-maps/assets/{composed-page-itsBuYQN.js.map → composed-page-CDZcDEpb.js.map} +1 -1
- package/dist/shell-source-maps/assets/{composer-section-CcOJo5ti.js.map → composer-section-BLXex8WX.js.map} +1 -1
- package/dist/shell-source-maps/assets/{connect-route-CFKOOd6G.js.map → connect-route-DMz3C4cs.js.map} +1 -1
- package/dist/shell-source-maps/assets/{copy-field-DOFRIY_Q.js.map → copy-field-D0wtSWzb.js.map} +1 -1
- package/dist/shell-source-maps/assets/{create-route-Dv-SPGqY.js.map → create-route-BQoMwg6m.js.map} +1 -1
- package/dist/shell-source-maps/assets/{custom-step-container-field-Cpk6ImRJ.js.map → custom-step-container-field-B2IfCGAR.js.map} +1 -1
- package/dist/shell-source-maps/assets/{embedded-list-DoHDT3Av.js.map → embedded-list-BOlcwiiA.js.map} +1 -1
- package/dist/shell-source-maps/assets/en-BED8S1rX.js.map +1 -0
- package/dist/shell-source-maps/assets/{export-dialog-Ivzdiuhz.js.map → export-dialog-Ogugn53w.js.map} +1 -1
- package/dist/shell-source-maps/assets/export-worker-S5xPFD_M.js.map +1 -0
- package/dist/shell-source-maps/assets/{first-organization-page-in6WzIgy.js.map → first-organization-page-C4-rQ_I2.js.map} +1 -1
- package/dist/shell-source-maps/assets/{graph-view-BRuO-SOE.js.map → graph-view-CzTg5srj.js.map} +1 -1
- package/dist/shell-source-maps/assets/{group-donut-3NIqjraT.js.map → group-donut-3ebIs5gF.js.map} +1 -1
- package/dist/shell-source-maps/assets/{guest-call-page-NZyVZiKI.js.map → guest-call-page-CD0LJIht.js.map} +1 -1
- package/dist/shell-source-maps/assets/{html-viewer-C1KycBYl.js.map → html-viewer-BYJGABwQ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{import-dialog-CyB3vJn7.js.map → import-dialog-BpUqiIUH.js.map} +1 -1
- package/dist/shell-source-maps/assets/{import-table-dialog-D8yGy95h.js.map → import-table-dialog-CYYjVijG.js.map} +1 -1
- package/dist/shell-source-maps/assets/{invitations-page-BjEW7hIz.js.map → invitations-page-BsN4z7EC.js.map} +1 -1
- package/dist/shell-source-maps/assets/{layout-grid-OO8eIGYq.js.map → layout-grid-DvW29fH0.js.map} +1 -1
- package/dist/shell-source-maps/assets/{legend-item-eNQOaTxV.js.map → legend-item-CuD1ms2_.js.map} +1 -1
- package/dist/shell-source-maps/assets/{list-page-bIQkpGOc.js.map → list-page-BtuFsbiK.js.map} +1 -1
- package/dist/shell-source-maps/assets/{maplibre-DV3j-5Y6.js.map → maplibre-DWK2ok5e.js.map} +1 -1
- package/dist/shell-source-maps/assets/{markdown-content-C08v-1FZ.js.map → markdown-content-HRnOc3WU.js.map} +1 -1
- package/dist/shell-source-maps/assets/{members-page-B9hyyuVp.js.map → members-page-CXYBNAaR.js.map} +1 -1
- package/dist/shell-source-maps/assets/{message-content-DLKHIzRa.js.map → message-content-ypqgAMEt.js.map} +1 -1
- package/dist/shell-source-maps/assets/{messages-NBuAsjFr.js.map → messages-QTTbTkpW.js.map} +1 -1
- package/dist/shell-source-maps/assets/nl-DjHVomkB.js.map +1 -0
- package/dist/shell-source-maps/assets/{organization-page-DeTS9uAn.js.map → organization-page-C0iuWYaS.js.map} +1 -1
- package/dist/shell-source-maps/assets/{organizations-page-qM5TQfyb.js.map → organizations-page-BOryGu_-.js.map} +1 -1
- package/dist/shell-source-maps/assets/parse-worker-CO_GFfU7.js.map +1 -0
- package/dist/shell-source-maps/assets/{pending-invitation-row-9-2Fmy3F.js.map → pending-invitation-row-1zBmAsKC.js.map} +1 -1
- package/dist/shell-source-maps/assets/{period-chart-UOm7kPWB.js.map → period-chart-Mcf3pdtE.js.map} +1 -1
- package/dist/shell-source-maps/assets/{person-row-DOXM02rY.js.map → person-row-Dg1T6u1A.js.map} +1 -1
- package/dist/shell-source-maps/assets/{public-form-page-Bj9YxgGp.js.map → public-form-page-DKBrB0BB.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-lines-PZ4g8sb5.js.map → record-lines-B4MMhxps.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-map-CkWjStZn.js.map → record-map-C8o8jmlo.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-opens-6vtBiJ2O.js.map → record-opens-Ds_etNOv.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-page-DrQL98n9.js.map → record-page-DR3a2_Z8.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-preview-BSqik7HQ.js.map → record-preview-C2bjzVoh.js.map} +1 -1
- package/dist/shell-source-maps/assets/{records-map-CXBbBlYG.js.map → records-map-DT_SwhgY.js.map} +1 -1
- package/dist/shell-source-maps/assets/{render-node-DEyR63E8.js.map → render-node-BKYZK3FU.js.map} +1 -1
- package/dist/shell-source-maps/assets/{reorder-button-CdgrzXlf.js.map → reorder-button-DmgQZa3E.js.map} +1 -1
- package/dist/shell-source-maps/assets/{run-trace-view-CqcgX5lE.js.map → run-trace-view-CScFddUb.js.map} +1 -1
- package/dist/shell-source-maps/assets/{runner-install-field-Dm7GhYaF.js.map → runner-install-field-DyyHVUfd.js.map} +1 -1
- package/dist/shell-source-maps/assets/{runtime-update-BdhyiFl9.js.map → runtime-update-CuLL4Qbm.js.map} +1 -1
- package/dist/shell-source-maps/assets/{sheet-source-NKu1Enl2.js.map → sheet-source-IXyzIyO8.js.map} +1 -1
- package/dist/shell-source-maps/assets/{sign-in-policy-page-DINzAtyt.js.map → sign-in-policy-page-Dto5W87n.js.map} +1 -1
- package/dist/shell-source-maps/assets/{start-block-queries-Bc743CdL.js.map → start-block-queries-DNegRXtD.js.map} +1 -1
- package/dist/shell-source-maps/assets/{step-catalog-B9QbvZP_.js.map → step-catalog-Dw8bipyJ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{step-panel-C5Pnb-Vb.js.map → step-panel-CA5-2Doz.js.map} +1 -1
- package/dist/shell-source-maps/assets/{timeline-display-hbo62z0J.js.map → timeline-display-BLF3onV2.js.map} +1 -1
- package/dist/shell-source-maps/assets/{trash-YqRXn8JG.js.map → trash-Cd-g6Eyo.js.map} +1 -1
- package/dist/shell-source-maps/assets/{update-set-DFWECx_E.js.map → update-set-DfPWNMBL.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-calendar-move-D_6TlMr4.js.map → use-calendar-move-J9sB_jXo.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-display-rows-1Xjy5pR2.js.map → use-display-rows-CYGJYJrz.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-my-invitations-CrSF37dB.js.map → use-my-invitations-DZ0rA8RK.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-paged-search-CtD7Lf-E.js.map → use-paged-search-cBs-xWuq.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-run-trace-5H4UJvB-.js.map → use-run-trace-CSdKdxn9.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-workflow-page-dAWuZvWk.js.map → use-workflow-page-DGd_5JMB.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-workflow-types-Cjkw47Mf.js.map → use-workflow-types-BQl6tPM-.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-canvas-BkFimRd2.js.map → workflow-canvas-DbLkc3zJ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-field-BQImywHx.js.map → workflow-field-DRAphvYG.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-graph-editor-DYBqdH_O.js.map → workflow-graph-editor-CzgoB1_t.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-run-field-CyxK0W7w.js.map → workflow-run-field-CQf9E5e1.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-status-field-Bzri4NHN.js.map → workflow-status-field-CiaCtBkf.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-workbench-DC2gtXz1.js.map → workflow-workbench-CMl69WwH.js.map} +1 -1
- package/dist/status/messages.d.ts +2 -2
- package/dist/users/messages.d.ts +2 -2
- package/package.json +5 -5
- package/dist/shell/assets/app-CwxoFZn2.js +0 -34
- package/dist/shell/assets/en-C_BQKBSV.js +0 -2
- package/dist/shell/assets/export-worker-C46NatsO.js +0 -15
- package/dist/shell/assets/nl-DzJ_yv1H.js +0 -2
- package/dist/shell/assets/parse-worker-COWuolaE.js +0 -35
- package/dist/shell-source-maps/assets/app-CwxoFZn2.js.map +0 -1
- package/dist/shell-source-maps/assets/en-C_BQKBSV.js.map +0 -1
- package/dist/shell-source-maps/assets/export-worker-C46NatsO.js.map +0 -1
- package/dist/shell-source-maps/assets/nl-DzJ_yv1H.js.map +0 -1
- package/dist/shell-source-maps/assets/parse-worker-COWuolaE.js.map +0 -1
|
@@ -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{$n as r,Ea as i,Hr as a,Ia as o,Kc as s,Ql as c,Qn as l,Ta as u,Vc as d,Xa as f,Xr as p,Xs as m,Zs as h,bi as g,dl as _,eu as v,fc as y,lc as b,ml as x,ms as S,ni as C,nl as w,sn as T,ss as E,tl as D,uc as O,vl as k,vr as A,yn as j,za as M}from"./app-CwxoFZn2.js";import{h as N,o as P}from"./vendor-t7Q7QbPu.js";import{Q as F}from"./embedded-list-DoHDT3Av.js";import{n as I}from"./lib-dnd-kit-sortable-CNDSKqCD.js";import{a as L,i as R,n as z,o as ee,r as B,s as V,t as H}from"./messages-NBuAsjFr.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=s(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=s(G),q=e(t(),1),J=w(`app/delete`),Y=c(),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??x(a),c=X({blockingPlural:s,noun:r});if(!o||i===void 0)return{text:c};let l={kind:`list`,resource:a,filter:v(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)(O,{title:J(`confirmTitle`,{title:e}),description:J(`confirmDescription`,{noun:t,title:e}),onClose:i,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(y,{onClick:i,children:J(`cancel`)}),(0,Q.jsx)(y,{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)(O,{title:J(`changedTitle`,{title:e}),description:J(`changedDescription`),onClose:a,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(y,{onClick:r,children:J(`reviewChanges`)}),(0,Q.jsx)(y,{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)(O,{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)(y,{onClick:e.onCancel,children:J(`cancel`)}),(0,Q.jsx)(y,{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)(O,{title:J(`deleting`),description:J(`progress`,{done:e.done,total:e.total}),onClose:()=>void 0,actions:(0,Q.jsx)(y,{loading:!0,disabled:!0,children:J(`working`)})});let t=e.total-e.failures.length;return(0,Q.jsx)(O,{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)(y,{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??x(e.name),before:g(e,n[e.name],i),after:g(e,r[e.name],i)}]}),ae=4,oe=({model:e,view:t,onDeleted:n,onReview:r,restore:i})=>{let o=S(),s=N(),c=M(),[l,u]=(0,q.useState)(),[d,f]=(0,q.useState)(!1),p=t?.names?.singular??x(e.name),g=t?.names?.plural??x(e.name),{resources:_,views:v}=E(),{href:y,open:b}=a(),C=(t,n)=>t.blockedBy&&Z({blockedBy:t.blockedBy,resources:_,views:v,noun:p,...e.primaryKey.length===1&&{key:n.key}}),w=()=>{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]})},T=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 m))throw e;return e}},D=t=>{w(),u(void 0),n?.(t),c.show({state:`success`,title:J(`deletedToast`,{title:t.title}),...e.softDelete&&i&&{action:{label:J(`undo`),onClick:()=>{i(t).then(()=>{w(),c.show({state:`success`,title:J(`restored`,{title:t.title})})},e=>{if(!h(e))throw e;w(),c.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})})}}}})},O=async(n,r)=>{f(!0);try{if(!await T(n,r))return D(n);let i=(await o.get(e.name,n.key)).record;u({kind:`conflict`,target:n,fresh:i,changes:ie(e,t,n.snapshot,i)})}catch(e){if(!h(e))throw e;u(void 0);let t=C(e,n);c.show({state:`error`,title:J(`couldNotDelete`,{title:n.title}),description:t?.text??e.message,...t?.link&&{action:{label:t.link.label,href:y(t.link.to),onNavigate:b}}})}finally{f(!1)}},k=async e=>{try{return await T(e,e.etag)?{title:e.title,message:J(`changedSinceLoaded`)}:void 0}catch(t){if(!h(t))throw t;return{title:e.title,message:C(t,e)?.text??t.message}}},A=async e=>{let t=[],n=[],r=0;u({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 k(a);i&&(t.push(i),n.push(a)),r+=1,u({kind:`bulk-running`,done:r,total:e.length})}})),w(),u({kind:`bulk-done`,total:e.length,failures:t}),n},j=()=>u(void 0);return{dialogs:l&&(0,Q.jsxs)(Q.Fragment,{children:[l.kind===`confirm`&&(0,Q.jsx)(te,{title:l.target.title,noun:p,busy:d,onCancel:j,onConfirm:()=>void O(l.target,l.target.etag)}),l.kind===`conflict`&&(0,Q.jsx)(ne,{title:l.target.title,changes:l.changes,busy:d,onCancel:j,onReview:()=>{j(),r?.(l.target,l.fresh)},onDeleteAnyway:()=>void O(l.target,`*`)}),l.kind===`bulk-confirm`&&(0,Q.jsx)($,{stage:`confirm`,count:l.targets.length,noun:p,plural:g,onCancel:()=>{j(),l.settle(l.targets)},onConfirm:()=>l.settle(A(l.targets))}),l.kind===`bulk-running`&&(0,Q.jsx)($,{stage:`running`,done:l.done,total:l.total}),l.kind===`bulk-done`&&(0,Q.jsx)($,{stage:`done`,total:l.total,failures:l.failures,onClose:j})]}),start:t=>e.softDelete?O(t,t.etag):u({kind:`confirm`,target:t}),startBulk:e=>new Promise(t=>u({kind:`bulk-confirm`,targets:e,settle:t}))}},se=e=>{let t=S();return e.softDelete?async n=>void await t.undelete(e.name,n.key):void 0},ce=(e,t,n)=>({order:r,index:a})=>{let o=t=>r.findIndex(n=>k(i(e,n))===t),s=t.after.find(e=>o(e.key)>a);if(s)return H(`dependsOn`,{record:n,other:s.title});let c=t.before.find(e=>o(e.key)!==-1&&o(e.key)<a);return c?H(`dependsOn`,{record:c.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:a,rule:o})=>{let s=S(),c=M(),d=j(),{resources:f,views:m}=E(),h=`${n} asc`,g=P({queryKey:[...D.list(e.name,i,h,500,`hand-order`),a.join(`,`)],queryFn:async()=>{let t=l(f,m,e,a),n=[],o=``;do{let c=await s.search(e.name,{filter:i||void 0,orderBy:h,pageSize:500,labels:t,...o&&{pageToken:o}});n.push(...r(f,e,a,c.items,c.labels).map((t,n)=>({...t,id:u(e,c.items[n])}))),o=c.nextPageToken}while(o);return n}}),[v,y]=(0,q.useState)(),b=(0,q.useRef)(void 0),x=(0,q.useRef)([]),C=(0,q.useRef)(void 0),w=(0,q.useRef)(Promise.resolve()),T=(0,q.useRef)(0),O=(0,q.useRef)(void 0),k=async()=>{let t=b.current,r=x.current;if(x.current=[],!t||r.length===0)return;let i=await s.batchWrite(r),a=new Map(i.results.flatMap(e=>e.op===`move`?e.records:[]).map(t=>[u(e,t.record),t])),o=z(i.results,t=>u(e,t)),l=L(e,[...a].map(([e,t])=>({...t,before:{[n]:o.get(e)}})),[n]);O.current!==void 0&&c.dismiss(O.current),O.current=c.show({state:`success`,title:V(`orderChanged`),action:{label:V(`undo`),onClick:()=>W(l)}}),b.current&&=b.current.map(e=>{let t=a.get(e.id);return t?{...e,[n]:t.record[n],etag:t.etag}:e})},A=(e,t)=>n=>{b.current=void 0,x.current=[],y(void 0),c.show(ee(n,e,{place:`list`,title:t?C.current:void 0}))},N=async()=>{--T.current,!(T.current>0)&&(await d(e.name),!(T.current>0)&&(b.current=void 0,y(void 0)))},F=(n,r)=>{let i=b.current??g.data;if(!i||n===r)return;if(!e.position?.after)return H(i,n,r,o);let a=p(e,i[n]).record,c=i[n].id;R(s,e,t,a).then(n=>{let i=b.current??g.data,s=ce(e,n,_(e,t,a,c));H(i,i.findIndex(e=>e.id===c),r,e=>s(e)??o?.(e))},A(V(`couldNotChange`),!1))},H=(r,a,o,s)=>{if(a===-1||a===o)return;let c=s?U(r,a,o,s):o;a!==c&&(b.current=I(r,a,c),x.current=[...x.current,B(e,n,i,b.current,c)],y(b.current),T.current+=1,C.current=_(e,t,p(e,r[a]).record,r[a].id),w.current=w.current.then(k).catch(A(V(`couldNotChange`),!0)).then(N))},U=(t,n,r,i)=>{let a=le(t.map(t=>p(e,t).record),n,r,i);return a.reason!==void 0&&c.show({state:`warning`,title:a.to===n?V(`notMoved`):V(`movedToPlace`,{place:a.to+1}),description:a.reason}),a.to},W=e=>{O.current!==void 0&&c.dismiss(O.current),O.current=void 0,T.current+=1,w.current=w.current.then(async()=>{await s.batchWrite(e),b.current=void 0,x.current=[],y(void 0)}).catch(A(V(`couldNotUndo`),!1)).then(N)};return{rows:v??g.data,loading:g.isPending,error:g.error,move:F}},de=({model:e,view:t,field:n,filter:r,columns:s,sort:c})=>{let{resources:l,views:u}=E(),{fields:d,dropRules:p}=o(),{go:m,href:h}=a(),g=c!==void 0,v=(0,q.useMemo)(()=>T(e,t,s,{resources:l,views:u,fieldTypes:d}).map(e=>g?e:{...e,sortable:!1}),[e,t,s.join(`,`),l,u,d,g]),y=(0,q.useMemo)(()=>C(e,t,v.map(e=>e.id)),[e,t,v]),x=t?.list?.drag?.rule,S=x===void 0?void 0:p?.[x],w=ue({model:e,view:t,field:n,filter:r,fields:y,...S&&{rule:S}}),D=w.rows,O=(0,q.useMemo)(()=>D&&{total:D.length,rowAt:e=>D[e]},[D]);if(x!==void 0&&!S)return(0,Q.jsx)(f,{children:V.rich(`noRule`,{rule:x})});if(w.loading)return(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:Array.from({length:3},(e,t)=>(0,Q.jsx)(b,{className:`h-4 w-full`},t))});if(w.error)return(0,Q.jsx)(A,{title:V(`couldNotLoad`),error:w.error});if(!O||O.total===0)return(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:V(`nothingYet`)});let k=t=>m({kind:`record`,resource:e.name,key:i(e,t)});return(0,Q.jsx)(F,{fit:!0,scroll:`parent`,columns:v,source:O,latencyMs:0,onOpenRow:k,rowLink:t=>({href:h({kind:`record`,resource:e.name,key:i(e,t)}),onFollow:()=>k(t)}),...c&&{sort:c.value,onSortChange:c.onChange},rowNumbers:!1,reorder:{label:n=>_(e,t,n,n.id),onMove:w.move}})},fe=({sorting:e,onChange:t,size:n,iconOnly:r=!1})=>{let i=V(e?`done`:`reorder`);return(0,Q.jsxs)(y,{size:n,variant:e?`primary`:`secondary`,onClick:()=>t(!e),...r&&{"aria-label":i,title:i},children:[e?(0,Q.jsx)(d,{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=
|
|
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{$n as r,Ea as i,Hr as a,Ia as o,Kc as s,Ql as c,Qn as l,Ta as u,Vc as d,Xa as f,Xr as p,Xs as m,Zs as h,bi as g,dl as _,eu as v,fc as y,lc as b,ml as x,ms as S,ni as C,nl as w,sn as T,ss as E,tl as D,uc as O,vl as k,vr as A,yn as j,za as M}from"./app-CWCg5I0x.js";import{h as N,o as P}from"./vendor-t7Q7QbPu.js";import{Q as F}from"./embedded-list-BOlcwiiA.js";import{n as I}from"./lib-dnd-kit-sortable-CNDSKqCD.js";import{a as L,i as R,n as z,o as ee,r as B,s as V,t as H}from"./messages-QTTbTkpW.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=s(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=s(G),q=e(t(),1),J=w(`app/delete`),Y=c(),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??x(a),c=X({blockingPlural:s,noun:r});if(!o||i===void 0)return{text:c};let l={kind:`list`,resource:a,filter:v(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)(O,{title:J(`confirmTitle`,{title:e}),description:J(`confirmDescription`,{noun:t,title:e}),onClose:i,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(y,{onClick:i,children:J(`cancel`)}),(0,Q.jsx)(y,{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)(O,{title:J(`changedTitle`,{title:e}),description:J(`changedDescription`),onClose:a,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(y,{onClick:r,children:J(`reviewChanges`)}),(0,Q.jsx)(y,{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)(O,{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)(y,{onClick:e.onCancel,children:J(`cancel`)}),(0,Q.jsx)(y,{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)(O,{title:J(`deleting`),description:J(`progress`,{done:e.done,total:e.total}),onClose:()=>void 0,actions:(0,Q.jsx)(y,{loading:!0,disabled:!0,children:J(`working`)})});let t=e.total-e.failures.length;return(0,Q.jsx)(O,{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)(y,{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??x(e.name),before:g(e,n[e.name],i),after:g(e,r[e.name],i)}]}),ae=4,oe=({model:e,view:t,onDeleted:n,onReview:r,restore:i})=>{let o=S(),s=N(),c=M(),[l,u]=(0,q.useState)(),[d,f]=(0,q.useState)(!1),p=t?.names?.singular??x(e.name),g=t?.names?.plural??x(e.name),{resources:_,views:v}=E(),{href:y,open:b}=a(),C=(t,n)=>t.blockedBy&&Z({blockedBy:t.blockedBy,resources:_,views:v,noun:p,...e.primaryKey.length===1&&{key:n.key}}),w=()=>{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]})},T=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 m))throw e;return e}},D=t=>{w(),u(void 0),n?.(t),c.show({state:`success`,title:J(`deletedToast`,{title:t.title}),...e.softDelete&&i&&{action:{label:J(`undo`),onClick:()=>{i(t).then(()=>{w(),c.show({state:`success`,title:J(`restored`,{title:t.title})})},e=>{if(!h(e))throw e;w(),c.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})})}}}})},O=async(n,r)=>{f(!0);try{if(!await T(n,r))return D(n);let i=(await o.get(e.name,n.key)).record;u({kind:`conflict`,target:n,fresh:i,changes:ie(e,t,n.snapshot,i)})}catch(e){if(!h(e))throw e;u(void 0);let t=C(e,n);c.show({state:`error`,title:J(`couldNotDelete`,{title:n.title}),description:t?.text??e.message,...t?.link&&{action:{label:t.link.label,href:y(t.link.to),onNavigate:b}}})}finally{f(!1)}},k=async e=>{try{return await T(e,e.etag)?{title:e.title,message:J(`changedSinceLoaded`)}:void 0}catch(t){if(!h(t))throw t;return{title:e.title,message:C(t,e)?.text??t.message}}},A=async e=>{let t=[],n=[],r=0;u({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 k(a);i&&(t.push(i),n.push(a)),r+=1,u({kind:`bulk-running`,done:r,total:e.length})}})),w(),u({kind:`bulk-done`,total:e.length,failures:t}),n},j=()=>u(void 0);return{dialogs:l&&(0,Q.jsxs)(Q.Fragment,{children:[l.kind===`confirm`&&(0,Q.jsx)(te,{title:l.target.title,noun:p,busy:d,onCancel:j,onConfirm:()=>void O(l.target,l.target.etag)}),l.kind===`conflict`&&(0,Q.jsx)(ne,{title:l.target.title,changes:l.changes,busy:d,onCancel:j,onReview:()=>{j(),r?.(l.target,l.fresh)},onDeleteAnyway:()=>void O(l.target,`*`)}),l.kind===`bulk-confirm`&&(0,Q.jsx)($,{stage:`confirm`,count:l.targets.length,noun:p,plural:g,onCancel:()=>{j(),l.settle(l.targets)},onConfirm:()=>l.settle(A(l.targets))}),l.kind===`bulk-running`&&(0,Q.jsx)($,{stage:`running`,done:l.done,total:l.total}),l.kind===`bulk-done`&&(0,Q.jsx)($,{stage:`done`,total:l.total,failures:l.failures,onClose:j})]}),start:t=>e.softDelete?O(t,t.etag):u({kind:`confirm`,target:t}),startBulk:e=>new Promise(t=>u({kind:`bulk-confirm`,targets:e,settle:t}))}},se=e=>{let t=S();return e.softDelete?async n=>void await t.undelete(e.name,n.key):void 0},ce=(e,t,n)=>({order:r,index:a})=>{let o=t=>r.findIndex(n=>k(i(e,n))===t),s=t.after.find(e=>o(e.key)>a);if(s)return H(`dependsOn`,{record:n,other:s.title});let c=t.before.find(e=>o(e.key)!==-1&&o(e.key)<a);return c?H(`dependsOn`,{record:c.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:a,rule:o})=>{let s=S(),c=M(),d=j(),{resources:f,views:m}=E(),h=`${n} asc`,g=P({queryKey:[...D.list(e.name,i,h,500,`hand-order`),a.join(`,`)],queryFn:async()=>{let t=l(f,m,e,a),n=[],o=``;do{let c=await s.search(e.name,{filter:i||void 0,orderBy:h,pageSize:500,labels:t,...o&&{pageToken:o}});n.push(...r(f,e,a,c.items,c.labels).map((t,n)=>({...t,id:u(e,c.items[n])}))),o=c.nextPageToken}while(o);return n}}),[v,y]=(0,q.useState)(),b=(0,q.useRef)(void 0),x=(0,q.useRef)([]),C=(0,q.useRef)(void 0),w=(0,q.useRef)(Promise.resolve()),T=(0,q.useRef)(0),O=(0,q.useRef)(void 0),k=async()=>{let t=b.current,r=x.current;if(x.current=[],!t||r.length===0)return;let i=await s.batchWrite(r),a=new Map(i.results.flatMap(e=>e.op===`move`?e.records:[]).map(t=>[u(e,t.record),t])),o=z(i.results,t=>u(e,t)),l=L(e,[...a].map(([e,t])=>({...t,before:{[n]:o.get(e)}})),[n]);O.current!==void 0&&c.dismiss(O.current),O.current=c.show({state:`success`,title:V(`orderChanged`),action:{label:V(`undo`),onClick:()=>W(l)}}),b.current&&=b.current.map(e=>{let t=a.get(e.id);return t?{...e,[n]:t.record[n],etag:t.etag}:e})},A=(e,t)=>n=>{b.current=void 0,x.current=[],y(void 0),c.show(ee(n,e,{place:`list`,title:t?C.current:void 0}))},N=async()=>{--T.current,!(T.current>0)&&(await d(e.name),!(T.current>0)&&(b.current=void 0,y(void 0)))},F=(n,r)=>{let i=b.current??g.data;if(!i||n===r)return;if(!e.position?.after)return H(i,n,r,o);let a=p(e,i[n]).record,c=i[n].id;R(s,e,t,a).then(n=>{let i=b.current??g.data,s=ce(e,n,_(e,t,a,c));H(i,i.findIndex(e=>e.id===c),r,e=>s(e)??o?.(e))},A(V(`couldNotChange`),!1))},H=(r,a,o,s)=>{if(a===-1||a===o)return;let c=s?U(r,a,o,s):o;a!==c&&(b.current=I(r,a,c),x.current=[...x.current,B(e,n,i,b.current,c)],y(b.current),T.current+=1,C.current=_(e,t,p(e,r[a]).record,r[a].id),w.current=w.current.then(k).catch(A(V(`couldNotChange`),!0)).then(N))},U=(t,n,r,i)=>{let a=le(t.map(t=>p(e,t).record),n,r,i);return a.reason!==void 0&&c.show({state:`warning`,title:a.to===n?V(`notMoved`):V(`movedToPlace`,{place:a.to+1}),description:a.reason}),a.to},W=e=>{O.current!==void 0&&c.dismiss(O.current),O.current=void 0,T.current+=1,w.current=w.current.then(async()=>{await s.batchWrite(e),b.current=void 0,x.current=[],y(void 0)}).catch(A(V(`couldNotUndo`),!1)).then(N)};return{rows:v??g.data,loading:g.isPending,error:g.error,move:F}},de=({model:e,view:t,field:n,filter:r,columns:s,sort:c})=>{let{resources:l,views:u}=E(),{fields:d,dropRules:p}=o(),{go:m,href:h}=a(),g=c!==void 0,v=(0,q.useMemo)(()=>T(e,t,s,{resources:l,views:u,fieldTypes:d}).map(e=>g?e:{...e,sortable:!1}),[e,t,s.join(`,`),l,u,d,g]),y=(0,q.useMemo)(()=>C(e,t,v.map(e=>e.id)),[e,t,v]),x=t?.list?.drag?.rule,S=x===void 0?void 0:p?.[x],w=ue({model:e,view:t,field:n,filter:r,fields:y,...S&&{rule:S}}),D=w.rows,O=(0,q.useMemo)(()=>D&&{total:D.length,rowAt:e=>D[e]},[D]);if(x!==void 0&&!S)return(0,Q.jsx)(f,{children:V.rich(`noRule`,{rule:x})});if(w.loading)return(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:Array.from({length:3},(e,t)=>(0,Q.jsx)(b,{className:`h-4 w-full`},t))});if(w.error)return(0,Q.jsx)(A,{title:V(`couldNotLoad`),error:w.error});if(!O||O.total===0)return(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:V(`nothingYet`)});let k=t=>m({kind:`record`,resource:e.name,key:i(e,t)});return(0,Q.jsx)(F,{fit:!0,scroll:`parent`,columns:v,source:O,latencyMs:0,onOpenRow:k,rowLink:t=>({href:h({kind:`record`,resource:e.name,key:i(e,t)}),onFollow:()=>k(t)}),...c&&{sort:c.value,onSortChange:c.onChange},rowNumbers:!1,reorder:{label:n=>_(e,t,n,n.id),onMove:w.move}})},fe=({sorting:e,onChange:t,size:n,iconOnly:r=!1})=>{let i=V(e?`done`:`reorder`);return(0,Q.jsxs)(y,{size:n,variant:e?`primary`:`secondary`,onClick:()=>t(!e),...r&&{"aria-label":i,title:i},children:[e?(0,Q.jsx)(d,{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=e681065a-dc4a-43f5-beb0-a6327ec4de04
|
|
@@ -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{lc as r,vr as i}from"./app-
|
|
2
|
-
//# debugId=
|
|
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{lc as r,vr as i}from"./app-CWCg5I0x.js";import{t as a}from"./workflow-canvas-DbLkc3zJ.js";import{a as o,i as s,n as c}from"./step-panel-CA5-2Doz.js";import{t as l}from"./use-run-trace-CSdKdxn9.js";import{t as u}from"./use-workflow-types-BQl6tPM-.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)(i,{error:e.error,title:s(`loadFailed`)});if(!e.run||!e.id||!u||!y)return(0,m.jsx)(r,{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=9270575d-51b6-4a1e-a519-bf87d4e8bfbc
|
package/dist/shell/assets/{runner-install-field-Dm7GhYaF.js → runner-install-field-DyyHVUfd.js}
RENAMED
|
@@ -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{Ys as r,cl as i,ea as a,fc as o,ms as s,nl as c}from"./app-
|
|
2
|
-
//# debugId=
|
|
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{Ys as r,cl as i,ea as a,fc as o,ms as s,nl as c}from"./app-CWCg5I0x.js";import{t as l}from"./copy-field-D0wtSWzb.js";var u=e(t(),1),d=c(`app/field-types/runner-install`),f=e(n(),1),p=e=>e instanceof r?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=s(),[n,r]=(0,u.useState)(),[i,c]=(0,u.useState)(!1),[m,h]=(0,u.useState)();if(e===null)return null;let g=async()=>{c(!0),h(void 0),await t.runnerRegistration(e).then(r,e=>h(p(e))),c(!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:a(Date.parse(n.expires_at))})})]}),m&&(0,f.jsx)(`p`,{role:`alert`,className:`text-body text-danger-text`,children:m}),(0,f.jsx)(o,{size:`sm`,variant:n?`secondary`:`primary`,className:`justify-self-start`,loading:i,onClick:()=>void g(),children:d(n?`again`:`issue`)})]})},h={of:[...i.runner_install],display:m,cell:()=>null};export{h as runnerInstallField};
|
|
2
|
+
//# debugId=f2c87554-7dd8-4350-af4f-9cf8ba9b83c4
|
|
@@ -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{Ka as r,Kc as i,Qi as a,Qs as o,Ys as s,Zs as c,ea as l,fc as u,mc as d,nl as f,pa as p,uc as m}from"./app-
|
|
2
|
-
//# debugId=
|
|
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{Ka as r,Kc as i,Qi as a,Qs as o,Ys as s,Zs as c,ea as l,fc as u,mc as d,nl as f,pa as p,uc as m}from"./app-CWCg5I0x.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=i(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 s({type:`urn:protobase:problem:${t.error.code}`,title:e.statusText||`Request failed`,status:e.status,detail:t.error.message}):o(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=f(`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:a(r)})},T=(e,t=Date.now(),n=p())=>e.updating?w(e,t):e.nextUpdateAt?x(`nextOn`,{policy:x(e.policy),when:l(Date.parse(e.nextUpdateAt),n)}):x(e.policy),E=(e,t=p())=>{let n=l(Date.parse(e.finishedAt),t),r=x(e.outcome,{version:e.toVersion,when:n});return e.message?`${r}: ${e.message}`:`${r}.`},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)(m,{title:x(`runtimeUpdate`),description:e.updating?(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,O.jsx)(d,{className:`size-3.5`}),T(e)]}):T(e),onClose:a,actions:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(u,{onClick:a,children:x(`close`)}),(0,O.jsx)(u,{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=r(),n=(0,b.useRef)(t);n.current=t;let i=t!==void 0;return(0,b.useMemo)(()=>i?y({url:e,token:()=>n.current}):void 0,[e,i])},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)(u,{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=ae2cbe10-6e64-4458-92c8-37f28f8c326b
|
package/dist/shell/assets/{shared-protobase-ui-CDtJQrEp.js → shared-protobase-ui-DOsgmmrs.js}
RENAMED
|
@@ -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,$c as t,$t as n,B as r,Br as ee,Bt as te,Cn as i,Co as a,Cr as o,Ct as s,Dn as c,Er as l,Et as u,Fa as d,Fo as f,Fr as p,Ft as m,G as h,Ga as g,Gi as _,H as v,Hn as y,Hr as b,Ht as x,Io as S,It as C,Jc as w,Ji as T,Jt as E,Ka as D,Ki as O,Kt as k,Lo as A,Mo as j,Mt as M,N,Nr as P,Nt as F,Or as I,P as L,Pa as R,Po as z,Pr as B,Pt as V,Q as H,Qc as U,Qt as W,R as G,Ra as K,Rr as q,St as J,To as Y,Tr as X,Tt as Z,U as Q,Ua as ne,Uo as re,Ut as ie,V as ae,Vr as oe,Vt as se,W as ce,Wi as le,Xc as ue,Xi as de,Xt as fe,Y as pe,Yc as me,Yi as he,Yt as ge,Z as _e,Zc as ve,Zi as $,_o as ye,_t as be,at as xe,bo as Se,br as Ce,bt as we,do as Te,dt as Ee,el as De,et as Oe,fc as ke,fo as Ae,fs as je,ft as Me,ga as Ne,gt as Pe,hs as Fe,ht as Ie,jt as Le,kr as Re,kt as ze,lt as Be,mc as Ve,ms as He,mt as Ue,n as We,nt as Ge,pc as Ke,po as qe,ps as Je,pt as Ye,qi as Xe,r as Ze,rl as Qe,rt as $e,sc as et,t as tt,tt as nt,uc as rt,ur as it,ut as at,vo as ot,vt as st,wr as ct,wt as lt,xo as ut,xr as dt,xt as ft,yr as pt,yt as mt,z as ht,zr as gt,zt as _t}from"./app-
|
|
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,$c as t,$t as n,B as r,Br as ee,Bt as te,Cn as i,Co as a,Cr as o,Ct as s,Dn as c,Er as l,Et as u,Fa as d,Fo as f,Fr as p,Ft as m,G as h,Ga as g,Gi as _,H as v,Hn as y,Hr as b,Ht as x,Io as S,It as C,Jc as w,Ji as T,Jt as E,Ka as D,Ki as O,Kt as k,Lo as A,Mo as j,Mt as M,N,Nr as P,Nt as F,Or as I,P as L,Pa as R,Po as z,Pr as B,Pt as V,Q as H,Qc as U,Qt as W,R as G,Ra as K,Rr as q,St as J,To as Y,Tr as X,Tt as Z,U as Q,Ua as ne,Uo as re,Ut as ie,V as ae,Vr as oe,Vt as se,W as ce,Wi as le,Xc as ue,Xi as de,Xt as fe,Y as pe,Yc as me,Yi as he,Yt as ge,Z as _e,Zc as ve,Zi as $,_o as ye,_t as be,at as xe,bo as Se,br as Ce,bt as we,do as Te,dt as Ee,el as De,et as Oe,fc as ke,fo as Ae,fs as je,ft as Me,ga as Ne,gt as Pe,hs as Fe,ht as Ie,jt as Le,kr as Re,kt as ze,lt as Be,mc as Ve,ms as He,mt as Ue,n as We,nt as Ge,pc as Ke,po as qe,ps as Je,pt as Ye,qi as Xe,r as Ze,rl as Qe,rt as $e,sc as et,t as tt,tt as nt,uc as rt,ur as it,ut as at,vo as ot,vt as st,wr as ct,wt as lt,xo as ut,xr as dt,xt as ft,yr as pt,yt as mt,z as ht,zr as gt,zt as _t}from"./app-CWCg5I0x.js";import{h as vt,o as yt}from"./vendor-t7Q7QbPu.js";export{ft as ActionCard,l as ActionInputError,Je as ApiProvider,gt as App,oe as AppLink,S as AppMark,Ee as AssistantDock,qe as AuthLayout,Se as AvailabilityMark,ke as Button,_t as CallMark,ie as CallView,h as Carousel,F as ChatDivider,M as ChatMessage,Le as ChatThread,ht as Choices,Te as CodeForm,mt as CompactTable,s as Composer,rt as Dialog,Pe as DiffView,G as Field,fe as FieldBadge,we as FieldList,Ce as FileReadError,H as FocusActions,e as FocusNotice,$e as FocusPage,Oe as FocusPanel,nt as FocusSlot,N as Form,ct as HtmlFrame,We as InPlaceForm,j as Input,A as LogoMark,c as Markdown,Z as MentionBox,lt as MentionedText,r as MenuSelect,a as MenuSurface,ye as OtpInput,Ye as PartView,se as RecordCall,k as RecordLink,tt as RecordPicker,Ae as ResendCodeButton,T as ResponsiveDialog,et as RouteLink,pe as SearchPicker,L as Section,Y as Segmented,i as Select,J as SidePanel,C as SignInPrompt,Ve as Spinner,ut as StatusMark,Ue as StepList,y as Textarea,ge as ToneEdge,ae as allowDelayMs,Ke as buttonClass,V as chatDayLabel,re as closeSidebarEvent,R as definePlugin,d as defineUi,be as diffStats,u as emptyDraft,me as extensionPointsOf,X as fileNamed,I as isConflict,v as isFramed,f as logoTapEvent,ze as mentionedIds,ve as mergeUi,st as parseDiff,Ie as parsePatch,t as pluginApi,w as pluginsChangedEvent,De as protobaseVersion,m as sameChatDay,Qe as showTextsIn,o as siblingPage,ot as signedOutEvent,_ as statusRefreshMs,U as uiFromModule,ee as uiReadyEvent,D as useApiToken,b as useAppAddress,Q as useArmedAfterFocus,at as useAssistant,Be as useAssistantClient,Me as useBackendData,He as useClient,W as useComponentReads,n as useComponentSelect,Ze as useCreateForm,P as useFacets,z as useFieldControl,dt as useFileText,xe as useFocusPage,_e as useFocusRecord,Ge as useFocusZoneFilled,ce as useGuardedPress,B as useHistogram,he as useInbox,it as useLayoutRecord,q as useList,E as useListDisplay,de as useMarkNotificationsRead,le as useMembers,je as useMeta,O as useOwnStatus,ue as usePlugin,K as usePresence,Ne as usePushNotifications,yt as useQuery,vt as useQueryClient,ne as useRecord,x as useRecordCallAddress,te as useRecordCalls,Fe as useResourceClient,p as useSeries,pt as useSiblingPage,g as useSignedInUser,Xe as useStatuses,$ as useUnreadNotifications,Re 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{Kc as r,Nc as i,Ql as a,Zs as o,al as s,bi as c,eu as l,fc as u,il as d,j as f,lo as p,mc as m,ml as h,pl as g,qc as _,vr as ee}from"./app-
|
|
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(s())})]},e))}),E=(e,t)=>e?.fields[t]?.label??h(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(g(e,t?.valueLabels))===i);return a.length===1?j(a[0]):a.length>1?M(y(`severalValues`,{cell:N(n),values:a.map(e=>g(e,t?.valueLabels)).join(`, `)})):M(y(`notOneOf`,{cell:N(n),values:r.map(e=>g(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??h(t),Ce=(e,t)=>e[t]?.names?.plural??h(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(!o(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:s})=>{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=o(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(s())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)=>p(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(s())})})]}),Me=({rows:e})=>(0,w.jsxs)(`p`,{className:`flex items-center gap-2 text-muted-foreground`,role:`status`,children:[(0,w.jsx)(m,{className:`size-3.5`}),y(`checkingRows`,{count:e.toLocaleString(s())})]}),Ne=({check:e,model:t,resources:n,views:r,columns:a,headers:o,fileName:s})=>{let l=r[t.name],d=a.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`)}),d.map(e=>(0,w.jsx)(`th`,{className:`whitespace-nowrap px-2 py-1.5 font-medium`,children:E(l,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}),d.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?c(t,e.values[t.name],l?.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)(u,{size:`sm`,onClick:()=>K(s,o,e.problems),children:[(0,w.jsx)(i,{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:r,onChange:i,help:a,className:o})=>{let s=(0,C.useId)();return(0,w.jsxs)(`div`,{className:_(`flex min-w-0 flex-col gap-1.5`,o),children:[(0,w.jsx)(`label`,{htmlFor:s,className:`font-medium`,children:e}),(0,w.jsx)(`select`,{id:s,"aria-label":t,value:n,onChange:e=>i(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:r.map(e=>(0,w.jsx)(`option`,{value:e.value,children:e.label},e.value))}),a&&(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a})]})},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)(m,{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(s()),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)(ee,{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)(u,{size:`sm`,onClick:()=>K(r,n,e.notWritten),children:[(0,w.jsx)(i,{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=a(),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,i)=>{let a=n(t.name,r),o=[...new Map(i.filter(e=>!a.has(Q(e))).map(e=>[Q(e),e])).values()],s=t.primaryKey[0];for(let n=0;n<o.length;n+=Z){let i=o.slice(n,n+Z);for(let e of i)a.set(Q(e),[]);let c=l(Ve.in(r,i)),u;do{let n=await e(t.name).list(t.name,{filter:c,fields:[...new Set([s,r])],pageSize:1e3,pageToken:u});for(let e of n.items)a.get(Q(e[r]))?.push(e[s]);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-COWuolaE.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:d()});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:d()});;){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=
|
|
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{Kc as r,Nc as i,Ql as a,Zs as o,al as s,bi as c,eu as l,fc as u,il as d,j as f,lo as p,mc as m,ml as h,pl as g,qc as _,vr as ee}from"./app-CWCg5I0x.js";import{c as v,d as y,l as te,o as b,u as x}from"./list-page-BtuFsbiK.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=r(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
|
+
`)}\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(s())})]},e))}),E=(e,t)=>e?.fields[t]?.label??h(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(g(e,t?.valueLabels))===i);return a.length===1?j(a[0]):a.length>1?M(y(`severalValues`,{cell:N(n),values:a.map(e=>g(e,t?.valueLabels)).join(`, `)})):M(y(`notOneOf`,{cell:N(n),values:r.map(e=>g(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??h(t),Ce=(e,t)=>e[t]?.names?.plural??h(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(!o(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:s})=>{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=o(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(s())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)=>p(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(s())})})]}),Me=({rows:e})=>(0,w.jsxs)(`p`,{className:`flex items-center gap-2 text-muted-foreground`,role:`status`,children:[(0,w.jsx)(m,{className:`size-3.5`}),y(`checkingRows`,{count:e.toLocaleString(s())})]}),Ne=({check:e,model:t,resources:n,views:r,columns:a,headers:o,fileName:s})=>{let l=r[t.name],d=a.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`)}),d.map(e=>(0,w.jsx)(`th`,{className:`whitespace-nowrap px-2 py-1.5 font-medium`,children:E(l,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}),d.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?c(t,e.values[t.name],l?.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)(u,{size:`sm`,onClick:()=>K(s,o,e.problems),children:[(0,w.jsx)(i,{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:r,onChange:i,help:a,className:o})=>{let s=(0,C.useId)();return(0,w.jsxs)(`div`,{className:_(`flex min-w-0 flex-col gap-1.5`,o),children:[(0,w.jsx)(`label`,{htmlFor:s,className:`font-medium`,children:e}),(0,w.jsx)(`select`,{id:s,"aria-label":t,value:n,onChange:e=>i(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:r.map(e=>(0,w.jsx)(`option`,{value:e.value,children:e.label},e.value))}),a&&(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a})]})},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)(m,{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(s()),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)(ee,{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)(u,{size:`sm`,onClick:()=>K(r,n,e.notWritten),children:[(0,w.jsx)(i,{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=a(),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,i)=>{let a=n(t.name,r),o=[...new Map(i.filter(e=>!a.has(Q(e))).map(e=>[Q(e),e])).values()],s=t.primaryKey[0];for(let n=0;n<o.length;n+=Z){let i=o.slice(n,n+Z);for(let e of i)a.set(Q(e),[]);let c=l(Ve.in(r,i)),u;do{let n=await e(t.name).list(t.name,{filter:c,fields:[...new Set([s,r])],pageSize:1e3,pageToken:u});for(let e of n.items)a.get(Q(e[r]))?.push(e[s]);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-CO_GFfU7.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:d()});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:d()});;){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=085f2cc8-c8ef-4c2a-b422-98fa80351388
|
package/dist/shell/assets/{sign-in-policy-page-DINzAtyt.js → sign-in-policy-page-Dto5W87n.js}
RENAMED
|
@@ -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{$o as r,Cs as i,Ds as a,al as o,ea as s,es as c,fc as l,is as u,mc as d,ns as f,qc as p,ws as m}from"./app-
|
|
2
|
-
//# debugId=
|
|
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{$o as r,Cs as i,Ds as a,al as o,ea as s,es as c,fc as l,is as u,mc as d,ns as f,qc as p,ws as m}from"./app-CWCg5I0x.js";import{t as h}from"./page-header-Ddz2r5ic.js";var g=e(t(),1),_=()=>[{value:`allowed`,label:i(`on`)},{value:`forbidden`,label:i(`off`)}],v=()=>[{value:`allowed`,label:i(`optional`)},{value:`required`,label:i(`required`)},{value:`forbidden`,label:i(`off`)}],y=()=>[{method:`password`,label:i(`password`),description:i(`passwordDescription`),rules:_()},{method:`emailCode`,label:i(`emailedSignInCode`),description:i(`emailedSignInCodeDescription`),rules:_()},{method:`passkey`,label:i(`passkeys`),description:i(`passkeysPolicyDescription`),rules:v()},{method:`twoFactor`,label:i(`twoFactor`),description:i(`twoFactorPolicyDescription`),rules:v()},{method:`staffAccess`,label:i(`staffAccess`),description:i(`staffAccessDescription`),rules:[{value:`allowed`,label:i(`on`)},{value:`notify`,label:i(`emailThePerson`)},{value:`forbidden`,label:i(`off`)}]},{method:`platformSignIn`,label:i(`platformSignIn`),description:i(`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:p(`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:a})=>{if(e===`emailCode`&&!n)return i(`codeNeedsMail`);if(e===`password`&&!n&&t.password===`forbidden`)return i(`passwordStaysOn`);if(e===`staffAccess`&&!n&&t.staffAccess===`notify`)return i(`staffNeedsMail`);if(e===`platformSignIn`&&t.platformSignIn===`allowed`&&t.passkey===`required`)return i(`platformOff`);if(t[e]===a[e]&&r[e]!==a[e])return i(`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:i(`platformSignInWith`,{provider:new Intl.ListFormat(o(),{type:`conjunction`}).format(t)})}]:[]:[n]),T=({state:e,onSave:t,busy:n,error:r,notice:a})=>{let[o,c]=(0,g.useState)(e.policy),u=w(e),d=u.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:u.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=>c({...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&&!d&&(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?i(`lastSavedBy`,{name:e.savedBy,time:s(Date.parse(e.savedAt))}):i(`lastSaved`,{time:s(Date.parse(e.savedAt))}):i(`neverChanged`)}),(0,x.jsxs)(`div`,{className:`flex gap-2`,children:[d&&(0,x.jsx)(l,{onClick:()=>c(e.policy),children:i(`reset`)}),(0,x.jsx)(l,{variant:`primary`,type:`submit`,loading:n,disabled:!d,children:i(`save`)})]})]})]})},E=(e,t)=>e.endedAt?(0,x.jsx)(f,{tone:`neutral`,children:i(`stopped`,{time:s(Date.parse(e.endedAt))})}):Date.parse(e.expiresAt)<=t?(0,x.jsx)(f,{tone:`neutral`,children:i(`ended`,{time:s(Date.parse(e.expiresAt))})}):(0,x.jsx)(f,{tone:`amber`,children:i(`signedInUntil`,{time:s(Date.parse(e.expiresAt))})}),D=({signIns:e,operator:t,error:n,now:a=Date.now()})=>(0,x.jsxs)(r,{title:i(`staffSignIns`),description:i(`staffSignInsDescription`,{operator:t}),children:[(0,x.jsx)(c,{message:n}),e&&e.length===0&&(0,x.jsx)(`p`,{className:`text-muted-foreground`,children:i(`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:i(`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:s(Date.parse(e.startedAt))}),E(e,a)]})]},e.id))})]}),O=({operator:e})=>{let{session:t}=m(),[n,r]=(0,g.useState)(),[o,s]=(0,g.useState)();return(0,g.useEffect)(()=>{t.staff.log().then(r,e=>s(e instanceof a?u(e):i(`couldNotReadStaffSignIns`)))},[t]),(0,x.jsx)(D,{operator:e,signIns:n,error:o})},k=()=>{let{session:e}=m(),[t,n]=(0,g.useState)(),[r,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(),[l,f]=(0,g.useState)();(0,g.useEffect)(()=>{e.signInPolicy.read().then(n,e=>c(e instanceof a?u(e):i(`couldNotReadPolicy`)))},[e]);let p=async t=>{o(!0),c(void 0),f(void 0);try{n(await e.signInPolicy.save(t)),f(i(`policySaved`))}catch(e){if(!(e instanceof a))throw e;c(u(e))}o(!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:i(`signInPolicy`),subtitle:i(`policySubtitle`)}),t?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{state:t,busy:r,error:s,notice:l,onSave:e=>void p(e)},t.savedAt??`default`),t.operator&&(0,x.jsx)(O,{operator:t.operator})]}):s?(0,x.jsx)(`p`,{role:`alert`,className:`text-danger-text`,children:s}):(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,x.jsx)(d,{}),` `,i(`loading`)]})]})};export{k as SignInPolicyPage};
|
|
2
|
+
//# debugId=eda395bc-ee75-47ab-b72a-47d52f4b6bd2
|
package/dist/shell/assets/{start-block-queries-Bc743CdL.js → start-block-queries-DNegRXtD.js}
RENAMED
|
@@ -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{Ar as n,Go as r,Gs as i,Ia as a,Lr as o,Ms as s,Ps as c,Qn as l,Sa as u,an as d,dn as f,dr as p,fn as m,in as h,ir as g,ks as _,lr as v,ms as y,nr as b,on as x,pn as S,ss as C}from"./app-
|
|
2
|
-
//# debugId=
|
|
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{Ar as n,Go as r,Gs as i,Ia as a,Lr as o,Ms as s,Ps as c,Qn as l,Sa as u,an as d,dn as f,dr as p,fn as m,in as h,ir as g,ks as _,lr as v,ms as y,nr as b,on as x,pn as S,ss as C}from"./app-CWCg5I0x.js";import{h as w}from"./vendor-t7Q7QbPu.js";import{S as T,ht as E,r as D}from"./embedded-list-BOlcwiiA.js";import{n as O}from"./record-preview-C2bjzVoh.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:a=``,columns:o,button:s,bulk:l=!1,limit:f=10,select:p}=d(e),g=r===void 0?void 0:n.resources[r];if(!g)return[];if(t.part===`chosen`){let e=p===void 0?void 0:n.given[p];return e?[A(m(n.client,g,{key:e}))]:[]}let _=n.views[g.name],{fields:v,read:y}=x({...n,model:g,view:_,columns:o?.map(c),button:s,bulk:l,phoneColumns:h(o)});return[A(D(n,{model:g,filter:i,orderBy:a||u(g,_),limit:f,fields:v,read:y}))]},Chart:(e,t,{client:r,resources:i,views:a})=>{let{resource:o,groupBy:s,splitBy:c,sum:l,average:u,filter:f,granularity:p,range:m,limit:h}=d(e),g=i[o],_=g&&E({model:g,groupBy:s,splitBy:c,sum:l,average:u,filter:f,granularity:p,range:m,limit:h},i,a);return g&&_?[A(n(r,g.name,_))]:[]},RecordCards:(e,t,{client:n,resources:r,views:i})=>{let{resource:a,filter:o=``,sort:s=``,limit:c=10}=d(e),l=r[a];if(!l)return[];let p=s||u(l,i[l.name]);return[A(S(n,l,{filter:o,sort:p,pageSize:c})),A(f(n,l,o))]},RecordRow:(e,t,{client:n,queryClient:r,resources:i,views:a})=>{let{resource:o,filter:s=``,sort:c=``}=d(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:s,filter:c,sender:u,time:f,calls:p,limit:m=50}=d(e);if(t.part===`calls`){let e=p&&r[p.resource];return e?[j(o(n,e.name,{filter:p.filter,orderBy:i(p.time),pageSize:m}))]:[]}let h=r[s];if(!h)return[];let g=l(r,a,h,u===void 0?[]:[u]);return[j(o(n,h.name,{filter:c,orderBy:i(f),pageSize:m,labels:g}))]}},N=(e,t,{client:n,resources:r})=>{let i=r[t.resource];return i?[A(f(n,i))]:[]},P=(e,t,n)=>(n?.reads??[]).flatMap(n=>{let r=s(t,n.block);if(!r||r.custom)return[];if(n.part===`condition`)return N(r,n,e);if(n.split)return[];let i=M[r.type];return i?i(_(r,{stack:[],params:e.params,...e.root&&{root:e.root}}),n,e):[]}),F=({tree:e,plan:t})=>{let n=y(),i=w(),{resources:o,views:s}=C(),c=a().fields,l=r(),u=b(),d=g(),f=v(p()),m=(0,k.useMemo)(()=>P({client:n,queryClient:i,resources:o,views:s,fieldTypes:c,xs:l,params:u,given:d,...f&&{root:f}},e,t),[n,i,o,s,c,l,u,d,f,e,t]);return(0,k.useEffect)(()=>{for(let e of m)e.start(i)},[m,i]),null};export{F as t};
|
|
2
|
+
//# debugId=cd7a0457-b435-41d7-b4b2-c5ffb940f44f
|
|
@@ -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{Cn as r,Dc as i,Ec as a,Fc as o,Hn as s,Ic as c,Kc as l,M as u,Mo as d,R as f,Sc as p,Wc as ee,fc as m,fs as te,ml as h,nl as ne,uc as re,vc as ie,wc as ae}from"./app-CwxoFZn2.js";import{t as oe}from"./circle-alert-B-bmotNV.js";import{a as se,c as ce,d as le,f as ue,g as de,h as fe,i as pe,m as me,o as he,p as ge,r as _e,s as ve,u as ye}from"./workflow-canvas-BkFimRd2.js";import{t as g}from"./trash-YqRXn8JG.js";import{A as be,D as xe,F as Se,M as _,_ as Ce,a as we,c as v,f as Te,g as Ee,h as y,i as De,k as b,m as Oe,n as ke,o as x,s as S,u as Ae,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-5H4UJvB-.js";import{n as D}from"./use-workflow-types-Cjkw47Mf.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=l(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=l(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=l(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=l(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=l(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=l(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=l(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}}})},R=e=>e.message.startsWith(`is missing`),xt=e=>new Map([...e].map(([e,t])=>[e,t.filter(e=>!R(e))])),St=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}},Ct=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),wt=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`&&!Ct(n)?[{field:e.name,message:`is a list of names, separated by commas`}]:[]}),Tt=(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,wt(L(e.input))])),unavailable:Object.fromEntries(a.map(e=>[e.id,e.reason??``])),versioned:ke(r.map(e=>e.id)),...n&&{pins:n}})},Et=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},z=e(n(),1),B=({problems:e})=>e.length>0&&(0,z.jsxs)(`div`,{className:`rounded-md border border-danger/30 bg-danger-soft px-3 py-2 text-body text-danger-text`,children:[(0,z.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,z.jsx)(oe,{className:`size-4`,"aria-hidden":`true`}),e.every(R)?D(`fillInToSave`,{count:e.length}):D(`cannotSave`,{count:e.length})]}),(0,z.jsx)(`ul`,{className:`mt-1 list-disc pl-6`,children:e.map((e,t)=>(0,z.jsx)(`li`,{children:e.field?D(`fieldProblem`,{field:e.field,message:e.message}):e.message},t))})]}),Dt=({warnings:e})=>e.length>0&&(0,z.jsxs)(`div`,{className:`rounded-md border border-warning/30 bg-warning-soft px-3 py-2 text-body text-warning-text`,children:[(0,z.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,z.jsx)(ie,{className:`size-4`,"aria-hidden":`true`}),D(`warningsSaveAnyway`,{count:e.length})]}),(0,z.jsx)(`ul`,{className:`mt-1 list-disc pl-6`,children:e.map((e,t)=>(0,z.jsx)(`li`,{children:e.field?D(`fieldProblem`,{field:e.field,message:e.message}):e.message},t))})]}),V=e(t(),1),Ot=({name:e,taken:t,disabled:n,onRename:r})=>{let[i,a]=(0,V.useState)(e),o=i.trim(),s=o===``?D(`nameNeeded`):o!==e&&t.includes(o)?D(`nameTaken`):void 0,c=()=>{!s&&o!==e&&r(o)};return(0,z.jsx)(f,{label:D(`name`),error:s,children:(0,z.jsx)(d,{value:i,invalid:!!s,disabled:n,onChange:e=>a(e.target.value),onBlur:c,onKeyDown:e=>{e.key===`Enter`&&c()}})})},H=(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},U=({label:e,value:t,names:n,none:i,error:a,disabled:o,onChange:s})=>(0,z.jsx)(f,{label:e,error:a,children:(0,z.jsxs)(r,{invalid:!!a,value:t??``,disabled:o,onChange:e=>s(e.target.value===``?void 0:e.target.value),children:[(0,z.jsx)(`option`,{value:``,children:i}),t!==void 0&&!n.includes(t)&&(0,z.jsx)(`option`,{value:t,children:t}),n.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]})}),kt=e=>e===void 0?``:typeof e==`string`?e:JSON.stringify(e,null,2),At=e=>{if(e.trim()!==``)try{return JSON.parse(e)}catch(t){if(!(t instanceof SyntaxError))throw t;return e}},jt=e=>{let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return t.length>0?t:void 0},Mt=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`)?e.join(`, `):kt(e),Nt=(0,V.createContext)(void 0),Pt=()=>(0,V.useContext)(Nt),Ft=e=>e===``?void 0:e,It={text:Ft,value:At,choice:Ft,json:At,names:jt},W=({label:e,kind:t,options:n=[],required:i,help:a,value:o,error:c,onChange:l,disabled:u,read:p=It[t],write:ee=t===`names`?Mt:kt})=>{let[m,te]=(0,V.useState)(),h=m!==void 0&&JSON.stringify(p(m))===JSON.stringify(o)?m:ee(o),ne=Pt(),re=e=>{te(e),l(p(e))},ie=ne!==void 0&&!u&&(o==null||typeof o==`string`)&&(t===`text`||t===`json`||t===`value`);return(0,z.jsxs)(f,{label:e,required:i,help:a,error:c,wide:t===`json`,children:[t===`choice`?(0,z.jsxs)(r,{invalid:!!c,value:h,disabled:u,onChange:e=>l(e.target.value===``?void 0:e.target.value),children:[(0,z.jsx)(`option`,{value:``,children:D(`defaultChoice`)}),n.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]}):t===`json`?(0,z.jsx)(s,{invalid:!!c,rows:2,className:`font-mono text-xs`,value:h,disabled:u,onChange:e=>re(e.target.value)}):(0,z.jsx)(d,{invalid:!!c,value:h,disabled:u,onChange:e=>re(e.target.value)}),ie&&(0,z.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:o,set:l}),children:D(`insertValue`)})]})},Lt=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean),Rt=e=>Array.isArray(e)?e.join(`, `):``,G=({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,z.jsxs)(z.Fragment,{children:[a.map((e,i)=>(0,z.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-md border border-danger/40 p-3`,children:[(0,z.jsx)(`legend`,{className:`px-1 text-xs font-medium text-danger-text`,children:D(`errorPathNumber`,{number:i+1})}),(0,z.jsx)(W,{label:D(`errors`),kind:`text`,help:D(`errorsHelp`),value:e.ErrorEquals??[],read:Lt,write:Rt,error:H(n,`Catch[${i}].ErrorEquals`),disabled:r,onChange:t=>s(i,{...e,ErrorEquals:t})}),(0,z.jsx)(U,{label:D(`thenGoesTo`),value:e.Next||void 0,names:t,none:D(`chooseStep`),error:H(n,`Catch[${i}].Next`),disabled:r,onChange:t=>s(i,{...e,Next:t??``})}),!r&&(0,z.jsxs)(m,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>o(a.filter((e,t)=>t!==i)),children:[(0,z.jsx)(g,{className:`size-3.5`}),D(`removeErrorPath`)]})]},i)),!r&&(0,z.jsx)(`div`,{children:(0,z.jsxs)(m,{size:`sm`,onClick:()=>o([...a,{ErrorEquals:[`States.ALL`],Next:``}]),children:[(0,z.jsx)(ae,{className:`size-3.5`}),D(`addErrorPath`)]})})]})},zt=({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,z.jsxs)(z.Fragment,{children:[a.map((s,c)=>(0,z.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-md border p-3`,children:[(0,z.jsx)(`legend`,{className:`px-1 text-xs font-medium text-muted-foreground`,children:D(`ruleNumber`,{number:c+1})}),(0,z.jsx)(W,{label:D(`condition`),kind:`text`,help:D(`conditionHelp`),value:s.Condition,error:H(n,`Choices[${c}].Condition`),disabled:r,onChange:e=>o(c,{...s,Condition:typeof e==`string`?e:``})}),(0,z.jsx)(U,{label:D(`thenGoesTo`),value:s.Next||void 0,names:t,none:D(`chooseStep`),error:H(n,`Choices[${c}].Next`),disabled:r,onChange:e=>o(c,{...s,Next:e??``})}),!r&&(0,z.jsxs)(m,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>i({...e,Choices:a.filter((e,t)=>t!==c)}),children:[(0,z.jsx)(g,{className:`size-3.5`}),D(`removeRule`)]})]},c)),!r&&(0,z.jsx)(`div`,{children:(0,z.jsxs)(m,{size:`sm`,onClick:()=>i({...e,Choices:[...a,{Condition:``,Next:``}]}),children:[(0,z.jsx)(ae,{className:`size-3.5`}),D(`addRule`)]})}),(0,z.jsx)(U,{label:D(`otherwiseGoesTo`),value:e.Default,names:t,none:D(`noDefault`),error:H(n,`Default`),disabled:r,onChange:t=>{let{Default:n,...r}=e;i(t===void 0?r:{...r,Default:t})}})]})},K=(e,t)=>{let{Cache:n,...r}=e;return t===void 0?r:{...r,Cache:t}},Bt=({state:e,types:t,disabled:n,onChange:r})=>{let[i,a]=(0,V.useState)(!1),o=ve(e,t);return o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(f,{label:D(`cacheResults`),help:D(o.forces?`cacheForceHelp`:`cacheHelp`),children:(0,z.jsx)(u,{checked:o.on,onChange:t=>{if(!n){if(!t)return r(K(e,o.offValue));if(o.disclaimer)return a(!0);r(K(e,!0))}}})}),i&&(0,z.jsx)(re,{title:D(`cacheConfirmTitle`),description:o.disclaimer,onClose:()=>a(!1),actions:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(m,{onClick:()=>a(!1),children:D(`cacheCancel`)}),(0,z.jsx)(m,{variant:`primary`,onClick:()=>(a(!1),r(K(e,!0))),children:D(`cacheConfirm`)})]})})]}):null},Vt=(e,t,n)=>{let{[t]:r,...i}=e;return n==null||n===``?i:{...i,[t]:n}},Ht=(e,t)=>{let{type:n}=b(e.Resource);if(t){let{Cache:t,...r}=e;return{...r,Resource:`${n}${be}`}}let{HeartbeatSeconds:r,TimeoutSeconds:i,...a}=e;return{...a,Resource:n,...i!==void 0&&i<=Se.taskTimeoutSeconds&&{TimeoutSeconds:i}}},Ut=e=>Oe(e)===void 0,Wt=(e,t)=>({...e,Resource:`${t}${b(e.Resource).waits&&Ut(t)?be:``}`}),Gt=(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}}},Kt=({state:e,types:t,problems:n,disabled:i,onChange:a})=>{let o=t.step_types.filter(e=>e.available),{type:s,waits:c}=b(e.Resource),l=Ut(s),d=t.step_types.find(e=>e.id===s),p=typeof e.Arguments==`string`||!d;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(f,{label:D(`stepType`),error:H(n,`Resource`),children:(0,z.jsxs)(r,{value:s,disabled:i,onChange:t=>a(Wt(e,t.target.value)),children:[!o.some(e=>e.id===s)&&(0,z.jsx)(`option`,{value:s,children:ge(s,d?.label)}),o.map(e=>(0,z.jsx)(`option`,{value:e.id,children:ge(e.id,e.label)},e.id))]})}),p?(0,z.jsx)(W,{label:D(`arguments`),kind:`json`,value:e.Arguments,error:H(n,`Arguments`),disabled:i,onChange:t=>a({...e,Arguments:t??{}})}):L(d.input).map(t=>(0,z.jsx)(W,{label:ce(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:H(n,`Arguments.${t.name}`),disabled:i,onChange:n=>a(Gt(e,t.name,n))},`${s}:${t.name}`)),l&&(0,z.jsx)(f,{label:D(`waitsForResult`),help:D(`waitsForResultHelp`),children:(0,z.jsx)(u,{checked:c,onChange:t=>!i&&a(Ht(e,t))})}),c||!l?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(W,{label:D(`waitTimeout`),help:D(`waitTimeoutHelp`),kind:`json`,value:e.TimeoutSeconds,error:H(n,`TimeoutSeconds`),disabled:i,onChange:t=>a(Vt(e,`TimeoutSeconds`,t))}),(0,z.jsx)(W,{label:D(`heartbeatSeconds`),help:D(`heartbeatHelp`),kind:`json`,value:e.HeartbeatSeconds,error:H(n,`HeartbeatSeconds`),disabled:i,onChange:t=>a(Vt(e,`HeartbeatSeconds`,t))})]}):(0,z.jsx)(Bt,{state:e,types:t,disabled:i,onChange:a})]})},q=(e,t,n)=>{let{[t]:r,...i}=e;return n===void 0?i:{...i,[t]:n}},qt=({state:e,problems:t,disabled:n,onChange:r})=>(0,z.jsx)(W,{label:D(`onlyWhen`),kind:`text`,help:D(`onlyWhenHelp`),value:e.Condition,error:H(t,`Condition`),disabled:n,onChange:t=>r(q(e,`Condition`,t))}),J=e=>{let{state:t,names:n,problems:r,disabled:i,onChange:a}=e;if(e.data)return(0,z.jsx)(qt,{...e});let o=t;return(0,z.jsx)(U,{label:D(`goesOnTo`),value:o.Next,names:n,none:D(`endsHere`),error:H(r,`Next`)??H(r,`End`),disabled:i,onChange:e=>{let{Next:t,End:n,...r}=o;a(e===void 0?{...r,End:!0}:{...r,Next:e})}})},Jt=e=>{let{state:t,types:n,problems:r,disabled:i,onChange:a}=e,o=(e,n,o,s)=>(0,z.jsx)(W,{label:n,kind:o,help:s,value:t[e],error:H(r,e),disabled:i,onChange:n=>a(q(t,e,n))});if(t.Type===`Task`)return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Kt,{state:t,types:n,problems:r,disabled:i,onChange:a}),(0,z.jsx)(J,{...e}),!e.data&&(0,z.jsx)(G,{...e,state:t})]});if(t.Type===`Choice`)return(0,z.jsx)(zt,{...e,state:t});if(t.Type===`Map`)return(0,z.jsxs)(z.Fragment,{children:[o(`Items`,D(`items`),`json`,D(`itemsHelp`)),o(`MaxConcurrency`,D(`maxConcurrency`),`json`),(0,z.jsx)(J,{...e}),!e.data&&(0,z.jsx)(G,{...e,state:t})]});if(t.Type===`Block`){let n=(e,n,o,s)=>(0,z.jsx)(W,{label:n,kind:o,help:s,value:t.Cache?.[e],error:H(r,`Cache.${e}`)??(e===`Ttl`?H(r,`Cache`):void 0),disabled:i,onChange:n=>a({...t,Cache:q(t.Cache??{Ttl:``},e,n)})});return(0,z.jsxs)(z.Fragment,{children:[o(`Arguments`,D(`blockArguments`),`json`,D(`blockArgumentsHelp`)),n(`Ttl`,D(`blockTtl`),`text`,D(`blockTtlHelp`)),n(`Key`,D(`blockKey`),`json`,D(`blockKeyHelp`)),(0,z.jsx)(J,{...e}),!e.data&&(0,z.jsx)(G,{...e,state:t})]})}return t.Type===`Wait`?(0,z.jsxs)(z.Fragment,{children:[o(`Seconds`,D(`seconds`),`json`),(0,z.jsx)(J,{...e})]}):t.Type===`Pass`?(0,z.jsxs)(z.Fragment,{children:[o(`Output`,D(`output`),`json`,D(`outputHelp`)),(0,z.jsx)(J,{...e})]}):t.Type===`Succeed`?o(`Output`,D(`output`),`json`,D(`outputHelp`)):t.Type===`Fail`?(0,z.jsxs)(z.Fragment,{children:[e.data&&(0,z.jsx)(qt,{...e}),o(`Error`,D(`error`),`text`),o(`Cause`,D(`cause`),`text`)]}):null},Yt=(e,t,n,r)=>{let{[n]:i,...a}=t;return{[e]:r===void 0?a:{...a,[n]:r}}},Xt=({trigger:e,types:t,problems:n,disabled:i,onChange:a})=>{let o=fe(e),s=t.triggers.filter(e=>e.available),c=s.find(e=>e.id===o),l=o!==void 0&&!c?o:void 0,u=o===void 0?{}:e[o]??{};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(f,{label:D(`startsWhen`),error:H(n,`trigger`),help:l&&D(`triggerOtherHelp`),children:(0,z.jsxs)(r,{value:o??``,disabled:i,onChange:e=>a({[e.target.value]:{}}),children:[l!==void 0&&(0,z.jsx)(`option`,{value:l,children:de(l,t.triggers.find(e=>e.id===l)?.label)}),o===void 0&&(0,z.jsx)(`option`,{value:``,children:D(`triggerUnknown`)}),s.map(e=>(0,z.jsx)(`option`,{value:e.id,children:de(e.id,e.label)},e.id))]})}),c&&L(c.input).map(e=>(0,z.jsx)(W,{label:ce(e.name,e.title),kind:e.kind,options:e.options,required:e.required,...e.kind===`names`&&{help:D(`namesHelp`)},value:u[e.name],error:H(n,`trigger.${c.id}.${e.name}`),disabled:i,onChange:t=>a(Yt(c.id,u,e.name,t))},`${c.id}:${e.name}`)),l!==void 0&&(0,z.jsx)(W,{label:D(`triggerInput`),kind:`json`,value:u,error:H(n,`trigger.${l}`),disabled:!0,onChange:()=>void 0})]})},Zt=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&typeof e.Type==`string`,Qt=({kind:e,name:t})=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e}),(0,z.jsx)(`h3`,{className:`truncate font-semibold text-foreground`,children:t})]}),$t=({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,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Qt,{kind:ye(s,t),name:l}),(0,z.jsx)(B,{problems:r}),(0,z.jsx)(Dt,{warnings:i}),(0,z.jsx)(Ot,{name:l,taken:Ne(e.stateMachine),disabled:d,onRename:t=>{f(_t(e,n,t)),o(Me(c,t))}},n),(0,z.jsx)(Jt,{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,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-body font-medium text-muted-foreground`,children:D(`asJson`)}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(W,{label:D(`stepJson`),kind:`json`,help:D(`stepJsonHelp`),value:s,disabled:d,onChange:t=>{Zt(t)&&f(pt(e,n,t))}},n)})]}),a&&(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[y(e)===`sequence`&&u.StartAt!==l&&(0,z.jsxs)(m,{size:`sm`,onClick:()=>f(vt(e,n)),children:[(0,z.jsx)(He,{className:`size-3.5`}),D(`startHere`)]}),(0,z.jsxs)(m,{size:`sm`,variant:`danger`,onClick:()=>{f(ut(e,n)),o(void 0)},children:[(0,z.jsx)(g,{className:`size-3.5`}),D(`removeStep`)]})]})]})},en=e=>{let{definition:t,types:n,selected:r,problems:i,onChange:a}=e;return(0,z.jsx)(`section`,{"aria-label":D(`chosenStep`),className:`flex flex-col gap-4 rounded-lg border bg-background p-4`,children:r===``?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Qt,{kind:D(`trigger`),name:me(t.trigger,n)}),(0,z.jsx)(B,{problems:i}),(0,z.jsx)(Xt,{trigger:t.trigger,types:n,problems:i,disabled:!a,onChange:e=>a?.(yt(t,e))})]}):(0,z.jsx)($t,{...e,selected:r})})},tn=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Y=(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;tn(s.Arguments)||(s.Arguments={});let c=s.Arguments;for(let e of n.slice(0,-1))tn(c[e])||(c[e]={}),c=c[e];let l=n.at(-1);return r===void 0?delete c[l]:c[l]=r,i},nn=e=>[`=`,`!=`,`>`,`<`,`matches`,`and`,`or`,`not`,...e?[`expression`]:[]],rn=e=>e.kind===`compare`||e.kind===`matches`?{value:``}:{value:e.kind===`logic`&&e.op===`and`},an=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:``}]},on=`{% true %}`,sn=(e,t)=>{if(t.length===0)return e;let n=e.sides[t[0]];return n&&v(n)?sn(n,t.slice(1)):void 0},cn=(e,t,n)=>({...e,sides:e.sides.map((e,r)=>r===t?n:e)}),ln=(e,t,n)=>{if(t.length===0)return n(e);let r=e.sides[t[0]],i=r&&v(r)?ln(r,t.slice(1),n):void 0;return i&&cn(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`?cn(e,1,{pattern:n.value||`.*`,flags:e.sides[1].flags}):void 0;if(e.kind!==`compare`&&e.kind!==`matches`||!v(n))return cn(e,t,n)}},dn=(e,t,n,r)=>{let i=x(C(e,t)?.Condition),a=i&&n.length>0&&ln(i,n.slice(0,-1),e=>un(e,n.at(-1),r));return a&&x(S(a))?Y(e,t,[T],S(a)):e},fn=(e,t,n,r)=>{let i=C(e,t)?.Condition;if(n.length===0)return i!==void 0&&i!==``?e:Y(e,t,[T],r===`expression`?on:S(an(r)));let a=x(i),o=a&&sn(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:dn(e,t,n,an(r))},pn=(e,t,n)=>{if(n.length===0)return Y(e,t,[T],void 0);let r=x(C(e,t)?.Condition),i=n.at(-1),a=r&&ln(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,rn(e))});return a?Y(e,t,[T],S(a)):e},mn=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},hn=(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(...mn(i)))}return[...n]},gn=e=>e.StartAt===void 0?Object.keys(e.States):hn(e,e.StartAt),_n=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`},vn=(e,t,n)=>t.flatMap(t=>{let r=e.States[t];if(!r)return[];let i=_(r),a=i?vn(i,gn(i),n):[];return r.Type===`Task`?(n?.step_types.find(e=>e.id===r.Resource)?.writes??!0)===!1||_n(r)?[]:[{name:t,kind:ye(r,n)}]:a}),yn=(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}},bn=(e,t,n)=>{let r=e?.stateMachine.States[n],i=r!==void 0&&`Output`in r;return JSON.stringify(yn(r,i))!==JSON.stringify(yn(t.stateMachine.States[n],i))},xn=(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))},Sn=(e,t,n=e.stateMachine.StartAt)=>{let r=e.stateMachine;return vn(r,y(e)===`data`?n===void 0?gn(r):xn(r,n):n===void 0?gn(r):hn(r,n),t)},Cn=/^[A-Za-z_][A-Za-z0-9_]*$/,wn=e=>Cn.test(e)?e:`\`${e.replaceAll("`",``)}\``,X=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:X(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:X(r[0])}),n(a,r[0],i+1);return}for(let[a,o]of Object.entries(r)){let r=e===``?wn(a):`${e}.${wn(a)}`;t.push({path:r,sample:X(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&&hn(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)),..._(e)?Pn(_(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=he(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}},Rn=(e,t)=>{let n=se(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)]}}},zn=(e,t)=>e.path.length===1&&e.path[0]===`#status`&&t.keys.length===1&&t.keys[0]===`#condition`&&!t.side,Bn=(e,t,n)=>{let r=Z(e,t.node);if(n===`out`){let n=he(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=se(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},Vn=(e,t)=>w(t).scope.some((t,n,r)=>C(e,r.slice(0,n+1).join(`/`))?.Type===`Block`),Hn=(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(`/`)},Un=(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},Wn=(e,t,n,r)=>{let i=Ln(t,n),a=Rn(t,r);if(!i||!a)return{reason:`notPins`};let o=Hn(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(Un(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(Vn(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(zn(i,a))return;let s=Bn(t,n,`out`),c=Bn(t,r,`in`);if(s&&c&&!xe(s,c))return{reason:`type`,source:s,target:c}},Gn=(e,t,n,r)=>{if(Wn(e,t,n,r))return e;let i=Ln(t,n),a=Rn(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?dn(o,a.step,a.side.at,{read:c}):a.select?Y(o,a.step,a.keys,Ae({...a.select.part,operand:{read:c}})):zn(i,a)?Y(o,a.step,a.keys,S({kind:`compare`,op:`=`,sides:[{read:c},{value:`SUCCEEDED`}]})):Y(o,a.step,a.keys,je(s))},Kn=(e,t,n)=>{let r=Rn(t,{node:n.target,handle:n.targetHandle});if(r?.side)return pn(e,r.step,r.side.at);if(r?.select)return Y(e,r.step,r.keys,Ae({...r.select.part,operand:{value:``}}));if(r)return Y(e,r.step,r.keys,void 0);let i=Z(t,n.target)??Z(t,n.source);return i?qn(e,t,i):e},qn=(e,t,n)=>{if(n.kind===`make`||n.kind===`select`)return Y(e,n.target,[n.key],void 0);if(n.kind===`condition`)return pn(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 _e(t,r(n),e=>pe(t,e)).reduce((e,n)=>Kn(e,t,n),e)},Jn=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`,Yn={connect:dt,disconnect:ft,removeState:ut,setArgument:Y,connectData:Gn,disconnectData:Kn,removePure:qn,wireRefusal:Wn,addCondition:fn,conditionChoices:nn,setConditionSide:dn,addSelect:(e,t,n)=>{let r=C(e,t)?.Arguments?.[n];if(r!==void 0&&!Jn(r)||typeof r==`string`&&r.startsWith(`{%`))return e;let i=r??``;return Y(e,t,[n],Ae({operand:{value:``},cases:[{when:``,then:i}],otherwise:i}))}},Xn=(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}}}),Zn=e=>{let{data:t}=te();return(0,V.useMemo)(()=>Xn(e,t?.resources??{},t?.views),[e,t?.resources,t?.views])},Q=ne(`app/field-types/workflow-page`),Qn={"app:http":{icon:Ke,keywords:[`api`,`fetch`,`url`,`webhook`,`get`,`post`]},"app:mail.send":{icon:i,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`]}},$n=[{type:`Choice`,icon:We,description:()=>Q(`flowChoice`),keywords:[`if`,`branch`,`switch`,`condition`]},{type:`Map`,icon:Xe,description:()=>Q(`flowMap`),keywords:[`loop`,`each`,`list`,`repeat`]},{type:`Block`,icon:a,description:()=>Q(`flowBlock`),keywords:[`cache`,`once`,`group`,`reuse`,`wrap`]},{type:`Wait`,icon:Qe,description:()=>Q(`flowWait`),keywords:[`delay`,`sleep`,`pause`,`later`]},{type:`Pass`,icon:Je,description:()=>Q(`flowPass`),keywords:[`variable`,`assign`,`transform`]},{type:`Succeed`,icon:c,description:()=>Q(`flowSucceed`),keywords:[`end`,`stop`,`done`]},{type:`Fail`,icon:o,description:()=>Q(`flowFail`),keywords:[`end`,`stop`,`error`]}],er=e=>({id:`task:${e.id}`,title:ue(e.id,e.label),description:e.description,keywords:[e.id,...Qn[e.id]?.keywords??[]],icon:Qn[e.id]?.icon??(e.id.startsWith(`app:`)?ee:p)}),$=e=>e.slice(0,Math.max(e.indexOf(`:`),0)),tr=e=>e===`custom`?Q(`customSteps`):e,nr=e=>{let t=new Set(Object.values(ke(e.step_types.map(e=>e.id)))),n=e.step_types.filter(e=>e.available&&(!Oe(e.id)||t.has(e.id))),r=[...new Set(n.map(e=>$(e.id)).filter(e=>e!==`app`))];return[{title:Q(`builtIn`),items:n.filter(e=>$(e.id)===`app`).map(er)},...r.map(e=>({title:tr(e),items:n.filter(t=>$(t.id)===e).map(er)})),{title:Q(`flow`),items:$n.map(e=>({id:`type:${e.type}`,title:le(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,Tt as _,Yn as a,Et as b,Dn as c,kn as d,bn as f,B as g,Nt as h,Zn as i,rt as k,Mn as l,en as m,nr as n,An as o,Sn as p,Q as r,On as s,rr as t,In as u,R as v,ot as w,xt as x,St as y};
|
|
2
|
-
//# debugId=
|
|
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{Cn as r,Dc as i,Ec as a,Fc as o,Hn as s,Ic as c,Kc as l,M as u,Mo as d,R as f,Sc as p,Wc as ee,fc as m,fs as te,ml as h,nl as ne,uc as re,vc as ie,wc as ae}from"./app-CWCg5I0x.js";import{t as oe}from"./circle-alert-DBbXAqFr.js";import{a as se,c as ce,d as le,f as ue,g as de,h as fe,i as pe,m as me,o as he,p as ge,r as _e,s as ve,u as ye}from"./workflow-canvas-DbLkc3zJ.js";import{t as g}from"./trash-Cd-g6Eyo.js";import{A as be,D as xe,F as Se,M as _,_ as Ce,a as we,c as v,f as Te,g as Ee,h as y,i as De,k as b,m as Oe,n as ke,o as x,s as S,u as Ae,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-CSdKdxn9.js";import{n as D}from"./use-workflow-types-BQl6tPM-.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=l(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=l(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=l(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=l(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=l(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=l(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=l(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}}})},R=e=>e.message.startsWith(`is missing`),xt=e=>new Map([...e].map(([e,t])=>[e,t.filter(e=>!R(e))])),St=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}},Ct=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),wt=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`&&!Ct(n)?[{field:e.name,message:`is a list of names, separated by commas`}]:[]}),Tt=(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,wt(L(e.input))])),unavailable:Object.fromEntries(a.map(e=>[e.id,e.reason??``])),versioned:ke(r.map(e=>e.id)),...n&&{pins:n}})},Et=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},z=e(n(),1),B=({problems:e})=>e.length>0&&(0,z.jsxs)(`div`,{className:`rounded-md border border-danger/30 bg-danger-soft px-3 py-2 text-body text-danger-text`,children:[(0,z.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,z.jsx)(oe,{className:`size-4`,"aria-hidden":`true`}),e.every(R)?D(`fillInToSave`,{count:e.length}):D(`cannotSave`,{count:e.length})]}),(0,z.jsx)(`ul`,{className:`mt-1 list-disc pl-6`,children:e.map((e,t)=>(0,z.jsx)(`li`,{children:e.field?D(`fieldProblem`,{field:e.field,message:e.message}):e.message},t))})]}),Dt=({warnings:e})=>e.length>0&&(0,z.jsxs)(`div`,{className:`rounded-md border border-warning/30 bg-warning-soft px-3 py-2 text-body text-warning-text`,children:[(0,z.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,z.jsx)(ie,{className:`size-4`,"aria-hidden":`true`}),D(`warningsSaveAnyway`,{count:e.length})]}),(0,z.jsx)(`ul`,{className:`mt-1 list-disc pl-6`,children:e.map((e,t)=>(0,z.jsx)(`li`,{children:e.field?D(`fieldProblem`,{field:e.field,message:e.message}):e.message},t))})]}),V=e(t(),1),Ot=({name:e,taken:t,disabled:n,onRename:r})=>{let[i,a]=(0,V.useState)(e),o=i.trim(),s=o===``?D(`nameNeeded`):o!==e&&t.includes(o)?D(`nameTaken`):void 0,c=()=>{!s&&o!==e&&r(o)};return(0,z.jsx)(f,{label:D(`name`),error:s,children:(0,z.jsx)(d,{value:i,invalid:!!s,disabled:n,onChange:e=>a(e.target.value),onBlur:c,onKeyDown:e=>{e.key===`Enter`&&c()}})})},H=(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},U=({label:e,value:t,names:n,none:i,error:a,disabled:o,onChange:s})=>(0,z.jsx)(f,{label:e,error:a,children:(0,z.jsxs)(r,{invalid:!!a,value:t??``,disabled:o,onChange:e=>s(e.target.value===``?void 0:e.target.value),children:[(0,z.jsx)(`option`,{value:``,children:i}),t!==void 0&&!n.includes(t)&&(0,z.jsx)(`option`,{value:t,children:t}),n.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]})}),kt=e=>e===void 0?``:typeof e==`string`?e:JSON.stringify(e,null,2),At=e=>{if(e.trim()!==``)try{return JSON.parse(e)}catch(t){if(!(t instanceof SyntaxError))throw t;return e}},jt=e=>{let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return t.length>0?t:void 0},Mt=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`)?e.join(`, `):kt(e),Nt=(0,V.createContext)(void 0),Pt=()=>(0,V.useContext)(Nt),Ft=e=>e===``?void 0:e,It={text:Ft,value:At,choice:Ft,json:At,names:jt},W=({label:e,kind:t,options:n=[],required:i,help:a,value:o,error:c,onChange:l,disabled:u,read:p=It[t],write:ee=t===`names`?Mt:kt})=>{let[m,te]=(0,V.useState)(),h=m!==void 0&&JSON.stringify(p(m))===JSON.stringify(o)?m:ee(o),ne=Pt(),re=e=>{te(e),l(p(e))},ie=ne!==void 0&&!u&&(o==null||typeof o==`string`)&&(t===`text`||t===`json`||t===`value`);return(0,z.jsxs)(f,{label:e,required:i,help:a,error:c,wide:t===`json`,children:[t===`choice`?(0,z.jsxs)(r,{invalid:!!c,value:h,disabled:u,onChange:e=>l(e.target.value===``?void 0:e.target.value),children:[(0,z.jsx)(`option`,{value:``,children:D(`defaultChoice`)}),n.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]}):t===`json`?(0,z.jsx)(s,{invalid:!!c,rows:2,className:`font-mono text-xs`,value:h,disabled:u,onChange:e=>re(e.target.value)}):(0,z.jsx)(d,{invalid:!!c,value:h,disabled:u,onChange:e=>re(e.target.value)}),ie&&(0,z.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:o,set:l}),children:D(`insertValue`)})]})},Lt=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean),Rt=e=>Array.isArray(e)?e.join(`, `):``,G=({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,z.jsxs)(z.Fragment,{children:[a.map((e,i)=>(0,z.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-md border border-danger/40 p-3`,children:[(0,z.jsx)(`legend`,{className:`px-1 text-xs font-medium text-danger-text`,children:D(`errorPathNumber`,{number:i+1})}),(0,z.jsx)(W,{label:D(`errors`),kind:`text`,help:D(`errorsHelp`),value:e.ErrorEquals??[],read:Lt,write:Rt,error:H(n,`Catch[${i}].ErrorEquals`),disabled:r,onChange:t=>s(i,{...e,ErrorEquals:t})}),(0,z.jsx)(U,{label:D(`thenGoesTo`),value:e.Next||void 0,names:t,none:D(`chooseStep`),error:H(n,`Catch[${i}].Next`),disabled:r,onChange:t=>s(i,{...e,Next:t??``})}),!r&&(0,z.jsxs)(m,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>o(a.filter((e,t)=>t!==i)),children:[(0,z.jsx)(g,{className:`size-3.5`}),D(`removeErrorPath`)]})]},i)),!r&&(0,z.jsx)(`div`,{children:(0,z.jsxs)(m,{size:`sm`,onClick:()=>o([...a,{ErrorEquals:[`States.ALL`],Next:``}]),children:[(0,z.jsx)(ae,{className:`size-3.5`}),D(`addErrorPath`)]})})]})},zt=({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,z.jsxs)(z.Fragment,{children:[a.map((s,c)=>(0,z.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-md border p-3`,children:[(0,z.jsx)(`legend`,{className:`px-1 text-xs font-medium text-muted-foreground`,children:D(`ruleNumber`,{number:c+1})}),(0,z.jsx)(W,{label:D(`condition`),kind:`text`,help:D(`conditionHelp`),value:s.Condition,error:H(n,`Choices[${c}].Condition`),disabled:r,onChange:e=>o(c,{...s,Condition:typeof e==`string`?e:``})}),(0,z.jsx)(U,{label:D(`thenGoesTo`),value:s.Next||void 0,names:t,none:D(`chooseStep`),error:H(n,`Choices[${c}].Next`),disabled:r,onChange:e=>o(c,{...s,Next:e??``})}),!r&&(0,z.jsxs)(m,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>i({...e,Choices:a.filter((e,t)=>t!==c)}),children:[(0,z.jsx)(g,{className:`size-3.5`}),D(`removeRule`)]})]},c)),!r&&(0,z.jsx)(`div`,{children:(0,z.jsxs)(m,{size:`sm`,onClick:()=>i({...e,Choices:[...a,{Condition:``,Next:``}]}),children:[(0,z.jsx)(ae,{className:`size-3.5`}),D(`addRule`)]})}),(0,z.jsx)(U,{label:D(`otherwiseGoesTo`),value:e.Default,names:t,none:D(`noDefault`),error:H(n,`Default`),disabled:r,onChange:t=>{let{Default:n,...r}=e;i(t===void 0?r:{...r,Default:t})}})]})},K=(e,t)=>{let{Cache:n,...r}=e;return t===void 0?r:{...r,Cache:t}},Bt=({state:e,types:t,disabled:n,onChange:r})=>{let[i,a]=(0,V.useState)(!1),o=ve(e,t);return o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(f,{label:D(`cacheResults`),help:D(o.forces?`cacheForceHelp`:`cacheHelp`),children:(0,z.jsx)(u,{checked:o.on,onChange:t=>{if(!n){if(!t)return r(K(e,o.offValue));if(o.disclaimer)return a(!0);r(K(e,!0))}}})}),i&&(0,z.jsx)(re,{title:D(`cacheConfirmTitle`),description:o.disclaimer,onClose:()=>a(!1),actions:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(m,{onClick:()=>a(!1),children:D(`cacheCancel`)}),(0,z.jsx)(m,{variant:`primary`,onClick:()=>(a(!1),r(K(e,!0))),children:D(`cacheConfirm`)})]})})]}):null},Vt=(e,t,n)=>{let{[t]:r,...i}=e;return n==null||n===``?i:{...i,[t]:n}},Ht=(e,t)=>{let{type:n}=b(e.Resource);if(t){let{Cache:t,...r}=e;return{...r,Resource:`${n}${be}`}}let{HeartbeatSeconds:r,TimeoutSeconds:i,...a}=e;return{...a,Resource:n,...i!==void 0&&i<=Se.taskTimeoutSeconds&&{TimeoutSeconds:i}}},Ut=e=>Oe(e)===void 0,Wt=(e,t)=>({...e,Resource:`${t}${b(e.Resource).waits&&Ut(t)?be:``}`}),Gt=(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}}},Kt=({state:e,types:t,problems:n,disabled:i,onChange:a})=>{let o=t.step_types.filter(e=>e.available),{type:s,waits:c}=b(e.Resource),l=Ut(s),d=t.step_types.find(e=>e.id===s),p=typeof e.Arguments==`string`||!d;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(f,{label:D(`stepType`),error:H(n,`Resource`),children:(0,z.jsxs)(r,{value:s,disabled:i,onChange:t=>a(Wt(e,t.target.value)),children:[!o.some(e=>e.id===s)&&(0,z.jsx)(`option`,{value:s,children:ge(s,d?.label)}),o.map(e=>(0,z.jsx)(`option`,{value:e.id,children:ge(e.id,e.label)},e.id))]})}),p?(0,z.jsx)(W,{label:D(`arguments`),kind:`json`,value:e.Arguments,error:H(n,`Arguments`),disabled:i,onChange:t=>a({...e,Arguments:t??{}})}):L(d.input).map(t=>(0,z.jsx)(W,{label:ce(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:H(n,`Arguments.${t.name}`),disabled:i,onChange:n=>a(Gt(e,t.name,n))},`${s}:${t.name}`)),l&&(0,z.jsx)(f,{label:D(`waitsForResult`),help:D(`waitsForResultHelp`),children:(0,z.jsx)(u,{checked:c,onChange:t=>!i&&a(Ht(e,t))})}),c||!l?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(W,{label:D(`waitTimeout`),help:D(`waitTimeoutHelp`),kind:`json`,value:e.TimeoutSeconds,error:H(n,`TimeoutSeconds`),disabled:i,onChange:t=>a(Vt(e,`TimeoutSeconds`,t))}),(0,z.jsx)(W,{label:D(`heartbeatSeconds`),help:D(`heartbeatHelp`),kind:`json`,value:e.HeartbeatSeconds,error:H(n,`HeartbeatSeconds`),disabled:i,onChange:t=>a(Vt(e,`HeartbeatSeconds`,t))})]}):(0,z.jsx)(Bt,{state:e,types:t,disabled:i,onChange:a})]})},q=(e,t,n)=>{let{[t]:r,...i}=e;return n===void 0?i:{...i,[t]:n}},qt=({state:e,problems:t,disabled:n,onChange:r})=>(0,z.jsx)(W,{label:D(`onlyWhen`),kind:`text`,help:D(`onlyWhenHelp`),value:e.Condition,error:H(t,`Condition`),disabled:n,onChange:t=>r(q(e,`Condition`,t))}),J=e=>{let{state:t,names:n,problems:r,disabled:i,onChange:a}=e;if(e.data)return(0,z.jsx)(qt,{...e});let o=t;return(0,z.jsx)(U,{label:D(`goesOnTo`),value:o.Next,names:n,none:D(`endsHere`),error:H(r,`Next`)??H(r,`End`),disabled:i,onChange:e=>{let{Next:t,End:n,...r}=o;a(e===void 0?{...r,End:!0}:{...r,Next:e})}})},Jt=e=>{let{state:t,types:n,problems:r,disabled:i,onChange:a}=e,o=(e,n,o,s)=>(0,z.jsx)(W,{label:n,kind:o,help:s,value:t[e],error:H(r,e),disabled:i,onChange:n=>a(q(t,e,n))});if(t.Type===`Task`)return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Kt,{state:t,types:n,problems:r,disabled:i,onChange:a}),(0,z.jsx)(J,{...e}),!e.data&&(0,z.jsx)(G,{...e,state:t})]});if(t.Type===`Choice`)return(0,z.jsx)(zt,{...e,state:t});if(t.Type===`Map`)return(0,z.jsxs)(z.Fragment,{children:[o(`Items`,D(`items`),`json`,D(`itemsHelp`)),o(`MaxConcurrency`,D(`maxConcurrency`),`json`),(0,z.jsx)(J,{...e}),!e.data&&(0,z.jsx)(G,{...e,state:t})]});if(t.Type===`Block`){let n=(e,n,o,s)=>(0,z.jsx)(W,{label:n,kind:o,help:s,value:t.Cache?.[e],error:H(r,`Cache.${e}`)??(e===`Ttl`?H(r,`Cache`):void 0),disabled:i,onChange:n=>a({...t,Cache:q(t.Cache??{Ttl:``},e,n)})});return(0,z.jsxs)(z.Fragment,{children:[o(`Arguments`,D(`blockArguments`),`json`,D(`blockArgumentsHelp`)),n(`Ttl`,D(`blockTtl`),`text`,D(`blockTtlHelp`)),n(`Key`,D(`blockKey`),`json`,D(`blockKeyHelp`)),(0,z.jsx)(J,{...e}),!e.data&&(0,z.jsx)(G,{...e,state:t})]})}return t.Type===`Wait`?(0,z.jsxs)(z.Fragment,{children:[o(`Seconds`,D(`seconds`),`json`),(0,z.jsx)(J,{...e})]}):t.Type===`Pass`?(0,z.jsxs)(z.Fragment,{children:[o(`Output`,D(`output`),`json`,D(`outputHelp`)),(0,z.jsx)(J,{...e})]}):t.Type===`Succeed`?o(`Output`,D(`output`),`json`,D(`outputHelp`)):t.Type===`Fail`?(0,z.jsxs)(z.Fragment,{children:[e.data&&(0,z.jsx)(qt,{...e}),o(`Error`,D(`error`),`text`),o(`Cause`,D(`cause`),`text`)]}):null},Yt=(e,t,n,r)=>{let{[n]:i,...a}=t;return{[e]:r===void 0?a:{...a,[n]:r}}},Xt=({trigger:e,types:t,problems:n,disabled:i,onChange:a})=>{let o=fe(e),s=t.triggers.filter(e=>e.available),c=s.find(e=>e.id===o),l=o!==void 0&&!c?o:void 0,u=o===void 0?{}:e[o]??{};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(f,{label:D(`startsWhen`),error:H(n,`trigger`),help:l&&D(`triggerOtherHelp`),children:(0,z.jsxs)(r,{value:o??``,disabled:i,onChange:e=>a({[e.target.value]:{}}),children:[l!==void 0&&(0,z.jsx)(`option`,{value:l,children:de(l,t.triggers.find(e=>e.id===l)?.label)}),o===void 0&&(0,z.jsx)(`option`,{value:``,children:D(`triggerUnknown`)}),s.map(e=>(0,z.jsx)(`option`,{value:e.id,children:de(e.id,e.label)},e.id))]})}),c&&L(c.input).map(e=>(0,z.jsx)(W,{label:ce(e.name,e.title),kind:e.kind,options:e.options,required:e.required,...e.kind===`names`&&{help:D(`namesHelp`)},value:u[e.name],error:H(n,`trigger.${c.id}.${e.name}`),disabled:i,onChange:t=>a(Yt(c.id,u,e.name,t))},`${c.id}:${e.name}`)),l!==void 0&&(0,z.jsx)(W,{label:D(`triggerInput`),kind:`json`,value:u,error:H(n,`trigger.${l}`),disabled:!0,onChange:()=>void 0})]})},Zt=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&typeof e.Type==`string`,Qt=({kind:e,name:t})=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e}),(0,z.jsx)(`h3`,{className:`truncate font-semibold text-foreground`,children:t})]}),$t=({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,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Qt,{kind:ye(s,t),name:l}),(0,z.jsx)(B,{problems:r}),(0,z.jsx)(Dt,{warnings:i}),(0,z.jsx)(Ot,{name:l,taken:Ne(e.stateMachine),disabled:d,onRename:t=>{f(_t(e,n,t)),o(Me(c,t))}},n),(0,z.jsx)(Jt,{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,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-body font-medium text-muted-foreground`,children:D(`asJson`)}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(W,{label:D(`stepJson`),kind:`json`,help:D(`stepJsonHelp`),value:s,disabled:d,onChange:t=>{Zt(t)&&f(pt(e,n,t))}},n)})]}),a&&(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[y(e)===`sequence`&&u.StartAt!==l&&(0,z.jsxs)(m,{size:`sm`,onClick:()=>f(vt(e,n)),children:[(0,z.jsx)(He,{className:`size-3.5`}),D(`startHere`)]}),(0,z.jsxs)(m,{size:`sm`,variant:`danger`,onClick:()=>{f(ut(e,n)),o(void 0)},children:[(0,z.jsx)(g,{className:`size-3.5`}),D(`removeStep`)]})]})]})},en=e=>{let{definition:t,types:n,selected:r,problems:i,onChange:a}=e;return(0,z.jsx)(`section`,{"aria-label":D(`chosenStep`),className:`flex flex-col gap-4 rounded-lg border bg-background p-4`,children:r===``?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Qt,{kind:D(`trigger`),name:me(t.trigger,n)}),(0,z.jsx)(B,{problems:i}),(0,z.jsx)(Xt,{trigger:t.trigger,types:n,problems:i,disabled:!a,onChange:e=>a?.(yt(t,e))})]}):(0,z.jsx)($t,{...e,selected:r})})},tn=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Y=(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;tn(s.Arguments)||(s.Arguments={});let c=s.Arguments;for(let e of n.slice(0,-1))tn(c[e])||(c[e]={}),c=c[e];let l=n.at(-1);return r===void 0?delete c[l]:c[l]=r,i},nn=e=>[`=`,`!=`,`>`,`<`,`matches`,`and`,`or`,`not`,...e?[`expression`]:[]],rn=e=>e.kind===`compare`||e.kind===`matches`?{value:``}:{value:e.kind===`logic`&&e.op===`and`},an=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:``}]},on=`{% true %}`,sn=(e,t)=>{if(t.length===0)return e;let n=e.sides[t[0]];return n&&v(n)?sn(n,t.slice(1)):void 0},cn=(e,t,n)=>({...e,sides:e.sides.map((e,r)=>r===t?n:e)}),ln=(e,t,n)=>{if(t.length===0)return n(e);let r=e.sides[t[0]],i=r&&v(r)?ln(r,t.slice(1),n):void 0;return i&&cn(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`?cn(e,1,{pattern:n.value||`.*`,flags:e.sides[1].flags}):void 0;if(e.kind!==`compare`&&e.kind!==`matches`||!v(n))return cn(e,t,n)}},dn=(e,t,n,r)=>{let i=x(C(e,t)?.Condition),a=i&&n.length>0&&ln(i,n.slice(0,-1),e=>un(e,n.at(-1),r));return a&&x(S(a))?Y(e,t,[T],S(a)):e},fn=(e,t,n,r)=>{let i=C(e,t)?.Condition;if(n.length===0)return i!==void 0&&i!==``?e:Y(e,t,[T],r===`expression`?on:S(an(r)));let a=x(i),o=a&&sn(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:dn(e,t,n,an(r))},pn=(e,t,n)=>{if(n.length===0)return Y(e,t,[T],void 0);let r=x(C(e,t)?.Condition),i=n.at(-1),a=r&&ln(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,rn(e))});return a?Y(e,t,[T],S(a)):e},mn=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},hn=(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(...mn(i)))}return[...n]},gn=e=>e.StartAt===void 0?Object.keys(e.States):hn(e,e.StartAt),_n=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`},vn=(e,t,n)=>t.flatMap(t=>{let r=e.States[t];if(!r)return[];let i=_(r),a=i?vn(i,gn(i),n):[];return r.Type===`Task`?(n?.step_types.find(e=>e.id===r.Resource)?.writes??!0)===!1||_n(r)?[]:[{name:t,kind:ye(r,n)}]:a}),yn=(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}},bn=(e,t,n)=>{let r=e?.stateMachine.States[n],i=r!==void 0&&`Output`in r;return JSON.stringify(yn(r,i))!==JSON.stringify(yn(t.stateMachine.States[n],i))},xn=(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))},Sn=(e,t,n=e.stateMachine.StartAt)=>{let r=e.stateMachine;return vn(r,y(e)===`data`?n===void 0?gn(r):xn(r,n):n===void 0?gn(r):hn(r,n),t)},Cn=/^[A-Za-z_][A-Za-z0-9_]*$/,wn=e=>Cn.test(e)?e:`\`${e.replaceAll("`",``)}\``,X=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:X(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:X(r[0])}),n(a,r[0],i+1);return}for(let[a,o]of Object.entries(r)){let r=e===``?wn(a):`${e}.${wn(a)}`;t.push({path:r,sample:X(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&&hn(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)),..._(e)?Pn(_(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=he(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}},Rn=(e,t)=>{let n=se(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)]}}},zn=(e,t)=>e.path.length===1&&e.path[0]===`#status`&&t.keys.length===1&&t.keys[0]===`#condition`&&!t.side,Bn=(e,t,n)=>{let r=Z(e,t.node);if(n===`out`){let n=he(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=se(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},Vn=(e,t)=>w(t).scope.some((t,n,r)=>C(e,r.slice(0,n+1).join(`/`))?.Type===`Block`),Hn=(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(`/`)},Un=(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},Wn=(e,t,n,r)=>{let i=Ln(t,n),a=Rn(t,r);if(!i||!a)return{reason:`notPins`};let o=Hn(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(Un(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(Vn(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(zn(i,a))return;let s=Bn(t,n,`out`),c=Bn(t,r,`in`);if(s&&c&&!xe(s,c))return{reason:`type`,source:s,target:c}},Gn=(e,t,n,r)=>{if(Wn(e,t,n,r))return e;let i=Ln(t,n),a=Rn(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?dn(o,a.step,a.side.at,{read:c}):a.select?Y(o,a.step,a.keys,Ae({...a.select.part,operand:{read:c}})):zn(i,a)?Y(o,a.step,a.keys,S({kind:`compare`,op:`=`,sides:[{read:c},{value:`SUCCEEDED`}]})):Y(o,a.step,a.keys,je(s))},Kn=(e,t,n)=>{let r=Rn(t,{node:n.target,handle:n.targetHandle});if(r?.side)return pn(e,r.step,r.side.at);if(r?.select)return Y(e,r.step,r.keys,Ae({...r.select.part,operand:{value:``}}));if(r)return Y(e,r.step,r.keys,void 0);let i=Z(t,n.target)??Z(t,n.source);return i?qn(e,t,i):e},qn=(e,t,n)=>{if(n.kind===`make`||n.kind===`select`)return Y(e,n.target,[n.key],void 0);if(n.kind===`condition`)return pn(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 _e(t,r(n),e=>pe(t,e)).reduce((e,n)=>Kn(e,t,n),e)},Jn=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`,Yn={connect:dt,disconnect:ft,removeState:ut,setArgument:Y,connectData:Gn,disconnectData:Kn,removePure:qn,wireRefusal:Wn,addCondition:fn,conditionChoices:nn,setConditionSide:dn,addSelect:(e,t,n)=>{let r=C(e,t)?.Arguments?.[n];if(r!==void 0&&!Jn(r)||typeof r==`string`&&r.startsWith(`{%`))return e;let i=r??``;return Y(e,t,[n],Ae({operand:{value:``},cases:[{when:``,then:i}],otherwise:i}))}},Xn=(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}}}),Zn=e=>{let{data:t}=te();return(0,V.useMemo)(()=>Xn(e,t?.resources??{},t?.views),[e,t?.resources,t?.views])},Q=ne(`app/field-types/workflow-page`),Qn={"app:http":{icon:Ke,keywords:[`api`,`fetch`,`url`,`webhook`,`get`,`post`]},"app:mail.send":{icon:i,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`]}},$n=[{type:`Choice`,icon:We,description:()=>Q(`flowChoice`),keywords:[`if`,`branch`,`switch`,`condition`]},{type:`Map`,icon:Xe,description:()=>Q(`flowMap`),keywords:[`loop`,`each`,`list`,`repeat`]},{type:`Block`,icon:a,description:()=>Q(`flowBlock`),keywords:[`cache`,`once`,`group`,`reuse`,`wrap`]},{type:`Wait`,icon:Qe,description:()=>Q(`flowWait`),keywords:[`delay`,`sleep`,`pause`,`later`]},{type:`Pass`,icon:Je,description:()=>Q(`flowPass`),keywords:[`variable`,`assign`,`transform`]},{type:`Succeed`,icon:c,description:()=>Q(`flowSucceed`),keywords:[`end`,`stop`,`done`]},{type:`Fail`,icon:o,description:()=>Q(`flowFail`),keywords:[`end`,`stop`,`error`]}],er=e=>({id:`task:${e.id}`,title:ue(e.id,e.label),description:e.description,keywords:[e.id,...Qn[e.id]?.keywords??[]],icon:Qn[e.id]?.icon??(e.id.startsWith(`app:`)?ee:p)}),$=e=>e.slice(0,Math.max(e.indexOf(`:`),0)),tr=e=>e===`custom`?Q(`customSteps`):e,nr=e=>{let t=new Set(Object.values(ke(e.step_types.map(e=>e.id)))),n=e.step_types.filter(e=>e.available&&(!Oe(e.id)||t.has(e.id))),r=[...new Set(n.map(e=>$(e.id)).filter(e=>e!==`app`))];return[{title:Q(`builtIn`),items:n.filter(e=>$(e.id)===`app`).map(er)},...r.map(e=>({title:tr(e),items:n.filter(t=>$(t.id)===e).map(er)})),{title:Q(`flow`),items:$n.map(e=>({id:`type:${e.type}`,title:le(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,Tt as _,Yn as a,Et as b,Dn as c,kn as d,bn as f,B as g,Nt as h,Zn as i,rt as k,Mn as l,en as m,nr as n,An as o,Sn as p,Q as r,On as s,rr as t,In as u,R as v,ot as w,xt as x,St as y};
|
|
2
|
+
//# debugId=f0f1b8a9-c89d-4999-9c8b-2bd778e53b6e
|
|
@@ -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{Bn as r,Vr as i,al as a,ea as o,fc as s,nl as c,ns as l,pc as u,qc as d,ss as f}from"./app-
|
|
2
|
-
//# debugId=
|
|
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{Bn as r,Vr as i,al as a,ea as o,fc as s,nl as c,ns as l,pc as u,qc as d,ss as f}from"./app-CWCg5I0x.js";import{l as p,m,n as h,u as g}from"./workflow-canvas-DbLkc3zJ.js";import{m as _}from"./workflows-Bey4jszG.js";import{E as v,T as y,n as b}from"./use-run-trace-CSdKdxn9.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(a(),{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 a=f(),s=typeof e.type==`string`&&_(e.type)!==void 0&&a.resources.workflow_custom_step_jobs!==void 0&&a.permissions.workflow_custom_step_jobs?.read!==!1,c=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)(r,{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)}),c&&(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:o(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)(i,{to:{kind:`record`,resource:`workflow_runs`,key:e.run},className:d(u({size:`sm`}),`justify-self-start`),children:e.reused===!0?E(`openEarlierBlockRun`):E(`openBlockRun`)})]}),s&&(0,D.jsx)(i,{to:{kind:`list`,resource:`workflow_custom_step_jobs`,filter:`run_id = "${t}"`},className:d(u({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)(r,{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)(r,{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 a=b(e.id,!1),[o,c]=(0,x.useState)(20);if(a.isPending)return null;let l=(a.data??[]).filter(e=>e.state===t),d=n===void 0?void 0:(a.data??[]).filter(e=>e.state===n&&typeof e.run==`string`).at(-1)?.run;return l.length===0&&typeof d==`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)(i,{to:{kind:`record`,resource:`workflow_runs`,key:d},className:u({size:`sm`})+` justify-self-start`,children:E(`openBlockRun`)})]}):l.length===0?(0,D.jsx)(`p`,{className:`text-body text-muted-foreground`,children:E(`notRun`)}):(0,D.jsxs)(`div`,{className:`grid gap-3`,children:[l.slice(0,o).map(t=>(0,D.jsx)(j,{step:t,runId:e.id,...r&&{valueActions:r}},String(t.id))),l.length>o&&(0,D.jsx)(s,{size:`sm`,className:`justify-self-start`,onClick:()=>c(o+20),children:E(`showMore`)})]})},P=({definition:e,run:t,selected:n,types:i})=>{let a=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:a?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(M,{kind:g(a,i),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,i)}),(0,D.jsx)(O,{title:E(`runInput`),children:(0,D.jsx)(r,{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=80e7ed83-a33c-4c4d-b7f1-960b13a4ad17
|
|
@@ -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,aa as i,bi as a,ca as o,cs as s,ia as c,ja as l,ka as u,lc as d,mi as f,ml as p,pa as m,qc as h,ra as g,ta as _,ua as v,vr as ee}from"./app-
|
|
2
|
-
//# debugId=
|
|
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,aa as i,bi as a,ca as o,cs as s,ia as c,ja as l,ka as u,lc as d,mi as f,ml as p,pa as m,qc as h,ra as g,ta as _,ua as v,vr as ee}from"./app-CWCg5I0x.js";import{_ as y,a as te,i as ne,n as re,o as b,t as ie,v as x}from"./lib-dnd-kit-core-xi-7xL_N.js";import{a as S,g as C,h as w,i as T,l as ae,m as oe,n as se,o as E,r as ce,t as le,u as D,v as O}from"./use-calendar-move-J9sB_jXo.js";var k=e(t(),1),A=864e5,j=e=>Date.parse(`${e}T00:00:00Z`),M=(e,t=0)=>{let n=new Date(j(e));return new Date(Date.UTC(n.getUTCFullYear(),Math.floor(n.getUTCMonth()/3)*3+3*t,1)).toISOString().slice(0,10)},N=({scale:e,day:t})=>({scale:e,day:e===`week`?w(t):e===`month`?C(t):M(t)}),P=(e,t,n=m())=>N(e??{scale:`month`,day:v(t,n)}),F=(e,t)=>{let{scale:n,day:r}=N(e);return{scale:n,day:n===`week`?D(r,7*t):n===`month`?C(r,t):M(r,t)}},I=e=>{let t=N(e).day,n=(j(F(e,1).day)-j(t))/A;return Array.from({length:n},(e,n)=>D(t,n))},ue=e=>({from:N(e).day,to:F(e,1).day}),de=(e,t,n,r=m())=>{let i=v(n,r),a=I(e);return N({scale:t,day:i>=a[0]&&i<=a.at(-1)?i:a[0]})},fe=e=>{let t=I(e);return e.scale===`week`?_(j(t[0]),j(t.at(-1))):e.scale===`month`?g(j(t[0])):i(j(t[0]),j(C(t.at(-1))))},L=e=>{let t=I(e);if(e.scale===`week`)return t.map((e,t)=>({index:t,span:1,label:`${o(j(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:c(j(t[e]))}))},R=(e,t,n,r,i=m())=>{let a=O(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,o=i===void 0?void 0:t.fields[i];if(i===void 0||!o)return[{key:``,rows:e}];let s=n?.fields[i],c=new Map;for(let t of e){let e=t.record[i],n=e==null||e===``,r=n?z:`value:${String(e)}`,l=n?f(`noValue`,{label:s?.label??p(i)}):t.labels[i]??a(o,e,s),u=c.get(r)??{value:n?void 0:e,lane:{key:r,label:l,rows:[]}};u.lane.rows.push(t),c.set(r,u)}let l=o.enumValues??[],u=(e,t)=>e.value===void 0||t.value===void 0?Number(e.value===void 0)-Number(t.value===void 0):o.type===`enum`?l.indexOf(String(e.value))-l.indexOf(String(t.value)):o.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[...c.values()].toSorted(u).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:h(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:h(`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:h(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:h(`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:a,dragged:o})=>{let s=R(r.record,n,e,i);return(0,V.jsxs)(`div`,{className:h(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:E(e,t,n,r)}),(0,V.jsx)(`div`,{className:`relative h-7`,children:s&&(0,V.jsx)(`div`,{className:`absolute top-1/2 -translate-y-1/2`,style:{left:U(s.first,i.length),width:U(s.last-s.first+1,i.length)},children:(0,V.jsx)(T,{model:e,view:t,display:n,row:r,day:s.start,movable:a,dragged:o,className:h(s.before&&`rounded-l-none border-l-0`,s.after&&`rounded-r-none border-r-0`)})})})]})},ge=()=>[{scale:`week`,label:f(`week`)},{scale:`month`,label:f(`month`)},{scale:`quarter`,label:f(`quarter`)}],W=({model:e,view:t,display:n,fields:i,filter:a,at:o,linkTo:c,now:h=Date.now()})=>{let[g,_]=(0,k.useState)(),C=P(c?o:g,h),w=I(C),T=L(C),A=ce({model:e,display:n,range:ue(C),fields:i,filter:a}),{moves:j,move:M}=se(e,n),N=B(oe(le(A.rows,j),n),e,t,n),R=s(e.name),z=u(R,`update`)&&[n.start,n.end].every(t=>t===void 0||!e.fields[t]?.readOnly),[H,U]=(0,k.useState)(),W=(0,k.useRef)(!1),G=(0,k.useRef)(0),K=(0,k.useRef)(null),q=()=>(K.current?.getBoundingClientRect().width??0)/w.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(y(te,{activationConstraint:{distance:4}}),y(b,{activationConstraint:{delay:250,tolerance:5}}),y(ne,{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=v(h,m()),X=r=>E(e,t,n,r.row),Z=e=>r(Date.parse(`${D(e.day,G.current)}T00:00:00Z`)),ye={onDragStart:({active:e})=>f(`pickedUp`,{title:X(e.data.current)}),onDragMove:({active:e})=>f(`startsOn`,{title:X(e.data.current),day:Z(e.data.current)}),onDragOver:()=>void 0,onDragEnd:({active:e})=>G.current===0?f(`putBack`,{title:X(e.data.current)}):f(`wasMovedTo`,{title:X(e.data.current),to:Z(e.data.current)}),onDragCancel:({active:e})=>f(`cancelled`,{title:X(e.data.current)})},Q=()=>{U(void 0),setTimeout(()=>W.current=!1)},$=({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})=>{Q(),G.current=J(r.x);let{row:i}=t.data.current,a=O(i.record,n,e);a&&G.current!==0&&M(i,a.first,D(a.first,G.current))},Se=n.group===void 0?t?.names?.plural??p(e.name):t?.fields[n.group]?.label??p(n.group),Ce=!A.loading&&!A.error&&A.rows.length===0;return(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3`,children:[(0,V.jsx)(ae,{heading:fe(C),unit:C.scale,previous:F(C,-1),today:P({scale:C.scale,day:Y},h),next:F(C,1),scales:ge().map(({scale:e,label:t})=>({view:de(C,e,h),label:t,current:C.scale===e})),scalesLabel:f(`timelineScale`),linkTo:c,onView:_}),A.error&&(0,V.jsx)(ee,{title:f(`couldNotLoadRows`),error:A.error}),A.capped&&(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:f(`capped`,{limit:500,unit:C.scale})}),(0,V.jsxs)(ie,{sensors:ve,modifiers:[_e],onDragStart:$,onDragMove:be,onDragEnd:xe,onDragCancel:Q,accessibility:{announcements:ye,screenReaderInstructions:{draggable:f(`timelineInstructions`)}},children:[(0,V.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-border`,children:[(0,V.jsx)(pe,{ticks:T,days:w,today:Y,label:Se,trackRef:K}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(me,{ticks:T,days:w,today:Y}),A.loading&&(0,V.jsxs)(`div`,{className:`relative flex flex-col gap-2 p-2`,children:[(0,V.jsx)(d,{className:`h-4`}),(0,V.jsx)(d,{className:`h-4`})]}),Ce&&(0,V.jsx)(`p`,{className:`relative px-2 py-3 text-xs text-muted-foreground`,children:f(`nothingIn`,{unit:C.scale})}),!A.loading&&N.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:w,movable:z&&l(r.record,`update`),dragged:()=>W.current},r.key))]},r.key))]})]}),(0,V.jsx)(re,{children:H&&(0,V.jsx)(S,{model:e,view:t,display:n,row:H.row,day:H.day})})]})]})};export{W as TimelineDisplay};
|
|
2
|
+
//# debugId=4b177a27-5765-4fc4-b40d-5dfcefb7ef46
|