@protobase/ui 0.118.1 → 0.119.1
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/app/charts/messages.d.ts +2 -2
- package/dist/app/comments/messages.d.ts +2 -2
- package/dist/app/confirm-sign-in-messages.d.ts +2 -2
- package/dist/app/create/messages.d.ts +2 -2
- package/dist/app/delete/messages.d.ts +2 -2
- package/dist/app/displays/messages.d.ts +2 -2
- package/dist/app/export/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/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/hand-order/messages.d.ts +2 -2
- package/dist/app/import/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/opened-address.d.ts +9 -0
- package/dist/app/opened-address.js +14 -0
- 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-opens.d.ts +1 -6
- package/dist/app/record-opens.js +2 -12
- package/dist/app/record-page.js +2 -1
- package/dist/app/record-row/messages.d.ts +2 -2
- package/dist/app/related-cards/messages.d.ts +2 -2
- package/dist/app/runtime/messages.d.ts +2 -2
- package/dist/app/saved/messages.d.ts +2 -2
- package/dist/app/saved/use-favorite.d.ts +1 -1
- package/dist/app/search/search-model.d.ts +7 -3
- package/dist/app/search/search-model.js +13 -6
- package/dist/app/searches/messages.d.ts +2 -2
- package/dist/app/searches/use-save-search.d.ts +1 -1
- package/dist/app-shell/messages.d.ts +2 -2
- package/dist/assistant-dock/messages.d.ts +2 -2
- package/dist/auth/auth-messages.d.ts +2 -0
- package/dist/auth/auth-messages.js +3 -1
- package/dist/auth/messages.d.ts +2 -2
- package/dist/filter-panel/messages.d.ts +2 -2
- package/dist/forms/messages.d.ts +2 -2
- package/dist/invitations/messages.d.ts +2 -2
- package/dist/locale/en.js +4 -1
- package/dist/locale/en.json.d.ts +3 -0
- package/dist/locale/messages.d.ts +6 -0
- package/dist/locale/nl.js +4 -1
- package/dist/mocks/customers.d.ts +1 -1
- package/dist/mocks/invoices.d.ts +1 -1
- package/dist/mocks/orders.d.ts +3 -3
- package/dist/notifications/bell/messages.d.ts +2 -2
- package/dist/organizations/first-organization-page.js +5 -7
- package/dist/organizations/messages.d.ts +2 -2
- package/dist/organizations/my-invitation-row.d.ts +6 -2
- package/dist/organizations/my-invitation-row.js +8 -3
- package/dist/organizations/new-organization-form.js +3 -2
- package/dist/organizations/organizations-page.js +4 -6
- package/dist/organizations/use-action.d.ts +10 -1
- package/dist/organizations/use-action.js +25 -15
- package/dist/organizations/use-join-invitation.d.ts +9 -0
- package/dist/organizations/use-join-invitation.js +25 -0
- package/dist/package.js +1 -1
- package/dist/plugins/messages.d.ts +2 -2
- package/dist/primitives/button.d.ts +4 -2
- package/dist/primitives/button.js +23 -15
- package/dist/shell/assets/{account-page-D9hXd-u3.js → account-page-BXnceUQo.js} +2 -2
- package/dist/shell/assets/app-D3BCcbgE.js +34 -0
- package/dist/shell/assets/{assistant-shell-DDkCxLNG.js → assistant-shell-DKf9TfL2.js} +2 -2
- package/dist/shell/assets/board-display-DJkQwIfT.js +2 -0
- package/dist/shell/assets/calendar-display-BKyuHAAF.js +2 -0
- package/dist/shell/assets/{call-rings-B5rBD5EL.js → call-rings-D_kQbFd3.js} +2 -2
- package/dist/shell/assets/{calls-z1AEvYOC.js → calls-D6jSGMCo.js} +2 -2
- package/dist/shell/assets/{circle-alert-C_1i142n.js → circle-alert-ytReRN_c.js} +2 -2
- package/dist/shell/assets/{composed-page--UJ8tsC0.js → composed-page-CbNBBioS.js} +2 -2
- package/dist/shell/assets/{composer-section-tfrO2pIi.js → composer-section-cg-cdFZx.js} +2 -2
- package/dist/shell/assets/{connect-route-rVNQDWcE.js → connect-route-hMUPiAft.js} +2 -2
- package/dist/shell/assets/{copy-field-D9agQmK0.js → copy-field-BoXXafL7.js} +2 -2
- package/dist/shell/assets/create-route-BePHRkTZ.js +2 -0
- package/dist/shell/assets/{custom-step-container-field-BanmPoI-.js → custom-step-container-field-B3bsPeCV.js} +4 -4
- package/dist/shell/assets/embedded-list-6lQyJozS.js +3 -0
- package/dist/shell/assets/{en-BrEwbNhJ.js → en-dURxhEht.js} +2 -2
- package/dist/shell/assets/{export-dialog-g69vJ8j2.js → export-dialog-BUbdSkkU.js} +2 -2
- package/dist/shell/assets/export-worker-DfIG4xQy.js +15 -0
- package/dist/shell/assets/first-organization-page-BhQOFT5P.js +2 -0
- package/dist/shell/assets/{graph-view-DXDcn-Fx.js → graph-view-DZHMI-UQ.js} +2 -2
- package/dist/shell/assets/{group-donut-B3bCn83A.js → group-donut-Cu5Ny3gq.js} +2 -2
- package/dist/shell/assets/{guest-call-page-rAD4EXPd.js → guest-call-page-DlAkbaRH.js} +3 -3
- package/dist/shell/assets/{html-viewer-BxhCE5h2.js → html-viewer-DrSS-WnU.js} +2 -2
- package/dist/shell/assets/{import-dialog-adjnDUuk.js → import-dialog-Dk_31-PT.js} +2 -2
- package/dist/shell/assets/import-table-dialog-vL-juOMH.js +2 -0
- package/dist/shell/assets/{index-BBHelxJ2.js → index-CTmZ8-B4.js} +1 -1
- package/dist/shell/assets/invitations-page-CfTEdorg.js +2 -0
- package/dist/shell/assets/{layout-grid-B3Php1Rf.js → layout-grid-CTlIrnH5.js} +2 -2
- package/dist/shell/assets/{legend-item-BbV6BD6w.js → legend-item-CqkLpsWb.js} +2 -2
- package/dist/shell/assets/list-page-Czg2Jaxx.js +4 -0
- package/dist/shell/assets/{maplibre-D4xk_BLC.js → maplibre-Bd79IbdT.js} +2 -2
- package/dist/shell/assets/{markdown-content-CnNrPGcY.js → markdown-content-BGl9PFVi.js} +2 -2
- package/dist/shell/assets/members-page-CEB-Wkl8.js +2 -0
- package/dist/shell/assets/messages-Ce8dRRRN.js +2 -0
- package/dist/shell/assets/{nl-Dto12ewP.js → nl-B0dpIbbz.js} +2 -2
- package/dist/shell/assets/organization-page-CTxtblmm.js +2 -0
- package/dist/shell/assets/organizations-page-DeNhUQDU.js +2 -0
- package/dist/shell/assets/parse-worker-VaelBbE0.js +35 -0
- package/dist/shell/assets/{pending-invitation-row-D_vU7ynw.js → pending-invitation-row-BMp0ZxE8.js} +2 -2
- package/dist/shell/assets/{period-chart-DPlEbvX7.js → period-chart-BDqtO8mc.js} +2 -2
- package/dist/shell/assets/{person-row-DMY-aQjx.js → person-row-DRqtbPma.js} +2 -2
- package/dist/shell/assets/public-form-page-XgK3-Nzh.js +2 -0
- package/dist/shell/assets/{record-lines-SeXhFNSm.js → record-lines-DdN5hlI_.js} +2 -2
- package/dist/shell/assets/{record-map-BiLFEqYi.js → record-map-sOmjX80D.js} +2 -2
- package/dist/shell/assets/{record-opens-Ct9iF9FZ.js → record-opens-DLfbC3xo.js} +2 -2
- package/dist/shell/assets/record-page-BntRofCL.js +3 -0
- package/dist/shell/assets/{record-preview-J1o4Sqs-.js → record-preview-QMV2lW2j.js} +2 -2
- package/dist/shell/assets/{records-map-Cwdig5mb.js → records-map-DgTxGcbC.js} +2 -2
- package/dist/shell/assets/render-node-CkL5Sgl_.js +3 -0
- package/dist/shell/assets/reorder-button-8yWv8J72.js +2 -0
- package/dist/shell/assets/{run-trace-view-1fk6kU1U.js → run-trace-view-BPvPw3Ko.js} +2 -2
- package/dist/shell/assets/{runner-install-field-C_hTvogl.js → runner-install-field-CKP8E9ZO.js} +2 -2
- package/dist/shell/assets/{runtime-update-8hRmQkq-.js → runtime-update-DGbf2Nmm.js} +2 -2
- package/dist/shell/assets/shared-protobase-ui-DN-uvpOy.js +1 -0
- package/dist/shell/assets/{sheet-source-CD5hImgE.js → sheet-source-cKJfUaud.js} +3 -3
- package/dist/shell/assets/sign-in-policy-page-Bty4Ih1x.js +2 -0
- package/dist/shell/assets/start-block-queries-x-gNbPt1.js +2 -0
- package/dist/shell/assets/step-catalog-CCAXc8kn.js +2 -0
- package/dist/shell/assets/{step-panel-BVdV2FNT.js → step-panel-jmfh86YA.js} +2 -2
- package/dist/shell/assets/timeline-display-CtxOHPoJ.js +2 -0
- package/dist/shell/assets/{trash-5PpoeP3R.js → trash-CFCBxAWq.js} +2 -2
- package/dist/shell/assets/{update-set-BnRA9YhA.js → update-set-BYNQUWVp.js} +2 -2
- package/dist/shell/assets/use-calendar-move-BytgRG51.js +2 -0
- package/dist/shell/assets/{use-display-rows-ERQ-vbki.js → use-display-rows-DGw9J73C.js} +2 -2
- package/dist/shell/assets/use-my-invitations-BcMFAcXl.js +2 -0
- package/dist/shell/assets/{use-paged-search-CcEitpWG.js → use-paged-search-CKcKKO6y.js} +2 -2
- package/dist/shell/assets/{use-run-trace-CV461SQS.js → use-run-trace-BRwbwZcf.js} +2 -2
- package/dist/shell/assets/{use-workflow-page-peSmP1Jq.js → use-workflow-page-DsD276W-.js} +2 -2
- package/dist/shell/assets/{use-workflow-types-xM8CZO96.js → use-workflow-types-Bn24Chp-.js} +2 -2
- package/dist/shell/assets/{workflow-canvas-CkKd9u0-.js → workflow-canvas-BKd_Yd0v.js} +4 -4
- package/dist/shell/assets/{workflow-field-WovRhNaT.js → workflow-field-DyBaV6m5.js} +3 -3
- package/dist/shell/assets/{workflow-graph-editor-DRZ2UtBp.js → workflow-graph-editor-B8RJ52_E.js} +2 -2
- package/dist/shell/assets/{workflow-run-field-CrBAVhOq.js → workflow-run-field-CzluYhjs.js} +3 -3
- package/dist/shell/assets/workflow-status-field-_umgNjK4.js +2 -0
- package/dist/shell/assets/workflow-workbench-CqOI36Oy.js +4 -0
- 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-D9hXd-u3.js.map → account-page-BXnceUQo.js.map} +1 -1
- package/dist/shell-source-maps/assets/app-D3BCcbgE.js.map +1 -0
- package/dist/shell-source-maps/assets/{assistant-shell-DDkCxLNG.js.map → assistant-shell-DKf9TfL2.js.map} +1 -1
- package/dist/shell-source-maps/assets/{board-display-plYPsh6z.js.map → board-display-DJkQwIfT.js.map} +1 -1
- package/dist/shell-source-maps/assets/{calendar-display-B3kFBd2k.js.map → calendar-display-BKyuHAAF.js.map} +1 -1
- package/dist/shell-source-maps/assets/{call-rings-B5rBD5EL.js.map → call-rings-D_kQbFd3.js.map} +1 -1
- package/dist/shell-source-maps/assets/{calls-z1AEvYOC.js.map → calls-D6jSGMCo.js.map} +1 -1
- package/dist/shell-source-maps/assets/{circle-alert-C_1i142n.js.map → circle-alert-ytReRN_c.js.map} +1 -1
- package/dist/shell-source-maps/assets/{composed-page--UJ8tsC0.js.map → composed-page-CbNBBioS.js.map} +1 -1
- package/dist/shell-source-maps/assets/{composer-section-tfrO2pIi.js.map → composer-section-cg-cdFZx.js.map} +1 -1
- package/dist/shell-source-maps/assets/{connect-route-rVNQDWcE.js.map → connect-route-hMUPiAft.js.map} +1 -1
- package/dist/shell-source-maps/assets/{copy-field-D9agQmK0.js.map → copy-field-BoXXafL7.js.map} +1 -1
- package/dist/shell-source-maps/assets/{create-route-C4xN9aXd.js.map → create-route-BePHRkTZ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{custom-step-container-field-BanmPoI-.js.map → custom-step-container-field-B3bsPeCV.js.map} +1 -1
- package/dist/shell-source-maps/assets/{embedded-list-B_e_Quer.js.map → embedded-list-6lQyJozS.js.map} +1 -1
- package/dist/shell-source-maps/assets/en-dURxhEht.js.map +1 -0
- package/dist/shell-source-maps/assets/{export-dialog-g69vJ8j2.js.map → export-dialog-BUbdSkkU.js.map} +1 -1
- package/dist/shell-source-maps/assets/export-worker-DfIG4xQy.js.map +1 -0
- package/dist/shell-source-maps/assets/first-organization-page-BhQOFT5P.js.map +1 -0
- package/dist/shell-source-maps/assets/{graph-view-DXDcn-Fx.js.map → graph-view-DZHMI-UQ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{group-donut-B3bCn83A.js.map → group-donut-Cu5Ny3gq.js.map} +1 -1
- package/dist/shell-source-maps/assets/{guest-call-page-rAD4EXPd.js.map → guest-call-page-DlAkbaRH.js.map} +1 -1
- package/dist/shell-source-maps/assets/{html-viewer-BxhCE5h2.js.map → html-viewer-DrSS-WnU.js.map} +1 -1
- package/dist/shell-source-maps/assets/{import-dialog-adjnDUuk.js.map → import-dialog-Dk_31-PT.js.map} +1 -1
- package/dist/shell-source-maps/assets/{import-table-dialog-yV9UTlBY.js.map → import-table-dialog-vL-juOMH.js.map} +1 -1
- package/dist/shell-source-maps/assets/{invitations-page-FKTUQL8J.js.map → invitations-page-CfTEdorg.js.map} +1 -1
- package/dist/shell-source-maps/assets/{layout-grid-B3Php1Rf.js.map → layout-grid-CTlIrnH5.js.map} +1 -1
- package/dist/shell-source-maps/assets/{legend-item-BbV6BD6w.js.map → legend-item-CqkLpsWb.js.map} +1 -1
- package/dist/shell-source-maps/assets/{list-page-CNhV2TuF.js.map → list-page-Czg2Jaxx.js.map} +1 -1
- package/dist/shell-source-maps/assets/{maplibre-D4xk_BLC.js.map → maplibre-Bd79IbdT.js.map} +1 -1
- package/dist/shell-source-maps/assets/{markdown-content-CnNrPGcY.js.map → markdown-content-BGl9PFVi.js.map} +1 -1
- package/dist/shell-source-maps/assets/{members-page-CnxFoeyp.js.map → members-page-CEB-Wkl8.js.map} +1 -1
- package/dist/shell-source-maps/assets/{messages-BHPGrBhJ.js.map → messages-Ce8dRRRN.js.map} +1 -1
- package/dist/shell-source-maps/assets/nl-B0dpIbbz.js.map +1 -0
- package/dist/shell-source-maps/assets/{organization-page-B6k9pMkb.js.map → organization-page-CTxtblmm.js.map} +1 -1
- package/dist/shell-source-maps/assets/organizations-page-DeNhUQDU.js.map +1 -0
- package/dist/shell-source-maps/assets/parse-worker-VaelBbE0.js.map +1 -0
- package/dist/shell-source-maps/assets/{pending-invitation-row-D_vU7ynw.js.map → pending-invitation-row-BMp0ZxE8.js.map} +1 -1
- package/dist/shell-source-maps/assets/{period-chart-DPlEbvX7.js.map → period-chart-BDqtO8mc.js.map} +1 -1
- package/dist/shell-source-maps/assets/{person-row-DMY-aQjx.js.map → person-row-DRqtbPma.js.map} +1 -1
- package/dist/shell-source-maps/assets/{public-form-page-DTgXLDpt.js.map → public-form-page-XgK3-Nzh.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-lines-SeXhFNSm.js.map → record-lines-DdN5hlI_.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-map-BiLFEqYi.js.map → record-map-sOmjX80D.js.map} +1 -1
- package/dist/shell-source-maps/assets/record-opens-DLfbC3xo.js.map +1 -0
- package/dist/shell-source-maps/assets/{record-page-TxDSHcMe.js.map → record-page-BntRofCL.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-preview-J1o4Sqs-.js.map → record-preview-QMV2lW2j.js.map} +1 -1
- package/dist/shell-source-maps/assets/{records-map-Cwdig5mb.js.map → records-map-DgTxGcbC.js.map} +1 -1
- package/dist/shell-source-maps/assets/{render-node-BpHo-wre.js.map → render-node-CkL5Sgl_.js.map} +1 -1
- package/dist/shell-source-maps/assets/{reorder-button-CBOmzmhg.js.map → reorder-button-8yWv8J72.js.map} +1 -1
- package/dist/shell-source-maps/assets/{run-trace-view-1fk6kU1U.js.map → run-trace-view-BPvPw3Ko.js.map} +1 -1
- package/dist/shell-source-maps/assets/{runner-install-field-C_hTvogl.js.map → runner-install-field-CKP8E9ZO.js.map} +1 -1
- package/dist/shell-source-maps/assets/{runtime-update-8hRmQkq-.js.map → runtime-update-DGbf2Nmm.js.map} +1 -1
- package/dist/shell-source-maps/assets/{sheet-source-CD5hImgE.js.map → sheet-source-cKJfUaud.js.map} +1 -1
- package/dist/shell-source-maps/assets/{sign-in-policy-page-BQ8ck7Ar.js.map → sign-in-policy-page-Bty4Ih1x.js.map} +1 -1
- package/dist/shell-source-maps/assets/{start-block-queries-4uvupY9E.js.map → start-block-queries-x-gNbPt1.js.map} +1 -1
- package/dist/shell-source-maps/assets/{step-catalog-B2eQNTOp.js.map → step-catalog-CCAXc8kn.js.map} +1 -1
- package/dist/shell-source-maps/assets/{step-panel-BVdV2FNT.js.map → step-panel-jmfh86YA.js.map} +1 -1
- package/dist/shell-source-maps/assets/{timeline-display-BxihBkFH.js.map → timeline-display-CtxOHPoJ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{trash-5PpoeP3R.js.map → trash-CFCBxAWq.js.map} +1 -1
- package/dist/shell-source-maps/assets/{update-set-BnRA9YhA.js.map → update-set-BYNQUWVp.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-calendar-move-Bu9MSBcs.js.map → use-calendar-move-BytgRG51.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-display-rows-ERQ-vbki.js.map → use-display-rows-DGw9J73C.js.map} +1 -1
- package/dist/shell-source-maps/assets/use-my-invitations-BcMFAcXl.js.map +1 -0
- package/dist/shell-source-maps/assets/{use-paged-search-CcEitpWG.js.map → use-paged-search-CKcKKO6y.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-run-trace-CV461SQS.js.map → use-run-trace-BRwbwZcf.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-workflow-page-peSmP1Jq.js.map → use-workflow-page-DsD276W-.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-workflow-types-xM8CZO96.js.map → use-workflow-types-Bn24Chp-.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-canvas-CkKd9u0-.js.map → workflow-canvas-BKd_Yd0v.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-field-WovRhNaT.js.map → workflow-field-DyBaV6m5.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-graph-editor-DRZ2UtBp.js.map → workflow-graph-editor-B8RJ52_E.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-run-field-CrBAVhOq.js.map → workflow-run-field-CzluYhjs.js.map} +1 -1
- package/dist/shell-source-maps/assets/workflow-status-field-_umgNjK4.js.map +1 -0
- package/dist/shell-source-maps/assets/{workflow-workbench-D8vU7ifz.js.map → workflow-workbench-CqOI36Oy.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-D6luJ1k4.js +0 -34
- package/dist/shell/assets/board-display-plYPsh6z.js +0 -2
- package/dist/shell/assets/calendar-display-B3kFBd2k.js +0 -2
- package/dist/shell/assets/create-route-C4xN9aXd.js +0 -2
- package/dist/shell/assets/embedded-list-B_e_Quer.js +0 -3
- package/dist/shell/assets/export-worker-DuHOhIiP.js +0 -15
- package/dist/shell/assets/first-organization-page-Cijgw9tC.js +0 -2
- package/dist/shell/assets/import-table-dialog-yV9UTlBY.js +0 -2
- package/dist/shell/assets/invitations-page-FKTUQL8J.js +0 -2
- package/dist/shell/assets/list-page-CNhV2TuF.js +0 -4
- package/dist/shell/assets/members-page-CnxFoeyp.js +0 -2
- package/dist/shell/assets/messages-BHPGrBhJ.js +0 -2
- package/dist/shell/assets/organization-page-B6k9pMkb.js +0 -2
- package/dist/shell/assets/organizations-page-D33Ruydz.js +0 -2
- package/dist/shell/assets/parse-worker-BRxyLV_D.js +0 -35
- package/dist/shell/assets/public-form-page-DTgXLDpt.js +0 -2
- package/dist/shell/assets/record-page-TxDSHcMe.js +0 -3
- package/dist/shell/assets/render-node-BpHo-wre.js +0 -3
- package/dist/shell/assets/reorder-button-CBOmzmhg.js +0 -2
- package/dist/shell/assets/shared-protobase-ui-Tq2sgl9G.js +0 -1
- package/dist/shell/assets/sign-in-policy-page-BQ8ck7Ar.js +0 -2
- package/dist/shell/assets/start-block-queries-4uvupY9E.js +0 -2
- package/dist/shell/assets/step-catalog-B2eQNTOp.js +0 -2
- package/dist/shell/assets/timeline-display-BxihBkFH.js +0 -2
- package/dist/shell/assets/use-calendar-move-Bu9MSBcs.js +0 -2
- package/dist/shell/assets/use-my-invitations-CnAvjXV0.js +0 -2
- package/dist/shell/assets/workflow-status-field-DgjtbjlH.js +0 -2
- package/dist/shell/assets/workflow-workbench-D8vU7ifz.js +0 -4
- package/dist/shell-source-maps/assets/app-D6luJ1k4.js.map +0 -1
- package/dist/shell-source-maps/assets/en-BrEwbNhJ.js.map +0 -1
- package/dist/shell-source-maps/assets/export-worker-DuHOhIiP.js.map +0 -1
- package/dist/shell-source-maps/assets/first-organization-page-Cijgw9tC.js.map +0 -1
- package/dist/shell-source-maps/assets/nl-Dto12ewP.js.map +0 -1
- package/dist/shell-source-maps/assets/organizations-page-D33Ruydz.js.map +0 -1
- package/dist/shell-source-maps/assets/parse-worker-BRxyLV_D.js.map +0 -1
- package/dist/shell-source-maps/assets/record-opens-Ct9iF9FZ.js.map +0 -1
- package/dist/shell-source-maps/assets/use-my-invitations-CnAvjXV0.js.map +0 -1
- package/dist/shell-source-maps/assets/workflow-status-field-DgjtbjlH.js.map +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/graph-view-DZHMI-UQ.js","assets/rolldown-runtime-DFwUHQ4A.js","assets/react-CuiNlnus.js","assets/app-D3BCcbgE.js","assets/vendor-t7Q7QbPu.js","assets/app-xwgcmboV.css","assets/lib-xyflow-system-hojcPWkY.js","assets/lib-d3-interpolate-C7dFwq8w.js","assets/lib-d3-color-B6XHLQii.js","assets/lib-d3-selection-C1a5EtaJ.js","assets/lib-d3-drag-CUJR_Vab.js","assets/lib-d3-dispatch-Bjkn7q4t.js","assets/lib-d3-zoom-DuEhbOrX.js","assets/lib-d3-transition-CUMO2iZu.js","assets/lib-d3-timer-CduGpaSm.js","assets/lib-d3-ease-ouQSXgQM.js","assets/lib-xyflow-react-CuNAzocq.js","assets/lib-classcat-otpLnDWv.js","assets/lib-zustand-r6mNROKr.js","assets/lib-use-sync-external-store-D4s7MiFL.js","assets/lib-xyflow-react-DLioOiRN.css","assets/use-elk-u1Ql5AOs.js","assets/lib-elkjs-ylMkguT9.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
(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{$a as r,$c as i,$n as a,$o as o,$s as s,$t as c,As as l,At as u,B as d,Bo as f,Bs as p,C as m,Cc as h,Cn as g,Cs as _,D as v,Dl as y,Do as b,Ec as x,En as S,Es as C,F as w,Fa as T,Fl as E,Fn as ee,Fs as te,Ga as ne,Go as D,Gt as re,Hc as O,Hl as ie,Hs as ae,Ic as oe,In as se,Is as ce,Ji as le,Jn as ue,Jo as k,Jt as de,Ka as fe,Ko as A,Ln as pe,Lr as me,Ls as he,M as ge,Mt as _e,Nc as ve,Nt as ye,Ol as be,Os as xe,Pa as Se,Pl as Ce,Pn as we,Pr as Te,Ps as Ee,Pt as De,Qn as Oe,Qo as ke,Qs as Ae,R as je,Ri as Me,Rn as Ne,Rr as Pe,Rs as Fe,Si as Ie,Ss as j,Ts as Le,Ua as Re,Un as ze,Uo as Be,Us as Ve,V as He,Vc as M,Vr as Ue,Vs as We,Wa as N,Wo as Ge,Xc as Ke,Xo as qe,Xt as Je,Yc as Ye,Yi as Xe,Yn as Ze,Yo as P,Ys as Qe,Zi as $e,Zo as F,Zs as et,_ as tt,_a as nt,_n as rt,_t as it,ac as I,al as at,ao as ot,as as st,at as ct,b as lt,ba as ut,bi as dt,bs as ft,ca as pt,cc as mt,cl as ht,cn as gt,cr as L,dr as _t,ec as vt,es as yt,fl as bt,fo as xt,fr as R,ga as St,gi as Ct,gn as wt,gt as Tt,ha as Et,hn as Dt,i as Ot,ic as z,in as B,ir as kt,ja as At,js as jt,jt as Mt,k as Nt,ki as Pt,ks as Ft,lc as It,ln as Lt,lr as Rt,ls as zt,ma as Bt,ml as Vt,mn as Ht,mr as V,na as Ut,nc as Wt,nn as Gt,no as Kt,nr as qt,ns as H,on as Jt,or as Yt,os as Xt,pn as Zt,pr as U,qo as Qt,rl as $t,rn as en,ro as tn,rs as nn,s as rn,sc as W,sl as an,sn as on,sr as G,ta as sn,tn as cn,tr as ln,un,ur as dn,v as fn,vn as pn,vs as K,wa as mn,wn as hn,ws as gn,wt as _n,xa as vn,xs as yn,y as bn,yc as xn,yn as Sn,ys as q,zo as Cn,zs as wn}from"./app-D3BCcbgE.js";import{C as Tn,f as En,o as Dn,s as On}from"./vendor-t7Q7QbPu.js";import{C as kn,Ct as An,Dt as jn,Et as Mn,Mt as Nn,O as Pn,Ot as Fn,Q as In,St as Ln,Tt as Rn,X as zn,Z as Bn,_t as Vn,at as Hn,b as Un,ct as Wn,dt as Gn,ft as Kn,gt as qn,it as Jn,k as Yn,kt as Xn,l as Zn,lt as Qn,mt as $n,n as er,nt as tr,o as nr,ot as rr,rt as ir,st as ar,t as or,tt as sr,ut as cr,wt as lr,x as ur,xt as dr,y as fr}from"./embedded-list-6lQyJozS.js";import{t as pr}from"./circle-alert-ytReRN_c.js";import{t as mr}from"./page-header-Ddz2r5ic.js";import{n as hr,t as gr}from"./pending-invitation-row-BMp0ZxE8.js";import{n as _r,t as vr}from"./person-row-DRqtbPma.js";import{n as yr,t as br}from"./use-paged-search-CKcKKO6y.js";import{n as xr,t as Sr}from"./client-publisher-D39SlIhp.js";import{t as Cr}from"./copy-field-BoXXafL7.js";var wr={name:`at-sign`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]};wr.node;var Tr=M(wr),Er={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};Er.node;var Dr=M(Er),Or={name:`key-square`,size:24,node:[[`path`,{d:`M12.4 2.7a2.5 2.5 0 0 1 3.4 0l5.5 5.5a2.5 2.5 0 0 1 0 3.4l-3.7 3.7a2.5 2.5 0 0 1-3.4 0L8.7 9.8a2.5 2.5 0 0 1 0-3.4z`,key:`165ttr`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`m9.4 10.6-6.814 6.814A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814`,key:`1ubxi2`}]]};Or.node;var kr=M(Or),Ar={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};Ar.node;var jr=M(Ar),Mr={name:`plug-zap`,size:24,node:[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]],aliases:[`plug-zap-2`]};Mr.node;var Nr=M(Mr),Pr={name:`shield-user`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M6.376 18.91a6 6 0 0 1 11.249.003`,key:`hnjrf2`}],[`circle`,{cx:`12`,cy:`11`,r:`4`,key:`1gt34v`}]]};Pr.node;var Fr=M(Pr),Ir={name:`smartphone`,size:24,node:[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]};Ir.node;var Lr=M(Ir),Rr={name:`tablet`,size:24,node:[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]};Rr.node;var zr=M(Rr),Br=[`done`,`error`,`running`];ae(`TextField`,!1),ae(`NumberField`,!1),ae(`DateField`,!1),ae(`BooleanField`,!1),ae(`UrlField`,!1),ae(`ChipField`,!1);var Vr=new Set([`TextField`,`NumberField`,`DateField`,`BooleanField`,`UrlField`,`ChipField`]),Hr=e=>typeof e!=`string`&&!e.custom&&Vr.has(e.type),Ur=e=>typeof e==`string`||Hr(e)||!e.custom&&(e.type===`Link`||e.type===`Trans`||e.type===`Text`&&[`span`,`strong`,`em`].includes(String(e.props.as))),Wr=(e,t)=>e===`BooleanField`?t!==!0&&t!==!1:e===`NumberField`||e===`UrlField`?t==null:t==null||t===``,Gr=e=>typeof e==`object`&&e?JSON.stringify(e):String(e),Kr=(e,{locales:t,options:n},r)=>{let i=typeof e==`string`&&e!==``&&!Number.isNaN(Number(e))?Number(e):e;return typeof i==`number`?i.toLocaleString(t??r,n):String(i)},qr=(e,t,n)=>{let r=e instanceof Date?e:typeof e==`string`||typeof e==`number`?new Date(e):void 0;if(!r||Number.isNaN(r.getTime()))return``;if(t.format===`relative`)return n.relative(Math.round((n.now-r.getTime())/1e3));let{showDate:i=!0,showTime:a=!1,options:o}=t,s=t.locales??n.locale;if(i&&a)return r.toLocaleString(s,o);if(a)return r.toLocaleTimeString(s,o);let c=o??(typeof e==`string`&&e.length<=10?{timeZone:`UTC`}:void 0);return r.toLocaleDateString(s,c)},Jr=(e,t,n)=>e?t.valueLabelTrue??n.yes:t.valueLabelFalse??n.no,Yr=new Set([`http:`,`https:`,`mailto:`,`tel:`]),Xr=e=>{let t=e.replace(/^[\u0000- ]+/,``).replace(/[\t\n\r]/g,``),n=/^([A-Za-z][A-Za-z0-9+.-]*):/.exec(t)?.[1];return n===void 0?t.startsWith(`/`)||!t.includes(`:`)?e:void 0:Yr.has(`${n.toLowerCase()}:`)?e:void 0},Zr=({layout:e,cardWidth:t})=>({layout:e??`stack`,cardWidth:t??`2/3`}),Qr=e=>e==null||e===``?void 0:String(e),$r=(e,t)=>e<t?-1:+(e>t),ei=({nodes:e,edges:t,key:n,edgeKey:r,fields:i})=>{let a=new Map,o=new Map;for(let t of e){let e=Qr(t[n]);if(e===void 0||a.has(e))continue;let r=i.group===void 0?void 0:t[i.group],s=Qr(r);s!==void 0&&!o.has(s)&&o.set(s,{id:s,value:r}),a.set(e,{id:e,row:t,...s!==void 0&&{group:s}})}let s=t.flatMap(e=>{let t=r.map(t=>Qr(e[t])),n=t.includes(void 0)?void 0:t.length===1?t[0]:JSON.stringify(t),o=Qr(e[i.source]),s=Qr(e[i.target]);return n===void 0||o===void 0||s===void 0||!a.has(o)||!a.has(s)?[]:[{id:n,source:o,target:s,row:e}]});return{groups:[...o.values()].sort((e,t)=>$r(e.id,t.id)),nodes:[...a.values()].sort((e,t)=>$r(e.id,t.id)),edges:s.sort((e,t)=>$r(e.source,t.source)||$r(e.target,t.target)||$r(e.id,t.id))}},J=e(t(),1),Y=e(n(),1),ti=({model:e,items:t,name:n,label:r,variant:i,className:a})=>{let{views:o}=H(),s=An(e.name,void 0),c=Me(),[l,u]=(0,J.useState)(!1),d=o[e.name]?.actions?.find(e=>e.name===n);if(!d||d.run?.kind===`link`)return null;let f=t.map(t=>Ht(e,t)),p=f.filter(e=>s.verdictOn(d,e)!==`skip`);if(p.length===0)return null;let m=f.length-p.length,h=dr(`actionCount`,{label:r??d.label,count:p.length}),g=e=>s.runEach(d,p,m,e);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{size:`sm`,variant:i??d.variant??`secondary`,className:a,loading:s.running===n,onClick:()=>Mn(d)?u(!0):void g(),children:h}),l&&(0,Y.jsx)(Rn,{action:d,label:h,danger:i===`danger`||i===void 0&&jn(d),records:p.map(e=>e.record),names:p.map(t=>Ln(c(e,o[e.name],t.record,t.key))),onCancel:()=>u(!1),onConfirm:()=>{u(!1),g()},onSubmit:async e=>{u(!1),await g(e)}})]})},ni=({name:e,resource:t,label:n,variant:r,className:i,about:a,onRun:o})=>{let s=Yt(),c=lr(t??s?.model.name??``,e,t===void 0||t===s?.model.name?s:void 0,e=>o?.(n??e.label)),[l,u]=(0,J.useState)(!1);if(!c.action)return null;let d=n??c.action.label,f=r??c.action.variant??`secondary`;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{size:`sm`,variant:f,className:i,loading:c.running,disabled:!!c.blocked,title:c.blocked,"aria-label":a===void 0?void 0:`${d}: ${a}`,onClick:()=>Mn(c.action)?u(!0):void c.run(),children:d}),l&&(0,Y.jsx)(Rn,{action:c.action,label:d,danger:f===`danger`,records:c.record?[c.record]:[],onCancel:()=>u(!1),onConfirm:()=>{u(!1),c.run()},onSubmit:async e=>{await c.submit(e),u(!1)}})]})},ri=({node:e,className:t})=>{let n=B(e),r=_t(),i=r?.model;return i&&(n.resource===void 0||n.resource===i.name)?(0,Y.jsx)(ti,{...n,model:i,items:r.items,className:t}):(0,Y.jsx)(ni,{...n,className:t})},ii=({node:e,children:t,slots:n,className:r})=>{let{title:i,description:a}=B(e);return(0,Y.jsx)(R,{title:i,description:a,actions:n.actions,className:O(`h-full`,r),children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-3`,children:t})})},ai=({children:e,wrap:t=(e,t)=>(0,Y.jsx)(J.Fragment,{children:e},t)})=>{let n=_t();if(!n)return null;let{model:r,items:i,planned:a}=n;return i.map((n,o)=>{let s=r?{...Ht(r,n),...a&&{planned:a}}:{item:n},c=`key`in s?s.key:o;return t((0,Y.jsx)(qt,{value:s,row:{index:o,count:i.length},children:e}),c)})},oi=({children:e})=>(0,Y.jsx)(ai,{children:e}),si=({model:e,at:t,filter:n,sort:r,limit:i=12,title:a,description:o,empty:s,actions:c,children:l,className:u})=>{let d=cn(t),f=rt(e,{filter:n,sort:r,pageSize:i,enabled:!d}),p=d??f,m=d?d.rows:f.data?.items??[];return(0,Y.jsx)(R,{title:a,description:o,actions:c,className:u,children:p.isPending?(0,Y.jsx)(`div`,{className:`flex gap-3`,children:Array.from({length:3},(e,t)=>(0,Y.jsx)(z,{className:`h-24 w-56`},t))}):p.error?(0,Y.jsx)(V,{title:N(`couldNotLoad`),error:p.error}):m.length===0?(0,Y.jsx)(U,{children:s??N(`nothingYet`)}):(0,Y.jsx)(`ul`,{className:`relative -mx-4 flex snap-x gap-3 overflow-x-auto px-4 pb-1`,children:(0,Y.jsx)(Rt,{value:{model:e,items:m,...d&&{planned:!0}},children:(0,Y.jsx)(ai,{wrap:(e,t)=>(0,Y.jsx)(`li`,{className:`flex w-60 shrink-0 snap-start flex-col gap-2 rounded-lg border border-border bg-surface p-3`,children:e},t),children:l})})})})},ci=({node:e,at:t,children:n,slots:r})=>{let{resource:i,...a}=B(e),o=H().resources[i];return o?(0,Y.jsx)(si,{...a,model:o,...t!==void 0&&{at:t},actions:r.actions,children:n}):null},li=({node:e,slots:t,className:n})=>{let{resource:r,title:i,description:a,actions:o,span:s,className:c,...l}=B(e),{resources:u,views:d}=H(),f=u[r];return f?(0,Y.jsx)(R,{title:i,description:a,actions:t.actions,className:O(`h-full`,n),children:(0,Y.jsx)(Kn,{model:f,view:d[r],...l})}):null},ui=({model:e,query:t,className:n=`mt-4 border-t pt-4`,children:r})=>{let i=wt(e,t),a=i.isPending?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(z,{className:`h-4 w-1/2`}),(0,Y.jsx)(z,{className:`h-4 w-1/3`})]}):i.error?(0,Y.jsx)(V,{title:N(`couldNotLoad`),error:i.error}):i.data?(0,Y.jsx)(qt,{value:i.data,children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-3`,children:r})}):(0,Y.jsx)(U,{children:N(`nothingYet`)});return(0,Y.jsx)(`div`,{className:n,children:a})},di=e=>{if(typeof e!=`string`&&typeof e!=`number`)return;let t=typeof e==`number`?e:Date.parse(e);return Number.isNaN(t)?void 0:t},fi=e=>e==null?``:String(e),X=(e,t,n)=>n===0?0:(e-t)/n*100,pi=(e,t,n)=>{let r=new Map;for(let i of e){let e=di(i[t.start]);if(e===void 0)continue;let a=di(i[t.end]),o=Math.max(e,a??n),s=r.get(fi(i[t.lane]))??{value:i[t.lane],bars:new Map};r.set(fi(i[t.lane]),s);let c=s.bars.get(fi(i[t.bar]))??{value:i[t.bar],records:[]};s.bars.set(fi(i[t.bar]),c),c.records.push({record:i,start:e,end:o,open:a===void 0})}return r},mi=e=>{let t=[];for(let n of[...e].sort((e,t)=>e.start-t.start)){let e=t.find(e=>e.at(-1).end<=n.start);e?e.push(n):t.push([n])}return t},hi=(e,t,n)=>{let r=pi(e,t,n),i=[...r.values()].flatMap(e=>[...e.bars.values()].flatMap(e=>e.records));if(i.length===0)return{lanes:[],from:n,to:n};let a=Math.min(...i.map(e=>e.start)),o=Math.max(...i.map(e=>e.end)),s=o-a;return{lanes:[...r.entries()].map(([e,n])=>{let r=[...n.bars.entries()].map(([e,r])=>{let i=r.records.sort((e,t)=>e.start-t.start).map(({record:e,start:n,end:r,open:i})=>({record:e,value:e[t.color],start:n,end:r,open:i,left:X(n,a,s),width:X(r,a,s)-X(n,a,s)})),o=i[0].start,c=Math.max(...i.map(e=>e.end));return{key:e,value:r.value,lane:n.value,start:o,end:c,left:X(o,a,s),width:X(c,a,s)-X(o,a,s),segments:i}});return{key:e,value:n.value,rows:mi(r)}}),from:a,to:o}},gi=(e,t)=>{let n=e.end-e.start;return{left:X(t.start,e.start,n),width:n===0?100:(t.end-t.start)/n*100}},_i=6e4,vi=60*_i,Z=24*vi,yi=[5*_i,15*_i,30*_i,vi,3*vi,6*vi,12*vi,Z,2*Z,7*Z,14*Z,30*Z,90*Z,365*Z],bi=365*Z,xi=(e,t,n,r,i)=>Math.floor((t+i)/n)-Math.ceil((e+r)/n)+1,Si=(e,t,n=()=>0)=>{let r=t-e;if(r<=0)return{daily:!1,ticks:[]};let i=n(e),a=n(t),o=yi.find(n=>xi(e,t,n,i,a)<=6)??Math.ceil(r/5/bi)*bi,s=[];for(let c=Math.ceil((e+i)/o)*o;c<=t+a;c+=o){let a=c-n(c-i);a+n(a)===c&&a>=e&&a<=t&&s.push({at:a,left:X(a,e,r)})}return{daily:o>=Z,ticks:s}},Ci=e=>({lane:fi(e.lane),bar:e.key}),wi=(e,t)=>t?e.lanes.find(e=>e.key===t.lane)?.rows.flat().find(e=>e.key===t.bar)??null:null,Ti=(e,t)=>{let n=Object.fromEntries(new Intl.DateTimeFormat(`en-US`,{timeZone:t,hourCycle:`h23`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`}).formatToParts(e).map(e=>[e.type,e.value]));return Date.UTC(Number(n.year),Number(n.month)-1,Number(n.day),Number(n.hour),Number(n.minute))-Math.floor(e/6e4)*6e4},Ei=e=>e<8?`translate-x-0`:e>92?`-translate-x-full`:`-translate-x-1/2`,Di=({from:e,to:t,dated:n})=>{let r=n?`UTC`:pt(),i=e=>n?0:Ti(e,r),{daily:a,ticks:o}=Si(e,t,i);return(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`relative h-5 min-w-0 flex-1 border-b border-border text-xs text-muted-foreground tabular-nums`,children:o.map(e=>(0,Y.jsx)(`span`,{className:`absolute bottom-1 whitespace-nowrap ${Ei(e.left)}`,style:{left:`${e.left}%`},children:a?$e(e.at+i(e.at)):Ut(e.at,r)},e.at))})},Oi=(e,t,n)=>{let r=String(n),i=t?.waitingValues?.includes(r)??!1,a=t?.valueColors&&Object.hasOwn(t.valueColors,r)?t.valueColors[r]:void 0;return a!==void 0&&Vt(a)?{className:ke[a],striped:i}:{color:qn(e,t,n===void 0?null:n,-1),striped:i}},ki=e=>({...e.color!==void 0&&{backgroundColor:e.color},...e.striped&&{backgroundImage:`repeating-linear-gradient(-45deg, transparent 0 4px, color-mix(in srgb, var(--background) 55%, transparent) 4px 6px)`}}),Ai=({bar:e,field:t,hints:n})=>e.segments.map((r,i)=>{let a=Oi(t,n,r.value),{left:o,width:s}=gi(e,r);return(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:O(`absolute inset-y-0`,a.className),style:{left:`${o}%`,width:`${s}%`,...ki(a)}},i)}),ji=(e,t)=>t?le(e):Xe(e),Mi=(e,t,n,r,i)=>{let a=e.fields[t.start]?.type===`date`;return N(`timelineRange`,{from:ji(n,a),to:i?N(`timelineNow`):ji(r,a)})},Ni=(e,t,n,r)=>`${Ct(t.fields[r.color],e.value,n?.fields[r.color])}: ${Mi(t,r,e.start,e.end,e.open)}`,Pi=(e,t,n,r,i)=>{let a=e.segments.some(t=>t.open&&t.end===e.end);return[`${i??Ct(t.fields[r.bar],e.value,n?.fields[r.bar])}: ${Mi(t,r,e.start,e.end,a)}`,...e.segments.map(e=>Ni(e,t,n,r))].join(`; `)},Fi=`absolute inset-y-0 flex overflow-hidden rounded-sm ring-offset-1 ring-offset-background outline-none hover:ring-2 hover:ring-border-strong focus-visible:ring-2 focus-visible:ring-primary`,Ii=({bar:e,model:t,view:n,fields:r,point:i,choose:a})=>{let o=H().resources[t.fields[r.bar]?.relation?.resource??``],s=S(o??t,e.key,o!==void 0),c=Pi(e,t,n,r,o?s:void 0),l={onMouseEnter:()=>i.hover(e),onMouseLeave:()=>i.hover(null),onFocus:()=>i.focus(e),onBlur:()=>i.focus(null)},u={left:`${e.left}%`,width:`max(${e.width}%, 4px)`},d=(0,Y.jsx)(Ai,{bar:e,field:t.fields[r.color],hints:n?.fields[r.color]});if(!a)return(0,Y.jsx)(`span`,{role:`img`,tabIndex:0,"aria-label":c,style:u,className:Fi,...l,children:d});let f=a.chosen===e.key;return(0,Y.jsx)(Wt,{to:a.barTo(e.key),"aria-label":c,"aria-current":f?`true`:void 0,style:u,className:O(Fi,f&&`ring-2 ring-foreground`),...l,children:d})},Li=({shape:e,...t})=>{let{model:n,fields:r}=t,i=n.fields[r.lane];return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`div`,{className:`flex sm:pl-40`,children:(0,Y.jsx)(Di,{from:e.from,to:e.to,dated:n.fields[r.start]?.type===`date`})}),(0,Y.jsx)(`ul`,{className:`flex flex-col gap-3 sm:gap-2`,children:e.lanes.map(e=>(0,Y.jsxs)(`li`,{className:`flex flex-col gap-1 sm:flex-row sm:items-center`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 truncate text-sm font-medium sm:w-40 sm:shrink-0 sm:pr-3`,children:(0,Y.jsx)(Sn,{model:n,field:i,value:e.value})}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1 border-l border-border pl-px`,children:e.rows.map((e,n)=>(0,Y.jsx)(`div`,{className:`relative h-6 overflow-x-clip`,children:e.map(e=>(0,Y.jsx)(Ii,{bar:e,...t},e.key))},n))})]},e.key))})]})},Ri=({model:e,view:t,fields:n,value:r})=>{let i=Oi(e.fields[n.color],t?.fields[n.color],r);return(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:O(`inline-block size-3 shrink-0 rounded-sm`,i.className),style:ki(i)})},zi=({values:e,...t})=>{let n=t.model.fields[t.fields.color],r=(n.enumValues??[]).filter(t=>e.has(t));return(0,Y.jsx)(`ul`,{className:`flex flex-wrap gap-x-4 gap-y-1.5 text-xs text-muted-foreground`,children:r.map(e=>(0,Y.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(Ri,{...t,value:e}),Ct(n,e,t.view?.fields[t.fields.color])]},e))})},Bi=({bar:e,...t})=>{let{model:n,view:r,fields:i}=t;if(!e)return(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:N(`timelinePoint`)});let a=e.segments.some(t=>t.open&&t.end===e.end);return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Y.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:(0,Y.jsx)(Sn,{model:n,field:n.fields[i.bar],value:e.value})}),(0,Y.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:Mi(n,i,e.start,e.end,a)})]}),(0,Y.jsx)(`ul`,{className:`flex flex-col gap-0.5 text-xs text-muted-foreground`,children:e.segments.map((e,a)=>(0,Y.jsxs)(`li`,{className:`flex items-center gap-1.5 tabular-nums`,children:[(0,Y.jsx)(Ri,{...t,value:e.value}),Ct(n.fields[i.color],e.value,r?.fields[i.color]),`: `,Mi(n,i,e.start,e.end,e.open)]},a))})]})},Vi=500,Hi=(e,t,{filter:n=``,sort:r,fields:i,limit:a})=>({queryKey:[...Ye.list(t.name,n,r,a,`timeline`),i.join(`,`)],queryFn:async()=>{let o=[],s;do{let c=await e.list(t.name,{filter:n||void 0,orderBy:r,pageSize:Math.min(Vi,a-o.length),fields:i,etag:!1,...s&&{pageToken:s}});o.push(...c.items),s=c.nextPageToken||void 0}while(s&&o.length<a);return{rows:o.toReversed(),cut:s!==void 0}}}),Ui=(e,{enabled:t=!0,...n})=>Dn({...Hi(zt(),e,n),enabled:t,placeholderData:En}),Wi=({model:e,view:t,fields:n,readSort:r,at:i,filter:a,limit:o=he,title:s,description:c,empty:l,actions:u,className:d,choose:f,details:p})=>{let[m,h]=(0,J.useState)(null),[g,_]=(0,J.useState)(null),v=e=>e?Ci(e):null,y={hover:e=>h(v(e)),focus:e=>_(v(e))},b=cn(i),x=Ui(e,{filter:a,sort:r,fields:[...new Set([...Object.values(n),...e.primaryKey])],limit:o,enabled:!b}),S=b??x,C=b?b.rows:x.data?.rows??[],w=!b&&x.data?.cut===!0,T=hi(C,n,Date.now());return(0,Y.jsxs)(R,{title:s,description:c,actions:u,className:O(`h-full`,d),children:[(()=>{if(S.isPending)return(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:Array.from({length:3},(e,t)=>(0,Y.jsx)(z,{className:`h-6`},t))});if(S.error)return(0,Y.jsx)(V,{title:N(`couldNotLoad`),error:S.error});if(T.lanes.length===0)return(0,Y.jsx)(U,{children:l??N(`nothingYet`)});let r=new Set(C.map(e=>String(e[n.color])));return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Y.jsx)(zi,{model:e,view:t,fields:n,values:r}),(0,Y.jsx)(Li,{shape:T,model:e,view:t,fields:n,point:y,...f&&{choose:f}}),w&&(0,Y.jsx)(U,{children:N(`timelineCut`,{count:C.length})}),(0,Y.jsx)(`div`,{"aria-live":`polite`,children:(0,Y.jsx)(Bi,{bar:wi(T,m)??wi(T,g),model:e,view:t,fields:n})})]})})(),p]})},Gi=(e,t)=>e.type===`integer`?Number(t):t,Ki=({select:e,children:t,...n})=>{let{given:r,linkTo:i}=a(),o=r[e],s=t=>i({[e]:t}),c=n.model.fields[n.fields.bar],l=o===void 0?null:(0,Y.jsx)(vt,{name:e,children:(0,Y.jsx)(ui,{model:n.model,query:{filter:Vn(c,Gi(c,o),n.filter),sort:n.sort},children:t},o)});return(0,Y.jsx)(Wi,{...n,choose:{barTo:s,chosen:o},details:l})},qi=({node:e,at:t,slots:n,children:r,className:i})=>{let{className:a,resource:o,select:s,lane:c,bar:l,start:u,end:d,color:f,children:p,...m}=B(e),{resources:h,views:g}=H(),_=h[o];if(!_)return null;let v={...m,model:_,view:g[_.name],fields:{lane:c,bar:l,start:u,end:d,color:f},readSort:Fe(e),sort:wn(e),...t!==void 0&&{at:t},actions:n.actions,className:i};return s===void 0?(0,Y.jsx)(Wi,{...v}):(0,Y.jsx)(Ki,{...v,select:s,children:r})},Ji=({node:e,children:t})=>{let n=We(e),r=ln(),{resources:i}=H();if(!n||!r)return t;let a=r.given[n.param],o=n.resource===void 0?void 0:i[n.resource];return a===void 0||!o?null:(0,Y.jsx)(vt,{name:n.param,children:(0,Y.jsx)(ui,{model:o,query:{key:a},className:``,children:t},a)})},Yi=(0,J.lazy)(()=>Tn(()=>import(`./graph-view-DZHMI-UQ.js`).then(e=>({default:e.GraphView})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]))),Xi=(0,Y.jsx)(`div`,{className:`flex h-64 w-full items-center justify-center`,children:(0,Y.jsx)(It,{})}),Zi=({node:e,at:t,slots:n,children:r,className:i})=>{let a=B(e),o=c(e,t),s=ln(),l=o.nodes,u=o.edges,{label:d,group:f,status:p,source:m,target:h}=a,g=(0,J.useMemo)(()=>({label:d,source:m,target:h,...f!==void 0&&{group:f},...p!==void 0&&{status:p}}),[d,m,h,f,p]),_=JSON.stringify([l?.rows,u?.rows,g]),v=(0,J.useMemo)(()=>l&&u&&ei({nodes:l.rows,edges:u.rows,key:l.model.primaryKey[0],edgeKey:u.model.primaryKey,fields:g}),[_]);if(!l||!u||!v)return null;let y=l.error??u.error;if(y&&e.fallback)throw y;if(y)return(0,Y.jsx)(V,{title:N(`couldNotLoad`),error:y});if(l.isPending||u.isPending)return Xi;if(v.nodes.length===0)return(0,Y.jsx)(U,{children:a.empty??N(`nothingYet`)});let b=a.select,x=b!==void 0&&s?{chosen:s.given[b],linkTo:e=>s.linkTo({[b]:e})}:void 0;return(0,Y.jsxs)(`div`,{className:O(`flex flex-col gap-4 lg:flex-row`,i),children:[(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsx)(J.Suspense,{fallback:Xi,children:(0,Y.jsx)(Yi,{shape:v,nodes:l,edges:u,fields:g,props:a,...x&&{select:x},...a.node!==void 0&&{content:n.node}})})}),r.length>0&&x?.chosen!==void 0&&(0,Y.jsx)(`div`,{className:`min-w-0 lg:w-80 lg:shrink-0`,children:(0,Y.jsx)(Ji,{node:e,children:r})})]})},Q=Ke(`app/conversation`),Qi=({resource:e,field:t,values:n,placeholder:r})=>{let{resources:i}=H(),a=zt(),o=pn(),s=nn(e),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)();return!i[e]||!mn(s,`create`)?null:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[u!==void 0&&(0,Y.jsx)(V,{title:Q(`notSent`),error:u}),(0,Y.jsx)(_n,{onSend:async r=>{l(!0),d(void 0);let i=await a.create(e,{...n,[t]:r}).then(()=>!0,e=>(d(e),!1));return l(!1),i&&o(e),i},busy:c,placeholder:r})]})},$i=({node:e})=>{let{resource:t,field:n,values:r,placeholder:i}=B(e);return(0,Y.jsx)(Qi,{resource:t,field:n,values:r,placeholder:i})},ea=({node:e,children:t,className:n})=>{let{open:r}=B(e);return(0,Y.jsx)(`details`,{open:r,className:O(`[&[open]>summary]:mb-2`,n),children:t})},ta=({children:e,className:t})=>(0,Y.jsx)(`summary`,{className:O(`cursor-pointer font-medium`,t),children:e}),na=({node:e,className:t})=>{let{source:n,emptyText:r}=B(e),i=Lt(n);if(i.state===`missing`)return null;if(i.state===`loading`)return(0,Y.jsx)(z,{className:O(`h-24 w-full`,t)});if(i.value===null||i.value===void 0||i.value===``)return r?(0,Y.jsx)(`p`,{className:O(`text-sm text-muted-foreground`,t),children:r}):null;let a=String(i.value),o=Tt(a);return o?(0,Y.jsx)(`div`,{className:O(`flex flex-col gap-3`,t),children:o.map((e,t)=>(0,Y.jsx)(it,{source:e.lines,path:e.path,split:!0,className:`rounded-md border border-border`},`${t}-${e.path}`))}):(0,Y.jsx)(`pre`,{className:O(`overflow-x-auto whitespace-pre-wrap break-words rounded-md border border-border bg-background p-3 font-mono text-[0.6875rem] leading-[18px]`,t),children:a})},ra=e=>e==null?``:typeof e==`object`?JSON.stringify(e):String(e),ia=(e,t)=>{if(t)return t;let n=e.split(`.`).map(e=>ht(e).toLowerCase()).join(` `);return n[0].toUpperCase()+n.slice(1)},aa=({node:e,className:t})=>{let{source:n,label:r,format:i}=B(e),{views:a}=H(),o=Lt(n);if(o.state===`missing`)return null;let s=o.state===`loading`?(0,Y.jsx)(z,{className:`h-4 w-24`}):o.state===`plain`?ra(o.value):(0,Y.jsx)(Sn,{model:o.model,field:o.field,value:o.value,format:i});if(r===!1)return(0,Y.jsx)(`div`,{className:t,children:s});let c=r??ia(n,o.state===`ready`?a[o.model.name]?.fields[o.field.name]?.label:void 0);return(0,Y.jsxs)(`div`,{className:O(`min-w-0`,t),children:[(0,Y.jsx)(`div`,{className:`text-body text-muted-foreground`,children:c}),(0,Y.jsx)(`div`,{className:`mt-0.5 truncate`,children:s})]})},oa={1:``,2:`md:grid-cols-2`,3:`md:grid-cols-2 xl:grid-cols-3`,4:`sm:grid-cols-2 xl:grid-cols-4`},sa={1:``,2:`grid-cols-2`,3:`grid-cols-2 xl:grid-cols-3`,4:`grid-cols-2 xl:grid-cols-4`},ca={1:``,2:`md:col-span-2`,3:`md:col-span-2 xl:col-span-3`,4:`sm:col-span-2 md:col-span-2 xl:col-span-4`},la=e=>typeof e==`object`&&!e.custom&&e.type===`Stat`,ua=({node:e,children:t,className:n})=>{let{columns:r=2}=B(e),i=e.children,a=i.length>0&&i.every(la);return(0,Y.jsx)(`div`,{className:O(`grid grid-cols-1 gap-4`,a?sa[r]:oa[r],n),children:t.map((e,t)=>{let n=i[t],r=typeof n==`object`?n.props.span:void 0;return(0,Y.jsx)(`div`,{className:O(`min-w-0`,r&&ca[r]),children:e},t)})})},da=({src:e,alt:t,width:n,height:r,className:i})=>(0,Y.jsx)(`img`,{src:e,alt:t??``,width:n,height:r,className:i??`max-w-full`}),fa=({width:e,height:t,space:n,theme:r})=>{let i=e??Math.ceil(n/100)*100;if(i!==0)return{width:String(i),...t!==void 0&&{height:String(t)},theme:r}},pa=e=>({staleTime:1/0,refetchOnWindowFocus:!1,...e!==void 0&&{refetchInterval:e*1e3}}),ma=e=>e instanceof Blob&&e.type.startsWith(`image/`),ha=e=>{let[t,n]=(0,J.useState)();return(0,J.useEffect)(()=>{if(!e)return n(void 0);let t=URL.createObjectURL(e);return n(t),()=>URL.revokeObjectURL(t)},[e]),t},ga=e=>{let[t,n]=(0,J.useState)();return[t!==void 0&&t===e,()=>n(e)]},_a=({name:e,alt:t,width:n,height:r,refresh:i,className:a})=>{let o=zt(),{theme:s}=T(),[c,l]=ct(),u=fa({width:n,height:r,space:l,theme:s}),d=Dn({queryKey:Ye.image(e,u??{}),enabled:u!==void 0,placeholderData:En,...pa(i),queryFn:async()=>{let t=await o.invoke(e,{query:u,cache:`no-store`});if(!ma(t))throw Error(`The function "${e}" answered no picture`);return t}}),f=ha(d.data),[p,m]=ga(f),h={...n!==void 0&&{width:n},...r!==void 0&&{height:r}};return(0,Y.jsx)(`div`,{ref:c,className:O(`min-w-0`,a),children:d.isError||p?t&&(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:t}):f?(0,Y.jsx)(`img`,{src:f,alt:t??``,onError:m,style:h,className:n===void 0?`w-full max-w-full object-contain`:`max-w-full object-contain`}):(0,Y.jsx)(z,{className:`w-full max-w-full`,style:{height:r??160,...n!==void 0&&{width:n}}})})},va=({node:e,className:t})=>{let n=B(e);return n.src===void 0?(0,Y.jsx)(_a,{name:n.function,alt:n.alt,width:n.width,height:n.height,refresh:n.refresh,className:t}):(0,Y.jsx)(da,{src:n.src,alt:n.alt,width:n.width,height:n.height,className:t})},ya=e=>function({node:t,className:n}){let r=B(t),{views:i}=H(),a=Lt(r.source);return a.state===`missing`?null:a.state===`loading`?(0,Y.jsx)(z,{className:`inline-block h-3 w-16 align-middle`}):Wr(t.type,a.value)?r.emptyText?(0,Y.jsx)(`span`,{className:n,children:r.emptyText}):null:a.state===`plain`?(0,Y.jsx)(`span`,{className:n,children:e({value:a.value,field:void 0,hints:void 0,props:r})}):(0,Y.jsx)(`span`,{className:n,children:e({value:a.value,field:a.field,hints:i[a.model.name]?.fields[a.field.name],props:r})})},ba=({value:e,field:t,hints:n})=>t?.type===`enum`&&typeof e==`string`?an(e,n?.valueLabels):Gr(e),xa=ya(ba),Sa=ya(({value:e,props:t})=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Kr(e,t,i())})),Ca=ya(({value:e,props:t})=>{let n=qr(e,t,{locale:i(),now:Date.now(),relative:sn});return(0,Y.jsx)(`time`,{dateTime:String(e),children:n})}),wa=ya(({value:e,props:t})=>{let n=Jr(e,t,{yes:Pt(`yes`),no:Pt(`no`)});return e?(0,Y.jsx)(ze,{label:n,className:`align-middle`}):(0,Y.jsx)(`span`,{className:`text-faint-foreground`,children:n})}),Ta=ya(({value:e,props:t})=>{let n=String(e),r=t.content??n,i=Xr(n);return i===void 0?r:(0,Y.jsx)(`a`,{href:i,className:`font-medium text-primary-text hover:underline`,.../^https?:/i.test(i)&&{target:`_blank`,rel:`noreferrer`},children:r})}),Ea=ya(e=>(0,Y.jsx)(hn,{value:e.value,hints:e.hints,children:ba(e)})),Da=`font-medium text-primary-text hover:underline`,Oa=({node:e,children:t,className:n})=>{let r=B(e),i={...L(G()),params:Oe()},a=r.variant?O(mt({variant:r.variant}),n):n??Da,o=e.children.some(e=>typeof e!=`string`||e.trim()!==``)?t:void 0;if(r.to){let e=Ce(r.to,Le(i));return(0,Y.jsx)(me,{to:e,className:a,children:o??Qe(e)})}let s=r.href??``;return(0,Y.jsx)(`a`,{href:s,className:a,...s.startsWith(`http`)&&{target:`_blank`,rel:`noreferrer`},children:o??s})},ka=(e,t,n)=>Object.fromEntries(t.map(t=>{let r=e.fields[t];if(r.type===`file`)return[t,n?.[t]??null];if(n)return[t,r.type===`boolean`?!!n[t]:v(n[t])];let i=r.default&&`value`in r.default?r.default.value:void 0;return[t,r.type===`boolean`?!!i:v(i)]})),Aa=(e,t,n)=>Object.fromEntries(Object.entries(t).flatMap(([t,r])=>{let i=e.fields[t];return rn(r)?r.key===v(n[t])?[]:[[t,i.type===`integer`?Number(r.key):r.key]]:m(i,r,n[t])?[[t,Nt(i,r)]]:[]})),ja=({model:e,record:t,mode:n,label:r,title:i,fields:a,values:o,onClose:s})=>{let{resources:c,views:l}=H(),u=zt(),d=Se(),f=pn(),p=l[e.name],[m,h]=(0,J.useState)(()=>ka(e,a,t?.record)),[g,_]=(0,J.useState)({}),[v,y]=(0,J.useState)(0),b=tt(v),[x,S]=(0,J.useState)(),[C,w]=(0,J.useState)(!1),[T,E]=(0,J.useState)(!1);Ae(T||C,`input-lost`);let ee=async()=>{w(!0),S(void 0),await(n===`create`?u.create(e.name,{...Ot(e,c,m),...o}):u.update(e.name,t.key,Aa(e,m,t.record),t.etag??`*`)).then(async()=>{await f(e.name),d.show({state:`success`,title:N(`saved`,{label:i??r})}),s()},e=>{let t=fn(e);_(t),Object.keys(t).length>0&&y(e=>e+1),S(e)}),w(!1)};return(0,Y.jsx)(I,{title:i??r,onClose:s,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{onClick:s,children:N(`cancel`)}),(0,Y.jsx)(W,{variant:`primary`,loading:C,onClick:()=>void ee(),children:N(n===`create`?`create`:`save`)})]}),children:(0,Y.jsxs)(`form`,{ref:b,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),ee()},children:[x!==void 0&&Object.keys(g).length===0&&(0,Y.jsx)(V,{title:N(`notSaved`),error:x}),a.map(n=>{let r=e.fields[n],i=m[n],a=r.relation?c[r.relation.resource]:void 0,o=p?.fields[n]?.label??ht(n),s=g[n];return(0,Y.jsx)(je,{name:n,label:o,help:p?.fields[n]?.help,error:s&&bn(r,o,s),children:(0,Y.jsx)(lt,{field:r,hints:p?.fields[n],value:rn(i)?i.key:i,stored:t?.record[n],relationLabel:rn(i)?i.label:void 0,relationPicker:a?{target:a,view:l[a.name]}:void 0,invalid:!!g[n],resource:e.name,onChange:e=>{_(({[n]:e,...t})=>t),E(!0),h(t=>({...t,[n]:e}))}})},n)})]})})},Ma=({model:e,recordKey:t,children:n})=>{let r=wt(e,{key:t});return(0,Y.jsx)(Y.Fragment,{children:n(r.data??void 0)})},Na=({node:e})=>{let t=B(e),n=Yt(),{resources:r}=H(),i=r[t.resource??n?.model.name??``],a=nn(i?.name??``),[o,s]=(0,J.useState)(!1);if(!i||!(t.mode===`create`?mn(a,`create`):mn(a,`update`)&&n?.permissions?.update!==!1))return null;let c=e=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{size:`sm`,variant:t.variant??`secondary`,disabled:t.mode===`edit`&&!e,onClick:()=>s(!0),children:t.label}),o&&(0,Y.jsx)(ja,{...t,model:i,record:t.mode===`edit`?e:void 0,onClose:()=>s(!1)})]});return t.mode===`edit`&&t.recordKey!==void 0?(0,Y.jsx)(Ma,{model:i,recordKey:t.recordKey,children:c}):c(t.mode===`edit`?n:void 0)},Pa=({node:e,children:t,slots:n,className:r})=>{let{title:i,description:a,width:o}=B(e);return(0,Y.jsx)(`div`,{className:O(`flex-1`,r),children:(0,Y.jsxs)(`div`,{className:O(`flex flex-col gap-6 px-4 pb-16 pt-6 md:px-10 md:py-8`,o!==`full`&&`mx-auto max-w-[1200px]`),children:[(0,Y.jsx)(mr,{title:i,subtitle:a,actions:n.actions}),t]})})},Fa=(e,t)=>{let n=G(),r=typeof e==`string`?kt(n,e):void 0,i=on(r&&`frame`in r?r.frame:void 0,r&&`path`in r?r.path:``);return typeof e==`number`?e:e===void 0?t:r&&`item`in r?Number(r.item):i.state===`ready`?Number(i.value):i.state===`loading`?void 0:NaN},Ia=({node:e,className:t})=>{let{value:n,max:r,label:a}=B(e),o=Fa(n,0),s=Fa(r,100);if(o===void 0||s===void 0)return(0,Y.jsx)(z,{className:`h-6 w-full`});if(!Number.isFinite(o)||!Number.isFinite(s))return null;let c=s>0?Math.min(1,Math.max(0,o/s)):0;return(0,Y.jsxs)(`div`,{className:O(`min-w-0`,t),children:[(0,Y.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-body`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:a}),(0,Y.jsxs)(`span`,{className:`tabular-nums`,children:[o.toLocaleString(i()),` / `,s.toLocaleString(i())]})]}),(0,Y.jsx)(`div`,{role:`progressbar`,"aria-label":a,"aria-valuenow":o,"aria-valuemin":0,"aria-valuemax":s,className:`mt-1.5 h-2 overflow-hidden rounded-full bg-muted`,children:(0,Y.jsx)(`div`,{className:c>=.9?`h-full rounded-full bg-warning`:`h-full rounded-full bg-primary`,style:{width:`${c*100}%`}})})]})},La=({model:e,at:t,filter:n,sort:r,recordKey:i,title:a,description:o,empty:s,actions:c,children:l,className:u})=>{let d=cn(t),f=wt(e,{filter:n,sort:r,key:i,enabled:!d}),p=d?Zt(e,d):f,m=e=>p.data?(0,Y.jsx)(qt,{value:p.data,children:e}):void 0,h=p.isPending?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(z,{className:`h-4 w-1/2`}),(0,Y.jsx)(z,{className:`h-4 w-1/3`})]}):p.error?(0,Y.jsx)(V,{title:N(`couldNotLoad`),error:p.error}):p.data?m((0,Y.jsx)(`div`,{className:`flex flex-col gap-3`,children:l})):(0,Y.jsx)(U,{children:s??N(`nothingYet`)});return(0,Y.jsx)(R,{title:a,description:o,actions:c?m(c):void 0,className:O(`h-full`,u),children:h})},Ra=({node:e,at:t,children:n,slots:r,className:i})=>{let{resource:a,filter:o,sort:s,recordKey:c,title:l,description:u,empty:d}=B(e),f=H().resources[a];return f?(0,Y.jsx)(La,{model:f,...t!==void 0&&{at:t},filter:o,sort:s,recordKey:c,title:l,description:u,empty:d,actions:r.actions,className:i,children:n}):null},za=Ke(`app/related-cards`),Ba=({children:e})=>{let t=(0,J.useRef)(null),[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(!1);return(0,J.useLayoutEffect)(()=>{let e=t.current;if(!e)return;let n=()=>a(e.scrollHeight>e.parentElement.clientHeight+1);n();let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[n]),(0,Y.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[(0,Y.jsx)(`div`,{className:O(`w-full min-w-0`,!n&&`max-h-40 overflow-hidden`),children:(0,Y.jsx)(`div`,{ref:t,children:e})}),(i||n)&&(0,Y.jsx)(W,{size:`sm`,variant:`ghost`,className:`-ml-2`,"aria-expanded":n,onClick:()=>r(!n),children:za(n?`showLess`:`showMore`)})]})},Va=e=>e==null||e===``,Ha=({scope:e,path:t,labelled:n=!0,clamped:r=!1})=>{let{views:i}=H(),a=on(e,t);if(a.state===`missing`||a.state===`ready`&&Va(a.value))return null;let o=a.state===`loading`?(0,Y.jsx)(z,{className:`h-4 w-24`}):(0,Y.jsx)(Sn,{model:a.model,field:a.field,value:a.value}),s=r?(0,Y.jsx)(Ba,{children:o}):o;if(!n)return(0,Y.jsx)(`div`,{className:`min-w-0`,children:s});let c=ia(t,a.state===`ready`?i[a.model.name]?.fields[a.field.name]?.label:void 0);return(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`dt`,{className:`text-body text-muted-foreground`,children:c}),(0,Y.jsx)(`dd`,{className:`mt-0.5`,children:s})]})},Ua=({scope:e,view:t,fields:n,time:r,tone:i,actions:a,button:o,onActed:s})=>{let c=Me(),{resources:l}=H(),u=c(e.model,t,e.record,e.key),d=a.length>0||o!==void 0;return(0,Y.jsxs)(`li`,{"data-card":e.key,className:O(`relative grid min-w-0 items-center gap-x-4 gap-y-1 rounded-lg border border-border bg-surface px-4 py-2.5`,d?`grid-cols-[minmax(0,1fr)_auto]`:`grid-cols-[minmax(0,1fr)]`),children:[i&&(0,Y.jsx)(de,{view:t,field:i,record:e.record}),(0,Y.jsxs)(`div`,{className:O(`flex min-w-0 items-baseline gap-2`,d&&`col-span-2 sm:col-span-1`),children:[(0,Y.jsx)(me,{to:{kind:`record`,resource:e.model.name,key:vn(e.model,e.record)},className:`line-clamp-2 min-w-0 font-medium [overflow-wrap:anywhere] text-primary-text hover:underline`,children:u}),r&&(0,Y.jsx)(`div`,{className:`ml-auto shrink-0 text-body whitespace-nowrap text-muted-foreground empty:hidden`,children:(0,Y.jsx)(Ha,{scope:e,path:r,labelled:!1})})]}),n.length>0&&(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-y-0.5 text-body text-muted-foreground`,children:n.map(t=>(0,Y.jsx)(`div`,{className:`flex max-w-full min-w-0 items-center whitespace-nowrap empty:hidden [&>div]:truncate [:not(:empty)~&]:before:mx-2 [:not(:empty)~&]:before:content-['·'_/_'']`,children:(0,Y.jsx)(Ha,{scope:e,path:t,labelled:!1})},t))}),d&&(0,Y.jsx)(qt,{value:e,children:(0,Y.jsxs)(`div`,{className:`col-start-2 flex flex-wrap items-center justify-end gap-2 sm:row-span-2 sm:row-start-1`,children:[o&&(0,Y.jsx)(sr,{button:o,model:e.model,view:t,record:e.record,models:l}),a.map(e=>(0,Y.jsx)(ni,{name:e,about:u,onRun:e=>s?.(e,u)},e))]})})]})},Wa=({scope:e,view:t,fields:n,tone:r,actions:i,button:a,onActed:o})=>{let s=Me(),{resources:c}=H(),l=s(e.model,t,e.record,e.key);return(0,Y.jsxs)(`li`,{"data-card":e.key,className:`relative flex min-w-0 flex-col gap-3 rounded-lg border border-border bg-surface p-4`,children:[r&&(0,Y.jsx)(de,{view:t,field:r,record:e.record}),(0,Y.jsx)(me,{to:{kind:`record`,resource:e.model.name,key:vn(e.model,e.record)},className:`self-start font-medium text-primary-text hover:underline`,children:l}),n.length>0&&(0,Y.jsx)(`dl`,{className:`flex flex-col gap-3`,children:n.map(t=>(0,Y.jsx)(Ha,{scope:e,path:t,clamped:!0},t))}),(i.length>0||a)&&(0,Y.jsx)(qt,{value:e,children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a&&(0,Y.jsx)(sr,{button:a,model:e.model,view:t,record:e.record,models:c}),i.map(e=>(0,Y.jsx)(ni,{name:e,about:l,onRun:e=>o?.(e,l)},e))]})})]})},Ga=e=>!e.disabled&&e.getAttribute(`aria-disabled`)!==`true`,Ka=e=>[...e.querySelectorAll(`button`)].find(Ga)??e.querySelector(`a`),qa=(e,t,n)=>{let r=e.indexOf(n),i=e=>t.includes(e);return e.slice(r+1).find(i)??e.slice(0,Math.max(r,0)).findLast(i)},Ja=e=>{let t=e.closest(`section`)?.querySelector(`h2`);return t&&!t.hasAttribute(`tabindex`)&&(t.tabIndex=-1),t},Ya=e=>{let t=(0,J.useRef)(null),n=(0,J.useRef)({current:e,previous:e}),r=(0,J.useRef)(void 0),[i,a]=(0,J.useState)(``),o=(e,n,i)=>{if(r.current=void 0,i.includes(e.key)||!t.current||(a(za(`left`,{action:e.action,title:e.title})),document.activeElement&&document.activeElement!==document.body))return;let o=qa(n,i,e.key),s=o===void 0?void 0:t.current.querySelector(`[data-card="${CSS.escape(o)}"]`);(s?Ka(s):Ja(t.current))?.focus()};return(0,J.useEffect)(()=>{let t=n.current.current;n.current={current:e,previous:t},r.current&&o(r.current,t,e)},[e]),{root:t,acted:(e,t,i)=>{let{current:a,previous:s}=n.current;if(a.includes(e)){r.current={key:e,action:t,title:i};return}o({key:e,action:t,title:i},s,a)},announcement:i}},Xa=({compact:e,limit:t})=>(0,Y.jsx)(`div`,{className:e?`flex flex-col gap-2`:`flex flex-col gap-3`,children:Array.from({length:e?Math.min(t,3):2},(t,n)=>(0,Y.jsx)(z,{className:e?`h-17.5 w-full max-sm:h-24`:`h-24 w-full`},n))}),Za=({model:e,view:t,filter:n,sort:r,fields:i,actions:a,button:o,limit:s,display:c,empty:l,carousel:u,compact:d,tone:p,planned:m})=>{let h=f(),g=cr(),_=t?.names?.plural??ht(e.name),v=r||nt(e,t),y=rt(e,{filter:n,sort:v,pageSize:s,enabled:!m}),b=Dt(e,n,!m),x=m?m.rows:{isPending:y.isPending,error:y.error},S=m?m.rows.rows:y.data?.items,C=m?{data:m.total&&!m.total.isPending&&!m.total.error?tr(m.total):void 0}:b,w=(0,J.useMemo)(()=>(S??[]).map(t=>Ht(e,t)),[e,S]),T=Ya((0,J.useMemo)(()=>w.map(e=>e.key),[w]));return(0,Y.jsxs)(`div`,{ref:T.root,children:[(()=>{if(x.isPending)return(0,Y.jsx)(Xa,{compact:!!d,limit:s});if(x.error)return(0,Y.jsx)(V,{title:za(`couldNotLoad`),error:x.error});if(w.length===0)return(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:l??za(`nothingYet`)});let r=w.map(e=>{let n=(t,n)=>T.acted(e.key,t,n);return d?(0,Y.jsx)(Ua,{scope:e,view:t,fields:i,time:d.time,tone:p,actions:a,button:o,onActed:n},e.key):(0,Y.jsx)(Wa,{scope:e,view:t,fields:i,tone:p,actions:a,button:o,onActed:n},e.key)}),f=C.data===void 0?void 0:Wn(w.length,C.data,!1);return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[u===void 0?(0,Y.jsx)(`ul`,{className:d?`flex flex-col gap-2`:`flex flex-col gap-3`,children:r}):(0,Y.jsx)(Gn,{scroll:g,label:_,share:u,children:r}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:f}),(0,Y.jsxs)(me,{to:rr(e,t,h,{filter:n,orderBy:v,display:ir(t,h,{preferred:c})}),className:`flex items-center gap-1 font-medium text-primary-text hover:underline`,children:[Qn(`viewAll`),` `,(0,Y.jsx)(`span`,{className:`sr-only`,children:_.toLowerCase()}),(0,Y.jsx)(Nn,{className:`size-3.5`,"aria-hidden":!0})]})]})]})})(),(0,Y.jsx)(`p`,{role:`status`,className:`sr-only`,children:T.announcement})]})},Qa={"1/4":1/4,"1/3":1/3,"1/2":1/2,"2/3":2/3},$a=({node:e,at:t,slots:n,className:r})=>{let i=B(e),{resource:a,filter:o=``,sort:s=``,fields:c,cardActions:l=[],limit:u=10,display:d,title:f,description:p,empty:m}=i,{layout:h,cardWidth:g}=Zr(i),{resources:_,views:v}=H(),[y,b]=Gt([t,t===void 0?void 0:`${t}#total`]),x=(0,J.useMemo)(()=>y&&{rows:y,total:b},[y,b]),S=_[a];if(!S)return null;let C=v[S.name];return(0,Y.jsx)(`section`,{className:O(`min-w-0`,r),"aria-label":f,children:(0,Y.jsx)(w,{title:f,help:p,actions:n.actions,children:(0,Y.jsx)(Za,{model:S,view:C,filter:o,sort:s,fields:c??$t(S,C),actions:l,limit:u,display:d,empty:m,carousel:h===`carousel`?Qa[g]:void 0,...x&&{planned:x}})})})},eo=({model:e,view:t,empty:n,...r})=>{let{resources:i,views:a}=H(),o=Ue(i,a,e.name),s=Pn(e.name,t.listOf,!0),c=(t.names?.plural??ht(e.name)).toLowerCase();if(!o.listOf)return null;if(s.error)return(0,Y.jsx)(V,{title:kn(`couldNotLoadYour`,{plural:c}),error:s.error});if(!s.data)return(0,Y.jsx)(z,{className:`h-24`});let l=Yn(o.model,s.data);return l?(0,Y.jsx)(ur,{...r,model:o.model,view:o.view,filter:``,scope:l,list:e.name,empty:n}):(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:n??kn(`noneYet`,{plural:c})})},to=({model:e,view:t,target:n,targetView:r,row:i})=>{let a=bt(vn(e,i)),{name:o,chips:s,title:c,body:l}=fr({model:e,of:t.searchesOf,target:n,targetView:r,row:i,recordKey:a});return(0,Y.jsxs)(`section`,{"aria-label":c,className:`flex flex-col gap-3 py-4 first:pt-0 last:pb-0`,children:[(0,Y.jsx)(`h3`,{className:`text-[0.9375rem] font-semibold`,children:(0,Y.jsx)(me,{to:{kind:`record`,resource:e.name,key:a},className:`hover:underline`,children:o??(0,Y.jsx)(zn,{chips:s})})}),(0,Y.jsx)(ur,{...l})]})},no=({model:e,view:t,empty:n})=>{let{resources:r,views:i}=H(),a=t.searchesOf,o=r[a.resource],s=Un(e.name,!0),c=(t.names?.plural??ht(e.name)).toLowerCase();return o?s.error?(0,Y.jsx)(V,{title:Bn(`couldNotLoadYour`,{plural:c}),error:s.error}):s.data?s.data.length===0?(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:n??Bn(`noneYet`,{plural:c})}):(0,Y.jsx)(`div`,{className:`flex flex-col divide-y`,children:s.data.map(n=>(0,Y.jsx)(to,{model:e,view:t,target:o,targetView:i[a.resource],row:n},bt(vn(e,n))))}):(0,Y.jsx)(z,{className:`h-40`}):null},ro=({node:e,slots:t,className:n})=>{let{resource:r,filter:i=``,sort:a,limit:o,display:s,title:c,description:l,empty:u}=B(e),{resources:d,views:f}=H(),p=d[r];if(!p)return null;let m=f[p.name];return(0,Y.jsx)(R,{title:c,description:l,actions:t.actions,className:n,children:m?.searchesOf?(0,Y.jsx)(no,{model:p,view:m,empty:u}):m?.listOf===void 0?(0,Y.jsx)(ur,{model:p,view:m,filter:i,sort:a,limit:o,display:s,empty:u}):(0,Y.jsx)(eo,{model:p,view:m,limit:o,display:s,empty:u})})},io=e=>e.type===`boolean`||e.type===`enum`,ao=({model:e,fields:t,title:n,description:r,stored:i,className:a})=>{let{resources:o,views:s}=H(),c=nn(e.name),l=zt(),u=Se(),d=pn(),f=s[e.name],[p,h]=(0,J.useState)(i),[g,_]=(0,J.useState)(()=>ka(e,t,i?.record)),[v,y]=(0,J.useState)({}),[b,x]=(0,J.useState)(),[S,C]=(0,J.useState)(!1),w=(0,J.useRef)(Promise.resolve()),T=(0,J.useRef)(i),E=ka(e,t,void 0),ee=p?mn(c,`update`)&&p.permissions?.update!==!1:mn(c,`create`),te=t.filter(t=>!io(e.fields[t])),ne=te.some(t=>p?m(e.fields[t],g[t],p.record[t]):g[t]!==E[t]),D=async t=>{let n=T.current;if(n){let r=await l.update(e.name,n.key,Aa(e,t,n.record),n.etag??`*`);return{...Ht(e,r.record),etag:r.etag,permissions:r.permissions??n.permissions}}let r=await l.create(e.name,Ot(e,o,{...E,...t}));return{...Ht(e,r.record),etag:r.etag}},re=t=>{let r=w.current.then(async()=>{C(!0),x(void 0),await D(t).then(async r=>{T.current=r,h(r),y(e=>Object.fromEntries(Object.entries(e).filter(([e])=>!Object.hasOwn(t,e)))),await d(e.name),u.show({state:`success`,title:N(`saved`,{label:n??N(`settings`)})})},e=>{y(t=>({...t,...fn(e)})),x(e)}),C(!1)});w.current=r},ie=(t,n)=>{_(e=>({...e,[t]:n})),io(e.fields[t])&&re({[t]:n})};return(0,Y.jsx)(R,{title:n,description:r,className:O(`h-full`,a),children:(0,Y.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),ne&&re(Object.fromEntries(te.map(e=>[e,g[e]])))},children:[b!==void 0&&Object.keys(v).length===0&&(0,Y.jsx)(V,{title:N(`notSaved`),error:b}),t.map(t=>{let n=e.fields[t],r=f?.fields[t]?.label??ht(t),i=v[t];return(0,Y.jsx)(je,{name:t,label:r,help:f?.fields[t]?.help,error:i&&bn(n,r,i),children:(0,Y.jsx)(lt,{field:n,hints:f?.fields[t],value:g[t],stored:p?.record[t]??E[t],invalid:!!i,locked:!ee||n.readOnly,resource:e.name,onChange:e=>ie(t,e)})},t)}),ee&&ne&&(0,Y.jsx)(`div`,{children:(0,Y.jsx)(W,{type:`submit`,variant:`primary`,size:`sm`,loading:S,children:N(`save`)})})]})})},oo=e=>{let t=wt(e.model,{});return t.isPending?(0,Y.jsx)(R,{title:e.title,description:e.description,className:e.className,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(z,{className:`h-4 w-1/2`}),(0,Y.jsx)(z,{className:`h-4 w-1/3`})]})}):t.error?(0,Y.jsx)(R,{title:e.title,description:e.description,className:e.className,children:(0,Y.jsx)(V,{title:N(`couldNotLoad`),error:t.error})}):(0,Y.jsx)(ao,{...e,stored:t.data??void 0})},so=({node:e,className:t})=>{let{resource:n,fields:r=[],className:i,...a}=B(e),o=H().resources[n];return o?(0,Y.jsx)(oo,{...a,model:o,fields:r.filter(e=>Object.hasOwn(o.fields,e)),stored:void 0,className:t}):null},co=(e,t)=>lo(e,t?[t]:[]),lo=(e,t)=>{let{resources:n}=H(),r=zt(),i=JSON.stringify(e),a=(0,J.useMemo)(()=>JSON.parse(i).map(ce),[i]),o=e=>t.some(t=>`item`in t?typeof t.item==`object`&&t.item!==null&&Object.hasOwn(t.item,e):Object.hasOwn(t.model.fields,e)),s=[...new Set(a.flatMap(e=>e.ok?e.paths:[]))],c=new Map(s.flatMap(e=>{let t=Ee(e,o);return t===void 0?[]:[[e,t]]})),l=s.filter(e=>!c.has(e)),u=[...new Set(c.values())].flatMap(e=>n[e]?[n[e]]:[]),d=l.map(e=>kt(t,e)),f=gt(l.map((e,t)=>{let n=d[t];return n&&`frame`in n?{scope:n.frame,path:n.path}:{scope:void 0,path:e}})),p=On({queries:u.map(e=>un(r,e))});return a.map(e=>{if(!e.ok)return!1;let t={};for(let n of e.paths){let e=c.get(n);if(e===void 0){let e=l.indexOf(n),r=d[e];if(r&&`item`in r){t[n]=r.item;continue}let i=f[e];if(i.state===`loading`)return;i.state===`ready`&&(t[n]=i.value);continue}let r=u.findIndex(t=>t.name===e);if(r===-1)t[n]=0;else if(p[r].isPending)return;else t[n]=p[r].data??0}return te(e,t)})},uo=(e,t)=>typeof e.props.fallback==`string`?e.props.fallback:t.fallback,fo=({node:e,children:t,slots:n,className:r})=>{let{when:i}=B(e),[a]=lo([i],G());if(a===void 0)return null;let o=a?t:uo(e,n);return o==null?null:r===void 0?(0,Y.jsx)(Y.Fragment,{children:o}):(0,Y.jsx)(`div`,{className:r,children:o})},po=(e,t)=>e.flatMap(e=>typeof e==`string`?[]:[String(gn(e,L(t)).props.when)]),mo=({node:e,children:t,slots:n,className:r})=>{let i=G(),a=lo(po(e.children,i),i),o=a.findIndex(e=>e!==!1);if(o!==-1&&a[o]===void 0)return null;let s=o===-1?uo(e,n):t[o];return s==null?null:r===void 0?(0,Y.jsx)(Y.Fragment,{children:s}):(0,Y.jsx)(`div`,{className:r,children:s})},ho=({children:e})=>(0,Y.jsx)(Y.Fragment,{children:e}),go=`text-2xl font-semibold tracking-tight tabular-nums`,_o=({model:e,at:t,filter:n})=>{let{views:r}=H(),a=cn(t),o=Dt(e,n,!a),s=a??o;if(s.isPending)return(0,Y.jsx)(z,{className:`h-8 w-16`});if(s.error)return(0,Y.jsx)(`span`,{className:`text-danger-text`,children:N(`couldNotCount`)});let c=a?tr(a):o.data;return(0,Y.jsx)(me,{to:$n(r[e.name],e.name,n),className:`${go} hover:text-primary-text after:absolute after:inset-0 after:content-['']`,children:c.toLocaleString(i())})},vo=({field:e,format:t})=>{let n=Lt(e);return n.state===`loading`?(0,Y.jsx)(z,{className:`h-8 w-16`}):n.state===`missing`?null:n.state===`plain`?(0,Y.jsx)(`span`,{className:go,children:ra(n.value)}):(0,Y.jsx)(`span`,{className:go,children:(0,Y.jsx)(Sn,{model:n.model,field:n.field,value:n.value,format:t})})},yo=({node:e,at:t,className:n})=>{let{label:r,value:i,resource:a,filter:o,field:s,format:c,description:l}=B(e),{resources:u}=H(),d=a===void 0?void 0:u[a];return(0,Y.jsxs)(R,{className:O(`relative h-full`,n),bodyClassName:`flex flex-col`,children:[(0,Y.jsx)(`p`,{className:`text-muted-foreground break-words`,children:r}),(0,Y.jsxs)(`div`,{className:`mt-auto pt-1`,children:[i!==void 0&&(0,Y.jsx)(`span`,{className:go,children:i}),d&&(0,Y.jsx)(_o,{model:d,...t!==void 0&&{at:t},filter:o}),s!==void 0&&(0,Y.jsx)(vo,{field:s,format:c})]}),l&&(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:l})]})},bo=(e,t,n)=>{let r=f(),i=Jn(t),[a,o]=(0,J.useState)(()=>Hn(localStorage,i)),s=(0,J.useCallback)(e=>{o(e),ar(localStorage,i,e)},[i]);return[ir(e,r,{picked:a,preferred:n}),s]},xo=({model:e,items:t,columns:n,button:r,title:i,description:a,empty:o,actions:s,className:c})=>{let{resources:l,views:u}=H(),d=u[e.name],{fields:p}=At(),m=mn(nn(e.name),`update`),{go:h,href:g}=Pe(),_=f(),v=!Cn(),y=(0,J.useMemo)(()=>n?.map(Ft)??$t(e,d),[n,e,d]),b=(0,J.useMemo)(()=>Jt(e,d,y,{resources:l,views:u,fieldTypes:p}),[e,d,y,l,u,p]),x=(0,J.useMemo)(()=>_?en(n)(b):b,[_,n,b]),S=(0,J.useMemo)(()=>r?Zn(x,e,d,r,l,v):x,[x,e,d,r,l,v]),C=(0,J.useMemo)(()=>t.map(t=>({...t,id:ut(e,t)})),[t,e]),w=(0,J.useMemo)(()=>({total:C.length,rowAt:e=>C[e]}),[C]),T=nr({model:e,view:d,opens:void 0,resources:l,views:u,canUpdate:m}),E=e=>({href:g(e),onFollow:()=>h(e)});return(0,Y.jsx)(R,{title:i,description:a,actions:s,className:c,children:C.length===0?(0,Y.jsx)(U,{children:o??N(`nothingYet`)}):(0,Y.jsx)(In,{fit:!0,columns:S,source:w,latencyMs:0,onOpenRow:e=>h(T.address(e)),rowLink:e=>E(T.address(e)),rowActions:T.actions(E),rowNumbers:!1,selectable:!1})})},So=e=>{let t=_t();return t?.model?(0,Y.jsx)(xo,{...e,model:t.model,items:t.items}):null},Co=({model:e,view:t,filter:n=``,sort:r=``,columns:i,button:a,bulk:o,limit:s=10,display:c,title:l,description:u,empty:d,actions:f,className:p,chosen:m,planned:h})=>{let[g,_]=bo(t,`page:${e.name}:${l??``}:${n}`,c),v=m?y:g,b=(0,J.useMemo)(()=>i?.map(Ft),[i]),x=(0,J.useMemo)(()=>en(i),[i]);return(0,Y.jsxs)(R,{title:l,description:u,actions:(0,Y.jsxs)(Y.Fragment,{children:[!m&&(0,Y.jsx)(or,{view:t,value:v,onChange:_}),f]}),className:O(`h-full`,p),children:[(0,Y.jsx)(er,{model:e,view:t,filter:n,sort:r,columns:b,button:a,bulk:o,limit:s,display:v,empty:d,phoneColumns:x,...m&&{rowTo:m.rowTo,chosenKey:m.key},...h&&{planned:h}}),m?.details]})},wo=({node:e,at:t,slots:n,children:r,className:i})=>{let{className:a,resource:o,select:s,children:c,...l}=B(e),{resources:u,views:d}=H(),[f,p]=Gt([t,t===void 0?void 0:`${t}#total`]),m=(0,J.useMemo)(()=>f&&{rows:f,total:p},[f,p]);if(o===void 0)return(0,Y.jsx)(So,{...l,actions:n.actions,className:i});let h=u[o];return h?s===void 0?(0,Y.jsx)(Co,{...l,model:h,view:d[h.name],actions:n.actions,className:i,...m&&{planned:m}}):(0,Y.jsx)(To,{...l,model:h,view:d[h.name],actions:n.actions,className:i,select:s,...m&&{planned:m},children:r}):null},To=({select:e,children:t,...n})=>{let{given:r,linkTo:i}=a(),o=t=>i({[e]:t}),s=r[e],c=s===void 0?null:(0,Y.jsx)(vt,{name:e,children:(0,Y.jsx)(ui,{model:n.model,query:{key:s},children:t},s)});return(0,Y.jsx)(Co,{...n,chosen:{rowTo:o,key:s,details:c}})},Eo=({node:e,children:t,className:n})=>{let{tab:r,pathOf:i}=St(),{navigate:a}=s(),o=Et(e),c=Bt(o,r),l=e=>i(e===o[0]?.name?void 0:e);return(0,Y.jsxs)(`div`,{className:O(`flex flex-col gap-6`,n),children:[(0,Y.jsxs)(`select`,{"aria-label":N(`tabs`),value:c?.name??``,onChange:e=>a(l(e.target.value)),className:`h-9 rounded-md border border-border-strong bg-background px-2 font-medium md:hidden`,children:[!c&&(0,Y.jsx)(`option`,{value:``,disabled:!0}),o.map(e=>(0,Y.jsx)(`option`,{value:e.name,children:e.label},e.name))]}),(0,Y.jsx)(`nav`,{"aria-label":N(`tabs`),className:`hidden border-b md:block`,children:(0,Y.jsx)(`ul`,{className:`flex gap-1`,children:o.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsx)(et,{to:l(e.name),"aria-current":e===c?`page`:void 0,className:O(`-mb-px inline-flex h-9 items-center whitespace-nowrap border-b-2 px-3 font-medium transition-colors`,e===c?`border-foreground text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:e.label})},e.name))})}),c?(0,Y.jsx)(J.Fragment,{children:t[o.indexOf(c)]},c.name):(0,Y.jsx)(ne,{children:N(`noTab`,{name:r??``})})]})},Do=({children:e})=>(0,Y.jsx)(`div`,{className:`flex flex-col gap-6`,children:e}),Oo=e=>e===void 0?1/0:Date.parse(e),ko=(e,t)=>{let n=e=>e.more&&e.items.length>0?Oo(e.items.at(-1).time):-1/0,r=Math.max(n(e),n(t)),i=[],a=0,o=0;for(;a<e.items.length||o<t.items.length;){let n=o>=t.items.length||a<e.items.length&&Oo(e.items[a].time)>=Oo(t.items[o].time)?e.items[a++]:t.items[o++];if(Oo(n.time)<r)break;i.push(n)}return i},Ao=({value:e,hints:t,mark:n})=>{let r=an(e,t?.valueLabels);return n===`done`?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsx)(oe,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-success-text`}),r]}):n===`running`?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsx)(It,{hidden:!0,className:`size-3.5 shrink-0`}),r]}):n!==`error`&&dt(t?.valueColors,e)!==`red`?r:(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-danger-text`,children:[(0,Y.jsx)(pr,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),r]})},jo=({value:e})=>{let t=typeof e==`string`?we(e):e;return t===ee?(0,Y.jsx)(pe,{children:String(e)}):(0,Y.jsx)(se,{value:t})},Mo=({label:e,children:t})=>(0,Y.jsxs)(`div`,{className:`grid gap-1`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]}),No=({call:e,statusHints:t})=>{let[n,r]=(0,J.useState)(!1),i=(0,J.useId)(),a=e.status!==void 0&&(0,Y.jsx)(Ao,{value:e.status,hints:t,mark:e.state}),o=(0,Y.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:e.name}),s=e.input!==void 0||e.result!==void 0||e.error!==void 0;return(0,Y.jsxs)(`div`,{"data-tool-call":!0,className:`flex min-w-0 flex-col gap-1 pl-11 text-xs text-muted-foreground`,children:[s?(0,Y.jsxs)(W,{size:`sm`,variant:`ghost`,className:`-ml-2.5 self-start`,"aria-expanded":n,"aria-controls":i,onClick:()=>r(!n),children:[(0,Y.jsx)(ve,{"aria-hidden":!0,className:O(`size-3.5 transition-transform`,n&&`rotate-90`)}),o,a]}):(0,Y.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[o,a]}),n&&(0,Y.jsxs)(`div`,{id:i,className:`grid gap-2`,children:[e.input!==void 0&&(0,Y.jsx)(Mo,{label:Q(`callInput`),children:(0,Y.jsx)(jo,{value:e.input})}),e.result!==void 0&&(0,Y.jsx)(Mo,{label:Q(`callResult`),children:(0,Y.jsx)(jo,{value:e.result})}),e.error!==void 0&&(0,Y.jsx)(Mo,{label:Q(`callError`),children:(0,Y.jsx)(pe,{children:e.error})})]})]})},Po=(e,t)=>e.map(e=>({kind:`message`,row:e,time:typeof e[t]==`string`?e[t]:void 0})),Fo=e=>{if(typeof e==`object`&&e&&`id`in e){let{id:t,name:n}=e;return{id:String(t),...typeof n==`string`&&{name:n}}}return{id:String(e??``),...typeof e==`string`&&{name:e}}},Io=(e,{key:t,sender:n,text:r,status:i},a=Date.now())=>{let o=[],s;for(let c of[...e].reverse()){let e=c.time,l=s?.time!==void 0&&e!==void 0&&De(s.time,e);if(e!==void 0&&!l&&o.push({kind:`day`,key:`day:${c.kind===`call`?c.key:t(c.row)}`,label:ye(e,a)}),c.kind===`call`){o.push(c),s={author:void 0,time:e};continue}let{row:u}=c,d=n===void 0?void 0:Fo(u[n]),f=d?.id??``,p=i===void 0||u[i]==null||u[i]===``?void 0:String(u[i]);o.push({kind:`message`,key:t(u),...d&&{author:d},time:e,text:u[r]==null?``:String(u[r]),...p!==void 0&&{status:p},continued:l&&s?.author===f}),s={author:f,time:e}}return o},Lo=e=>Br.includes(e??``)?e:void 0,Ro=e=>e==null||e===``?void 0:String(e),zo=e=>`call:${JSON.stringify(e)}`,Bo=(e,t,n)=>{let r=Ro(e[n.status]),i=Lo(r),a=n.input===void 0?void 0:e[n.input],o=n.result===void 0?void 0:e[n.result],s=n.error===void 0?void 0:Ro(e[n.error]);return{kind:`call`,key:t,name:String(e[n.name]??``),time:typeof e[n.time]==`string`?e[n.time]:void 0,...r!==void 0&&{status:r},...i!==void 0&&{state:i},...a!=null&&{input:a},...o!=null&&{result:o},...s!==void 0&&{error:s}}},Vo=({planned:e,limit:t,expanded:n,expand:r,own:i})=>{if(!e)return i;let a=n&&!i.error&&i.pages<2&&(i.pages===0||i.hasNextPage),o={items:e.rows,labels:e.labels??{},hasNextPage:e.rows.length>=t,isFetchingNextPage:a,isFetchNextPageError:!1,isLoading:e.isPending};return n&&i.error&&i.pages===0?{...o,error:i.error,fetchNextPage:i.refetch,refetch:i.refetch}:n&&!a?i:{...o,error:e.error,fetchNextPage:r,refetch:r}},Ho=(e,{pageSize:t=50,enabled:n=!0,...r},i)=>{let[a,o]=(0,J.useState)(!1),s=Te(e,{...r,pageSize:t,enabled:n&&(!i||a)}),c=s.data?.pages.length??0,{hasNextPage:l,isFetchingNextPage:u,fetchNextPage:d,error:f}=s;return(0,J.useEffect)(()=>{i&&a&&!f&&c===1&&l&&!u&&d()},[i,a,f,c,l,u,d]),Vo({planned:i,limit:t,expanded:a,expand:()=>o(!0),own:{...s,pages:c}})},Uo=(e,t,n)=>{let{views:r}=H(),i=e?.model.name??``,a=Ho(i,{filter:e?.filter,orderBy:e&&p(e.fields.time),pageSize:t,enabled:e!==void 0},n);return e?{calls:a.items.map(t=>Bo(t,zo(vn(e.model,t)),e.fields)),hasNextPage:a.hasNextPage,isFetchingNextPage:a.isFetchingNextPage,list:a,statusHints:r[i]?.fields[e.fields.status]}:{calls:[],hasNextPage:!1,isFetchingNextPage:!1,list:a,statusHints:void 0}},Wo=e=>e.items.length>0?`messages`:e.error?`error`:e.isLoading?`loading`:`messages`,Go=(e,t)=>e.isLoading?t.loading:t.empty,Ko=e=>e.items.length>0&&!!e.error,qo=e=>e.isFetchNextPageError?()=>void e.fetchNextPage():()=>void e.refetch(),Jo=e=>{for(let t of e)t.hasNextPage&&t.fetchNextPage()},Yo=({model:e,filter:t,sender:n,time:r,text:i,status:a,limit:o=50,empty:s,working:c,calls:l,planned:d})=>{let{resources:f,views:m}=H(),h=ft(),_=h?.state.kind===`signed-in`?h.state.user.id:void 0,v=n===void 0?[]:[n],y=ue(f,m,e,v),b=Ho(e.name,{filter:t,orderBy:p(r),pageSize:o,labels:y},d?.messages),x=Uo(l,o,d?.calls),S=Wo(b);if(S===`error`)return(0,Y.jsx)(V,{title:Q(`couldNotLoad`),error:b.error,onRetry:qo(b)});if(S===`loading`)return(0,Y.jsx)(`div`,{className:`p-4`,children:(0,Y.jsx)(U,{children:Q(`loadingMessages`)})});let C=Ze(f,e,v,b.items,b.labels),w=ko({items:x.calls,more:x.hasNextPage},{items:Po(C,r),more:b.hasNextPage}),T=Io(w,{key:t=>String(vn(e,t)),sender:n,time:r,text:i,status:a}),E=a===void 0?void 0:m[e.name]?.fields[a],ee=e.fields[i]!==void 0&&Ie(e.fields[i],m[e.name]?.fields[i]),te=T.findLast(e=>e.kind===`message`&&e.author!==void 0&&e.author.id===_);return(0,Y.jsxs)(Y.Fragment,{children:[Ko(b)&&(0,Y.jsx)(`div`,{className:`shrink-0 p-2`,children:(0,Y.jsx)(V,{title:Q(`couldNotLoad`),error:b.error,onRetry:qo(b)})}),l&&x.list.error&&(0,Y.jsx)(`div`,{className:`shrink-0 p-2`,children:(0,Y.jsx)(V,{title:Q(`couldNotLoadCalls`),error:x.list.error,onRetry:qo(x.list)})}),(0,Y.jsx)(u,{length:w.length,followKey:te?.key,working:c,empty:Go(x.list,{loading:Q(`loadingMessages`),empty:s??Q(`noMessages`)}),onLoadEarlier:b.hasNextPage||x.hasNextPage?()=>Jo([b,x.list]):void 0,loadingEarlier:b.isFetchingNextPage||x.isFetchingNextPage,children:T.map(e=>e.kind===`day`?(0,Y.jsx)(_e,{label:e.label},e.key):e.kind===`call`?(0,Y.jsx)(No,{call:e,statusHints:x.statusHints},e.key):(0,Y.jsx)(Mt,{...e.author?{author:e.author}:{alone:!0},time:e.time,continued:e.continued,footer:e.status!==void 0&&(0,Y.jsx)(Ao,{value:e.status,hints:E}),children:ee&&e.text!==``?(0,Y.jsx)(g,{source:e.text,className:`whitespace-normal`}):e.text},e.key))})]})},Xo=({children:e})=>(0,Y.jsx)(`div`,{className:`flex h-[min(36rem,65dvh)] flex-col rounded-lg border border-border bg-background`,children:e}),Zo=({node:e,at:t,slots:n,className:r})=>{let{title:i,description:a,resource:o,filter:s,sender:c,time:l,text:u,status:d,working:f,calls:p,limit:m,empty:h}=B(e),{resources:g}=H(),[_]=lo(f===void 0?[]:[f],G()),[v,y]=Gt([t,t===void 0?void 0:`${t}#calls`]),b=g[o];if(!b)return null;let x=p&&g[p.resource];return(0,Y.jsx)(`section`,{className:O(`flex min-w-0 flex-col`,r),"aria-label":i,children:(0,Y.jsx)(w,{title:i,help:a,actions:n.actions,children:(0,Y.jsx)(Xo,{children:(0,Y.jsx)(Yo,{model:b,filter:s,sender:c,time:l,text:u,status:d,calls:p&&x&&{model:x,filter:p.filter,fields:p},limit:m,empty:h,working:f===void 0?void 0:_===!0,...(v||y)&&{planned:{messages:v,calls:y}}})})})})},Qo=({children:e,className:t})=>(0,Y.jsx)(`div`,{className:t,children:e}),$o=({children:e,className:t})=>(0,Y.jsx)(`div`,{className:O(`flex`,t),children:e}),es=({children:e,className:t})=>(0,Y.jsx)(`div`,{className:O(`flex flex-col`,t),children:e}),ts=({node:e,children:t,className:n})=>{let{as:r=`p`}=B(e);return(0,Y.jsx)(r,{className:n,children:t})},ns=({node:e,children:t})=>{let{source:n}=B(e),r=C(L(G()),n),i=(0,J.useMemo)(()=>({items:Array.isArray(r)?r:[]}),[r]);return(0,Y.jsx)(Rt,{value:i,children:t})},rs=({node:e,className:t})=>{let{source:n,choices:r,label:i=n,defaultValue:o}=B(e),{values:s,linkTo:c}=a(),l=s[n];return(0,Y.jsxs)(`div`,{className:O(`flex flex-wrap items-center gap-2`,t),children:[(0,Y.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:i}),r?(0,Y.jsx)(d,{label:i,value:l??``,options:r.map(e=>({value:String(e.id),label:e.name})),link:e=>c({[n]:o!==void 0&&e===String(o)?void 0:e})}):(0,Y.jsx)(`span`,{children:l})]})},is=({model:e,filter:t,perPage:n,more:r,planned:i,expanded:a,expand:o,own:s})=>{if(t===void 0)return{read:{isPending:!1,error:null},list:{model:e,items:[]}};if(i&&!a){let t=i.rows.slice(0,n),a=r&&t.length===n?o:void 0;return{read:i,list:{model:e,items:t,planned:!0,...a&&{loadMore:a}}}}if(i&&!s.error&&s.pages<2&&(s.pages===0||s.hasNextPage))return{read:i,list:{model:e,items:i.rows.slice(0,n),planned:!0,loadMore:()=>{},loadingMore:!0}};let c=r&&s.hasNextPage?()=>void s.fetchNextPage():void 0;return{read:{isPending:s.isPending,error:s.error},list:{model:e,items:s.items,...c&&{loadMore:c,loadingMore:s.isFetchingNextPage}}}},as=({model:e,filter:t,sort:n,perPage:r,more:i,planned:a})=>{let[o,s]=(0,J.useState)(!1),c=Te(e.name,{filter:t,orderBy:n,pageSize:r,enabled:t!==void 0&&(!a||o)}),l=c.data?.pages.length??0,{hasNextPage:u,isFetchingNextPage:d,fetchNextPage:f,error:p}=c;return(0,J.useEffect)(()=>{a&&o&&!p&&l===1&&u&&!d&&f()},[a,o,p,l,u,d,f]),is({model:e,filter:t,perPage:r,more:i,planned:a,expanded:o,expand:()=>s(!0),own:{pages:l,items:c.items,hasNextPage:u,isFetchingNextPage:d,isPending:c.isPending,error:p,fetchNextPage:f}})},os=({node:e,at:t,children:n})=>{let r=B(e),i=H().resources[r.reference],a=Le(L(G())),o=cn(t);return i?(0,Y.jsx)(ss,{model:i,...jt(r,i.primaryKey[0],a),more:r.pagination===`more`,empty:r.empty,...o&&{planned:o},children:n}):null},ss=({empty:e,children:t,...n})=>{let{read:r,list:i}=as(n);return(0,Y.jsx)(dn,{read:r,list:i,empty:e,children:t})},cs=({node:e,at:t,children:n})=>{let r=B(e),i=H().resources[r.reference],a=Le(L(G())),o=cn(t);return i?(0,Y.jsx)(ss,{model:i,...l(r,i.primaryKey[0],a),more:!1,empty:r.empty,...o&&{planned:o},children:n}):null},ls=({model:e,at:t,recordKey:n,link:r=`edit`,children:i,className:a})=>{let{views:o}=H(),s=cn(t),c=wt(e,{key:n,enabled:!s}),l=s?Zt(e,s):c;if(l.isPending)return(0,Y.jsx)(z,{className:`h-4 w-24`});if(l.error)return(0,Y.jsx)(V,{title:N(`couldNotLoad`),error:l.error});if(!l.data)return null;let u=i.length>0?(0,Y.jsx)(qt,{value:l.data,children:i}):at(e,o[e.name],l.data.record,n);return r===!1?(0,Y.jsx)(`span`,{className:a,children:u}):(0,Y.jsx)(me,{to:{kind:`record`,resource:e.name,key:n},className:a??`font-medium text-primary-text hover:underline`,children:u})},us=({node:e,at:t,children:n,className:r})=>{let{reference:i,source:a,link:o,empty:s}=B(e),c=H().resources[i],l=C(L(G()),a);return c?l==null||l===``?s===void 0?null:(0,Y.jsx)(`span`,{className:r,children:s}):(0,Y.jsx)(ls,{model:c,...t!==void 0&&{at:t},recordKey:String(l),link:o,className:r,children:n}):null},ds=(e,t)=>t.map(t=>r(e,t)).join(`, `),$=Ke(`users`),fs=({roles:e})=>{let{session:t}=q(),[n,r]=(0,J.useState)([]),[i,a]=(0,J.useState)([]),o=(0,J.useCallback)(()=>void t.users.invitations().then(a,()=>a([])),[t]);return(0,J.useEffect)(o,[o]),(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(hr,{title:$(`inviteSomeone`),description:$(`inviteDescription`),onInvite:async e=>{let i=await t.users.invite({email:e,roles:n});return r([]),o(),i},incomplete:n.length===0,children:(0,Y.jsx)(_r,{roles:e,selected:n,grantable:new Set(e.map(e=>e.name)),onChange:r})}),(0,Y.jsx)(k,{title:$(`notAcceptedYet`),description:i.length>0?$(`sendingAgain`):$(`nobodyWaiting`),children:i.length>0&&(0,Y.jsx)(`ul`,{className:`divide-y rounded-md border`,children:i.map(n=>(0,Y.jsx)(gr,{email:n.email,gives:ds(e,n.roles),expiresAt:n.expiresAt,onResend:async()=>{let e=await t.users.invite({email:n.email,roles:n.roles});return o(),e},onRevoke:async()=>{await t.users.revoke(n.id),o()}},n.id))})})]})},ps=({roles:e,onCreated:t})=>{let{session:n}=q(),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)([]),{busy:d,error:f,run:p}=fe(),m=()=>p(async()=>{await n.users.create({email:r.trim(),name:a.trim(),roles:l,...s&&{password:s}}),i(``),o(``),c(``),u([]),t()}),h=!r.trim()||!a.trim()||l.length===0||s!==``&&s.length<12;return(0,Y.jsxs)(k,{title:$(`addAnAccount`),description:$(`addDescription`),children:[(0,Y.jsx)(P,{message:f}),(0,Y.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,Y.jsx)(b,{"aria-label":$(`email`),type:`email`,placeholder:`name@example.com`,value:r,onChange:e=>i(e.target.value),wrapperClassName:`flex-1`}),(0,Y.jsx)(b,{"aria-label":$(`name`),placeholder:$(`name`),autoComplete:`off`,value:a,onChange:e=>o(e.target.value),wrapperClassName:`flex-1`})]}),(0,Y.jsx)(b,{"aria-label":$(`password`),type:`password`,autoComplete:`new-password`,placeholder:$(`passwordOptional`,{length:12}),value:s,onChange:e=>c(e.target.value)}),(0,Y.jsx)(_r,{roles:e,selected:l,grantable:new Set(e.map(e=>e.name)),onChange:u}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(W,{type:`submit`,variant:`primary`,loading:d,disabled:h,children:$(`addAccount`)})})]})]})},ms=({user:e,roles:t,self:n})=>{let{session:r}=q(),[i,a]=(0,J.useState)(e),{busy:o,error:s,run:c,setError:l}=fe(),u=e=>{if(e.length===0)return l($(`keepOneRole`));c(async()=>{await r.users.setRoles(i.id,e),a({...i,roles:e})})},d=e=>void c(async()=>{await(e?r.users.block(i.id):r.users.unblock(i.id)),a({...i,blocked:e})});return(0,Y.jsx)(vr,{name:i.name,email:i.email,self:n,error:s,actions:(0,Y.jsxs)(Y.Fragment,{children:[i.blocked&&(0,Y.jsx)(F,{tone:`red`,children:$(`blocked`)}),!n&&(i.blocked?(0,Y.jsx)(W,{size:`sm`,loading:o,onClick:()=>d(!1),children:$(`unblock`)}):(0,Y.jsx)(W,{size:`sm`,variant:`danger`,loading:o,onClick:()=>d(!0),children:$(`block`)}))]}),children:(0,Y.jsx)(_r,{roles:t,selected:i.roles,grantable:new Set(t.map(e=>e.name)),disabled:o,onChange:u})})},hs=({roles:e,version:t})=>{let{session:n,state:r}=q(),[i,a]=(0,J.useState)(``),o=(0,J.useCallback)((e,t)=>n.users.search(e,t).then(e=>({items:e.users,total:e.total})),[n,t]),s=br(o,i),c=r.kind===`signed-in`?r.user.id:void 0;return(0,Y.jsx)(yr,{title:$(`people`),description:$(`peopleDescription`),searchLabel:$(`findSomeone`),placeholder:$(`emailAddress`),query:i,onQuery:a,list:s,renderRow:n=>(0,Y.jsx)(ms,{user:n,roles:e,self:n.id===c},`${t}/${n.id}`)})},gs=()=>{let{session:e}=q(),[t,n]=(0,J.useState)([]),[r,i]=(0,J.useState)();return(0,J.useEffect)(()=>{e.users.roles().then(n,e=>i(e instanceof j?o(e):$(`couldNotReadRoles`)))},[e]),{roles:t,error:r}},_s=()=>{let{roles:e,error:t}=gs(),[n,r]=(0,J.useState)(0);return(0,Y.jsxs)(`div`,{className:`flex max-w-3xl flex-col gap-4`,children:[(0,Y.jsx)(P,{message:t}),(0,Y.jsx)(hs,{roles:e,version:n}),(0,Y.jsx)(fs,{roles:e}),(0,Y.jsx)(ps,{roles:e,onCreated:()=>r(e=>e+1)})]})},vs=({sender:e,busy:t,error:n,onSave:r,onClose:i})=>{let[a,o]=(0,J.useState)(e?.address??``),[s,c]=(0,J.useState)(e?.name??``),[l,u]=(0,J.useState)(e?.signature??``),[d,f]=(0,J.useState)(e?.isDefault??!1);return(0,Y.jsxs)(I,{title:e?e.address:K(`addFromAddress`),description:K(e?`changeFromAddressDescription`:`addFromAddressDescription`),onClose:i,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{onClick:i,children:K(`cancel`)}),(0,Y.jsx)(W,{variant:`primary`,loading:t,disabled:!a.trim(),onClick:()=>r({address:a.trim(),name:s.trim(),signature:l,isDefault:d}),children:K(e?`save`:`addAddress`)})]}),children:[!e&&(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[K(`fromAddress`),(0,Y.jsx)(b,{autoFocus:!0,type:`email`,value:a,maxLength:254,placeholder:K(`fromAddressPlaceholder`),onChange:e=>o(e.target.value)})]}),(0,Y.jsxs)(`label`,{className:`mt-3 flex flex-col gap-1.5 font-medium`,children:[K(`fromName`),(0,Y.jsx)(b,{value:s,maxLength:100,placeholder:K(`fromNamePlaceholder`),onChange:e=>c(e.target.value)})]}),(0,Y.jsxs)(`label`,{className:`mt-3 flex cursor-pointer items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{children:K(`defaultFromAddress`)}),(0,Y.jsx)(ge,{checked:d,onChange:f,label:K(`defaultFromAddress`)})]}),(0,Y.jsxs)(`label`,{className:`mt-3 flex flex-col gap-1.5 font-medium`,children:[K(`signature`),(0,Y.jsx)(Ne,{value:l,maxLength:2e3,placeholder:K(`signaturePlaceholder`),onChange:e=>u(e.target.value)})]}),(0,Y.jsx)(P,{message:n})]})},ys=e=>e.signature?K(`ownSignature`):K(`genericSignature`),bs=({senders:{address:e,senders:t},onAdd:n,onUpdate:r,onRemove:i})=>{let[a,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(),[u,d]=(0,J.useState)(),f=(0,J.useRef)(!1),p=t.find(e=>e.isDefault),m=()=>{d(void 0),l(void 0)},h=async e=>{if(!f.current){f.current=!0,s(!0),l(void 0);try{await e(),d(void 0)}catch(e){if(e instanceof TypeError)return l(K(`noAnswerFromServer`));if(!(e instanceof j))throw e;l(o(e))}finally{f.current=!1,s(!1)}}},g=e=>h(async()=>{let t=e.name||null,i=e.signature.trim()?e.signature:null;if(u?.kind===`change`)return r(u.sender.id,{name:t,signature:i,isDefault:e.isDefault});let a=await n({address:e.address,...t&&{name:t},...i&&{signature:i}});e.isDefault&&await r(a.id,{isDefault:!0})});return(0,Y.jsxs)(`div`,{className:`mt-5 border-t pt-4`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold`,children:K(`fromAddresses`)}),(0,Y.jsx)(`p`,{className:`mt-1 mb-3 text-muted-foreground`,children:K(`fromAddressesDescription`)}),(0,Y.jsx)(P,{message:u?void 0:c}),(e||t.length>0)&&(0,Y.jsxs)(`ul`,{className:`mb-3 divide-y rounded-md border`,children:[e&&(0,Y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,Y.jsx)(Tr,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`bdi`,{className:`block truncate font-medium`,children:e}),(0,Y.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:K(`mailboxOwnAddress`)})]}),p?(0,Y.jsx)(W,{size:`sm`,variant:`ghost`,loading:a,onClick:()=>void h(()=>r(p.id,{isDefault:!1})),children:K(`makeDefault`)}):(0,Y.jsx)(F,{tone:`blue`,children:K(`default`)})]}),t.map(e=>(0,Y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,Y.jsx)(Tr,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`bdi`,{className:`block truncate font-medium`,children:e.address}),e.name&&(0,Y.jsx)(`bdi`,{className:`block truncate`,children:e.name}),(0,Y.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:ys(e)})]}),e.isDefault&&(0,Y.jsx)(F,{tone:`blue`,children:K(`default`)}),(0,Y.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>d({kind:`change`,sender:e}),children:K(`edit`)}),(0,Y.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>d({kind:`remove`,sender:e}),children:K(`remove`)})]},e.id))]}),(0,Y.jsxs)(W,{onClick:()=>d({kind:`add`}),children:[(0,Y.jsx)(xn,{className:`size-3.5`}),K(`addFromAddress`)]}),u?.kind===`add`&&(0,Y.jsx)(vs,{busy:a,error:c,onSave:e=>void g(e),onClose:m}),u?.kind===`change`&&(0,Y.jsx)(vs,{sender:u.sender,busy:a,error:c,onSave:e=>void g(e),onClose:m},u.sender.id),u?.kind===`remove`&&(0,Y.jsx)(I,{title:K(`removeFromAddress`,{address:u.sender.address}),description:K(`removeFromAddressDescription`),onClose:m,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{onClick:m,children:K(`cancel`)}),(0,Y.jsx)(W,{variant:`danger`,loading:a,onClick:()=>void h(()=>i(u.sender.id)),children:K(`remove`)})]}),children:(0,Y.jsx)(P,{message:c})})]})},xs=(e,t,n)=>Object.fromEntries(Fn(e,t,{code:`not_linked`}).filter(e=>e.signInOnly).map(({link:e})=>[e.id,Xn(`signInOnly`,{provider:n(e.provider),name:e.name})])),Ss=({links:e})=>{let{session:t,linkPersonalMail:n,signInProviders:r}=q(),{account:i}=t,[a]=(0,J.useState)(Ge),o=(0,J.useCallback)(async()=>{let[t,n,r]=await Promise.all([i.linkedPersonalMail(e),i.linkedProviders(),i.mailSenders()]);return{mail:t,providers:n,senders:r}},[i,e]),{data:s,error:c,reload:l}=D(o,K(`couldNotReadMethods`));return s?(0,Y.jsx)(Qt,{title:K(`mailbox`),description:K(`mailboxDescription`),providers:e.map(({id:e,name:t})=>({id:e,name:t})),linked:s.mail,notes:xs(e,s,e=>r.find(t=>t.id===e)?.name??yn(e)),reconnect:!0,onConnect:t=>n(e.find(e=>e.id===t)),error:a&&yt(a,e.length===1?e[0].name:K(`theProvider`)),children:(0,Y.jsx)(bs,{senders:s.senders,onAdd:async e=>{let t=await i.addMailSender(e);return await l(),t},onUpdate:async(e,t)=>{await i.updateMailSender(e,t),await l()},onRemove:async e=>{await i.removeMailSender(e),await l()}})}):(0,Y.jsx)(A,{error:c})},Cs=()=>{let{personalMail:e}=q();return e.length>0?(0,Y.jsx)(Ss,{links:e}):null},ws=e=>xr(e.name)??`An unnamed app`,Ts=e=>e.access.map(({role:e,organization:t})=>`as ${e||`no role`}${t?` in ${t}`:``}`).join(`, `),Es=({apps:e,onDisconnect:t})=>{let[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(),[s,c]=(0,J.useState)(),l=async e=>{r(!0),a(void 0);try{await t(e.clientId),c(void 0)}catch(e){if(!(e instanceof j))throw e;a(o(e))}r(!1)};return(0,Y.jsxs)(k,{title:`Connected apps`,description:`AI assistants and other apps you allowed to act as you here. Disconnecting one stops it within 15 minutes; it has to ask you again to come back.`,children:[(0,Y.jsx)(P,{message:s?void 0:i}),e.length===0?(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:`No apps are connected. Add this app's MCP address to an AI assistant to connect one.`}):(0,Y.jsx)(`ul`,{className:`divide-y rounded-md border`,children:e.map(e=>{let t=Sr(e.clientId);return(0,Y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,Y.jsx)(Dr,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`bdi`,{className:`block truncate font-medium`,children:ws(e)}),(0,Y.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[t&&`Published by ${t} · `,`Allowed `,le(Date.parse(e.allowedAt)),` · `,Ts(e)]})]}),(0,Y.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>c(e),children:`Disconnect`})]},e.clientId)})}),s&&(0,Y.jsx)(I,{title:`Disconnect ${ws(s)}?`,description:`It can no longer read or change anything as you. What it already started may keep working for up to 15 minutes.`,onClose:()=>c(void 0),actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{onClick:()=>c(void 0),children:`Cancel`}),(0,Y.jsx)(W,{variant:`danger`,loading:n,onClick:()=>void l(s),children:`Disconnect`})]}),children:i&&(0,Y.jsx)(P,{message:i})})]})},Ds=(e,t)=>{let n=new URL(`https://claude.ai/customize/connectors`);return n.searchParams.set(`modal`,`add-custom-connector`),t&&n.searchParams.set(`connectorName`,t),n.searchParams.set(`connectorUrl`,e),n.href},Os=({url:e,appName:t})=>(0,Y.jsx)(k,{title:K(`mcpAddress`),description:K(`mcpAddressDescription`),children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(Cr,{value:e,copyLabel:K(`copyMcpAddress`)}),(0,Y.jsxs)(`a`,{href:Ds(e,t),target:`_blank`,rel:`noreferrer`,className:mt(),children:[(0,Y.jsx)(x,{className:`size-3.5`}),K(`addToClaude`)]})]})}),ks=()=>{let{account:e}=q().session,{data:t,error:n,reload:r}=D((0,J.useCallback)(()=>e.connectedApps(),[e]),K(`couldNotReadMethods`));return t?(0,Y.jsx)(Es,{apps:t,onDisconnect:t=>e.disconnectApp(t).then(r)}):(0,Y.jsx)(A,{error:n})},As=({url:e})=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Os,{url:e,appName:H().appName}),(0,Y.jsx)(ks,{})]}),js=()=>{let{mcp:e}=q();return e?(0,Y.jsx)(As,{url:e.url}):null},Ms={30:30,90:90,365:365,never:void 0},Ns={30:`expiresIn30Days`,90:`expiresIn90Days`,365:`expiresInAYear`,never:`neverExpires`},Ps=e=>le(Date.parse(e)),Fs=e=>e?K(Date.parse(e)<=Date.now()?`expiredOn`:`expiresOn`,{date:Ps(e)}):K(`neverExpires`),Is=e=>[K(`createdOn`,{date:Ps(e.createdAt)}),Fs(e.expiresAt),e.lastUsedAt?K(`lastUsedOn`,{date:Ps(e.lastUsedAt)}):K(`notUsedYet`),e.organization?K(`actsAsIn`,{role:e.role,organization:e.organization}):K(`actsAs`,{role:e.role})].join(` · `),Ls=({tokens:e,onCreate:t,onRevoke:n})=>{let[r,i]=(0,J.useState)(!1),[a,s]=(0,J.useState)(),[c,l]=(0,J.useState)(),[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(`90`),[m,h]=(0,J.useState)(),g=()=>{l(void 0),s(void 0),h(void 0)},_=(0,J.useRef)(!1),v=async e=>{if(!_.current){_.current=!0,i(!0),s(void 0);try{l(await e()),h(void 0)}catch(e){if(e instanceof TypeError)return s(K(`noAnswerFromServer`));if(!(e instanceof j))throw e;e.code===`STRONG_SIGN_IN_REQUIRED`?h(`asked`):s(o(e))}finally{_.current=!1,i(!1)}}},y=()=>v(async()=>{let e=Ms[f];return{kind:`created`,created:await t({name:u.trim(),...e!==void 0&&{expiresInDays:e}})}});return(0,Y.jsxs)(k,{title:K(`accessTokens`),description:K(`accessTokensDescription`),children:[(0,Y.jsx)(P,{message:c?void 0:a}),e.length===0?(0,Y.jsx)(`p`,{className:`mb-3 text-muted-foreground`,children:K(`noAccessTokens`)}):(0,Y.jsx)(`ul`,{className:`mb-3 divide-y rounded-md border`,children:e.map(e=>(0,Y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,Y.jsx)(kr,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`bdi`,{className:`block truncate font-medium`,children:e.name}),(0,Y.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:Is(e)})]}),(0,Y.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>l({kind:`revoke`,token:e}),children:K(`revoke`)})]},e.id))}),(0,Y.jsxs)(W,{onClick:()=>{d(``),p(`90`),l({kind:`create`})},children:[(0,Y.jsx)(xn,{className:`size-3.5`}),K(`newAccessToken`)]}),c?.kind===`create`&&(0,Y.jsxs)(I,{title:K(`newAccessToken`),description:K(`newAccessTokenDescription`),onClose:g,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{onClick:g,children:K(`cancel`)}),(0,Y.jsx)(W,{variant:`primary`,loading:r,disabled:!u.trim(),onClick:()=>void y(),children:K(`createAccessToken`)})]}),children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[K(`name`),(0,Y.jsx)(b,{autoFocus:!0,value:u,maxLength:100,placeholder:K(`accessTokenNamePlaceholder`),onChange:e=>d(e.target.value)})]}),(0,Y.jsxs)(`label`,{className:`mt-3 flex flex-col gap-1.5 font-medium`,children:[K(`accessTokenExpiry`),(0,Y.jsx)(He,{value:f,onChange:e=>p(e.target.value),children:Object.keys(Ms).map(e=>(0,Y.jsx)(`option`,{value:e,children:K(Ns[e])},e))})]}),m===`asked`&&(0,Y.jsx)(ot,{purpose:`change`,minutes:15,onConfirmed:()=>h(`done`)}),m===`done`&&(0,Y.jsx)(`p`,{className:`mt-2 text-muted-foreground`,children:K(`confirmedCreateAccessToken`)}),(0,Y.jsx)(P,{message:a})]}),c?.kind===`created`&&(0,Y.jsx)(I,{title:K(`accessTokenCreated`,{name:c.created.personalAccessToken.name}),description:K(`accessTokenCreatedDescription`),onClose:g,actions:(0,Y.jsx)(W,{variant:`primary`,onClick:g,children:K(`done`)}),children:(0,Y.jsx)(Cr,{value:c.created.token,copyLabel:K(`copyAccessToken`)})}),c?.kind===`revoke`&&(0,Y.jsx)(I,{title:K(`revokeAccessToken`,{name:c.token.name}),description:K(`revokeAccessTokenDescription`),onClose:g,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{onClick:g,children:K(`cancel`)}),(0,Y.jsx)(W,{variant:`danger`,loading:r,onClick:()=>void v(async()=>(await n(c.token.id),void 0)),children:K(`revoke`)})]}),children:(0,Y.jsx)(P,{message:a})})]})},Rs=()=>{let{account:e}=q().session,{data:t,error:n,reload:r}=D((0,J.useCallback)(()=>e.personalAccessTokens(),[e]),K(`couldNotReadAccessTokens`));return t?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(P,{message:n}),(0,Y.jsx)(Ls,{tokens:t,onCreate:t=>e.createPersonalAccessToken(t).then(e=>(r(),e),async e=>{throw await r(),e}),onRevoke:t=>e.revokePersonalAccessToken(t).finally(r)})]}):(0,Y.jsx)(A,{error:n})},zs=()=>q().personalAccessTokens?(0,Y.jsx)(Rs,{}):null,Bs={revoked:`disconnectedRevoked`,queued:`disconnectedQueued`,not_revoked:`disconnectedNotRevoked`},Vs=e=>e.provider===`google`,Hs=({connections:e,onConnect:t,onDisconnect:n,error:r})=>{let[i,a]=(0,J.useState)(),[s,c]=(0,J.useState)(r),[l,u]=(0,J.useState)(),[d,f]=(0,J.useState)(),p=async(e,t)=>{a(e),c(void 0),f(void 0);try{await t(),u(void 0)}catch(e){if(!(e instanceof j))throw e;c(o(e))}finally{a(void 0)}};return(0,Y.jsxs)(k,{title:K(`connections`),description:K(`connectionsDescription`),children:[(0,Y.jsx)(P,{message:l?void 0:s}),(0,Y.jsx)(qe,{message:d}),(0,Y.jsx)(`ul`,{className:`divide-y rounded-md border`,children:e.map(e=>(0,Y.jsxs)(`li`,{className:`flex flex-col gap-2 px-3 py-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Y.jsx)(Nr,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.label}),(0,Y.jsx)(W,{size:`sm`,loading:i===e.key,disabled:i!==void 0,onClick:()=>void p(e.key,()=>t(e)),children:e.accounts.length>0?K(`connectAgain`,{name:e.label}):K(`connect`,{name:e.label})})]}),e.accounts.map(t=>(0,Y.jsxs)(J.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 pl-7 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1 text-muted-foreground`,children:[K(`connectedOn`,{date:le(Date.parse(t.created_at))}),` · `,(0,Y.jsx)(`code`,{className:`text-xs`,children:t.id})]}),t.needs_sign_in?(0,Y.jsx)(F,{tone:`amber`,children:K(`connectionNeedsSignIn`)}):(0,Y.jsx)(F,{tone:`green`,children:K(`connected`)}),(0,Y.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>u({connection:e,accountId:t.id}),children:K(`disconnect`)})]}),t.used_by.length>0&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 pl-7 text-sm`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:K(`connectionUsedBy`)}),t.used_by.map(e=>(0,Y.jsx)(re,{resource:`workflows`,recordKey:e.id,className:`font-medium text-primary-text hover:underline`,children:e.name},e.id))]})]},t.id))]},e.key))}),l&&(0,Y.jsx)(I,{title:K(`disconnectTitle`,{name:l.connection.label}),description:Vs(l.connection)?`${K(`disconnectDescription`)} ${K(`disconnectWholeGrant`)}`:K(`disconnectDescription`),onClose:()=>u(void 0),actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{onClick:()=>u(void 0),children:K(`cancel`)}),(0,Y.jsx)(W,{variant:`danger`,loading:i===l.accountId,onClick:()=>void p(l.accountId,async()=>f(K(Bs[await n(l.accountId)]))),children:K(`disconnect`)})]}),children:s&&(0,Y.jsx)(P,{message:s})})]})},Us=()=>{let{session:e,connectAccount:t}=q(),{account:n}=e,[r]=(0,J.useState)(Ge),{data:i,error:a,reload:o}=D((0,J.useCallback)(()=>n.workflowConnections(),[n]),K(`couldNotReadMethods`));return i?i.length===0?null:(0,Y.jsx)(Hs,{connections:i,onConnect:t,onDisconnect:e=>n.disconnectAccount(e).finally(o),error:r&&yt(r,K(`theProvider`))}):(0,Y.jsx)(A,{error:a})},Ws=e=>e.code===`LAST_ADMIN`?K(`deleteAccountLastAdmin`):e.code===`ACCOUNT_LOCKED`?K(`deleteAccountLocked`):o(e),Gs=({hasPassword:e,onDelete:t,onClose:n})=>{let[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(),[l,u]=(0,J.useState)(!1),d=(0,J.useId)(),f=async()=>{o(!0),c(void 0),u(!1);try{await t(e?r:void 0)}catch(e){if(!(e instanceof j))throw e;e.code===`STRONG_SIGN_IN_REQUIRED`?u(!0):c(Ws(e)),o(!1)}};return(0,Y.jsxs)(I,{title:K(`deleteAccountQuestion`),description:K(`deleteAccountWarning`),onClose:n,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{onClick:n,children:K(`cancel`)}),(0,Y.jsx)(W,{variant:`danger`,type:`submit`,form:d,loading:a,disabled:e&&!r,children:K(`deleteAccountConfirm`)})]}),children:[(0,Y.jsxs)(`form`,{id:d,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),f()},children:[e&&(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[K(`deleteAccountPassword`),(0,Y.jsx)(b,{type:`password`,name:`current-password`,autoComplete:`current-password`,autoFocus:!0,value:r,invalid:!!s,onChange:e=>i(e.target.value)})]}),(0,Y.jsx)(P,{message:s})]}),l&&(0,Y.jsx)(ot,{purpose:`change`,minutes:15,onConfirmed:()=>void f()})]})},Ks=({hasPassword:e,staff:t,onDelete:n})=>{let[r,i]=(0,J.useState)(!1);return(0,Y.jsxs)(k,{title:K(`deleteAccount`),description:K(t?`deleteAccountStaff`:`deleteAccountDescription`),children:[!t&&(0,Y.jsx)(W,{variant:`danger`,onClick:()=>i(!0),children:K(`deleteAccount`)}),r&&(0,Y.jsx)(Gs,{hasPassword:e,onDelete:n,onClose:()=>i(!1)})]})},qs=()=>{let{session:e,state:t,deleteAccount:n}=q(),{account:r}=e,{data:i,error:a}=D((0,J.useCallback)(()=>r.signInMethods(),[r]),K(`couldNotReadMethods`));return i?(0,Y.jsx)(Ks,{hasPassword:i.account.password,staff:t.kind===`signed-in`&&!!t.staff,onDelete:n}):(0,Y.jsx)(A,{error:a})},Js=[[/Edg(e|A|iOS)?\//,`Edge`],[/OPR\/|Opera/,`Opera`],[/SamsungBrowser\//,`Samsung Internet`],[/Firefox\/|FxiOS\//,`Firefox`],[/Chrome\/|CriOS\//,`Chrome`],[/Safari\//,`Safari`]],Ys=[[/iPhone/,`iPhone`],[/iPad/,`iPad`],[/Android/,`Android`],[/CrOS/,`ChromeOS`],[/Windows/,`Windows`],[/Mac OS X|Macintosh/,`macOS`],[/Linux/,`Linux`]],Xs=(e,t)=>e.find(([e])=>e.test(t))?.[1],Zs=e=>e?{browser:Xs(Js,e),system:Xs(Ys,e)}:{},Qs=e=>e.device?K(`deviceThrough`,{device:e.device,provider:e.name}):e.name,$s=(e,t)=>{if(e.staff)return t?K(`staffOf`,{operator:t}):K(`staff`);let{browser:n,system:r}=Zs(e.userAgent);return n&&r?K(`browserOn`,{browser:n,system:r}):r?K(`aBrowserOn`,{system:r}):n??K(`unknownDevice`)},ec=e=>{if(e.staff)return Fr;let{system:t}=Zs(e.userAgent);return t===`iPhone`||t===`Android`?Lr:t===`iPad`?zr:jr},tc=e=>[...e].sort((e,t)=>Number(t.current)-Number(e.current)||t.createdAt.localeCompare(e.createdAt)),nc=(e,t)=>e.kind===`one`?K(`signOutDevice`,{name:$s(e.session,t)}):e.kind===`link`?K(`signOutDevice`,{name:Qs(e.link)}):K(`signOutOthersTitle`),rc=e=>K(e.kind===`one`?`signOutDeviceDescription`:e.kind===`link`?`signOutLinkedDeviceDescription`:`signOutOthersDescription`),ic=({sessions:e,operator:t,links:n=[],onSignOut:r,onSignOutOthers:i,onSignOutLink:a})=>{let[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(),[d,f]=(0,J.useState)(),p=e.filter(e=>!n.some(t=>t.sessions.includes(e.token))),m=e.filter(e=>!e.current),h=e=>e.kind===`one`?r(e.session.token):e.kind===`link`?a(e.link.id):i(),g=async e=>{c(!0),u(void 0);try{await h(e),f(void 0)}catch(e){if(!(e instanceof j))throw e;u(o(e))}c(!1)},_=e=>{u(void 0),f(e)};return(0,Y.jsxs)(k,{title:K(`devices`),description:K(`devicesDescription`),children:[p.length===0&&n.length===0?(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:K(`noDevices`)}):(0,Y.jsxs)(`ul`,{className:`divide-y rounded-md border`,children:[tc(p).map(e=>{let n=ec(e);return(0,Y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,Y.jsx)(n,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`bdi`,{className:`truncate font-medium`,children:$s(e,t)}),e.current&&(0,Y.jsx)(F,{tone:`green`,children:K(`thisDevice`)})]}),(0,Y.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[K(`signedInFromUntil`,{from:Xe(Date.parse(e.createdAt)),until:Xe(Date.parse(e.expiresAt))}),!e.staff&&e.ipAddress&&` · ${e.ipAddress}`]})]}),!e.current&&(0,Y.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>_({kind:`one`,session:e}),children:K(`signOut`)})]},e.token)}),n.map(t=>{let n=e.some(e=>e.current&&t.sessions.includes(e.token));return(0,Y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,Y.jsx)(Lr,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`bdi`,{className:`truncate font-medium`,children:Qs(t)}),n&&(0,Y.jsx)(F,{tone:`green`,children:K(`thisDevice`)})]}),(0,Y.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:K(`linkedOn`,{date:Xe(Date.parse(t.linkedAt))})})]}),!n&&a&&(0,Y.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>_({kind:`link`,link:t}),children:K(`signOut`)})]},t.id)})]}),m.length>0&&(0,Y.jsx)(W,{className:`mt-3`,onClick:()=>_({kind:`others`}),children:K(`signOutOthers`)}),d&&(0,Y.jsx)(I,{title:nc(d,t),description:rc(d),onClose:()=>f(void 0),actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{onClick:()=>f(void 0),children:K(`cancel`)}),(0,Y.jsx)(W,{variant:`danger`,loading:s,onClick:()=>void g(d),children:K(`signOut`)})]}),children:(0,Y.jsx)(P,{message:l})})]})},ac=()=>{let{session:e,staffSignIn:t,deviceLinks:n}=q(),{account:r}=e,i=(0,J.useCallback)(async()=>{let[e,t]=await Promise.all([r.sessions(),n?r.deviceLinks():[]]);return{sessions:e,links:t}},[r,n]),{data:a,error:o,reload:s}=D(i,K(`couldNotReadDevices`));return a?(0,Y.jsx)(ic,{sessions:a.sessions,links:a.links,operator:t,onSignOut:e=>r.revokeSession(e).then(s),onSignOutOthers:()=>r.revokeOtherSessions().then(s),onSignOutLink:e=>r.signOutDeviceLink(e).then(s)}):(0,Y.jsx)(A,{error:o})},oc={allowed:`passkeysAllowed`,required:`passkeysRequired`,forbidden:`passkeysForbidden`},sc=({rule:e,passkeys:t,onAdd:n,onRename:r,onRemove:i})=>{let[a,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(),[u,d]=(0,J.useState)(),[f,p]=(0,J.useState)(``),[m,g]=(0,J.useState)(),_=e===`required`&&t.length<=1,v=async e=>{s(!0),l(void 0),g(void 0);try{await e(),d(void 0)}catch(e){if(!(e instanceof j))throw e;e.code===`STRONG_SIGN_IN_REQUIRED`?g(`asked`):l(o(e))}s(!1)};return(0,Y.jsxs)(k,{title:K(`passkeys`),status:e===`required`&&(0,Y.jsx)(F,{tone:`blue`,children:K(`required`)}),description:K(oc[e]),children:[(0,Y.jsx)(P,{message:u?void 0:c}),t.length>0&&(0,Y.jsx)(`ul`,{className:`mb-3 divide-y rounded-md border`,children:t.map(e=>(0,Y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,Y.jsx)(h,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate font-medium`,children:e.name??K(`passkey`)}),(0,Y.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[e.createdAt?K(`addedOn`,{date:le(Date.parse(e.createdAt))}):K(`addedEarlier`),` · `,e.backedUp?K(`synced`):K(`oneDevice`)]})]}),(0,Y.jsxs)(`span`,{className:`flex gap-1`,children:[(0,Y.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>{p(e.name??``),d({kind:`rename`,passkey:e})},children:K(`rename`)}),(0,Y.jsx)(W,{size:`sm`,variant:`ghost`,disabled:_,title:_?K(`keepLastPasskey`):void 0,onClick:()=>d({kind:`remove`,passkey:e}),children:K(`remove`)})]})]},e.id))}),e!==`forbidden`&&(0,Y.jsxs)(W,{loading:a&&!u,onClick:()=>void v(n),children:[(0,Y.jsx)(xn,{className:`size-3.5`}),K(`addPasskey`)]}),m===`asked`&&(0,Y.jsx)(ot,{purpose:`change`,withPassword:!0,minutes:15,onConfirmed:()=>g(`done`)}),m===`done`&&(0,Y.jsx)(`p`,{className:`mt-2 text-muted-foreground`,children:K(`confirmedAddPasskey`)}),u?.kind===`rename`&&(0,Y.jsxs)(I,{title:K(`renamePasskey`),description:K(`renamePasskeyDescription`),onClose:()=>d(void 0),actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{onClick:()=>d(void 0),children:K(`cancel`)}),(0,Y.jsx)(W,{variant:`primary`,loading:a,disabled:!f.trim(),onClick:()=>void v(()=>r(u.passkey.id,f.trim())),children:K(`save`)})]}),children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[K(`name`),(0,Y.jsx)(b,{autoFocus:!0,value:f,maxLength:60,onChange:e=>p(e.target.value)})]}),(0,Y.jsx)(P,{message:c})]}),u?.kind===`remove`&&(0,Y.jsx)(I,{title:K(`removePasskey`),description:K(`removePasskeyDescription`,{name:u.passkey.name??K(`thisPasskey`)}),onClose:()=>d(void 0),actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{onClick:()=>d(void 0),children:K(`cancel`)}),(0,Y.jsx)(W,{variant:`danger`,loading:a,onClick:()=>void v(()=>i(u.passkey.id)),children:K(`remove`)})]}),children:c&&(0,Y.jsx)(P,{message:c})})]})},cc=()=>{let{account:e}=q().session,t=(0,J.useCallback)(()=>Promise.all([e.signInMethods(),e.passkeys()]),[e]),{data:n,error:r,reload:i}=D(t,K(`couldNotReadMethods`));if(!n)return(0,Y.jsx)(A,{error:r});let[a,o]=n;return(0,Y.jsx)(sc,{rule:a.policy.passkey,passkeys:o,onAdd:()=>e.addPasskey().then(i),onRename:(t,n)=>e.renamePasskey(t,n).then(i),onRemove:t=>e.removePasskey(t).then(i)})},lc=e=>e.code===`PASSWORD_TOO_SHORT`?K(`useAtLeast`,{length:12}):e.code===`PASSWORD_TOO_LONG`?K(`passwordTooLong`):o(e),uc=(e,t)=>{if(e.length<12)return K(`useAtLeast`,{length:12});if(e!==t)return K(`passwordsDiffer`)},dc=({hasPassword:e,onSave:t,onClose:n})=>{let[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(),p=(0,J.useId)(),m=(!e||r)&&a&&s,h=async()=>{let e=uc(a,s);if(f(e),!e){u(!0);try{await t({current:r,next:a})}catch(e){if(!(e instanceof j))throw e;f(lc(e)),u(!1)}}};return(0,Y.jsx)(I,{title:K(e?`changePassword`:`setPassword`),description:K(`atLeast`,{length:12}),onClose:n,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{onClick:n,children:K(`cancel`)}),(0,Y.jsx)(W,{variant:`primary`,type:`submit`,form:p,loading:l,disabled:!m,children:K(`save`)})]}),children:(0,Y.jsxs)(`form`,{id:p,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),h()},children:[e&&(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[K(`currentPassword`),(0,Y.jsx)(b,{type:`password`,name:`current-password`,autoComplete:`current-password`,autoFocus:!0,value:r,onChange:e=>i(e.target.value)})]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[K(`newPassword`),(0,Y.jsx)(b,{type:`password`,name:`new-password`,autoComplete:`new-password`,autoFocus:!e,value:a,invalid:!!d,onChange:e=>o(e.target.value)})]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[K(`repeatPassword`),(0,Y.jsx)(b,{type:`password`,name:`repeat-password`,autoComplete:`new-password`,value:s,invalid:!!d,onChange:e=>c(e.target.value)})]}),e&&(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:K(`changeSignsOutOthers`)}),(0,Y.jsx)(P,{message:d})]})})},fc=({rule:e,hasPassword:t,staff:n})=>K(n?`passwordStaff`:e===`forbidden`?`passwordForbidden`:t?`passwordIsSet`:`passwordNotSet`),pc=({rule:e,hasPassword:t,staff:n,onChange:r,onSet:i})=>{let[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),l=!n&&e===`allowed`;return(0,Y.jsxs)(k,{title:K(`password`),description:fc({rule:e,hasPassword:t,staff:n}),children:[(0,Y.jsx)(qe,{message:s?K(`passwordSaved`):void 0}),l&&(0,Y.jsx)(W,{onClick:()=>{c(!1),o(!0)},children:K(t?`changePassword`:`setPassword`)}),a&&(0,Y.jsx)(dc,{hasPassword:t,onClose:()=>o(!1),onSave:async({current:e,next:n})=>{await(t?r(e,n):i(n)),o(!1),c(!0)}})]})},mc=()=>{let{session:e,state:t}=q(),{account:n}=e,{data:r,error:i,reload:a}=D((0,J.useCallback)(()=>n.signInMethods(),[n]),K(`couldNotReadMethods`));return r?(0,Y.jsx)(pc,{rule:r.policy.password,hasPassword:r.account.password,staff:t.kind===`signed-in`&&!!t.staff,onChange:(e,t)=>n.changePassword(e,t).then(a),onSet:e=>n.setPassword(e).then(a)}):(0,Y.jsx)(A,{error:i})},hc=({email:e,change:t,onDone:n,onClose:r})=>{let[i,a]=(0,J.useState)(``),[s,c]=(0,J.useState)(),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(),h=async e=>{f(!0),m(void 0);try{await e()}catch(e){if(!(e instanceof j))throw e;m(o(e))}f(!1)},g=i.trim(),_=()=>h(async()=>{await t.request(g),u(``),c(g)}),v=e=>h(async()=>{await t.confirm(s,e),n()});return s?(0,Y.jsxs)(I,{title:K(`changeEmail`),description:K(`codeSentTo`,{email:s,minutes:10}),onClose:r,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{variant:`ghost`,onClick:()=>{c(void 0),m(void 0)},children:K(`otherAddress`)}),(0,Y.jsx)(W,{variant:`primary`,loading:d,disabled:l.length<6,onClick:()=>void v(l),children:K(`changeEmail`)})]}),children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[K(`code`),(0,Y.jsx)(xt,{name:`code`,required:!0,autoFocus:!0,value:l,invalid:!!p,onChange:u,onComplete:e=>!d&&void v(e)})]}),(0,Y.jsx)(P,{message:p})]}):(0,Y.jsxs)(I,{title:K(`changeEmail`),description:K(`changeEmailDescription`),onClose:r,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{onClick:r,children:K(`cancel`)}),(0,Y.jsx)(W,{variant:`primary`,loading:d,disabled:!g||g.toLowerCase()===e.toLowerCase(),onClick:()=>void _(),children:K(`sendCode`)})]}),children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[K(`newEmail`),(0,Y.jsx)(b,{type:`email`,autoComplete:`email`,autoFocus:!0,value:i,onChange:e=>a(e.target.value)})]}),(0,Y.jsx)(P,{message:p})]})},gc=({name:e,email:t,onRename:n,emailChange:r,onEmailChanged:i})=>{let[a,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(!1),[m,h]=(0,J.useState)(),g=async()=>{p(!0),h(void 0);try{await n(u.trim()),s(!1)}catch(e){if(!(e instanceof j))throw e;h(o(e))}p(!1)};return(0,Y.jsxs)(k,{title:K(`profile`),description:K(`profileDescription`),children:[(0,Y.jsxs)(`dl`,{className:`mb-3 grid grid-cols-[auto_1fr] gap-x-6 gap-y-1.5`,children:[(0,Y.jsx)(`dt`,{className:`text-muted-foreground`,children:K(`name`)}),(0,Y.jsx)(`dd`,{className:`min-w-0 truncate font-medium`,children:e}),(0,Y.jsx)(`dt`,{className:`text-muted-foreground`,children:K(`email`)}),(0,Y.jsx)(`dd`,{className:`min-w-0 truncate font-medium`,children:t})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsx)(W,{onClick:()=>{d(e),h(void 0),s(!0)},children:K(`changeName`)}),r&&(0,Y.jsx)(W,{onClick:()=>l(!0),children:K(`changeEmail`)})]}),a&&(0,Y.jsxs)(I,{title:K(`changeName`),description:K(`changeNameDescription`),onClose:()=>s(!1),actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{onClick:()=>s(!1),children:K(`cancel`)}),(0,Y.jsx)(W,{variant:`primary`,loading:f,disabled:!u.trim()||u.trim()===e,onClick:()=>void g(),children:K(`save`)})]}),children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[K(`name`),(0,Y.jsx)(b,{autoFocus:!0,value:u,maxLength:100,onChange:e=>d(e.target.value)})]}),(0,Y.jsx)(P,{message:m})]}),c&&r&&(0,Y.jsx)(hc,{email:t,change:r,onClose:()=>l(!1),onDone:()=>{l(!1),i?.()}})]})},_c=()=>{let{session:e,changeEmail:t}=q(),{data:n,loaded:r,error:i,reload:a}=D((0,J.useCallback)(()=>e.session(),[e]),K(`couldNotReadProfile`));if(!r)return(0,Y.jsx)(A,{error:i});if(!n)return null;let o=t?{request:e.account.requestEmailChange,confirm:e.account.changeEmail}:void 0;return(0,Y.jsx)(gc,{name:n.name,email:n.email,onRename:t=>e.account.updateName(t).then(a),emailChange:o,onEmailChanged:a})},vc=({title:e,description:t,confirmLabel:n,danger:r,needsPassword:i,onConfirm:a,onClose:s})=>{let[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(),[m,h]=(0,J.useState)(!1),g=async()=>{d(!0),p(void 0),h(!1);try{await a(i?c:void 0)}catch(e){if(!(e instanceof j))throw e;e.code===`STRONG_SIGN_IN_REQUIRED`?h(!0):p(o(e)),d(!1)}};return(0,Y.jsxs)(I,{title:e,description:t,onClose:s,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{onClick:s,children:K(`cancel`)}),(0,Y.jsx)(W,{variant:r?`danger`:`primary`,loading:u,disabled:i&&!c,onClick:()=>void g(),children:n})]}),children:[i&&(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[K(`yourPassword`),(0,Y.jsx)(b,{type:`password`,autoComplete:`current-password`,autoFocus:!0,value:c,invalid:!!f,onChange:e=>l(e.target.value),onKeyDown:e=>e.key===`Enter`&&c&&void g()})]}),f&&(0,Y.jsx)(`p`,{role:`alert`,className:`mt-2 text-body font-medium text-danger-text`,children:f}),m&&(0,Y.jsx)(ot,{purpose:`change`,minutes:15,onConfirmed:()=>void g()})]})},yc={allowed:`twoFactorAllowed`,required:`twoFactorRequired`,forbidden:`twoFactorForbidden`},bc=e=>{let{rule:t,enabled:n,authenticatorApp:r,mail:i,needsPassword:a,onTurnOff:o,onNewBackupCodes:s,onChanged:c}=e,[l,u]=(0,J.useState)(),d=()=>u(void 0),f=n?(0,Y.jsx)(F,{tone:`green`,children:K(`on`)}):t===`required`?(0,Y.jsx)(F,{tone:`amber`,children:K(`required`)}):(0,Y.jsx)(F,{children:K(`off`)}),p=K(n?r?i?`twoFactorOnWithAppOrMail`:`twoFactorOnWithApp`:`twoFactorOnWithMail`:yc[t]);return l?.kind===`setup`?(0,Y.jsx)(k,{title:K(`twoFactor`),status:f,description:p,children:(0,Y.jsx)(`div`,{className:`max-w-sm`,children:(0,Y.jsx)(Kt,{offerEmailedCodes:i&&!l.appOnly,needsPassword:a,onStartApp:e.onStartApp,onConfirmApp:e.onConfirmApp,onEmailedCodes:e.onEmailedCodes,onCancel:d,onDone:()=>{d(),c()}})})}):(0,Y.jsxs)(k,{title:K(`twoFactor`),status:f,description:p,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[!n&&t!==`forbidden`&&(0,Y.jsx)(W,{variant:`primary`,onClick:()=>u({kind:`setup`,appOnly:!1}),children:K(`turnOn`)}),n&&!r&&t!==`forbidden`&&(0,Y.jsx)(W,{onClick:()=>u({kind:`setup`,appOnly:!0}),children:K(`addAuthenticator`)}),n&&r&&(0,Y.jsx)(W,{onClick:()=>u({kind:`new-codes`}),children:K(`newBackupCodes`)}),n&&(0,Y.jsx)(W,{variant:`danger`,disabled:t===`required`,title:t===`required`?K(`twoFactorIsRequired`):void 0,onClick:()=>u({kind:`turn-off`}),children:K(`turnOff`)})]}),l?.kind===`turn-off`&&(0,Y.jsx)(vc,{title:K(`turnOffTitle`),description:K(`turnOffDescription`),confirmLabel:K(`turnOff`),danger:!0,needsPassword:a,onClose:d,onConfirm:async e=>{await o(e),d(),c()}}),l?.kind===`new-codes`&&(0,Y.jsx)(vc,{title:K(`newCodesTitle`),description:K(`newCodesDescription`),confirmLabel:K(`makeNewCodes`),needsPassword:a,onClose:d,onConfirm:async e=>u({kind:`codes`,codes:await s(e)})}),l?.kind===`codes`&&(0,Y.jsx)(I,{title:K(`yourNewCodes`),description:K(`keepCodesSafe`),onClose:d,actions:(0,Y.jsx)(W,{variant:`primary`,onClick:d,children:K(`savedCodes`)}),children:(0,Y.jsx)(tn,{codes:l.codes})})]})},xc=()=>{let{account:e}=q().session,{data:t,error:n,reload:r}=D((0,J.useCallback)(()=>e.signInMethods(),[e]),K(`couldNotReadMethods`));return t?(0,Y.jsx)(bc,{rule:t.policy.twoFactor,enabled:t.account.twoFactor,authenticatorApp:t.account.authenticatorApp,mail:t.mail,needsPassword:t.account.password,onStartApp:t=>e.startAuthenticatorApp(t),onConfirmApp:t=>e.confirmAuthenticatorApp(t),onEmailedCodes:t=>e.turnOnEmailedCodes(t),onTurnOff:t=>e.turnOffTwoFactor(t),onNewBackupCodes:t=>e.newBackupCodes(t),onChanged:r}):(0,Y.jsx)(A,{error:n})},Sc=({problem:e,fallback:t})=>t===void 0?(0,Y.jsx)(ne,{children:e}):(0,Y.jsxs)(Y.Fragment,{children:[!1,t]}),Cc=({name:e,registered:t,fallback:n,children:r})=>t?(0,Y.jsx)(Re,{name:e,fallback:n===void 0?void 0:(0,Y.jsx)(Sc,{problem:N.rich(`couldNotDraw`,{name:e}),fallback:n}),children:r}):(0,Y.jsx)(Sc,{problem:N.rich(`noComponent`,{component:e}),fallback:n}),wc={Page:Pa,Grid:ua,Card:ii,Stat:yo,RecordCard:Ra,Field:aa,Diff:na,Table:wo,CardRow:ci,RecordRow:ro,RecordCards:$a,Chart:li,Timeline:qi,Graph:Zi,Progress:Ia,Image:va,ModalForm:Na,Thread:Zo,Composer:$i,Action:ri,Show:fo,Switch:mo,Match:ho,Link:Oa,Settings:so,Tabs:Eo,Tab:Do,Users:_s,Profile:_c,Password:mc,Passkeys:cc,TwoFactor:xc,ConnectedAccounts:Be,PersonalMail:Cs,Connections:Us,Devices:ac,ConnectedApps:js,PersonalAccessTokens:zs,DeleteAccount:qs,Box:Qo,Row:$o,Column:es,Text:ts,ReferenceManyField:os,ReferenceArrayField:cs,ArrayField:ns,RecordsIterator:oi,ReferenceField:us,SelectInput:rs,Details:ea,Summary:ta,TextField:xa,NumberField:Sa,DateField:Ca,BooleanField:wa,UrlField:Ta,ChipField:Ea},Tc=new Set(`Page.Grid.Card.Stat.RecordCard.Field.Diff.Table.CardRow.RecordRow.RecordCards.Chart.Timeline.Graph.Progress.Image.Thread.Link.Tabs.Settings.Show.Switch.Action.Box.Row.Column.Text.ReferenceField.SelectInput.Details.Summary.TextField.NumberField.DateField.BooleanField.UrlField.ChipField`.split(`.`)),Ec=(e,t,...n)=>e.map((e,r)=>({child:e,...t!==void 0&&{at:xe(t,...n,r)}})),Dc=({text:e})=>{let t=G(),n=Oe(),r={...L(t),params:n};return(0,Y.jsx)(Y.Fragment,{children:E(e,e=>ie(C(r,e)))})},Oc=(e,t)=>e.includes(`{{`)?(0,Y.jsx)(Dc,{text:e},t):(0,Y.jsx)(J.Fragment,{children:e},t),kc=e=>e.map(({child:e,at:t},n)=>typeof e==`string`?Oc(e,n):(0,Y.jsx)(Ic,{node:e,at:t},n)),Ac=e=>{let t=[];for(let n of e){let e=t.at(-1);Ur(n.child)&&e&&Ur(e[0].child)?e.push(n):t.push([n])}return t.map((e,t)=>{let[n]=e;return Ur(n.child)?(0,Y.jsx)(`p`,{className:`leading-6`,children:kc(e)},t):(0,Y.jsx)(Ic,{node:n.child,at:n.at},t)})},jc=e=>Ve(e)||Array.isArray(e)&&e.length>0&&e.every(Ve),Mc=(e,t)=>Object.fromEntries(Object.entries(e.props).flatMap(([e,n])=>jc(n)?[[e,(0,Y.jsx)(Y.Fragment,{children:Ac(Nc(n,t,e))})]]:[])),Nc=(e,t,n)=>Array.isArray(e)?Ec(e,t,`props`,n):[{child:e,...t!==void 0&&{at:xe(t,`props`,n)}}],Pc=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Fc=(e,t)=>{let n=Pc(e.props.components)?e.props.components:{},r=Object.fromEntries(Object.entries(n).flatMap(([e,t])=>Ve(t)?[[e,e=>({...t,children:[...t.children,...e]})]]:[])),i=_(t,String(e.props.i18nKey),Pc(e.props.values)?e.props.values:{},r);return Array.isArray(i)?i.map(e=>typeof e==`string`||Ve(e)?e:String(e)):[i]},Ic=({node:e,at:t})=>{let{components:n}=At(),r=G(),i=Oe(),a=st(),o=(0,J.useMemo)(()=>Xt(gn(e,{...L(r),params:i}),a),[e,r,i,a]);if(o.type===`Trans`&&!o.custom)return(0,Y.jsx)(Y.Fragment,{children:kc(Fc(o,a).map(e=>({child:e})))});if(o.custom){let e=n?.[o.type],r=o.children.length>0?(0,Y.jsx)(Ji,{node:o,children:Ac(Ec(o.children,t,`children`))}):void 0;return(0,Y.jsx)(Cc,{name:o.type,registered:!!e,fallback:o.fallback&&(0,Y.jsx)(Y.Fragment,{children:Ac(Ec(o.fallback,t,`fallback`))}),children:e&&(0,Y.jsx)(Je,{node:o,...t!==void 0&&{at:t},children:(0,Y.jsx)(e,{...be(o.props),children:r})})})}let s=wc[o.type];if(!s)return(0,Y.jsx)(ne,{children:N.rich(`unknownBlock`,{type:o.type})});let c=typeof o.props.className==`string`?o.props.className:void 0,l=Ec(o.children,t,`children`),u=(0,Y.jsx)(s,{node:o,at:t,slots:Mc(o,t),className:c,children:o.type===`Text`||o.type===`Link`||o.type===`Summary`?kc(l):Ac(o.type===`Switch`?l.filter(({child:e})=>typeof e!=`string`):l)}),d=c===void 0||Tc.has(o.type)?u:(0,Y.jsx)(`div`,{className:c,children:u});return o.fallback?(0,Y.jsx)(Re,{name:o.type,resetKey:o,fallback:(0,Y.jsx)(Y.Fragment,{children:Ac(Ec(o.fallback,t,`fallback`))}),children:d}):d};export{bo as a,Ha as c,Yo as i,za as l,Cc as n,co as o,Xo as r,Za as s,Ic as t,Qi as u};
|
|
3
|
+
//# debugId=a42f94a0-97f4-4d41-9457-f8d7768e7a71
|
|
@@ -0,0 +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{Ga as r,Gs as i,Ic as a,Jn as o,Kl as s,Kr as c,Ks as l,Pa as u,Qr as d,Rr as f,Vc as p,Wl as m,Xc as h,Yc as g,Yn as _,ac as v,al as y,ba as b,cl as x,fl as S,gi as C,ic as w,ja as T,ls as E,mr as D,ns as O,on as k,sc as A,vn as j,xa as M}from"./app-D3BCcbgE.js";import{h as N,o as P}from"./vendor-t7Q7QbPu.js";import{Q as F}from"./embedded-list-6lQyJozS.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-Ce8dRRRN.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=p(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=p(G),q=e(t(),1),J=h(`app/delete`),Y=m(),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 c=n[a]?.names?.plural??x(a),l=X({blockingPlural:c,noun:r});if(!o||i===void 0)return{text:l};let u={kind:`list`,resource:a,filter:s(Y.eq(o,i))};return{text:l,link:{label:J(`show`,{plural:c}),to:u}}},Q=e(n(),1),te=({title:e,noun:t,busy:n,onConfirm:r,onCancel:i})=>(0,Q.jsx)(v,{title:J(`confirmTitle`,{title:e}),description:J(`confirmDescription`,{noun:t,title:e}),onClose:i,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(A,{onClick:i,children:J(`cancel`)}),(0,Q.jsx)(A,{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)(v,{title:J(`changedTitle`,{title:e}),description:J(`changedDescription`),onClose:a,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(A,{onClick:r,children:J(`reviewChanges`)}),(0,Q.jsx)(A,{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)(v,{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)(A,{onClick:e.onCancel,children:J(`cancel`)}),(0,Q.jsx)(A,{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)(v,{title:J(`deleting`),description:J(`progress`,{done:e.done,total:e.total}),onClose:()=>void 0,actions:(0,Q.jsx)(A,{loading:!0,disabled:!0,children:J(`working`)})});let t=e.total-e.failures.length;return(0,Q.jsx)(v,{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)(A,{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:C(e,n[e.name],i),after:C(e,r[e.name],i)}]}),ae=4,oe=({model:e,view:t,onDeleted:n,onReview:r,restore:a})=>{let o=E(),s=N(),c=u(),[d,p]=(0,q.useState)(),[m,h]=(0,q.useState)(!1),g=t?.names?.singular??x(e.name),_=t?.names?.plural??x(e.name),{resources:v,views:y}=O(),{href:b,open:S}=f(),C=(t,n)=>t.blockedBy&&Z({blockedBy:t.blockedBy,resources:v,views:y,noun:g,...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 i))throw e;return e}},D=t=>{w(),p(void 0),n?.(t),c.show({state:`success`,title:J(`deletedToast`,{title:t.title}),...e.softDelete&&a&&{action:{label:J(`undo`),onClick:()=>{a(t).then(()=>{w(),c.show({state:`success`,title:J(`restored`,{title:t.title})})},e=>{if(!l(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})})}}}})},k=async(n,r)=>{h(!0);try{if(!await T(n,r))return D(n);let i=(await o.get(e.name,n.key)).record;p({kind:`conflict`,target:n,fresh:i,changes:ie(e,t,n.snapshot,i)})}catch(e){if(!l(e))throw e;p(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:b(t.link.to),onNavigate:S}}})}finally{h(!1)}},A=async e=>{try{return await T(e,e.etag)?{title:e.title,message:J(`changedSinceLoaded`)}:void 0}catch(t){if(!l(t))throw t;return{title:e.title,message:C(t,e)?.text??t.message}}},j=async e=>{let t=[],n=[],r=0;p({kind:`bulk-running`,done:r,total:e.length});let i=[...e];return await Promise.all(Array.from({length:Math.min(ae,e.length)},async()=>{for(let a=i.shift();a;a=i.shift()){let i=await A(a);i&&(t.push(i),n.push(a)),r+=1,p({kind:`bulk-running`,done:r,total:e.length})}})),w(),p({kind:`bulk-done`,total:e.length,failures:t}),n},M=()=>p(void 0);return{dialogs:d&&(0,Q.jsxs)(Q.Fragment,{children:[d.kind===`confirm`&&(0,Q.jsx)(te,{title:d.target.title,noun:g,busy:m,onCancel:M,onConfirm:()=>void k(d.target,d.target.etag)}),d.kind===`conflict`&&(0,Q.jsx)(ne,{title:d.target.title,changes:d.changes,busy:m,onCancel:M,onReview:()=>{M(),r?.(d.target,d.fresh)},onDeleteAnyway:()=>void k(d.target,`*`)}),d.kind===`bulk-confirm`&&(0,Q.jsx)($,{stage:`confirm`,count:d.targets.length,noun:g,plural:_,onCancel:()=>{M(),d.settle(d.targets)},onConfirm:()=>d.settle(j(d.targets))}),d.kind===`bulk-running`&&(0,Q.jsx)($,{stage:`running`,done:d.done,total:d.total}),d.kind===`bulk-done`&&(0,Q.jsx)($,{stage:`done`,total:d.total,failures:d.failures,onClose:M})]}),start:t=>e.softDelete?k(t,t.etag):p({kind:`confirm`,target:t}),startBulk:e=>new Promise(t=>p({kind:`bulk-confirm`,targets:e,settle:t}))}},se=e=>{let t=E();return e.softDelete?async n=>void await t.undelete(e.name,n.key):void 0},ce=(e,t,n)=>({order:r,index:i})=>{let a=t=>r.findIndex(n=>S(M(e,n))===t),o=t.after.find(e=>a(e.key)>i);if(o)return H(`dependsOn`,{record:n,other:o.title});let s=t.before.find(e=>a(e.key)!==-1&&a(e.key)<i);return s?H(`dependsOn`,{record:s.title,other:n}):void 0},le=(e,t,n,r)=>{let i=e[t],a;for(let o=n;o<e.length;o++){let n=r({record:i,order:I(e,t,o),index:o});if(n===void 0)return{to:o,...a!==void 0&&{reason:a}};a??=n}return{to:t,reason:a}},ue=({model:e,view:t,field:n,filter:r,fields:i,rule:a})=>{let s=E(),l=u(),d=j(),{resources:f,views:p}=O(),m=`${n} asc`,h=P({queryKey:[...g.list(e.name,r,m,500,`hand-order`),i.join(`,`)],queryFn:async()=>{let t=o(f,p,e,i),n=[],a=``;do{let o=await s.search(e.name,{filter:r||void 0,orderBy:m,pageSize:500,labels:t,...a&&{pageToken:a}});n.push(..._(f,e,i,o.items,o.labels).map((t,n)=>({...t,id:b(e,o.items[n])}))),a=o.nextPageToken}while(a);return n}}),[v,x]=(0,q.useState)(),S=(0,q.useRef)(void 0),C=(0,q.useRef)([]),w=(0,q.useRef)(void 0),T=(0,q.useRef)(Promise.resolve()),D=(0,q.useRef)(0),k=(0,q.useRef)(void 0),A=async()=>{let t=S.current,r=C.current;if(C.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=>[b(e,t.record),t])),o=z(i.results,t=>b(e,t)),c=L(e,[...a].map(([e,t])=>({...t,before:{[n]:o.get(e)}})),[n]);k.current!==void 0&&l.dismiss(k.current),k.current=l.show({state:`success`,title:V(`orderChanged`),action:{label:V(`undo`),onClick:()=>W(c)}}),S.current&&=S.current.map(e=>{let t=a.get(e.id);return t?{...e,[n]:t.record[n],etag:t.etag}:e})},M=(e,t)=>n=>{S.current=void 0,C.current=[],x(void 0),l.show(ee(n,e,{place:`list`,title:t?w.current:void 0}))},N=async()=>{--D.current,!(D.current>0)&&(await d(e.name),!(D.current>0)&&(S.current=void 0,x(void 0)))},F=(n,r)=>{let i=S.current??h.data;if(!i||n===r)return;if(!e.position?.after)return H(i,n,r,a);let o=c(e,i[n]).record,l=i[n].id;R(s,e,t,o).then(n=>{let i=S.current??h.data,s=ce(e,n,y(e,t,o,l));H(i,i.findIndex(e=>e.id===l),r,e=>s(e)??a?.(e))},M(V(`couldNotChange`),!1))},H=(i,a,o,s)=>{if(a===-1||a===o)return;let l=s?U(i,a,o,s):o;a!==l&&(S.current=I(i,a,l),C.current=[...C.current,B(e,n,r,S.current,l)],x(S.current),D.current+=1,w.current=y(e,t,c(e,i[a]).record,i[a].id),T.current=T.current.then(A).catch(M(V(`couldNotChange`),!0)).then(N))},U=(t,n,r,i)=>{let a=le(t.map(t=>c(e,t).record),n,r,i);return a.reason!==void 0&&l.show({state:`warning`,title:a.to===n?V(`notMoved`):V(`movedToPlace`,{place:a.to+1}),description:a.reason}),a.to},W=e=>{k.current!==void 0&&l.dismiss(k.current),k.current=void 0,D.current+=1,T.current=T.current.then(async()=>{await s.batchWrite(e),S.current=void 0,C.current=[],x(void 0)}).catch(M(V(`couldNotUndo`),!1)).then(N)};return{rows:v??h.data,loading:h.isPending,error:h.error,move:F}},de=({model:e,view:t,field:n,filter:i,columns:a,sort:o})=>{let{resources:s,views:c}=O(),{fields:l,dropRules:u}=T(),{go:p,href:m}=f(),h=o!==void 0,g=(0,q.useMemo)(()=>k(e,t,a,{resources:s,views:c,fieldTypes:l}).map(e=>h?e:{...e,sortable:!1}),[e,t,a.join(`,`),s,c,l,h]),_=(0,q.useMemo)(()=>d(e,t,g.map(e=>e.id)),[e,t,g]),v=t?.list?.drag?.rule,b=v===void 0?void 0:u?.[v],x=ue({model:e,view:t,field:n,filter:i,fields:_,...b&&{rule:b}}),S=x.rows,C=(0,q.useMemo)(()=>S&&{total:S.length,rowAt:e=>S[e]},[S]);if(v!==void 0&&!b)return(0,Q.jsx)(r,{children:V.rich(`noRule`,{rule:v})});if(x.loading)return(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:Array.from({length:3},(e,t)=>(0,Q.jsx)(w,{className:`h-4 w-full`},t))});if(x.error)return(0,Q.jsx)(D,{title:V(`couldNotLoad`),error:x.error});if(!C||C.total===0)return(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:V(`nothingYet`)});let E=t=>p({kind:`record`,resource:e.name,key:M(e,t)});return(0,Q.jsx)(F,{fit:!0,scroll:`parent`,columns:g,source:C,latencyMs:0,onOpenRow:E,rowLink:t=>({href:m({kind:`record`,resource:e.name,key:M(e,t)}),onFollow:()=>E(t)}),...o&&{sort:o.value,onSortChange:o.onChange},rowNumbers:!1,reorder:{label:n=>y(e,t,n,n.id),onMove:x.move}})},fe=({sorting:e,onChange:t,size:n,iconOnly:r=!1})=>{let i=V(e?`done`:`reorder`);return(0,Q.jsxs)(A,{size:n,variant:e?`primary`:`secondary`,onClick:()=>t(!e),...r&&{"aria-label":i,title:i},children:[e?(0,Q.jsx)(a,{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=3cc96bfc-27bd-4ae0-8b3a-ec7790cc69e8
|
|
@@ -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{
|
|
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{ic as r,mr as i}from"./app-D3BCcbgE.js";import{t as a}from"./workflow-canvas-BKd_Yd0v.js";import{a as o,i as s,n as c}from"./step-panel-jmfh86YA.js";import{t as l}from"./use-run-trace-BRwbwZcf.js";import{t as u}from"./use-workflow-types-Bn24Chp-.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=4fbcfc37-2a89-47ba-bff0-8be09764ec1d
|
package/dist/shell/assets/{runner-install-field-C_hTvogl.js → runner-install-field-CKP8E9ZO.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{
|
|
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{Ws as r,Xc as i,Yi as a,ls as o,nl as s,sc as c}from"./app-D3BCcbgE.js";import{t as l}from"./copy-field-BoXXafL7.js";var u=e(t(),1),d=i(`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=o(),[n,r]=(0,u.useState)(),[i,s]=(0,u.useState)(!1),[m,h]=(0,u.useState)();if(e===null)return null;let g=async()=>{s(!0),h(void 0),await t.runnerRegistration(e).then(r,e=>h(p(e))),s(!1)};return(0,f.jsxs)(`div`,{className:`grid gap-2`,children:[n&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l,{value:n.command,copyLabel:d(`copy`)}),(0,f.jsx)(`p`,{className:`text-body text-muted-foreground`,children:d(`shownOnce`,{until:a(Date.parse(n.expires_at))})})]}),m&&(0,f.jsx)(`p`,{role:`alert`,className:`text-body text-danger-text`,children:m}),(0,f.jsx)(c,{size:`sm`,variant:n?`secondary`:`primary`,className:`justify-self-start`,loading:i,onClick:()=>void g(),children:d(n?`again`:`issue`)})]})},h={of:[...s.runner_install],display:m,cell:()=>null};export{h as runnerInstallField};
|
|
2
|
+
//# debugId=8a3fc13d-64ec-4714-b42a-adeaf4cd3549
|
|
@@ -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{
|
|
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{Ks as r,Va as i,Vc as a,Ws as o,Xc as s,Yi as c,ac as l,ca as u,lc as d,qi as f,qs as p,sc as m}from"./app-D3BCcbgE.js";var h={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]],aliases:[`arrow-up-circle`]};h.node;var g=a(h),_=e=>typeof e==`object`&&!!e&&`error`in e&&typeof e.error==`object`&&e.error!==null&&`code`in e.error&&`message`in e.error,v=async e=>{let t=e.headers.get(`content-type`)?.includes(`json`)??!1?await e.clone().json():void 0;return _(t)?new o({type:`urn:protobase:problem:${t.error.code}`,title:e.statusText||`Request failed`,status:e.status,detail:t.error.message}):p(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=s(`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:f(r)})},T=(e,t=Date.now(),n=u())=>e.updating?w(e,t):e.nextUpdateAt?x(`nextOn`,{policy:x(e.policy),when:c(Date.parse(e.nextUpdateAt),n)}):x(e.policy),E=(e,t=u())=>{let n=c(Date.parse(e.finishedAt),t),r=x(e.outcome,{version:e.toVersion,when:n});return e.message?`${r}: ${e.message}`:`${r}.`},D=e=>r(e)&&e.status<500&&e.problem.detail?e.problem.detail:r(e)&&e.status===409?x(`alreadyLatest`):r(e)&&e.status===403?x(`onlyAdmin`):x(`couldNotStart`),O=e(n(),1),k=({label:e,value:t})=>(0,O.jsxs)(`div`,{className:`flex justify-between gap-4 py-1`,children:[(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,O.jsx)(`span`,{className:`font-medium tabular-nums`,children:t})]}),A=({status:e,requesting:t,error:n,checkError:r,onUpdate:i,onClose:a})=>{let o=e.updating?void 0:e.lastUpdate;return(0,O.jsxs)(l,{title:x(`runtimeUpdate`),description:e.updating?(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,O.jsx)(d,{className:`size-3.5`}),T(e)]}):T(e),onClose:a,actions:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(m,{onClick:a,children:x(`close`)}),(0,O.jsx)(m,{variant:`primary`,loading:t,disabled:e.updating||!e.updateAvailable,onClick:i,children:e.updating?x(`updating`):x(`updateNow`)})]}),children:[(0,O.jsx)(k,{label:x(`currentVersion`),value:e.version}),(0,O.jsx)(k,{label:x(`latestVersion`),value:e.latest}),o&&(0,O.jsx)(`p`,{className:o.outcome===`failed`?`mt-3 text-danger-text`:`mt-3 text-muted-foreground`,children:E(o)}),n!==void 0&&(0,O.jsx)(`p`,{role:`alert`,className:`mt-3 text-danger-text`,children:D(n)}),r!==void 0&&(0,O.jsx)(`p`,{className:`mt-3 text-muted-foreground`,children:x(`checkFailed`)})]})},j=e=>{let t=i(),n=(0,b.useRef)(t);n.current=t;let r=t!==void 0;return(0,b.useMemo)(()=>r?y({url:e,token:()=>n.current}):void 0,[e,r])},M=e=>{let[t,n]=(0,b.useState)(),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(),[s,c]=(0,b.useState)(),l=t?.updating??!1;return(0,b.useEffect)(()=>{if(!e)return;let t=!0,r=()=>e.status().then(e=>{t&&(n(e),c(void 0))},e=>t&&c(e));r();let i=setInterval(()=>void r(),C(l));return()=>{t=!1,clearInterval(i)}},[e,l]),{status:t,update:(0,b.useCallback)(async()=>{e&&(i(!0),o(void 0),await e.update().then(n,o),i(!1))},[e]),requesting:r,error:a,checkError:s}},N=({client:e})=>{let{status:t,update:n,requesting:r,error:i,checkError:a}=M(e),[o,s]=(0,b.useState)(!1);return!t||!o&&!S(t)?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(m,{size:`sm`,variant:`ghost`,"aria-label":x(`updateAvailable`),title:x(`updateAvailable`),onClick:()=>s(!0),className:`max-md:size-9 max-md:p-0`,children:[(0,O.jsx)(g,{className:`size-3.5 text-primary`}),(0,O.jsx)(`span`,{className:`max-md:sr-only`,children:x(`update`)})]}),o&&(0,O.jsx)(A,{status:t,requesting:r,error:i,checkError:a,onUpdate:()=>void n(),onClose:()=>s(!1)})]})},P=({url:e})=>(0,O.jsx)(N,{client:j(e)}),F=({url:e,client:t})=>t?(0,O.jsx)(N,{client:t}):(0,O.jsx)(P,{url:e});export{F as RuntimeUpdateButton};
|
|
2
|
+
//# debugId=c66dfd8d-9a63-404a-8643-0af2b16f1378
|
|
@@ -0,0 +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,Aa as t,Ao as n,Ar as r,At as ee,B as te,Ba as i,Bi as a,Bt as o,Cn as s,Ct as c,Do as l,Dt as u,Et as d,Fr as f,Ft as p,G as m,Gc as h,Gi as g,Gt as _,H as v,Hi as y,Ht as b,Ir as x,Jc as S,Jt as C,K as w,Kc as T,Ki as E,Lr as D,Mo as O,Mt as k,N as A,Na as j,Nt as M,Ot as N,P,Pr as F,Pt as I,Q as L,Qt as R,R as z,Ra as B,Rn as V,Ro as H,Rr as U,Rt as W,Sr as G,St as K,Tr as q,Tt as J,U as Y,Uc as X,Ui as Z,V as Q,Va as ne,Vi as re,Vt as ie,W as ae,Wc as oe,Wi as se,X as ce,Yt as le,Zc as ue,Zt as $,_r as de,_t as fe,ac as pe,bo as me,br as he,bt as ge,cc as _e,co as ve,cs as ye,da as be,dt as xe,et as Se,fo as Ce,ft as we,go as Te,gr as Ee,gt as De,ho as Oe,hr as ke,ht as Ae,it as je,jo as Me,jr as Ne,jt as Pe,ka as Fe,ko as Ie,kr as Le,lc as Re,ls as ze,mt as Be,n as Ve,nc as He,nt as Ue,oo as We,or as Ge,ot as Ke,po as qe,pt as Je,qc as Ye,qt as Xe,r as Ze,rt as Qe,sc as $e,so as et,ss as tt,t as nt,tt as rt,us as it,ut as at,vo as ot,vt as st,wr as ct,wt as lt,xr as ut,xt as dt,yr as ft,yt as pt,z as mt,zi as ht,zt as gt}from"./app-D3BCcbgE.js";import{h as _t,o as vt}from"./vendor-t7Q7QbPu.js";export{K as ActionCard,G as ActionInputError,ye as ApiProvider,f as App,D as AppLink,Me as AppMark,we as AssistantDock,ve as AuthLayout,Oe as AvailabilityMark,$e as Button,W as CallMark,b as CallView,w as Carousel,k as ChatDivider,Pe as ChatMessage,ee as ChatThread,mt as Choices,We as CodeForm,ge as CompactTable,lt as Composer,pe as Dialog,fe as DiffView,z as Field,le as FieldBadge,dt as FieldList,Ee as FileReadError,e as FocusActions,Se as FocusNotice,je as FocusPage,rt as FocusPanel,Ue as FocusSlot,A as Form,he as HtmlFrame,Ve as InPlaceForm,l as Input,O as LogoMark,s as Markdown,d as MentionBox,J as MentionedText,te as MenuSelect,ot as MenuSurface,Ce as OtpInput,Be as PartView,o as RecordCall,_ as RecordLink,nt as RecordPicker,et as ResendCodeButton,Z as ResponsiveDialog,He as RouteLink,ce as SearchPicker,P as Section,me as Segmented,Q as Select,c as SidePanel,p as SignInPrompt,Re as Spinner,Te as StatusMark,Ae as StepList,V as Textarea,C as ToneEdge,v as allowDelayMs,_e as buttonClass,M as chatDayLabel,H as closeSidebarEvent,Fe as definePlugin,t as defineUi,st as diffStats,u as emptyDraft,ut as fileNamed,ct as isConflict,Y as isFramed,n as logoTapEvent,N as mentionedIds,h as mergeUi,pt as parseDiff,De as parsePatch,Ye as pluginApi,X as pluginsChangedEvent,S as protobaseVersion,I as sameChatDay,ue as showTextsIn,ft as siblingPage,qe as signedOutEvent,a as statusRefreshMs,T as uiFromModule,x as uiReadyEvent,ne as useApiToken,U as useAppAddress,ae as useArmedAfterFocus,xe as useAssistant,at as useAssistantClient,Je as useBackendData,ze as useClient,$ as useComponentReads,R as useComponentSelect,Ze as useCreateForm,Le as useFacets,Ie as useFieldControl,de as useFileText,Ke as useFocusPage,L as useFocusRecord,Qe as useFocusZoneFilled,m as useGuardedPress,r as useHistogram,se as useInbox,Ge as useLayoutRecord,F as useList,Xe as useListDisplay,g as useMarkNotificationsRead,ht as useMembers,tt as useMeta,re as useOwnStatus,oe as usePlugin,j as usePresence,be as usePushNotifications,vt as useQuery,_t as useQueryClient,B as useRecord,ie as useRecordCallAddress,gt as useRecordCalls,it as useResourceClient,Ne as useSeries,ke as useSiblingPage,i as useSignedInUser,y as useStatuses,E as useUnreadNotifications,q 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{
|
|
2
|
-
`)}\r\n`},E=({label:e,counts:t})=>(0,T.jsx)(`dl`,{"aria-label":e,className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:t.map(([e,t])=>(0,T.jsxs)(`div`,{className:`rounded-lg border px-3 py-2`,children:[(0,T.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:e}),(0,T.jsx)(`dd`,{className:`text-lg font-semibold tabular-nums`,children:t.toLocaleString(s())})]},e))}),D=(e,t)=>e?.fields[t]?.label??v(t),ie=new Set([`text`,`integer`,`bigint`,`decimal`,`boolean`,`date`,`timestamp`,`uuid`,`enum`,`relation`,`currency`,`country`]),O=(e,t)=>{let n=e.relation?t[e.relation.resource]:void 0;return n?.primaryKey.length===1?n:void 0},ae=(e,t,{json:n=!1}={})=>Object.values(e.fields).filter(r=>r.readOnly||r.name===e.tenant?!1:r.type===`json`?n:ie.has(r.type)?r.type!==`relation`||O(r,t)!==void 0:!1),oe=new Set([`text`,`integer`,`bigint`,`uuid`,`date`,`currency`,`country`,`enum`]),se=e=>{let t=e.primaryKey.length===1?[e.fields[e.primaryKey[0]]]:[],n=Object.values(e.fields).filter(t=>t.filterable&&!t.sensitive&&oe.has(t.type)&&!e.primaryKey.includes(t.name));return[...t,...n]},k=(e,t)=>O(e,t),A=e=>!e.nullable&&!e.default,j=e=>e.toLowerCase().replace(/[\s_-]+/g,``),ce=(e,t,n)=>{let r=new Set;return e.flatMap((e,i)=>{let a=j(e);if(a===``)return[];let o=t.find(e=>!r.has(e.name)&&(j(D(n,e.name))===a||j(e.name)===a));return o?(r.add(o.name),[{column:i,field:o.name}]):[]})},le=(e,t,n)=>{if(e===`update`)return[];let r=new Set(n.map(e=>e.field));return t.filter(e=>A(e)&&!r.has(e.name))},M=e=>({ok:!0,value:e}),N=e=>({ok:!1,problem:e}),P=e=>`“${x(e)}”`,F=(e,t)=>{if(typeof e==`number`)return String(e);if(typeof e==`string`)return p(e,t.decimal)},ue=(e,t,n)=>{let r=F(t,n);if(r===void 0)return N(b(`notNumber`,{cell:P(t)}));let[i,a=``]=r.split(`.`);if(/[1-9]/.test(a)||/e/i.test(r))return N(b(`notWholeNumber`,{cell:P(t)}));if(e.type===`bigint`)return M(String(BigInt(i)));let o=Number(i);return Number.isSafeInteger(o)?M(o):N(b(`tooLarge`,{cell:P(t)}))},de=(e,t)=>{let n=F(e,t);return n===void 0?N(b(`notNumber`,{cell:P(e)})):M(n)},fe=new Set([`true`,`yes`,`1`]),pe=new Set([`false`,`no`,`0`]),me=e=>{if(typeof e==`boolean`)return M(e);let t=typeof e==`string`||typeof e==`number`?String(e).trim().toLowerCase():``;return fe.has(t)?M(!0):pe.has(t)?M(!1):N(b(`notBoolean`,{cell:P(e)}))},I=e=>String(e).padStart(2,`0`),he=(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}-${I(t)}-${I(n)}`},L=`(\\d{1,2}):(\\d{2})(?::(\\d{2})(?:\\.\\d+)?)?`,ge=(e,t)=>{let n=RegExp(`^(\\d{4})[-/](\\d{1,2})[-/](\\d{1,2})(?:[T ]${L}(Z|[+-]\\d{2}:?\\d{2})?)?$`).exec(e.trim()),r=RegExp(`^(\\d{1,2})[./-](\\d{1,2})[./-](\\d{4})(?: ${L})?$`).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=he(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:`${I(Number(c))}:${l}:${I(Number(u))}`,zone:n?.[7]}},R=(e,t)=>{if(ee(e)){let[t,n]=e.date.split(`T`);return{date:t,time:n}}return typeof e==`string`?ge(e,t.dateOrder):void 0},z=(e,t)=>N(b(`notDate`,{cell:P(e),dayFirst:t.dateOrder===`dmy`})),_e=(e,t)=>{let n=R(e,t);return n?n.time&&n.time!==`00:00:00`?N(b(`hasTime`,{cell:P(e)})):M(n.date):z(e,t)},ve=(e,t)=>{let n=R(e,t);if(!n)return z(e,t);if(n.zone)return M(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 M(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(x(n)),a=r.filter(e=>B(e)===i||B(g(e,t?.valueLabels))===i);return a.length===1?M(a[0]):a.length>1?N(b(`severalValues`,{cell:P(n),values:a.map(e=>g(e,t?.valueLabels)).join(`, `)})):N(b(`notOneOf`,{cell:P(n),values:r.map(e=>g(e,t?.valueLabels)).join(`, `)}))},be=(e,t)=>typeof e==`boolean`&&!t.booleanText?N(b(`notText`,{cell:P(e)})):M(x(e)),xe=e=>S(e)?M(e.json):M(e),V=(e,t,n,r)=>{if(y(n))return e.nullable?M(null):N(b(`emptyRequired`));if(e.type===`json`)return xe(n);if(S(n))return N(b(`nestedValue`,{cell:P(n)}));switch(e.type){case`integer`:case`bigint`:return ue(e,n,r);case`decimal`:return de(n,r);case`boolean`:return me(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??v(t),Ce=(e,t)=>e[t]?.names?.plural??v(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=D(o,d),g=k(p,i);if(g&&!y(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]=x(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(`${D(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=`${D(e.views[t.model.name],t.field).toLowerCase()} “${String(t.value)}”`;return n.length===1?{key:n[0]}:n.length===0?{none:b(`noneHas`,{singular:Se(e.views,t.model.name),named:r})}:{several:b(`severalHave`,{count:n.length,plural:Ce(e.views,t.model.name),named:r})}},Te=e=>e.cells.every(y),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(`${D(i[r.name],e)}: ${a.none??a.several}`)}let d=l&&H(n,l);d?.several&&s.push(b(`notOneRecord`,{found:d.several})),d?.none&&t.mode===`update`&&s.push(b(`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(x),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=>`${D(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)=>_(re(t,n),b(`notImportedFile`,{name:(e??`import`).replace(/\.[^.]+$/,``)}),`text/csv`),q=({rows:e})=>(0,T.jsxs)(`ul`,{"aria-label":b(`rowsNotImported`),className:`flex flex-col gap-1 text-body`,children:[e.slice(0,G).map(e=>(0,T.jsxs)(`li`,{children:[(0,T.jsx)(`span`,{className:`font-medium`,children:b(`rowProblems`,{line:e.line})}),` `,e.problems.join(`; `)]},e.line)),e.length>G&&(0,T.jsx)(`li`,{className:`text-muted-foreground`,children:b(`andMore`,{count:(e.length-G).toLocaleString(s())})})]}),Me=({rows:e})=>(0,T.jsxs)(`p`,{className:`flex items-center gap-2 text-muted-foreground`,role:`status`,children:[(0,T.jsx)(d,{className:`size-3.5`}),b(`checkingRows`,{count:e.toLocaleString(s())})]}),Ne=({check:e,model:t,resources:n,views:r,columns:a,headers:o,fileName:s})=>{let c=r[t.name],l=a.map(e=>t.fields[e.field]);return(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsx)(E,{label:b(`check`),counts:[[b(`rows`),e.rows],[b(`toCreate`),e.creates],[b(`toUpdate`),e.updates],[b(`withProblems`),e.problems.length]]}),e.preview.length>0&&(0,T.jsx)(`div`,{className:`overflow-x-auto rounded-lg border`,children:(0,T.jsxs)(`table`,{"aria-label":b(`firstRows`),className:`w-full text-left text-body`,children:[(0,T.jsx)(`thead`,{className:`bg-muted text-muted-foreground`,children:(0,T.jsxs)(`tr`,{children:[(0,T.jsx)(`th`,{className:`px-2 py-1.5 font-medium`,children:b(`row`)}),l.map(e=>(0,T.jsx)(`th`,{className:`whitespace-nowrap px-2 py-1.5 font-medium`,children:D(c,e.name)},e.name))]})}),(0,T.jsx)(`tbody`,{className:`divide-y`,children:e.preview.map(e=>(0,T.jsxs)(`tr`,{className:e.problems.length>0?`bg-danger-soft`:void 0,children:[(0,T.jsx)(`td`,{className:`px-2 py-1.5 tabular-nums text-muted-foreground`,children:e.line}),l.map(t=>(0,T.jsx)(`td`,{className:`max-w-48 truncate px-2 py-1.5`,children:k(t,n)?String(e.values[t.name]??`—`):t.name in e.values?f(t,e.values[t.name],c?.fields[t.name]):``},t.name))]},e.line))})]})}),e.problems.length>0&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsx)(`h3`,{className:`font-medium`,children:b(`problemRows`)}),(0,T.jsxs)(h,{size:`sm`,onClick:()=>K(s,o,e.problems),children:[(0,T.jsx)(i,{className:`size-3.5`}),b(`download`)]})]}),(0,T.jsx)(q,{rows:e.problems})]}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`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,w.useId)();return(0,T.jsxs)(`div`,{className:l(`flex min-w-0 flex-col gap-1.5`,o),children:[(0,T.jsx)(`label`,{htmlFor:s,className:`font-medium`,children:e}),(0,T.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,T.jsx)(`option`,{value:e.value,children:e.label},e.value))}),a&&(0,T.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,w.useId)();return(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsx)(`label`,{htmlFor:o,className:`font-medium`,children:b(`file`)}),(0,T.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,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`fileHint`)})]}),r&&(0,T.jsxs)(`p`,{className:`flex items-center gap-2 text-muted-foreground`,role:`status`,children:[(0,T.jsx)(d,{className:`size-3.5`}),b(`reading`,{name:e?.name??b(`theFile`)})]}),!r&&t.length>1&&(0,T.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,T.jsx)(te,{className:`mb-2 size-4 shrink-0 text-muted-foreground`}),(0,T.jsx)(J,{className:`flex-1`,label:b(`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,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:b(n?`stopping`:`saving`)}),(0,T.jsxs)(`span`,{className:`tabular-nums`,children:[X(r),` / `,X(t)]})]}),(0,T.jsx)(`div`,{role:`progressbar`,"aria-label":b(`rowsSaved`),"aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":t,className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,T.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,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[t!==void 0&&(0,T.jsx)(m,{title:b(`stopped`),error:t}),e.cancelled&&(0,T.jsx)(`p`,{role:`status`,children:b(`cancelled`)}),(0,T.jsx)(E,{label:b(`summary`),counts:[[b(`created`),e.created],[b(`updated`),e.updated],[b(`skipped`),e.skipped],[b(`failed`),e.failed]]}),e.notWritten.length>0&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsx)(`h3`,{className:`font-medium`,children:b(`rowsNotImported`)}),(0,T.jsxs)(h,{size:`sm`,onClick:()=>K(r,n,e.notWritten),children:[(0,T.jsx)(i,{className:`size-3.5`}),b(`download`)]})]}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`notWrittenHint`)}),(0,T.jsx)(q,{rows:[...e.notWritten].sort((e,t)=>e.line-t.line)})]})]}),Ve=c(),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 o=n(t.name,r),s=[...new Map(i.filter(e=>!o.has(Q(e))).map(e=>[Q(e),e])).values()],c=t.primaryKey[0];for(let n=0;n<s.length;n+=Z){let i=s.slice(n,n+Z);for(let e of i)o.set(Q(e),[]);let l=a(Ve.in(r,i)),u;do{let n=await e(t.name).list(t.name,{filter:l,fields:[...new Set([c,r])],pageSize:1e3,pageToken:u});for(let e of n.items)o.get(Q(e[r]))?.push(e[c]);u=n.nextPageToken||void 0}while(u)}},keysOf:(e,t,r)=>n(e,t).get(Q(r))??[]}},Ue=500,$=()=>{let e=new Worker(new URL(`/assets/parse-worker-BRxyLV_D.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:b(`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:u()});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:u()});;){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{A as _,Y as a,Me as c,je as d,ce as f,k as g,se as h,Be as i,ke as l,ae as m,He as n,J as o,D as p,ze as r,Ne as s,We as t,Oe as u,le 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{$c as r,Hc as i,Kl as a,Ks as o,Oc as s,Qc as c,Vc as l,Wl as u,cl as d,gi as f,io as p,j as m,lc as h,mr as g,sc as _,sl as v}from"./app-D3BCcbgE.js";import{c as y,d as b,l as ee,o as x,u as S}from"./list-page-Czg2Jaxx.js";var C={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`}]]};C.node;var te=l(C),w=e(t(),1),T=e(n(),1),ne=e=>/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e,re=(e,t)=>{let n=[...t].sort((e,t)=>e.line-t.line).map(t=>[...e.map((e,n)=>x(t.cells[n]??null)),String(t.line),t.problems.join(`; `)]);return`${[[...e,b(`line`),b(`problems`)],...n].map(e=>e.map(ne).join(`,`)).join(`\r
|
|
2
|
+
`)}\r\n`},E=({label:e,counts:t})=>(0,T.jsx)(`dl`,{"aria-label":e,className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:t.map(([e,t])=>(0,T.jsxs)(`div`,{className:`rounded-lg border px-3 py-2`,children:[(0,T.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:e}),(0,T.jsx)(`dd`,{className:`text-lg font-semibold tabular-nums`,children:t.toLocaleString(r())})]},e))}),D=(e,t)=>e?.fields[t]?.label??d(t),ie=new Set([`text`,`integer`,`bigint`,`decimal`,`boolean`,`date`,`timestamp`,`uuid`,`enum`,`relation`,`currency`,`country`]),O=(e,t)=>{let n=e.relation?t[e.relation.resource]:void 0;return n?.primaryKey.length===1?n:void 0},ae=(e,t,{json:n=!1}={})=>Object.values(e.fields).filter(r=>r.readOnly||r.name===e.tenant?!1:r.type===`json`?n:ie.has(r.type)?r.type!==`relation`||O(r,t)!==void 0:!1),oe=new Set([`text`,`integer`,`bigint`,`uuid`,`date`,`currency`,`country`,`enum`]),se=e=>{let t=e.primaryKey.length===1?[e.fields[e.primaryKey[0]]]:[],n=Object.values(e.fields).filter(t=>t.filterable&&!t.sensitive&&oe.has(t.type)&&!e.primaryKey.includes(t.name));return[...t,...n]},k=(e,t)=>O(e,t),A=e=>!e.nullable&&!e.default,j=e=>e.toLowerCase().replace(/[\s_-]+/g,``),ce=(e,t,n)=>{let r=new Set;return e.flatMap((e,i)=>{let a=j(e);if(a===``)return[];let o=t.find(e=>!r.has(e.name)&&(j(D(n,e.name))===a||j(e.name)===a));return o?(r.add(o.name),[{column:i,field:o.name}]):[]})},le=(e,t,n)=>{if(e===`update`)return[];let r=new Set(n.map(e=>e.field));return t.filter(e=>A(e)&&!r.has(e.name))},M=e=>({ok:!0,value:e}),N=e=>({ok:!1,problem:e}),P=e=>`“${x(e)}”`,F=(e,t)=>{if(typeof e==`number`)return String(e);if(typeof e==`string`)return m(e,t.decimal)},ue=(e,t,n)=>{let r=F(t,n);if(r===void 0)return N(b(`notNumber`,{cell:P(t)}));let[i,a=``]=r.split(`.`);if(/[1-9]/.test(a)||/e/i.test(r))return N(b(`notWholeNumber`,{cell:P(t)}));if(e.type===`bigint`)return M(String(BigInt(i)));let o=Number(i);return Number.isSafeInteger(o)?M(o):N(b(`tooLarge`,{cell:P(t)}))},de=(e,t)=>{let n=F(e,t);return n===void 0?N(b(`notNumber`,{cell:P(e)})):M(n)},fe=new Set([`true`,`yes`,`1`]),pe=new Set([`false`,`no`,`0`]),me=e=>{if(typeof e==`boolean`)return M(e);let t=typeof e==`string`||typeof e==`number`?String(e).trim().toLowerCase():``;return fe.has(t)?M(!0):pe.has(t)?M(!1):N(b(`notBoolean`,{cell:P(e)}))},I=e=>String(e).padStart(2,`0`),he=(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}-${I(t)}-${I(n)}`},L=`(\\d{1,2}):(\\d{2})(?::(\\d{2})(?:\\.\\d+)?)?`,ge=(e,t)=>{let n=RegExp(`^(\\d{4})[-/](\\d{1,2})[-/](\\d{1,2})(?:[T ]${L}(Z|[+-]\\d{2}:?\\d{2})?)?$`).exec(e.trim()),r=RegExp(`^(\\d{1,2})[./-](\\d{1,2})[./-](\\d{4})(?: ${L})?$`).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=he(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:`${I(Number(c))}:${l}:${I(Number(u))}`,zone:n?.[7]}},R=(e,t)=>{if(ee(e)){let[t,n]=e.date.split(`T`);return{date:t,time:n}}return typeof e==`string`?ge(e,t.dateOrder):void 0},z=(e,t)=>N(b(`notDate`,{cell:P(e),dayFirst:t.dateOrder===`dmy`})),_e=(e,t)=>{let n=R(e,t);return n?n.time&&n.time!==`00:00:00`?N(b(`hasTime`,{cell:P(e)})):M(n.date):z(e,t)},ve=(e,t)=>{let n=R(e,t);if(!n)return z(e,t);if(n.zone)return M(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 M(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(x(n)),a=r.filter(e=>B(e)===i||B(v(e,t?.valueLabels))===i);return a.length===1?M(a[0]):a.length>1?N(b(`severalValues`,{cell:P(n),values:a.map(e=>v(e,t?.valueLabels)).join(`, `)})):N(b(`notOneOf`,{cell:P(n),values:r.map(e=>v(e,t?.valueLabels)).join(`, `)}))},be=(e,t)=>typeof e==`boolean`&&!t.booleanText?N(b(`notText`,{cell:P(e)})):M(x(e)),xe=e=>S(e)?M(e.json):M(e),V=(e,t,n,r)=>{if(y(n))return e.nullable?M(null):N(b(`emptyRequired`));if(e.type===`json`)return xe(n);if(S(n))return N(b(`nestedValue`,{cell:P(n)}));switch(e.type){case`integer`:case`bigint`:return ue(e,n,r);case`decimal`:return de(n,r);case`boolean`:return me(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??d(t),Ce=(e,t)=>e[t]?.names?.plural??d(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=D(o,d),g=k(p,i);if(g&&!y(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]=x(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(`${D(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=`${D(e.views[t.model.name],t.field).toLowerCase()} “${String(t.value)}”`;return n.length===1?{key:n[0]}:n.length===0?{none:b(`noneHas`,{singular:Se(e.views,t.model.name),named:r})}:{several:b(`severalHave`,{count:n.length,plural:Ce(e.views,t.model.name),named:r})}},Te=e=>e.cells.every(y),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(`${D(i[r.name],e)}: ${a.none??a.several}`)}let d=l&&H(n,l);d?.several&&s.push(b(`notOneRecord`,{found:d.several})),d?.none&&t.mode===`update`&&s.push(b(`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(x),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=>`${D(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(re(t,n),b(`notImportedFile`,{name:(e??`import`).replace(/\.[^.]+$/,``)}),`text/csv`),q=({rows:e})=>(0,T.jsxs)(`ul`,{"aria-label":b(`rowsNotImported`),className:`flex flex-col gap-1 text-body`,children:[e.slice(0,G).map(e=>(0,T.jsxs)(`li`,{children:[(0,T.jsx)(`span`,{className:`font-medium`,children:b(`rowProblems`,{line:e.line})}),` `,e.problems.join(`; `)]},e.line)),e.length>G&&(0,T.jsx)(`li`,{className:`text-muted-foreground`,children:b(`andMore`,{count:(e.length-G).toLocaleString(r())})})]}),Me=({rows:e})=>(0,T.jsxs)(`p`,{className:`flex items-center gap-2 text-muted-foreground`,role:`status`,children:[(0,T.jsx)(h,{className:`size-3.5`}),b(`checkingRows`,{count:e.toLocaleString(r())})]}),Ne=({check:e,model:t,resources:n,views:r,columns:i,headers:a,fileName:o})=>{let c=r[t.name],l=i.map(e=>t.fields[e.field]);return(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsx)(E,{label:b(`check`),counts:[[b(`rows`),e.rows],[b(`toCreate`),e.creates],[b(`toUpdate`),e.updates],[b(`withProblems`),e.problems.length]]}),e.preview.length>0&&(0,T.jsx)(`div`,{className:`overflow-x-auto rounded-lg border`,children:(0,T.jsxs)(`table`,{"aria-label":b(`firstRows`),className:`w-full text-left text-body`,children:[(0,T.jsx)(`thead`,{className:`bg-muted text-muted-foreground`,children:(0,T.jsxs)(`tr`,{children:[(0,T.jsx)(`th`,{className:`px-2 py-1.5 font-medium`,children:b(`row`)}),l.map(e=>(0,T.jsx)(`th`,{className:`whitespace-nowrap px-2 py-1.5 font-medium`,children:D(c,e.name)},e.name))]})}),(0,T.jsx)(`tbody`,{className:`divide-y`,children:e.preview.map(e=>(0,T.jsxs)(`tr`,{className:e.problems.length>0?`bg-danger-soft`:void 0,children:[(0,T.jsx)(`td`,{className:`px-2 py-1.5 tabular-nums text-muted-foreground`,children:e.line}),l.map(t=>(0,T.jsx)(`td`,{className:`max-w-48 truncate px-2 py-1.5`,children:k(t,n)?String(e.values[t.name]??`—`):t.name in e.values?f(t,e.values[t.name],c?.fields[t.name]):``},t.name))]},e.line))})]})}),e.problems.length>0&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsx)(`h3`,{className:`font-medium`,children:b(`problemRows`)}),(0,T.jsxs)(_,{size:`sm`,onClick:()=>K(o,a,e.problems),children:[(0,T.jsx)(s,{className:`size-3.5`}),b(`download`)]})]}),(0,T.jsx)(q,{rows:e.problems})]}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`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:a,help:o,className:s})=>{let c=(0,w.useId)();return(0,T.jsxs)(`div`,{className:i(`flex min-w-0 flex-col gap-1.5`,s),children:[(0,T.jsx)(`label`,{htmlFor:c,className:`font-medium`,children:e}),(0,T.jsx)(`select`,{id:c,"aria-label":t,value:n,onChange:e=>a(e.target.value),className:`h-8 w-full min-w-0 rounded-md border border-border-strong bg-background px-2 shadow-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20 max-sm:min-h-11`,children:r.map(e=>(0,T.jsx)(`option`,{value:e.value,children:e.label},e.value))}),o&&(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o})]})},Y=({file:e,sheets:t,sheet:n,reading:r,onChoose:i,onSheet:a})=>{let o=(0,w.useId)();return(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsx)(`label`,{htmlFor:o,className:`font-medium`,children:b(`file`)}),(0,T.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,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`fileHint`)})]}),r&&(0,T.jsxs)(`p`,{className:`flex items-center gap-2 text-muted-foreground`,role:`status`,children:[(0,T.jsx)(h,{className:`size-3.5`}),b(`reading`,{name:e?.name??b(`theFile`)})]}),!r&&t.length>1&&(0,T.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,T.jsx)(te,{className:`mb-2 size-4 shrink-0 text-muted-foreground`}),(0,T.jsx)(J,{className:`flex-1`,label:b(`sheet`),value:n??``,options:t.map(e=>({value:e,label:e})),onChange:a})]})]})},X=e=>e.toLocaleString(r()),ze=({progress:e,total:t,cancelling:n})=>{let r=e.created+e.updated+e.failed;return(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:b(n?`stopping`:`saving`)}),(0,T.jsxs)(`span`,{className:`tabular-nums`,children:[X(r),` / `,X(t)]})]}),(0,T.jsx)(`div`,{role:`progressbar`,"aria-label":b(`rowsSaved`),"aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":t,className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,T.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,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[t!==void 0&&(0,T.jsx)(g,{title:b(`stopped`),error:t}),e.cancelled&&(0,T.jsx)(`p`,{role:`status`,children:b(`cancelled`)}),(0,T.jsx)(E,{label:b(`summary`),counts:[[b(`created`),e.created],[b(`updated`),e.updated],[b(`skipped`),e.skipped],[b(`failed`),e.failed]]}),e.notWritten.length>0&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsx)(`h3`,{className:`font-medium`,children:b(`rowsNotImported`)}),(0,T.jsxs)(_,{size:`sm`,onClick:()=>K(r,n,e.notWritten),children:[(0,T.jsx)(s,{className:`size-3.5`}),b(`download`)]})]}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`notWrittenHint`)}),(0,T.jsx)(q,{rows:[...e.notWritten].sort((e,t)=>e.line-t.line)})]})]}),Ve=u(),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 o=n(t.name,r),s=[...new Map(i.filter(e=>!o.has(Q(e))).map(e=>[Q(e),e])).values()],c=t.primaryKey[0];for(let n=0;n<s.length;n+=Z){let i=s.slice(n,n+Z);for(let e of i)o.set(Q(e),[]);let l=a(Ve.in(r,i)),u;do{let n=await e(t.name).list(t.name,{filter:l,fields:[...new Set([c,r])],pageSize:1e3,pageToken:u});for(let e of n.items)o.get(Q(e[r]))?.push(e[c]);u=n.nextPageToken||void 0}while(u)}},keysOf:(e,t,r)=>n(e,t).get(Q(r))??[]}},Ue=500,$=()=>{let e=new Worker(new URL(`/assets/parse-worker-VaelBbE0.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:b(`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:c()});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:c()});;){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{A as _,Y as a,Me as c,je as d,ce as f,k as g,se as h,Be as i,ke as l,ae as m,He as n,J as o,D as p,ze as r,Ne as s,We as t,Oe as u,le as v};
|
|
3
|
+
//# debugId=1c2897d4-6ae7-45f6-b1d7-62d1a15bf37f
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$c as r,$o as i,Hc as a,Jo as o,Ss as s,Yi as c,Yo as l,Zo as u,lc as d,sc as f,vs as p,ys as m}from"./app-D3BCcbgE.js";import{t as h}from"./page-header-Ddz2r5ic.js";var g=e(t(),1),_=()=>[{value:`allowed`,label:p(`on`)},{value:`forbidden`,label:p(`off`)}],v=()=>[{value:`allowed`,label:p(`optional`)},{value:`required`,label:p(`required`)},{value:`forbidden`,label:p(`off`)}],y=()=>[{method:`password`,label:p(`password`),description:p(`passwordDescription`),rules:_()},{method:`emailCode`,label:p(`emailedSignInCode`),description:p(`emailedSignInCodeDescription`),rules:_()},{method:`passkey`,label:p(`passkeys`),description:p(`passkeysPolicyDescription`),rules:v()},{method:`twoFactor`,label:p(`twoFactor`),description:p(`twoFactorPolicyDescription`),rules:v()},{method:`staffAccess`,label:p(`staffAccess`),description:p(`staffAccessDescription`),rules:[{value:`allowed`,label:p(`on`)},{value:`notify`,label:p(`emailThePerson`)},{value:`forbidden`,label:p(`off`)}]},{method:`platformSignIn`,label:p(`platformSignIn`),description:p(`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:a(`rounded px-3 text-body font-medium transition-colors`,e.value===t?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:e.label},e.value))}),C=({method:e},t,{mail:n,effective:r,policy:i})=>{if(e===`emailCode`&&!n)return p(`codeNeedsMail`);if(e===`password`&&!n&&t.password===`forbidden`)return p(`passwordStaysOn`);if(e===`staffAccess`&&!n&&t.staffAccess===`notify`)return p(`staffNeedsMail`);if(e===`platformSignIn`&&t.platformSignIn===`allowed`&&t.passkey===`required`)return p(`platformOff`);if(t[e]===i[e]&&r[e]!==i[e])return p(`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:p(`platformSignInWith`,{provider:new Intl.ListFormat(r(),{type:`conjunction`}).format(t)})}]:[]:[n]),T=({state:e,onSave:t,busy:n,error:r,notice:i})=>{let[a,o]=(0,g.useState)(e.policy),s=w(e),l=s.some(({method:t})=>a[t]!==e.policy[t]);return(0,x.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),t(a)},children:[(0,x.jsx)(`ul`,{className:`divide-y rounded-lg border bg-background`,children:s.map(t=>{let n=C(t,a,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:a[t.method],onChange:e=>o({...a,[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}),i&&!l&&(0,x.jsx)(`p`,{role:`status`,className:`rounded-md bg-success-soft px-3 py-2 text-body font-medium text-success-text`,children:i}),(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?p(`lastSavedBy`,{name:e.savedBy,time:c(Date.parse(e.savedAt))}):p(`lastSaved`,{time:c(Date.parse(e.savedAt))}):p(`neverChanged`)}),(0,x.jsxs)(`div`,{className:`flex gap-2`,children:[l&&(0,x.jsx)(f,{onClick:()=>o(e.policy),children:p(`reset`)}),(0,x.jsx)(f,{variant:`primary`,type:`submit`,loading:n,disabled:!l,children:p(`save`)})]})]})]})},E=(e,t)=>e.endedAt?(0,x.jsx)(u,{tone:`neutral`,children:p(`stopped`,{time:c(Date.parse(e.endedAt))})}):Date.parse(e.expiresAt)<=t?(0,x.jsx)(u,{tone:`neutral`,children:p(`ended`,{time:c(Date.parse(e.expiresAt))})}):(0,x.jsx)(u,{tone:`amber`,children:p(`signedInUntil`,{time:c(Date.parse(e.expiresAt))})}),D=({signIns:e,operator:t,error:n,now:r=Date.now()})=>(0,x.jsxs)(o,{title:p(`staffSignIns`),description:p(`staffSignInsDescription`,{operator:t}),children:[(0,x.jsx)(l,{message:n}),e&&e.length===0&&(0,x.jsx)(`p`,{className:`text-muted-foreground`,children:p(`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:p(`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:c(Date.parse(e.startedAt))}),E(e,r)]})]},e.id))})]}),O=({operator:e})=>{let{session:t}=m(),[n,r]=(0,g.useState)(),[a,o]=(0,g.useState)();return(0,g.useEffect)(()=>{t.staff.log().then(r,e=>o(e instanceof s?i(e):p(`couldNotReadStaffSignIns`)))},[t]),(0,x.jsx)(D,{operator:e,signIns:n,error:a})},k=()=>{let{session:e}=m(),[t,n]=(0,g.useState)(),[r,a]=(0,g.useState)(!1),[o,c]=(0,g.useState)(),[l,u]=(0,g.useState)();(0,g.useEffect)(()=>{e.signInPolicy.read().then(n,e=>c(e instanceof s?i(e):p(`couldNotReadPolicy`)))},[e]);let f=async t=>{a(!0),c(void 0),u(void 0);try{n(await e.signInPolicy.save(t)),u(p(`policySaved`))}catch(e){if(!(e instanceof s))throw e;c(i(e))}a(!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:p(`signInPolicy`),subtitle:p(`policySubtitle`)}),t?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{state:t,busy:r,error:o,notice:l,onSave:e=>void f(e)},t.savedAt??`default`),t.operator&&(0,x.jsx)(O,{operator:t.operator})]}):o?(0,x.jsx)(`p`,{role:`alert`,className:`text-danger-text`,children:o}):(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,x.jsx)(d,{}),` `,p(`loading`)]})]})};export{k as SignInPolicyPage};
|
|
2
|
+
//# debugId=6dcb8221-d718-4f25-954a-f25ce907f0e1
|
|
@@ -0,0 +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{Bo as n,Bs as r,Ds as i,Er as a,Jn as o,Nr as s,Qn as c,_a as l,an as u,ar as d,dn as f,er as p,fn as m,in as h,ja as g,ks as _,ls as v,ns as y,rn as b,sr as x,un as S,ws as C}from"./app-D3BCcbgE.js";import{h as w}from"./vendor-t7Q7QbPu.js";import{S as T,ht as E,r as D}from"./embedded-list-6lQyJozS.js";import{n as O}from"./record-preview-QMV2lW2j.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:c=!1,limit:d=10,select:p}=h(e),m=r===void 0?void 0:n.resources[r];if(!m)return[];if(t.part===`chosen`){let e=p===void 0?void 0:n.given[p];return e?[A(f(n.client,m,{key:e}))]:[]}let g=n.views[m.name],{fields:v,read:y}=u({...n,model:m,view:g,columns:o?.map(_),button:s,bulk:c,phoneColumns:b(o)});return[A(D(n,{model:m,filter:i,orderBy:a||l(m,g),limit:d,fields:v,read:y}))]},Chart:(e,t,{client:n,resources:r,views:i})=>{let{resource:o,groupBy:s,splitBy:c,sum:l,average:u,filter:d,granularity:f,range:p,limit:m}=h(e),g=r[o],_=g&&E({model:g,groupBy:s,splitBy:c,sum:l,average:u,filter:d,granularity:f,range:p,limit:m},r,i);return g&&_?[A(a(n,g.name,_))]:[]},RecordCards:(e,t,{client:n,resources:r,views:i})=>{let{resource:a,filter:o=``,sort:s=``,limit:c=10}=h(e),u=r[a];if(!u)return[];let d=s||l(u,i[u.name]);return[A(m(n,u,{filter:o,sort:d,pageSize:c})),A(S(n,u,o))]},RecordRow:(e,t,{client:n,queryClient:r,resources:i,views:a})=>{let{resource:o,filter:s=``,sort:c=``}=h(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:i,views:a})=>{let{resource:c,filter:l,sender:u,time:d,calls:f,limit:p=50}=h(e);if(t.part===`calls`){let e=f&&i[f.resource];return e?[j(s(n,e.name,{filter:f.filter,orderBy:r(f.time),pageSize:p}))]:[]}let m=i[c];if(!m)return[];let g=o(i,a,m,u===void 0?[]:[u]);return[j(s(n,m.name,{filter:l,orderBy:r(d),pageSize:p,labels:g}))]}},N=(e,t,{client:n,resources:r})=>{let i=r[t.resource];return i?[A(S(n,i))]:[]},P=(e,t,n)=>(n?.reads??[]).flatMap(n=>{let r=i(t,n.block);if(!r||r.custom)return[];if(n.part===`condition`)return N(r,n,e);if(n.split)return[];let a=M[r.type];return a?a(C(r,{stack:[],params:e.params,...e.root&&{root:e.root}}),n,e):[]}),F=({tree:e,plan:t})=>{let r=v(),i=w(),{resources:a,views:o}=y(),s=g().fields,l=n(),u=c(),f=p(),m=d(x()),h=(0,k.useMemo)(()=>P({client:r,queryClient:i,resources:a,views:o,fieldTypes:s,xs:l,params:u,given:f,...m&&{root:m}},e,t),[r,i,a,o,s,l,u,f,m,e,t]);return(0,k.useEffect)(()=>{for(let e of h)e.start(i)},[h,i]),null};export{F as t};
|
|
2
|
+
//# debugId=31fa035b-3edd-4500-9073-5870baf7a3d5
|