@objectstack/console 9.11.0 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AdapterProvider-CJjaoZJR.js +1 -0
- package/dist/assets/{AiPendingActionsPage-DBH0IlpT.js → AiPendingActionsPage-B4OLmiXS.js} +1 -1
- package/dist/assets/{ApiConsolePage-BV14INY2.js → ApiConsolePage-D9A9ewr3.js} +1 -1
- package/dist/assets/{AppDocsIndex-C22gKPwi.js → AppDocsIndex-ChEbT5sV.js} +1 -1
- package/dist/assets/{AppManagementPage-DTh0NujK.js → AppManagementPage-DwyKF7UE.js} +1 -1
- package/dist/assets/ApprovalsInboxPage-Ca5Bb0JN.js +1 -0
- package/dist/assets/{AuditLogPage-B_Zg_tx5.js → AuditLogPage-BtNmxWyG.js} +1 -1
- package/dist/assets/{ComponentNavView-BhShg1Hw.js → ComponentNavView-naLkSvjF.js} +1 -1
- package/dist/assets/ConsoleFloatingChatbot-1MfhDZaK.js +1 -0
- package/dist/assets/DashboardView-Ccnc4ERO.js +1 -0
- package/dist/assets/DashboardWidgetInspector-DQvlAqdm.js +1 -0
- package/dist/assets/{DeveloperHubPage--9rLh7im.js → DeveloperHubPage-COHQrdbV.js} +1 -1
- package/dist/assets/{ExpressionProvider-B9tL1RMW.js → ExpressionProvider-C2XzKImE.js} +1 -1
- package/dist/assets/FlowRunsPage-DIO45X3A.js +1 -0
- package/dist/assets/{IntegrationsPage-CMt7Atqp.js → IntegrationsPage-Bu6X6rLQ.js} +2 -2
- package/dist/assets/InterfaceListPage-Cfv6Lkis.js +1 -0
- package/dist/assets/{ManagedByBadge-BF_1ck8d.js → ManagedByBadge-DDil8sjK.js} +1 -1
- package/dist/assets/MarketplaceAccessDenied-C3bv4Vmg.js +1 -0
- package/dist/assets/{MarketplaceInstalledPage-DBh3sDdm.js → MarketplaceInstalledPage-C-saIRJu.js} +1 -1
- package/dist/assets/MarketplacePackagePage-CcpJSBrF.js +4 -0
- package/dist/assets/MarketplacePage-B0zIXkwO.js +1 -0
- package/dist/assets/MetadataInspector-D9KL7Kgi.js +1 -0
- package/dist/assets/{MetadataProvider-xgIDLxXw.js → MetadataProvider-BO_KcC86.js} +1 -1
- package/dist/assets/{MonacoImpl-BsJjT9SV.js → MonacoImpl-VsaaS7Wx.js} +1 -1
- package/dist/assets/{PageView-pabqNsbK.js → PageView-gzbH9RTq.js} +1 -1
- package/dist/assets/ProfilePage-BXz0C-TJ.js +1 -0
- package/dist/assets/PublicFormsPage-D5-EASU8.js +1 -0
- package/dist/assets/RecordDetailView-ANMXqsUj.js +9 -0
- package/dist/assets/{RecordFormPage-Dh_BBkOw.js → RecordFormPage-BYeWa90w.js} +1 -1
- package/dist/assets/ReportDefaultInspector-B6X1lhzs.js +7 -0
- package/dist/assets/ReportView-uPqsauzE.js +2 -0
- package/dist/assets/{SearchResultsPage-BPgmZAb1.js → SearchResultsPage-DraOSIqg.js} +1 -1
- package/dist/assets/{SettingsHub-B47RbJU1.js → SettingsHub-CzOLpvoR.js} +1 -1
- package/dist/assets/{SettingsView-B75wJU1L.js → SettingsView-BJnPeWpq.js} +1 -1
- package/dist/assets/SystemHubPage-CeKubn-w.js +1 -0
- package/dist/assets/architecture-7EHR7CIX-X1S5OWmc.js +1 -0
- package/dist/assets/{architectureDiagram-3BPJPVTR-SscyJlk0.js → architectureDiagram-3BPJPVTR-MvRuEgzs.js} +1 -1
- package/dist/assets/{assistantBus-3d9MxsCF.js → assistantBus-BMrg1uLy.js} +1 -1
- package/dist/assets/blockDiagram-GPEHLZMM-Bv7ki00F.js +132 -0
- package/dist/assets/{c4Diagram-AAUBKEIU-VLeNt7tD.js → c4Diagram-AAUBKEIU-BRUAUvfZ.js} +1 -1
- package/dist/assets/channel-BqPJ7J2_.js +1 -0
- package/dist/assets/{chunk-2J33WTMH-DyXQVMuc.js → chunk-2J33WTMH-DTuZqhEo.js} +1 -1
- package/dist/assets/{chunk-3OPIFGDE-3g0dk_di.js → chunk-3OPIFGDE-C_qRhnNp.js} +1 -1
- package/dist/assets/{chunk-4BX2VUAB-BpAZJ7ZC.js → chunk-4BX2VUAB-Curilu76.js} +1 -1
- package/dist/assets/chunk-55IACEB6-ClqERWh2.js +1 -0
- package/dist/assets/chunk-5ZQYHXKU-NIbfS0Mi.js +2 -0
- package/dist/assets/{chunk-727SXJPM-DwSFE_v-.js → chunk-727SXJPM-C9Y2Btvf.js} +1 -1
- package/dist/assets/{chunk-AQP2D5EJ-DWgSztUW.js → chunk-AQP2D5EJ-CtIyrl6v.js} +1 -1
- package/dist/assets/{chunk-BSJP7CBP-okvguKD4.js → chunk-BSJP7CBP-DjJyEH0K.js} +1 -1
- package/dist/assets/chunk-CSCIHK7Q-DbAqhmGo.js +124 -0
- package/dist/assets/{chunk-FMBD7UC4-CZzqt4RW.js → chunk-FMBD7UC4-DZ7XVMi3.js} +1 -1
- package/dist/assets/{chunk-KSCS5N6A-IxEh4Ag5.js → chunk-KSCS5N6A-DHHPqSRu.js} +2 -2
- package/dist/assets/{chunk-L5ZTLDWV-DW1lPBoG.js → chunk-L5ZTLDWV-Cm-9mVS5.js} +1 -1
- package/dist/assets/{chunk-LZXEDZCA-C_-aaYcd.js → chunk-LZXEDZCA-DNmRzWTq.js} +1 -1
- package/dist/assets/{chunk-ND2GUHAM-C1toj0H3.js → chunk-ND2GUHAM-D-GBTiNx.js} +1 -1
- package/dist/assets/{chunk-NZK2D7GU-H2MwBqQV.js → chunk-NZK2D7GU-CtXqakqk.js} +1 -1
- package/dist/assets/{chunk-O5CBEL6O-BzyWPZhZ.js → chunk-O5CBEL6O-B7H8dfmV.js} +3 -3
- package/dist/assets/chunk-QZHKN3VN-WFr5OVn5.js +1 -0
- package/dist/assets/chunk-WU5MYG2G-DKJgGIni.js +1 -0
- package/dist/assets/{chunk-XPW4576I-DPNxFY7Q.js → chunk-XPW4576I-BnrxXe1_.js} +1 -1
- package/dist/assets/classDiagram-4FO5ZUOK-WH7-26qH.js +1 -0
- package/dist/assets/classDiagram-v2-Q7XG4LA2-WH7-26qH.js +1 -0
- package/dist/assets/{cose-bilkent-S5V4N54A-HKJWDQRL.js → cose-bilkent-S5V4N54A-DhuYtQPb.js} +1 -1
- package/dist/assets/{dagre-BM42HDAG-CU8nx02l.js → dagre-BM42HDAG-Dnyz2UIF.js} +1 -1
- package/dist/assets/{data-adapter-Hh2YXzlW.js → data-adapter-QvY0S7Jg.js} +1 -1
- package/dist/assets/{diagram-2AECGRRQ-CormMz8j.js → diagram-2AECGRRQ-sHfykK_1.js} +1 -1
- package/dist/assets/{diagram-5GNKFQAL-Dh1SagBx.js → diagram-5GNKFQAL-CQPF5SyR.js} +1 -1
- package/dist/assets/{diagram-KO2AKTUF-DcG6Z05V.js → diagram-KO2AKTUF-DG_jPd_S.js} +1 -1
- package/dist/assets/{diagram-LMA3HP47-DrVLZ6ZE.js → diagram-LMA3HP47-eeIrBazE.js} +1 -1
- package/dist/assets/{diagram-OG6HWLK6-C4_MMUc2.js → diagram-OG6HWLK6-aTF20BV0.js} +1 -1
- package/dist/assets/{dist-DYcwLEm6.js → dist-D80kLFC3.js} +1 -1
- package/dist/assets/{erDiagram-TEJ5UH35-BZH_OrBL.js → erDiagram-TEJ5UH35-CZG8EC14.js} +1 -1
- package/dist/assets/eventmodeling-FCH6USID-y9LH0zSr.js +1 -0
- package/dist/assets/{flowDiagram-I6XJVG4X-CnjHQUK0.js → flowDiagram-I6XJVG4X-Dy6yH4qt.js} +1 -1
- package/dist/assets/framework-CsYa1Kaj.js +34 -0
- package/dist/assets/{ganttDiagram-6RSMTGT7-rVbHlqzo.js → ganttDiagram-6RSMTGT7-BbnAVyeg.js} +2 -2
- package/dist/assets/{gitGraph-WXDBUCRP-9vsQCBlr.js → gitGraph-WXDBUCRP-CWBdNpUZ.js} +1 -1
- package/dist/assets/{gitGraphDiagram-PVQCEYII-CH2LgClA.js → gitGraphDiagram-PVQCEYII-DQzVZDx1.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-0aDolIZW.js → highlighted-body-OFNGDK62-DH1qH6jn.js} +1 -1
- package/dist/assets/index-Bx77jcFN.js +4 -0
- package/dist/assets/index-CYLGNLiD.css +2 -0
- package/dist/assets/{info-J43DQDTF-CfWeH1Bg.js → info-J43DQDTF-BT1tFy_c.js} +1 -1
- package/dist/assets/{infoDiagram-5YYISTIA-CRC7ojj-.js → infoDiagram-5YYISTIA-CL6j94aA.js} +1 -1
- package/dist/assets/infrastructure-BsIvKvpW.js +3 -0
- package/dist/assets/{ishikawaDiagram-YF4QCWOH-8v73fBR1.js → ishikawaDiagram-YF4QCWOH-B2te-ZRn.js} +1 -1
- package/dist/assets/{journeyDiagram-JHISSGLW-DbRK-WaU.js → journeyDiagram-JHISSGLW-lZExleN9.js} +1 -1
- package/dist/assets/{kanban-definition-UN3LZRKU-BggLxHvZ.js → kanban-definition-UN3LZRKU-C9AtY5D5.js} +1 -1
- package/dist/assets/{marketplaceApi-CucX7DD9.js → marketplaceApi-DL8PegzV.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-DlOIGBXr.js +1 -0
- package/dist/assets/{mermaid-parser.core-iuxcj-n_.js → mermaid-parser.core-Fbhy6q19.js} +1 -1
- package/dist/assets/mermaid.core-X9A0zXAG.js +8 -0
- package/dist/assets/metadata-admin--twLAcNF.js +21 -0
- package/dist/assets/{mindmap-definition-RKZ34NQL-kqhi9XCR.js → mindmap-definition-RKZ34NQL-BLNposyO.js} +1 -1
- package/dist/assets/{packet-YPE3B663-C0xexAqH.js → packet-YPE3B663-2eu0wHWY.js} +1 -1
- package/dist/assets/{pie-LRSECV5Y-DbQVOiyX.js → pie-LRSECV5Y-BA_jHDuN.js} +1 -1
- package/dist/assets/{pieDiagram-4H26LBE5-9fHcPmFE.js → pieDiagram-4H26LBE5-B_jWIggY.js} +3 -3
- package/dist/assets/plugin-calendar-HZM7PnuZ.js +1 -0
- package/dist/assets/plugin-charts-CHVu5fbZ.js +7 -0
- package/dist/assets/{plugin-chatbot-76fXVh9-.js → plugin-chatbot-B25XBELF.js} +53 -53
- package/dist/assets/plugin-dashboard-C8TbFk_D.js +6 -0
- package/dist/assets/plugin-form-sm04IEZv.js +1 -0
- package/dist/assets/plugin-gantt-BAbv_iPP.js +93 -0
- package/dist/assets/plugin-grid-pjPmzTDb.js +6 -0
- package/dist/assets/plugin-kanban-CFOumo0N.js +1 -0
- package/dist/assets/{plugin-map-C3ZvB3-I.js → plugin-map-DD4Y0TfP.js} +1 -1
- package/dist/assets/{plugin-markdown-C0Wtx408.js → plugin-markdown-Fz2pgiZT.js} +1 -1
- package/dist/assets/plugin-report-DidhEKAB.js +59 -0
- package/dist/assets/{plugin-timeline-BStIRl3O.js → plugin-timeline-BEk5SlxQ.js} +1 -1
- package/dist/assets/plugin-tree-uFJca_YQ.js +1 -0
- package/dist/assets/plugin-view-CDxJidrj.js +1 -0
- package/dist/assets/plugins-views-BpKTWXXa.js +4 -0
- package/dist/assets/{quadrantDiagram-W4KKPZXB-CaMxia_k.js → quadrantDiagram-W4KKPZXB-DuQbsXa3.js} +1 -1
- package/dist/assets/{radar-GUYGQ44K-DapGfmwo.js → radar-GUYGQ44K-BdSwem6Q.js} +1 -1
- package/dist/assets/{requirementDiagram-4Y6WPE33-CXwY4Gdd.js → requirementDiagram-4Y6WPE33-BS1D5lNA.js} +1 -1
- package/dist/assets/{sankeyDiagram-5OEKKPKP-KEb3hSPZ.js → sankeyDiagram-5OEKKPKP-DGvgs5mF.js} +2 -2
- package/dist/assets/{sequenceDiagram-3UESZ5HK-BfbOOh3M.js → sequenceDiagram-3UESZ5HK-CoXT3Sa8.js} +1 -1
- package/dist/assets/{skeletons-Y2db5nbR.js → skeletons-DZWz9Ill.js} +1 -1
- package/dist/assets/{src-CVz7aDdY.js → src-B_91OByQ.js} +1 -1
- package/dist/assets/{src-BLxLm3Xq.js → src-CpvBTq6C.js} +1 -1
- package/dist/assets/src-ZyouQodC.js +2 -0
- package/dist/assets/{stateDiagram-AJRCARHV-BLJI6xj_.js → stateDiagram-AJRCARHV-CGBlOS6N.js} +1 -1
- package/dist/assets/stateDiagram-v2-BHNVJYJU-B7qRtpsa.js +1 -0
- package/dist/assets/{timeline-definition-PNZ67QCA-aiklZXLq.js → timeline-definition-PNZ67QCA-C3SxX0_p.js} +1 -1
- package/dist/assets/{treeView-BLDUP644-Byr_7ESV.js → treeView-BLDUP644-LYooC8jV.js} +1 -1
- package/dist/assets/{treemap-LRROVOQU-B6DiJnlo.js → treemap-LRROVOQU-DRMY684K.js} +1 -1
- package/dist/assets/{types-C6YwlE8G.js → types-IRCvjK2K.js} +1 -1
- package/dist/assets/ui-components-DXl7VfQF.js +42 -0
- package/dist/assets/{ui-layout-CL-1JYQ8.js → ui-layout-BwKCXo1Z.js} +1 -1
- package/dist/assets/{useActionModal-Dz0k3wwf.js → useActionModal-CYfSmVlP.js} +1 -1
- package/dist/assets/useOpenRecordList-CwVRoKH4.js +1 -0
- package/dist/assets/{usePackageL10n-shLsxEAx.js → usePackageL10n-DIEe85Ot.js} +1 -1
- package/dist/assets/useReconcileOnError-BXVpquqp.js +1 -0
- package/dist/assets/vendor-charts-BMpO4zwC.js +39 -0
- package/dist/assets/{vendor-dndkit-DMFEUxSy.js → vendor-dndkit-CJ-mJJuO.js} +1 -1
- package/dist/assets/{vendor-i18n-Bz5UncqE.js → vendor-i18n-DA5MKfC_.js} +1 -1
- package/dist/assets/{vendor-icons-core-C_yMA5lO.js → vendor-icons-core-y1IwBwLD.js} +1 -1
- package/dist/assets/{vendor-markdown-CyAGIM8D.js → vendor-markdown-BhPWU2N7.js} +1 -1
- package/dist/assets/vendor-objectstack-C1teU2a6.js +96 -0
- package/dist/assets/vendor-radix-90T7eS-d.js +46 -0
- package/dist/assets/vendor-react-ClIa1CJA.js +11 -0
- package/dist/assets/vendor-sentry-DUcsR3Vf.js +501 -0
- package/dist/assets/{vendor-ui-utils-rQOI1gAo.js → vendor-ui-utils-C92Fl7BT.js} +1 -1
- package/dist/assets/{vennDiagram-CIIHVFJN-DsKC4yvC.js → vennDiagram-CIIHVFJN-BWIbAw03.js} +1 -1
- package/dist/assets/{wardley-L42UT6IY-f1iiSYpj.js → wardley-L42UT6IY-zPLhQ1bd.js} +1 -1
- package/dist/assets/{wardleyDiagram-YWT4CUSO-DbrUmWlY.js → wardleyDiagram-YWT4CUSO-Ck_J2TTN.js} +1 -1
- package/dist/assets/{xychartDiagram-2RQKCTM6-B4biX1Sz.js → xychartDiagram-2RQKCTM6-CDqp4wV0.js} +2 -2
- package/dist/index.html +6 -6
- package/package.json +1 -1
- package/dist/assets/AdapterProvider-DQfb2hDB.js +0 -1
- package/dist/assets/ApprovalsInboxPage-C0mBPkCR.js +0 -1
- package/dist/assets/ConsoleFloatingChatbot-Ct9u34kL.js +0 -1
- package/dist/assets/DashboardView-D3oJL44H.js +0 -1
- package/dist/assets/DashboardWidgetInspector-BhjBPVJV.js +0 -1
- package/dist/assets/FlowRunsPage-CDYR2nha.js +0 -1
- package/dist/assets/InterfaceListPage-CIYeUsaL.js +0 -1
- package/dist/assets/MarketplaceAccessDenied-DvMKTKZG.js +0 -1
- package/dist/assets/MarketplacePackagePage-DuZ5A7L3.js +0 -4
- package/dist/assets/MarketplacePage-8XMnemHc.js +0 -1
- package/dist/assets/MetadataInspector-BcJZckHC.js +0 -1
- package/dist/assets/ProfilePage-CPP3LKyF.js +0 -1
- package/dist/assets/PublicFormsPage-CJz8WQst.js +0 -1
- package/dist/assets/RecordDetailView-Dg0FtCgX.js +0 -9
- package/dist/assets/ReportDefaultInspector-bXn7Ud0K.js +0 -1
- package/dist/assets/ReportView-CYKdWMWV.js +0 -2
- package/dist/assets/RuntimeDraftBar-CpfEHMPU.js +0 -1
- package/dist/assets/SystemHubPage-DFwicwZT.js +0 -1
- package/dist/assets/architecture-7EHR7CIX-BdMnUPE0.js +0 -1
- package/dist/assets/blockDiagram-GPEHLZMM-D6-9deBJ.js +0 -132
- package/dist/assets/channel-ByUUDCyR.js +0 -1
- package/dist/assets/chunk-55IACEB6-BhOjfCrn.js +0 -1
- package/dist/assets/chunk-5ZQYHXKU-DG12s6lW.js +0 -2
- package/dist/assets/chunk-CSCIHK7Q-DfSAlgJl.js +0 -124
- package/dist/assets/chunk-QZHKN3VN-ujroCBCz.js +0 -1
- package/dist/assets/chunk-WU5MYG2G-DwQt8tuZ.js +0 -1
- package/dist/assets/classDiagram-4FO5ZUOK-B7mTyEXp.js +0 -1
- package/dist/assets/classDiagram-v2-Q7XG4LA2-B7mTyEXp.js +0 -1
- package/dist/assets/eventmodeling-FCH6USID-CFiyy8DS.js +0 -1
- package/dist/assets/framework-DCMHw4uc.js +0 -34
- package/dist/assets/index-DIwBADyw.css +0 -2
- package/dist/assets/index-OUEQY-pz.js +0 -4
- package/dist/assets/infrastructure-CJNwTVno.js +0 -3
- package/dist/assets/mergeServerFields-DLHgCyyI.js +0 -7
- package/dist/assets/mermaid-GHXKKRXX-BkPYaQdJ.js +0 -1
- package/dist/assets/mermaid.core-C41Aiku8.js +0 -8
- package/dist/assets/metadata-admin-CLro8Vr2.js +0 -19
- package/dist/assets/plugin-calendar-BnAXrMpl.js +0 -1
- package/dist/assets/plugin-charts-CqgNZ5dQ.js +0 -7
- package/dist/assets/plugin-dashboard-lpyBUnU3.js +0 -5
- package/dist/assets/plugin-form-DjP7n76r.js +0 -1
- package/dist/assets/plugin-gantt-BRce7Qx4.js +0 -39
- package/dist/assets/plugin-grid-3MIxvbIs.js +0 -6
- package/dist/assets/plugin-kanban-BY5U45PP.js +0 -1
- package/dist/assets/plugin-report-CjGy4oCX.js +0 -59
- package/dist/assets/plugin-view-C15Djdpb.js +0 -1
- package/dist/assets/plugins-views-DvIN271Q.js +0 -4
- package/dist/assets/src-ChUzpvnF.js +0 -2
- package/dist/assets/stateDiagram-v2-BHNVJYJU-DPQJ1_JB.js +0 -1
- package/dist/assets/ui-components-D1FYlKrM.js +0 -42
- package/dist/assets/useReconcileOnError-Cxzq30_3.js +0 -1
- package/dist/assets/vendor-charts-fo4ZbB_t.js +0 -39
- package/dist/assets/vendor-objectstack-BNd856rx.js +0 -96
- package/dist/assets/vendor-radix-CSVEhP0L.js +0 -56
- package/dist/assets/vendor-react-DR370ovB.js +0 -11
- package/dist/assets/vendor-sentry-BIOhD5Kg.js +0 -501
package/dist/assets/{xychartDiagram-2RQKCTM6-B4biX1Sz.js → xychartDiagram-2RQKCTM6-CDqp4wV0.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{dn as e,ot as t,rt as n}from"./vendor-charts-BMpO4zwC.js";import{n as r,r as i}from"./src-B_91OByQ.js";import{D as a,H as o,K as s,U as c,a as l,b as u,c as d,f,v as p,w as m,y as h,z as g}from"./chunk-CSCIHK7Q-DbAqhmGo.js";import{t as _}from"./chunk-WU5MYG2G-DKJgGIni.js";import{i as v}from"./chunk-5ZQYHXKU-NIbfS0Mi.js";import{t as y}from"./chunk-O5CBEL6O-B7H8dfmV.js";var b=(function(){var e=r(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),t=[1,10,12,14,16,18,19,21,23],n=[2,6],i=[1,3],a=[1,5],o=[1,6],s=[1,7],c=[1,5,10,12,14,16,18,19,21,23,34,35,36],l=[1,25],u=[1,26],d=[1,28],f=[1,29],p=[1,30],m=[1,31],h=[1,32],g=[1,33],_=[1,34],v=[1,35],y=[1,36],b=[1,37],x=[1,43],S=[1,42],C=[1,47],w=[1,50],T=[1,10,12,14,16,18,19,21,23,34,35,36],E=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],D=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],O=[1,64],k={trace:r(function(){},`trace`),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:`error`,5:`XYCHART`,8:`CHART_ORIENTATION`,10:`title`,12:`X_AXIS`,14:`Y_AXIS`,16:`LINE`,18:`BAR`,19:`acc_title`,20:`acc_title_value`,21:`acc_descr`,22:`acc_descr_value`,23:`acc_descr_multiline_value`,24:`SQUARE_BRACES_START`,26:`SQUARE_BRACES_END`,27:`NUMBER_WITH_DECIMAL`,28:`COMMA`,31:`ARROW_DELIMITER`,34:`NEWLINE`,35:`SEMI`,36:`EOF`,38:`STR`,39:`MD_STR`,41:`AMP`,42:`NUM`,43:`ALPHA`,44:`PLUS`,45:`EQUALS`,46:`MULT`,47:`DOT`,48:`BRKT`,49:`MINUS`,50:`UNDERSCORE`},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:r(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 5:r.setOrientation(a[s]);break;case 9:r.setDiagramTitle(a[s].text.trim());break;case 12:r.setLineData({text:``,type:`text`},a[s]);break;case 13:r.setLineData(a[s-1],a[s]);break;case 14:r.setBarData({text:``,type:`text`},a[s]);break;case 15:r.setBarData(a[s-1],a[s]);break;case 16:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 17:case 18:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 19:this.$=a[s-1];break;case 20:this.$=[Number(a[s-2]),...a[s]];break;case 21:this.$=[Number(a[s])];break;case 22:r.setXAxisTitle(a[s]);break;case 23:r.setXAxisTitle(a[s-1]);break;case 24:r.setXAxisTitle({type:`text`,text:``});break;case 25:r.setXAxisBand(a[s]);break;case 26:r.setXAxisRangeData(Number(a[s-2]),Number(a[s]));break;case 27:this.$=a[s-1];break;case 28:this.$=[a[s-2],...a[s]];break;case 29:this.$=[a[s]];break;case 30:r.setYAxisTitle(a[s]);break;case 31:r.setYAxisTitle(a[s-1]);break;case 32:r.setYAxisTitle({type:`text`,text:``});break;case 33:r.setYAxisRangeData(Number(a[s-2]),Number(a[s]));break;case 37:this.$={text:a[s],type:`text`};break;case 38:this.$={text:a[s],type:`text`};break;case 39:this.$={text:a[s],type:`markdown`};break;case 40:this.$=a[s];break;case 41:this.$=a[s-1]+``+a[s];break}},`anonymous`),table:[e(t,n,{3:1,4:2,7:4,5:i,34:a,35:o,36:s}),{1:[3]},e(t,n,{4:2,7:4,3:8,5:i,34:a,35:o,36:s}),e(t,n,{4:2,7:4,6:9,3:10,5:i,8:[1,11],34:a,35:o,36:s}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(c,[2,34]),e(c,[2,35]),e(c,[2,36]),{1:[2,1]},e(t,n,{4:2,7:4,3:21,5:i,34:a,35:o,36:s}),{1:[2,3]},e(c,[2,5]),e(t,[2,7],{4:22,34:a,35:o,36:s}),{11:23,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:39,13:38,24:x,27:S,29:40,30:41,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:45,15:44,27:C,33:46,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:49,17:48,24:w,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:52,17:51,24:w,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{20:[1,53]},{22:[1,54]},e(T,[2,18]),{1:[2,2]},e(T,[2,8]),e(T,[2,9]),e(E,[2,37],{40:55,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b}),e(E,[2,38]),e(E,[2,39]),e(D,[2,40]),e(D,[2,42]),e(D,[2,43]),e(D,[2,44]),e(D,[2,45]),e(D,[2,46]),e(D,[2,47]),e(D,[2,48]),e(D,[2,49]),e(D,[2,50]),e(D,[2,51]),e(T,[2,10]),e(T,[2,22],{30:41,29:56,24:x,27:S}),e(T,[2,24]),e(T,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},e(T,[2,11]),e(T,[2,30],{33:60,27:C}),e(T,[2,32]),{31:[1,61]},e(T,[2,12]),{17:62,24:w},{25:63,27:O},e(T,[2,14]),{17:65,24:w},e(T,[2,16]),e(T,[2,17]),e(D,[2,41]),e(T,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(T,[2,31]),{27:[1,69]},e(T,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(T,[2,15]),e(T,[2,26]),e(T,[2,27]),{11:59,32:72,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},e(T,[2,33]),e(T,[2,19]),{25:73,27:O},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:r(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:r(function(e){var t=this,n=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){n.length-=2*e,a.length-=e,o.length-=e}r(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=t.symbols_[e]||e),e}r(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=n[n.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
|
|
2
2
|
`+h.showPosition()+`
|
|
3
3
|
Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:n.push(S),a.push(h.yytext),o.push(h.yylloc),n.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(n=n.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),n.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[n[n.length-2]][n[n.length-1]],n.push(A);break;case 3:return!0}}return!0},`parse`)};k.lexer=(function(){return{EOF:1,parseError:r(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:r(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:r(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:r(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:r(function(){return this._more=!0,this},`more`),reject:r(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:r(function(e){this.unput(this.match.slice(e))},`less`),pastInput:r(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:r(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:r(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
|
|
5
5
|
`+t+`^`},`showPosition`),test_match:r(function(e,t){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),r=e[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],n=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},`test_match`),next:r(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,n,r;this._more||(this.yytext=``,this.match=``);for(var i=this._currentRules(),a=0;a<i.length;a++)if(n=this._input.match(this.rules[i[a]]),n&&(!t||n[0].length>t[0].length)){if(t=n,r=a,this.options.backtrack_lexer){if(e=this.test_match(n,i[a]),e!==!1)return e;if(this._backtrack){t=!1;continue}else return!1}else if(!this.options.flex)break}return t?(e=this.test_match(t,i[r]),e===!1?!1:e):this._input===``?this.EOF:this.parseError(`Lexical error on line `+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
-
`+this.showPosition(),{text:``,token:null,line:this.yylineno})},`next`),lex:r(function(){return this.next()||this.lex()},`lex`),begin:r(function(e){this.conditionStack.push(e)},`begin`),popState:r(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},`popState`),_currentRules:r(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},`_currentRules`),topState:r(function(e){return e=this.conditionStack.length-1-Math.abs(e||0),e>=0?this.conditionStack[e]:`INITIAL`},`topState`),pushState:r(function(e){this.begin(e)},`pushState`),stateStackSize:r(function(){return this.conditionStack.length},`stateStackSize`),options:{"case-insensitive":!0},performAction:r(function(e,t,n,r){switch(n){case 0:break;case 1:break;case 2:return this.popState(),34;case 3:return this.popState(),34;case 4:return 34;case 5:break;case 6:return 10;case 7:return this.pushState(`acc_title`),19;case 8:return this.popState(),`acc_title_value`;case 9:return this.pushState(`acc_descr`),21;case 10:return this.popState(),`acc_descr_value`;case 11:this.pushState(`acc_descr_multiline`);break;case 12:this.popState();break;case 13:return`acc_descr_multiline_value`;case 14:return 5;case 15:return 5;case 16:return 8;case 17:return this.pushState(`axis_data`),`X_AXIS`;case 18:return this.pushState(`axis_data`),`Y_AXIS`;case 19:return this.pushState(`axis_band_data`),24;case 20:return 31;case 21:return this.pushState(`data`),16;case 22:return this.pushState(`data`),18;case 23:return this.pushState(`data_inner`),24;case 24:return 27;case 25:return this.popState(),26;case 26:this.popState();break;case 27:this.pushState(`string`);break;case 28:this.popState();break;case 29:return`STR`;case 30:return 24;case 31:return 26;case 32:return 43;case 33:return`COLON`;case 34:return 44;case 35:return 28;case 36:return 45;case 37:return 46;case 38:return 48;case 39:return 50;case 40:return 47;case 41:return 41;case 42:return 49;case 43:return 42;case 44:break;case 45:return 35;case 46:return 36}},`anonymous`),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\})/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:xychart\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,24,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,18,21,22,23,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,22,24,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[28,29],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}}})();function A(){this.yy={}}return r(A,`Parser`),A.prototype=k,k.Parser=A,new A})();b.parser=b;var x=b;function S(e){return e.type===`bar`}r(S,`isBarPlot`);function C(e){return e.type===`band`}r(C,`isBandAxisData`);function w(e){return e.type===`linear`}r(w,`isLinearAxisData`);var T=class{constructor(e){this.parentGroup=e}static{r(this,`TextDimensionCalculatorWithFont`)}getMaxDimension(e,t){if(!this.parentGroup)return{width:e.reduce((e,t)=>Math.max(t.length,e),0)*t,height:t};let n={width:0,height:0},r=this.parentGroup.append(`g`).attr(`visibility`,`hidden`).attr(`font-size`,t);for(let i of e){let e=y(r,1,i),a=e?e.width:i.length*t,o=e?e.height:t;n.width=Math.max(n.width,a),n.height=Math.max(n.height,o)}return r.remove(),n}},E=.7,D=.2,O=class{constructor(e,t,n,r){this.axisConfig=e,this.title=t,this.textDimensionCalculator=n,this.axisThemeConfig=r,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition=`left`,this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition=`left`}static{r(this,`BaseAxis`)}setRange(e){this.range=e,this.axisPosition===`left`||this.axisPosition===`right`?this.boundingRect.height=e[1]-e[0]:this.boundingRect.width=e[1]-e[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(e){this.axisPosition=e,this.setRange(this.range)}getTickDistance(){let e=this.getRange();return Math.abs(e[0]-e[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map(e=>e.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){E*this.getTickDistance()>this.outerPadding*2&&(this.outerPadding=Math.floor(E*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(e){let t=e.height;if(this.axisConfig.showAxisLine&&t>this.axisConfig.axisLineWidth&&(t-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let n=this.getLabelDimension(),r=D*e.width;this.outerPadding=Math.min(n.width/2,r);let i=n.height+this.axisConfig.labelPadding*2;this.labelTextHeight=n.height,i<=t&&(t-=i,this.showLabel=!0)}if(this.axisConfig.showTick&&t>=this.axisConfig.tickLength&&(this.showTick=!0,t-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let e=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=e.height+this.axisConfig.titlePadding*2;this.titleTextHeight=e.height,n<=t&&(t-=n,this.showTitle=!0)}this.boundingRect.width=e.width,this.boundingRect.height=e.height-t}calculateSpaceIfDrawnVertical(e){let t=e.width;if(this.axisConfig.showAxisLine&&t>this.axisConfig.axisLineWidth&&(t-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let n=this.getLabelDimension(),r=D*e.height;this.outerPadding=Math.min(n.height/2,r);let i=n.width+this.axisConfig.labelPadding*2;i<=t&&(t-=i,this.showLabel=!0)}if(this.axisConfig.showTick&&t>=this.axisConfig.tickLength&&(this.showTick=!0,t-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let e=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=e.height+this.axisConfig.titlePadding*2;this.titleTextHeight=e.height,n<=t&&(t-=n,this.showTitle=!0)}this.boundingRect.width=e.width-t,this.boundingRect.height=e.height}calculateSpace(e){return this.axisPosition===`left`||this.axisPosition===`right`?this.calculateSpaceIfDrawnVertical(e):this.calculateSpaceIfDrawnHorizontally(e),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}getDrawableElementsForLeftAxis(){let e=[];if(this.showAxisLine){let t=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;e.push({type:`path`,groupTexts:[`left-axis`,`axisl-line`],data:[{path:`M ${t},${this.boundingRect.y} L ${t},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&e.push({type:`text`,groupTexts:[`left-axis`,`label`],data:this.getTickValues().map(e=>({text:e.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(e),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:`middle`,horizontalPos:`right`}))}),this.showTick){let t=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);e.push({type:`path`,groupTexts:[`left-axis`,`ticks`],data:this.getTickValues().map(e=>({path:`M ${t},${this.getScaleValue(e)} L ${t-this.axisConfig.tickLength},${this.getScaleValue(e)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&e.push({type:`text`,groupTexts:[`left-axis`,`title`],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:`top`,horizontalPos:`center`}]}),e}getDrawableElementsForBottomAxis(){let e=[];if(this.showAxisLine){let t=this.boundingRect.y+this.axisConfig.axisLineWidth/2;e.push({type:`path`,groupTexts:[`bottom-axis`,`axis-line`],data:[{path:`M ${this.boundingRect.x},${t} L ${this.boundingRect.x+this.boundingRect.width},${t}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&e.push({type:`text`,groupTexts:[`bottom-axis`,`label`],data:this.getTickValues().map(e=>({text:e.toString(),x:this.getScaleValue(e),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:`top`,horizontalPos:`center`}))}),this.showTick){let t=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);e.push({type:`path`,groupTexts:[`bottom-axis`,`ticks`],data:this.getTickValues().map(e=>({path:`M ${this.getScaleValue(e)},${t} L ${this.getScaleValue(e)},${t+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&e.push({type:`text`,groupTexts:[`bottom-axis`,`title`],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:`top`,horizontalPos:`center`}]}),e}getDrawableElementsForTopAxis(){let e=[];if(this.showAxisLine){let t=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;e.push({type:`path`,groupTexts:[`top-axis`,`axis-line`],data:[{path:`M ${this.boundingRect.x},${t} L ${this.boundingRect.x+this.boundingRect.width},${t}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&e.push({type:`text`,groupTexts:[`top-axis`,`label`],data:this.getTickValues().map(e=>({text:e.toString(),x:this.getScaleValue(e),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+this.axisConfig.titlePadding*2:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:`top`,horizontalPos:`center`}))}),this.showTick){let t=this.boundingRect.y;e.push({type:`path`,groupTexts:[`top-axis`,`ticks`],data:this.getTickValues().map(e=>({path:`M ${this.getScaleValue(e)},${t+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(e)},${t+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&e.push({type:`text`,groupTexts:[`top-axis`,`title`],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:`top`,horizontalPos:`center`}]}),e}getDrawableElements(){if(this.axisPosition===`left`)return this.getDrawableElementsForLeftAxis();if(this.axisPosition===`right`)throw Error(`Drawing of right axis is not implemented`);return this.axisPosition===`bottom`?this.getDrawableElementsForBottomAxis():this.axisPosition===`top`?this.getDrawableElementsForTopAxis():[]}},k=class extends O{static{r(this,`BandAxis`)}constructor(e,t,r,i,a){super(e,i,a,t),this.categories=r,this.scale=n().domain(this.categories).range(this.getRange())}setRange(e){super.setRange(e)}recalculateScale(){this.scale=n().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),i.trace(`BandAxis axis final categories, range: `,this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(e){return this.scale(e)??this.getRange()[0]}},A=class extends O{static{r(this,`LinearAxis`)}constructor(t,n,r,i,a){super(t,i,a,n),this.domain=r,this.scale=e().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){let t=[...this.domain];this.axisPosition===`left`&&t.reverse(),this.scale=e().domain(t).range(this.getRange())}getScaleValue(e){return this.scale(e)}};function j(e,t,n,r){let i=new T(r);return C(e)?new k(t,n,e.categories,e.title,i):new A(t,n,[e.min,e.max],e.title,i)}r(j,`getAxis`);var M=class{constructor(e,t,n,r){this.textDimensionCalculator=e,this.chartConfig=t,this.chartData=n,this.chartThemeConfig=r,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}static{r(this,`ChartTitle`)}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){let t=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),n=Math.max(t.width,e.width),r=t.height+2*this.chartConfig.titlePadding;return t.width<=n&&t.height<=r&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=n,this.boundingRect.height=r,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){let e=[];return this.showChartTitle&&e.push({groupTexts:[`chart-title`],type:`text`,data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:`middle`,horizontalPos:`center`,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]}),e}};function N(e,t,n,r){return new M(new T(r),e,t,n)}r(N,`getChartTitleComponent`);var ee=class{constructor(e,t,n,r,i){this.plotData=e,this.xAxis=t,this.yAxis=n,this.orientation=r,this.plotIndex=i}static{r(this,`LinePlot`)}getDrawableElement(){let e=this.plotData.data.map(e=>[this.xAxis.getScaleValue(e[0]),this.yAxis.getScaleValue(e[1])]),n;return n=this.orientation===`horizontal`?t().y(e=>e[0]).x(e=>e[1])(e):t().x(e=>e[0]).y(e=>e[1])(e),n?[{groupTexts:[`plot`,`line-plot-${this.plotIndex}`],type:`path`,data:[{path:n,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}]:[]}},te=class{constructor(e,t,n,r,i,a){this.barData=e,this.boundingRect=t,this.xAxis=n,this.yAxis=r,this.orientation=i,this.plotIndex=a}static{r(this,`BarPlot`)}getDrawableElement(){let e=this.barData.data.map(e=>[this.xAxis.getScaleValue(e[0]),this.yAxis.getScaleValue(e[1])]),t=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*.95,n=t/2;return this.orientation===`horizontal`?[{groupTexts:[`plot`,`bar-plot-${this.plotIndex}`],type:`rect`,data:e.map(e=>({x:this.boundingRect.x,y:e[0]-n,height:t,width:e[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]:[{groupTexts:[`plot`,`bar-plot-${this.plotIndex}`],type:`rect`,data:e.map(e=>({x:e[0]-n,y:e[1],width:t,height:this.boundingRect.y+this.boundingRect.height-e[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},ne=class{constructor(e,t,n){this.chartConfig=e,this.chartData=t,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0}}static{r(this,`BasePlot`)}setAxes(e,t){this.xAxis=e,this.yAxis=t}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){return this.boundingRect.width=e.width,this.boundingRect.height=e.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error(`Axes must be passed to render Plots`);let e=[];for(let[t,n]of this.chartData.plots.entries())switch(n.type){case`line`:{let r=new ee(n,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,t);e.push(...r.getDrawableElement())}break;case`bar`:{let r=new te(n,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,t);e.push(...r.getDrawableElement())}break}return e}};function re(e,t,n){return new ne(e,t,n)}r(re,`getPlotComponent`);var ie=class{constructor(e,t,n,r){this.chartConfig=e,this.chartData=t,this.componentStore={title:N(e,t,n,r),plot:re(e,t,n),xAxis:j(t.xAxis,e.xAxis,{titleColor:n.xAxisTitleColor,labelColor:n.xAxisLabelColor,tickColor:n.xAxisTickColor,axisLineColor:n.xAxisLineColor},r),yAxis:j(t.yAxis,e.yAxis,{titleColor:n.yAxisTitleColor,labelColor:n.yAxisLabelColor,tickColor:n.yAxisTickColor,axisLineColor:n.yAxisLineColor},r)}}static{r(this,`Orchestrator`)}calculateVerticalSpace(){let e=this.chartConfig.width,t=this.chartConfig.height,n=0,r=0,i=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),a=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),o=this.componentStore.plot.calculateSpace({width:i,height:a});e-=o.width,t-=o.height,o=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:t}),r=o.height,t-=o.height,this.componentStore.xAxis.setAxisPosition(`bottom`),o=this.componentStore.xAxis.calculateSpace({width:e,height:t}),t-=o.height,this.componentStore.yAxis.setAxisPosition(`left`),o=this.componentStore.yAxis.calculateSpace({width:e,height:t}),n=o.width,e-=o.width,e>0&&(i+=e,e=0),t>0&&(a+=t,t=0),this.componentStore.plot.calculateSpace({width:i,height:a}),this.componentStore.plot.setBoundingBoxXY({x:n,y:r}),this.componentStore.xAxis.setRange([n,n+i]),this.componentStore.xAxis.setBoundingBoxXY({x:n,y:r+a}),this.componentStore.yAxis.setRange([r,r+a]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:r}),this.chartData.plots.some(e=>S(e))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let e=this.chartConfig.width,t=this.chartConfig.height,n=0,r=0,i=0,a=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),o=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),s=this.componentStore.plot.calculateSpace({width:a,height:o});e-=s.width,t-=s.height,s=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:t}),n=s.height,t-=s.height,this.componentStore.xAxis.setAxisPosition(`left`),s=this.componentStore.xAxis.calculateSpace({width:e,height:t}),e-=s.width,r=s.width,this.componentStore.yAxis.setAxisPosition(`top`),s=this.componentStore.yAxis.calculateSpace({width:e,height:t}),t-=s.height,i=n+s.height,e>0&&(a+=e,e=0),t>0&&(o+=t,t=0),this.componentStore.plot.calculateSpace({width:a,height:o}),this.componentStore.plot.setBoundingBoxXY({x:r,y:i}),this.componentStore.yAxis.setRange([r,r+a]),this.componentStore.yAxis.setBoundingBoxXY({x:r,y:n}),this.componentStore.xAxis.setRange([i,i+o]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:i}),this.chartData.plots.some(e=>S(e))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){this.chartConfig.chartOrientation===`horizontal`?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();let e=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(let t of Object.values(this.componentStore))e.push(...t.getDrawableElements());return e}},ae=class{static{r(this,`XYChartBuilder`)}static build(e,t,n,r){return new ie(e,t,n,r).getDrawableElement()}},P=0,F,I=U(),L=H(),R=W(),z=L.plotColorPalette.split(`,`).map(e=>e.trim()),B=!1,V=!1;function H(){let e=a(),t=u();return v(e.xyChart,t.themeVariables.xyChart)}r(H,`getChartDefaultThemeConfig`);function U(){let e=u();return v(f.xyChart,e.xyChart)}r(U,`getChartDefaultConfig`);function W(){return{yAxis:{type:`linear`,title:``,min:1/0,max:-1/0},xAxis:{type:`band`,title:``,categories:[]},title:``,plots:[]}}r(W,`getChartDefaultData`);function G(e){let t=u();return g(e.trim(),t)}r(G,`textSanitizer`);function K(e){F=e}r(K,`setTmpSVGG`);function q(e){e===`horizontal`?I.chartOrientation=`horizontal`:I.chartOrientation=`vertical`}r(q,`setOrientation`);function J(e){R.xAxis.title=G(e.text)}r(J,`setXAxisTitle`);function Y(e,t){R.xAxis={type:`linear`,title:R.xAxis.title,min:e,max:t},B=!0}r(Y,`setXAxisRangeData`);function X(e){R.xAxis={type:`band`,title:R.xAxis.title,categories:e.map(e=>G(e.text))},B=!0}r(X,`setXAxisBand`);function oe(e){R.yAxis.title=G(e.text)}r(oe,`setYAxisTitle`);function se(e,t){R.yAxis={type:`linear`,title:R.yAxis.title,min:e,max:t},V=!0}r(se,`setYAxisRangeData`);function ce(e){let t=Math.min(...e),n=Math.max(...e),r=w(R.yAxis)?R.yAxis.min:1/0,i=w(R.yAxis)?R.yAxis.max:-1/0;R.yAxis={type:`linear`,title:R.yAxis.title,min:Math.min(r,t),max:Math.max(i,n)}}r(ce,`setYAxisRangeFromPlotData`);function Z(e){let t=[];if(e.length===0)return t;if(!B){let t=w(R.xAxis)?R.xAxis.min:1/0,n=w(R.xAxis)?R.xAxis.max:-1/0;Y(Math.min(t,1),Math.max(n,e.length))}if(V||ce(e),C(R.xAxis)&&(t=R.xAxis.categories.map((t,n)=>[t,e[n]])),w(R.xAxis)){let n=R.xAxis.min,r=R.xAxis.max,i=(r-n)/(e.length-1),a=[];for(let e=n;e<=r;e+=i)a.push(`${e}`);t=a.map((t,n)=>[t,e[n]])}return t}r(Z,`transformDataWithoutCategory`);function Q(e){return z[e===0?0:e%z.length]}r(Q,`getPlotColorFromPalette`);function le(e,t){let n=Z(t);R.plots.push({type:`line`,strokeFill:Q(P),strokeWidth:2,data:n}),P++}r(le,`setLineData`);function $(e,t){let n=Z(t);R.plots.push({type:`bar`,fill:Q(P),data:n}),P++}r($,`setBarData`);function ue(){if(R.plots.length===0)throw Error(`No Plot to render, please provide a plot with some data`);return R.title=m(),ae.build(I,R,L,F)}r(ue,`getDrawableElem`);function de(){return L}r(de,`getChartThemeConfig`);function fe(){return I}r(fe,`getChartConfig`);function pe(){return R}r(pe,`getXYChartData`);var me={parser:x,db:{getDrawableElem:ue,clear:r(function(){l(),P=0,I=U(),R=W(),L=H(),z=L.plotColorPalette.split(`,`).map(e=>e.trim()),B=!1,V=!1},`clear`),setAccTitle:c,getAccTitle:h,setDiagramTitle:s,getDiagramTitle:m,getAccDescription:p,setAccDescription:o,setOrientation:q,setXAxisTitle:J,setXAxisRangeData:Y,setXAxisBand:X,setYAxisTitle:oe,setYAxisRangeData:se,setLineData:le,setBarData:$,setTmpSVGG:K,getChartThemeConfig:de,getChartConfig:fe,getXYChartData:pe},renderer:{draw:r((e,t,n,a)=>{let o=a.db,s=o.getChartThemeConfig(),c=o.getChartConfig(),l=o.getXYChartData().plots[0].data.map(e=>e[1]);function u(e){return e===`top`?`text-before-edge`:`middle`}r(u,`getDominantBaseLine`);function f(e){return e===`left`?`start`:e===`right`?`end`:`middle`}r(f,`getTextAnchor`);function p(e){return`translate(${e.x}, ${e.y}) rotate(${e.rotation||0})`}r(p,`getTextTransformation`),i.debug(`Rendering xychart chart
|
|
6
|
+
`+this.showPosition(),{text:``,token:null,line:this.yylineno})},`next`),lex:r(function(){return this.next()||this.lex()},`lex`),begin:r(function(e){this.conditionStack.push(e)},`begin`),popState:r(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},`popState`),_currentRules:r(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},`_currentRules`),topState:r(function(e){return e=this.conditionStack.length-1-Math.abs(e||0),e>=0?this.conditionStack[e]:`INITIAL`},`topState`),pushState:r(function(e){this.begin(e)},`pushState`),stateStackSize:r(function(){return this.conditionStack.length},`stateStackSize`),options:{"case-insensitive":!0},performAction:r(function(e,t,n,r){switch(n){case 0:break;case 1:break;case 2:return this.popState(),34;case 3:return this.popState(),34;case 4:return 34;case 5:break;case 6:return 10;case 7:return this.pushState(`acc_title`),19;case 8:return this.popState(),`acc_title_value`;case 9:return this.pushState(`acc_descr`),21;case 10:return this.popState(),`acc_descr_value`;case 11:this.pushState(`acc_descr_multiline`);break;case 12:this.popState();break;case 13:return`acc_descr_multiline_value`;case 14:return 5;case 15:return 5;case 16:return 8;case 17:return this.pushState(`axis_data`),`X_AXIS`;case 18:return this.pushState(`axis_data`),`Y_AXIS`;case 19:return this.pushState(`axis_band_data`),24;case 20:return 31;case 21:return this.pushState(`data`),16;case 22:return this.pushState(`data`),18;case 23:return this.pushState(`data_inner`),24;case 24:return 27;case 25:return this.popState(),26;case 26:this.popState();break;case 27:this.pushState(`string`);break;case 28:this.popState();break;case 29:return`STR`;case 30:return 24;case 31:return 26;case 32:return 43;case 33:return`COLON`;case 34:return 44;case 35:return 28;case 36:return 45;case 37:return 46;case 38:return 48;case 39:return 50;case 40:return 47;case 41:return 41;case 42:return 49;case 43:return 42;case 44:break;case 45:return 35;case 46:return 36}},`anonymous`),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\})/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:xychart\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,24,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,18,21,22,23,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,22,24,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[28,29],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}}})();function A(){this.yy={}}return r(A,`Parser`),A.prototype=k,k.Parser=A,new A})();b.parser=b;var x=b;function S(e){return e.type===`bar`}r(S,`isBarPlot`);function C(e){return e.type===`band`}r(C,`isBandAxisData`);function w(e){return e.type===`linear`}r(w,`isLinearAxisData`);var T=class{constructor(e){this.parentGroup=e}static{r(this,`TextDimensionCalculatorWithFont`)}getMaxDimension(e,t){if(!this.parentGroup)return{width:e.reduce((e,t)=>Math.max(t.length,e),0)*t,height:t};let n={width:0,height:0},r=this.parentGroup.append(`g`).attr(`visibility`,`hidden`).attr(`font-size`,t);for(let i of e){let e=y(r,1,i),a=e?e.width:i.length*t,o=e?e.height:t;n.width=Math.max(n.width,a),n.height=Math.max(n.height,o)}return r.remove(),n}},E=.7,D=.2,O=class{constructor(e,t,n,r){this.axisConfig=e,this.title=t,this.textDimensionCalculator=n,this.axisThemeConfig=r,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition=`left`,this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition=`left`}static{r(this,`BaseAxis`)}setRange(e){this.range=e,this.axisPosition===`left`||this.axisPosition===`right`?this.boundingRect.height=e[1]-e[0]:this.boundingRect.width=e[1]-e[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(e){this.axisPosition=e,this.setRange(this.range)}getTickDistance(){let e=this.getRange();return Math.abs(e[0]-e[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map(e=>e.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){E*this.getTickDistance()>this.outerPadding*2&&(this.outerPadding=Math.floor(E*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(e){let t=e.height;if(this.axisConfig.showAxisLine&&t>this.axisConfig.axisLineWidth&&(t-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let n=this.getLabelDimension(),r=D*e.width;this.outerPadding=Math.min(n.width/2,r);let i=n.height+this.axisConfig.labelPadding*2;this.labelTextHeight=n.height,i<=t&&(t-=i,this.showLabel=!0)}if(this.axisConfig.showTick&&t>=this.axisConfig.tickLength&&(this.showTick=!0,t-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let e=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=e.height+this.axisConfig.titlePadding*2;this.titleTextHeight=e.height,n<=t&&(t-=n,this.showTitle=!0)}this.boundingRect.width=e.width,this.boundingRect.height=e.height-t}calculateSpaceIfDrawnVertical(e){let t=e.width;if(this.axisConfig.showAxisLine&&t>this.axisConfig.axisLineWidth&&(t-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let n=this.getLabelDimension(),r=D*e.height;this.outerPadding=Math.min(n.height/2,r);let i=n.width+this.axisConfig.labelPadding*2;i<=t&&(t-=i,this.showLabel=!0)}if(this.axisConfig.showTick&&t>=this.axisConfig.tickLength&&(this.showTick=!0,t-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let e=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=e.height+this.axisConfig.titlePadding*2;this.titleTextHeight=e.height,n<=t&&(t-=n,this.showTitle=!0)}this.boundingRect.width=e.width-t,this.boundingRect.height=e.height}calculateSpace(e){return this.axisPosition===`left`||this.axisPosition===`right`?this.calculateSpaceIfDrawnVertical(e):this.calculateSpaceIfDrawnHorizontally(e),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}getDrawableElementsForLeftAxis(){let e=[];if(this.showAxisLine){let t=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;e.push({type:`path`,groupTexts:[`left-axis`,`axisl-line`],data:[{path:`M ${t},${this.boundingRect.y} L ${t},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&e.push({type:`text`,groupTexts:[`left-axis`,`label`],data:this.getTickValues().map(e=>({text:e.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(e),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:`middle`,horizontalPos:`right`}))}),this.showTick){let t=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);e.push({type:`path`,groupTexts:[`left-axis`,`ticks`],data:this.getTickValues().map(e=>({path:`M ${t},${this.getScaleValue(e)} L ${t-this.axisConfig.tickLength},${this.getScaleValue(e)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&e.push({type:`text`,groupTexts:[`left-axis`,`title`],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:`top`,horizontalPos:`center`}]}),e}getDrawableElementsForBottomAxis(){let e=[];if(this.showAxisLine){let t=this.boundingRect.y+this.axisConfig.axisLineWidth/2;e.push({type:`path`,groupTexts:[`bottom-axis`,`axis-line`],data:[{path:`M ${this.boundingRect.x},${t} L ${this.boundingRect.x+this.boundingRect.width},${t}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&e.push({type:`text`,groupTexts:[`bottom-axis`,`label`],data:this.getTickValues().map(e=>({text:e.toString(),x:this.getScaleValue(e),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:`top`,horizontalPos:`center`}))}),this.showTick){let t=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);e.push({type:`path`,groupTexts:[`bottom-axis`,`ticks`],data:this.getTickValues().map(e=>({path:`M ${this.getScaleValue(e)},${t} L ${this.getScaleValue(e)},${t+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&e.push({type:`text`,groupTexts:[`bottom-axis`,`title`],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:`top`,horizontalPos:`center`}]}),e}getDrawableElementsForTopAxis(){let e=[];if(this.showAxisLine){let t=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;e.push({type:`path`,groupTexts:[`top-axis`,`axis-line`],data:[{path:`M ${this.boundingRect.x},${t} L ${this.boundingRect.x+this.boundingRect.width},${t}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&e.push({type:`text`,groupTexts:[`top-axis`,`label`],data:this.getTickValues().map(e=>({text:e.toString(),x:this.getScaleValue(e),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+this.axisConfig.titlePadding*2:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:`top`,horizontalPos:`center`}))}),this.showTick){let t=this.boundingRect.y;e.push({type:`path`,groupTexts:[`top-axis`,`ticks`],data:this.getTickValues().map(e=>({path:`M ${this.getScaleValue(e)},${t+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(e)},${t+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&e.push({type:`text`,groupTexts:[`top-axis`,`title`],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:`top`,horizontalPos:`center`}]}),e}getDrawableElements(){if(this.axisPosition===`left`)return this.getDrawableElementsForLeftAxis();if(this.axisPosition===`right`)throw Error(`Drawing of right axis is not implemented`);return this.axisPosition===`bottom`?this.getDrawableElementsForBottomAxis():this.axisPosition===`top`?this.getDrawableElementsForTopAxis():[]}},k=class extends O{static{r(this,`BandAxis`)}constructor(e,n,r,i,a){super(e,i,a,n),this.categories=r,this.scale=t().domain(this.categories).range(this.getRange())}setRange(e){super.setRange(e)}recalculateScale(){this.scale=t().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),i.trace(`BandAxis axis final categories, range: `,this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(e){return this.scale(e)??this.getRange()[0]}},A=class extends O{static{r(this,`LinearAxis`)}constructor(e,t,r,i,a){super(e,i,a,t),this.domain=r,this.scale=n().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){let e=[...this.domain];this.axisPosition===`left`&&e.reverse(),this.scale=n().domain(e).range(this.getRange())}getScaleValue(e){return this.scale(e)}};function j(e,t,n,r){let i=new T(r);return C(e)?new k(t,n,e.categories,e.title,i):new A(t,n,[e.min,e.max],e.title,i)}r(j,`getAxis`);var M=class{constructor(e,t,n,r){this.textDimensionCalculator=e,this.chartConfig=t,this.chartData=n,this.chartThemeConfig=r,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}static{r(this,`ChartTitle`)}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){let t=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),n=Math.max(t.width,e.width),r=t.height+2*this.chartConfig.titlePadding;return t.width<=n&&t.height<=r&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=n,this.boundingRect.height=r,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){let e=[];return this.showChartTitle&&e.push({groupTexts:[`chart-title`],type:`text`,data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:`middle`,horizontalPos:`center`,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]}),e}};function N(e,t,n,r){return new M(new T(r),e,t,n)}r(N,`getChartTitleComponent`);var ee=class{constructor(e,t,n,r,i){this.plotData=e,this.xAxis=t,this.yAxis=n,this.orientation=r,this.plotIndex=i}static{r(this,`LinePlot`)}getDrawableElement(){let t=this.plotData.data.map(e=>[this.xAxis.getScaleValue(e[0]),this.yAxis.getScaleValue(e[1])]),n;return n=this.orientation===`horizontal`?e().y(e=>e[0]).x(e=>e[1])(t):e().x(e=>e[0]).y(e=>e[1])(t),n?[{groupTexts:[`plot`,`line-plot-${this.plotIndex}`],type:`path`,data:[{path:n,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}]:[]}},te=class{constructor(e,t,n,r,i,a){this.barData=e,this.boundingRect=t,this.xAxis=n,this.yAxis=r,this.orientation=i,this.plotIndex=a}static{r(this,`BarPlot`)}getDrawableElement(){let e=this.barData.data.map(e=>[this.xAxis.getScaleValue(e[0]),this.yAxis.getScaleValue(e[1])]),t=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*.95,n=t/2;return this.orientation===`horizontal`?[{groupTexts:[`plot`,`bar-plot-${this.plotIndex}`],type:`rect`,data:e.map(e=>({x:this.boundingRect.x,y:e[0]-n,height:t,width:e[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]:[{groupTexts:[`plot`,`bar-plot-${this.plotIndex}`],type:`rect`,data:e.map(e=>({x:e[0]-n,y:e[1],width:t,height:this.boundingRect.y+this.boundingRect.height-e[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},ne=class{constructor(e,t,n){this.chartConfig=e,this.chartData=t,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0}}static{r(this,`BasePlot`)}setAxes(e,t){this.xAxis=e,this.yAxis=t}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){return this.boundingRect.width=e.width,this.boundingRect.height=e.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error(`Axes must be passed to render Plots`);let e=[];for(let[t,n]of this.chartData.plots.entries())switch(n.type){case`line`:{let r=new ee(n,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,t);e.push(...r.getDrawableElement())}break;case`bar`:{let r=new te(n,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,t);e.push(...r.getDrawableElement())}break}return e}};function re(e,t,n){return new ne(e,t,n)}r(re,`getPlotComponent`);var ie=class{constructor(e,t,n,r){this.chartConfig=e,this.chartData=t,this.componentStore={title:N(e,t,n,r),plot:re(e,t,n),xAxis:j(t.xAxis,e.xAxis,{titleColor:n.xAxisTitleColor,labelColor:n.xAxisLabelColor,tickColor:n.xAxisTickColor,axisLineColor:n.xAxisLineColor},r),yAxis:j(t.yAxis,e.yAxis,{titleColor:n.yAxisTitleColor,labelColor:n.yAxisLabelColor,tickColor:n.yAxisTickColor,axisLineColor:n.yAxisLineColor},r)}}static{r(this,`Orchestrator`)}calculateVerticalSpace(){let e=this.chartConfig.width,t=this.chartConfig.height,n=0,r=0,i=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),a=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),o=this.componentStore.plot.calculateSpace({width:i,height:a});e-=o.width,t-=o.height,o=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:t}),r=o.height,t-=o.height,this.componentStore.xAxis.setAxisPosition(`bottom`),o=this.componentStore.xAxis.calculateSpace({width:e,height:t}),t-=o.height,this.componentStore.yAxis.setAxisPosition(`left`),o=this.componentStore.yAxis.calculateSpace({width:e,height:t}),n=o.width,e-=o.width,e>0&&(i+=e,e=0),t>0&&(a+=t,t=0),this.componentStore.plot.calculateSpace({width:i,height:a}),this.componentStore.plot.setBoundingBoxXY({x:n,y:r}),this.componentStore.xAxis.setRange([n,n+i]),this.componentStore.xAxis.setBoundingBoxXY({x:n,y:r+a}),this.componentStore.yAxis.setRange([r,r+a]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:r}),this.chartData.plots.some(e=>S(e))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let e=this.chartConfig.width,t=this.chartConfig.height,n=0,r=0,i=0,a=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),o=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),s=this.componentStore.plot.calculateSpace({width:a,height:o});e-=s.width,t-=s.height,s=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:t}),n=s.height,t-=s.height,this.componentStore.xAxis.setAxisPosition(`left`),s=this.componentStore.xAxis.calculateSpace({width:e,height:t}),e-=s.width,r=s.width,this.componentStore.yAxis.setAxisPosition(`top`),s=this.componentStore.yAxis.calculateSpace({width:e,height:t}),t-=s.height,i=n+s.height,e>0&&(a+=e,e=0),t>0&&(o+=t,t=0),this.componentStore.plot.calculateSpace({width:a,height:o}),this.componentStore.plot.setBoundingBoxXY({x:r,y:i}),this.componentStore.yAxis.setRange([r,r+a]),this.componentStore.yAxis.setBoundingBoxXY({x:r,y:n}),this.componentStore.xAxis.setRange([i,i+o]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:i}),this.chartData.plots.some(e=>S(e))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){this.chartConfig.chartOrientation===`horizontal`?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();let e=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(let t of Object.values(this.componentStore))e.push(...t.getDrawableElements());return e}},ae=class{static{r(this,`XYChartBuilder`)}static build(e,t,n,r){return new ie(e,t,n,r).getDrawableElement()}},P=0,F,I=U(),L=H(),R=W(),z=L.plotColorPalette.split(`,`).map(e=>e.trim()),B=!1,V=!1;function H(){let e=a(),t=u();return v(e.xyChart,t.themeVariables.xyChart)}r(H,`getChartDefaultThemeConfig`);function U(){let e=u();return v(f.xyChart,e.xyChart)}r(U,`getChartDefaultConfig`);function W(){return{yAxis:{type:`linear`,title:``,min:1/0,max:-1/0},xAxis:{type:`band`,title:``,categories:[]},title:``,plots:[]}}r(W,`getChartDefaultData`);function G(e){let t=u();return g(e.trim(),t)}r(G,`textSanitizer`);function K(e){F=e}r(K,`setTmpSVGG`);function q(e){e===`horizontal`?I.chartOrientation=`horizontal`:I.chartOrientation=`vertical`}r(q,`setOrientation`);function J(e){R.xAxis.title=G(e.text)}r(J,`setXAxisTitle`);function Y(e,t){R.xAxis={type:`linear`,title:R.xAxis.title,min:e,max:t},B=!0}r(Y,`setXAxisRangeData`);function X(e){R.xAxis={type:`band`,title:R.xAxis.title,categories:e.map(e=>G(e.text))},B=!0}r(X,`setXAxisBand`);function oe(e){R.yAxis.title=G(e.text)}r(oe,`setYAxisTitle`);function se(e,t){R.yAxis={type:`linear`,title:R.yAxis.title,min:e,max:t},V=!0}r(se,`setYAxisRangeData`);function ce(e){let t=Math.min(...e),n=Math.max(...e),r=w(R.yAxis)?R.yAxis.min:1/0,i=w(R.yAxis)?R.yAxis.max:-1/0;R.yAxis={type:`linear`,title:R.yAxis.title,min:Math.min(r,t),max:Math.max(i,n)}}r(ce,`setYAxisRangeFromPlotData`);function Z(e){let t=[];if(e.length===0)return t;if(!B){let t=w(R.xAxis)?R.xAxis.min:1/0,n=w(R.xAxis)?R.xAxis.max:-1/0;Y(Math.min(t,1),Math.max(n,e.length))}if(V||ce(e),C(R.xAxis)&&(t=R.xAxis.categories.map((t,n)=>[t,e[n]])),w(R.xAxis)){let n=R.xAxis.min,r=R.xAxis.max,i=(r-n)/(e.length-1),a=[];for(let e=n;e<=r;e+=i)a.push(`${e}`);t=a.map((t,n)=>[t,e[n]])}return t}r(Z,`transformDataWithoutCategory`);function Q(e){return z[e===0?0:e%z.length]}r(Q,`getPlotColorFromPalette`);function le(e,t){let n=Z(t);R.plots.push({type:`line`,strokeFill:Q(P),strokeWidth:2,data:n}),P++}r(le,`setLineData`);function $(e,t){let n=Z(t);R.plots.push({type:`bar`,fill:Q(P),data:n}),P++}r($,`setBarData`);function ue(){if(R.plots.length===0)throw Error(`No Plot to render, please provide a plot with some data`);return R.title=m(),ae.build(I,R,L,F)}r(ue,`getDrawableElem`);function de(){return L}r(de,`getChartThemeConfig`);function fe(){return I}r(fe,`getChartConfig`);function pe(){return R}r(pe,`getXYChartData`);var me={parser:x,db:{getDrawableElem:ue,clear:r(function(){l(),P=0,I=U(),R=W(),L=H(),z=L.plotColorPalette.split(`,`).map(e=>e.trim()),B=!1,V=!1},`clear`),setAccTitle:c,getAccTitle:h,setDiagramTitle:s,getDiagramTitle:m,getAccDescription:p,setAccDescription:o,setOrientation:q,setXAxisTitle:J,setXAxisRangeData:Y,setXAxisBand:X,setYAxisTitle:oe,setYAxisRangeData:se,setLineData:le,setBarData:$,setTmpSVGG:K,getChartThemeConfig:de,getChartConfig:fe,getXYChartData:pe},renderer:{draw:r((e,t,n,a)=>{let o=a.db,s=o.getChartThemeConfig(),c=o.getChartConfig(),l=o.getXYChartData().plots[0].data.map(e=>e[1]);function u(e){return e===`top`?`text-before-edge`:`middle`}r(u,`getDominantBaseLine`);function f(e){return e===`left`?`start`:e===`right`?`end`:`middle`}r(f,`getTextAnchor`);function p(e){return`translate(${e.x}, ${e.y}) rotate(${e.rotation||0})`}r(p,`getTextTransformation`),i.debug(`Rendering xychart chart
|
|
7
7
|
`+e);let m=_(t),h=m.append(`g`).attr(`class`,`main`),g=h.append(`rect`).attr(`width`,c.width).attr(`height`,c.height).attr(`class`,`background`);d(m,c.height,c.width,!0),m.attr(`viewBox`,`0 0 ${c.width} ${c.height}`),g.attr(`fill`,s.backgroundColor),o.setTmpSVGG(m.append(`g`).attr(`class`,`mermaid-tmp-group`));let v=o.getDrawableElem(),y={};function b(e){let t=h,n=``;for(let[r]of e.entries()){let i=h;r>0&&y[n]&&(i=y[n]),n+=e[r],t=y[n],t||=y[n]=i.append(`g`).attr(`class`,e[r])}return t}r(b,`getGroup`);for(let e of v){if(e.data.length===0)continue;let t=b(e.groupTexts);switch(e.type){case`rect`:if(t.selectAll(`rect`).data(e.data).enter().append(`rect`).attr(`x`,e=>e.x).attr(`y`,e=>e.y).attr(`width`,e=>e.width).attr(`height`,e=>e.height).attr(`fill`,e=>e.fill).attr(`stroke`,e=>e.strokeFill).attr(`stroke-width`,e=>e.strokeWidth),c.showDataLabel){let n=c.showDataLabelOutsideBar;if(c.chartOrientation===`horizontal`){let i=function(e,t){let{data:n,label:r}=e;return t*r.length*a<=n.width-o};r(i,`fitsHorizontally`);let a=.7,o=10,c=e.data.map((e,t)=>({data:e,label:l[t].toString()})).filter(e=>e.data.width>0&&e.data.height>0),u=c.map(e=>{let{data:t}=e,n=t.height*.7;for(;!i(e,n)&&n>0;)--n;return n}),d=Math.floor(Math.min(...u)),f=r(e=>n?e.data.x+e.data.width+10:e.data.x+e.data.width-10,`determineLabelXPosition`);t.selectAll(`text`).data(c).enter().append(`text`).attr(`x`,f).attr(`y`,e=>e.data.y+e.data.height/2).attr(`text-anchor`,n?`start`:`end`).attr(`dominant-baseline`,`middle`).attr(`fill`,s.dataLabelColor).attr(`font-size`,`${d}px`).text(e=>e.label)}else{let i=function(e,t,n){let{data:r,label:i}=e,a=t*i.length*.7,o=r.x+r.width/2,s=o-a/2,c=o+a/2,l=s>=r.x&&c<=r.x+r.width,u=r.y+n+t<=r.y+r.height;return l&&u};r(i,`fitsInBar`);let a=e.data.map((e,t)=>({data:e,label:l[t].toString()})).filter(e=>e.data.width>0&&e.data.height>0),o=a.map(e=>{let{data:t,label:n}=e,r=t.width/(n.length*.7);for(;!i(e,r,10)&&r>0;)--r;return r}),c=Math.floor(Math.min(...o)),u=r(e=>n?e.data.y-10:e.data.y+10,`determineLabelYPosition`);t.selectAll(`text`).data(a).enter().append(`text`).attr(`x`,e=>e.data.x+e.data.width/2).attr(`y`,u).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,n?`auto`:`hanging`).attr(`fill`,s.dataLabelColor).attr(`font-size`,`${c}px`).text(e=>e.label)}}break;case`text`:t.selectAll(`text`).data(e.data).enter().append(`text`).attr(`x`,0).attr(`y`,0).attr(`fill`,e=>e.fill).attr(`font-size`,e=>e.fontSize).attr(`dominant-baseline`,e=>u(e.verticalPos)).attr(`text-anchor`,e=>f(e.horizontalPos)).attr(`transform`,e=>p(e)).text(e=>e.text);break;case`path`:t.selectAll(`path`).data(e.data).enter().append(`path`).attr(`d`,e=>e.path).attr(`fill`,e=>e.fill?e.fill:`none`).attr(`stroke`,e=>e.strokeFill).attr(`stroke-width`,e=>e.strokeWidth);break}}},`draw`)}};export{me as diagram};
|
package/dist/index.html
CHANGED
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
<script>
|
|
19
19
|
window.process = window.process || { env: { NODE_ENV: 'development' }, version: '', platform: 'browser' };
|
|
20
20
|
</script>
|
|
21
|
-
<script type="module" crossorigin src="./assets/index-
|
|
21
|
+
<script type="module" crossorigin src="./assets/index-Bx77jcFN.js"></script>
|
|
22
22
|
<link rel="stylesheet" crossorigin href="./assets/ui-components-BL3SEdAz.css">
|
|
23
23
|
<link rel="stylesheet" crossorigin href="./assets/plugin-dashboard-DnNKJB60.css">
|
|
24
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
25
|
-
<link rel="modulepreload" href="./assets/framework-
|
|
26
|
-
<link rel="modulepreload" href="./assets/ui-components-
|
|
27
|
-
<link rel="modulepreload" href="./assets/vendor-radix-
|
|
28
|
-
<link rel="modulepreload" href="./assets/vendor-react-
|
|
24
|
+
<link rel="stylesheet" crossorigin href="./assets/index-CYLGNLiD.css">
|
|
25
|
+
<link rel="modulepreload" href="./assets/framework-CsYa1Kaj.js" />
|
|
26
|
+
<link rel="modulepreload" href="./assets/ui-components-DXl7VfQF.js" />
|
|
27
|
+
<link rel="modulepreload" href="./assets/vendor-radix-90T7eS-d.js" />
|
|
28
|
+
<link rel="modulepreload" href="./assets/vendor-react-ClIa1CJA.js" />
|
|
29
29
|
</head>
|
|
30
30
|
<body>
|
|
31
31
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectstack/console",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.2.0",
|
|
4
4
|
"description": "Prebuilt Console SPA pinned to this @objectstack/framework release. Source of truth: @object-ui/console (https://github.com/objectstack-ai/objectui).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/objectstack-ai/framework/tree/main/packages/console",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-CMxvf4Kt.js";import{_ as t,t as n}from"./vendor-react-DR370ovB.js";import{m as r}from"./infrastructure-CJNwTVno.js";import{S as i}from"./framework-DCMHw4uc.js";import{t as a}from"./data-adapter-Hh2YXzlW.js";var o=e(t(),1),s=n();function c({children:e,adapter:t}){let[n,c]=(0,o.useState)(t??null);return(0,o.useEffect)(()=>{if(t){c(t);return}let e=!1;async function n(){try{let t=new a({baseUrl:``,fetch:r(),autoReconnect:!0,maxReconnectAttempts:5,reconnectDelay:1e3,cache:{maxSize:50,ttl:3e5}});await t.connect(),e||c(t)}catch(t){e||console.error(`[Console] Failed to initialize:`,t)}}return n(),()=>{e=!0}},[t]),(0,s.jsx)(i.Provider,{value:n,children:e})}export{c as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-CMxvf4Kt.js";import{_ as t,f as n,r,t as i}from"./vendor-react-DR370ovB.js";import{d as a,f as ee}from"./infrastructure-CJNwTVno.js";import{r as te}from"./framework-DCMHw4uc.js";import{$n as ne,$s as re,Bt as ie,Ds as ae,Es as oe,Fi as se,Ft as ce,H as le,Ht as o,Io as ue,Ir as de,It as fe,Jn as pe,Kn as me,Lt as he,Mt as ge,Pt as _e,R as ve,Rt as ye,Si as be,Sr as xe,Ut as Se,Vt as Ce,Wt as we,Xo as Te,_s as Ee,at as De,bs as Oe,cr as s,ct as c,dr as l,dt as ke,fr as u,fs as Ae,hr as d,ir as je,is as Me,it as Ne,jr as Pe,ks as Fe,lr as f,ls as Ie,lt as p,mc as m,mr as Le,nn as Re,nt as ze,on as Be,or as h,ot as Ve,pr as g,qn as He,qo as Ue,rr as We,rt as Ge,sc as Ke,si as qe,sr as _,st as Je,tt as Ye,ur as v,ut as Xe,xi as Ze,z as Qe,zt as $e}from"./ui-components-D1FYlKrM.js";import{r as y}from"./vendor-ui-utils-rQOI1gAo.js";var b=e(t(),1),et=`${``.replace(/\/$/,``)}/api/v1`;async function x(e,t){let n=await fetch(`${et}${e}`,{credentials:`include`,headers:{"Content-Type":`application/json`,...t?.headers||{}},...t}),r=null;try{r=await n.json()}catch{}if(!n.ok){let e=r?.code??`HTTP_${n.status}`,t=r?.message??r?.error??n.statusText,i=Error(`${e}: ${t}`);throw i.code=e,i.status=n.status,i.details=r,i}return r}var S={listProcesses(e={}){let t=new URLSearchParams;e.object&&t.set(`object`,e.object),e.activeOnly&&t.set(`activeOnly`,`true`);let n=t.toString();return x(`/approvals/processes${n?`?${n}`:``}`)},listRequests(e={}){let t=new URLSearchParams;e.status&&t.set(`status`,e.status),e.object&&t.set(`object`,e.object),e.recordId&&t.set(`recordId`,e.recordId);let n=Array.isArray(e.approverId)?e.approverId.filter(Boolean).join(`,`):e.approverId;n&&t.set(`approverId`,n),e.submitterId&&t.set(`submitterId`,e.submitterId),e.q?.trim()&&t.set(`q`,e.q.trim()),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let r=t.toString();return x(`/approvals/requests${r?`?${r}`:``}`)},async getRequest(e){return{data:await x(`/approvals/requests/${encodeURIComponent(e)}`)}},listActions(e){return x(`/approvals/requests/${encodeURIComponent(e)}/actions`)},async approve(e,t){let n=await x(`/approvals/requests/${encodeURIComponent(e)}/approve`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,finalized:n.finalized}},async reject(e,t){let n=await x(`/approvals/requests/${encodeURIComponent(e)}/reject`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,finalized:n.finalized}},async recall(e,t){return{data:(await x(`/approvals/requests/${encodeURIComponent(e)}/recall`,{method:`POST`,body:JSON.stringify(t)})).request,finalized:!0}},async reassign(e,t){return{data:(await x(`/approvals/requests/${encodeURIComponent(e)}/reassign`,{method:`POST`,body:JSON.stringify(t)})).request}},async remind(e,t={}){let n=await x(`/approvals/requests/${encodeURIComponent(e)}/remind`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,notified:n.notified}},async requestInfo(e,t){return{data:(await x(`/approvals/requests/${encodeURIComponent(e)}/request-info`,{method:`POST`,body:JSON.stringify(t)})).request}},async sendBack(e,t){let n=await x(`/approvals/requests/${encodeURIComponent(e)}/revise`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,autoRejected:n.autoRejected===!0}},async resubmit(e,t={}){let n=await x(`/approvals/requests/${encodeURIComponent(e)}/resubmit`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,resumed:n.resumed===!0}},async comment(e,t){return{data:(await x(`/approvals/requests/${encodeURIComponent(e)}/comment`,{method:`POST`,body:JSON.stringify(t)})).request}},async submit(e){return x(`/approvals/requests`,{method:`POST`,body:JSON.stringify(e)})}};function tt(e){if(!e)return[];let t=new Set;e.id&&t.add(e.id),e.email&&t.add(e.email);let n=[...e.roles||[],...typeof e.role==`string`?e.role.split(`,`):[]];for(let e of n){let n=String(e).trim();n&&t.add(`role:${n}`)}return Array.from(t)}var C=i(),nt=50,rt={pending:`border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-400`,approved:`border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-400`,rejected:`border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-400`,recalled:`border-border bg-muted text-muted-foreground`,returned:`border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-500/30 dark:bg-violet-500/10 dark:text-violet-400`};function it(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function w(e){return e?e.includes(`@`)?e:e.startsWith(`role:`)?`Role: ${e.slice(5)}`:e.length>14?`${e.slice(0,6)}…${e.slice(-4)}`:e:`—`}function T(e){return e&&String(e).replace(/^flow:/,``).trim().split(/[_\-\s]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)||`—`}function at(e){return e.process_label||T(e.process_name)}function ot(e){return e.step_label?e.step_label:e.current_step?T(e.current_step):null}function st(e){return e.submitter_name||w(e.submitter_id)}function ct(e,t){return t.pending_approver_names?.[e]||w(e)}function lt(e){return e.object_label||e.object_name}function E(e){return e.submitted_at||e.created_at||void 0}function D(e){let t=E(e);if(!t)return null;let n=Date.parse(t);return Number.isNaN(n)?null:(Date.now()-n)/36e5}function ut(e){if(e.status!==`pending`)return`text-muted-foreground`;let t=D(e);return t==null?`text-muted-foreground`:t>72?`text-red-600 dark:text-red-400 font-medium`:t>24?`text-amber-600 dark:text-amber-400`:`text-muted-foreground`}function dt(e){let t=Math.max(1,Math.round(Math.abs(e)/36e5));return t<48?`${t}h`:`${Math.round(t/24)}d`}var ft=new Set([`id`,`created_at`,`updated_at`,`created_by`,`updated_by`,`organization_id`]);function O(e){return e.split(`_`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function k(e,t){if(typeof t==`boolean`)return t?`✓`:`—`;if(typeof t==`number`){if(t>0xe8d4a51000&&/(_at$|_date$|^date_|_time$)/.test(e))try{return new Date(t).toLocaleDateString()}catch{}return t.toLocaleString()}let n=String(t);if(/^\d{4}-\d{2}-\d{2}T\d{2}/.test(n))try{return new Date(n).toLocaleString()}catch{}return n}var pt=/^[A-Za-z0-9_-]{15,}$/;function mt(e,t,n=6){if(!e||typeof e!=`object`||Array.isArray(e))return[];let r=[];for(let[i,a]of Object.entries(e)){if(ft.has(i)||a==null||typeof a==`object`||String(a).trim()===``)continue;let e=t?.[i];if(!(!e&&typeof a==`string`&&pt.test(a.trim())&&!/^\d+$/.test(a.trim()))&&(r.push([O(i),e??k(i,a)]),r.length>=n))break}return r}function ht(){let{t:e,language:t}=te(),{user:i}=ee(),et=a(),{appName:x}=n(),T=(0,b.useMemo)(()=>tt(i),[i]),D=(0,b.useCallback)((t,n,r)=>String(e(`approvalsInbox.${t}`,{defaultValue:n,...r})),[e]),ft=(0,b.useCallback)(e=>{if(!e)return`—`;let n=Date.parse(e);if(Number.isNaN(n))return e;let r=Math.round((Date.now()-n)/1e3);if(r<45)return D(`justNow`,`just now`);let i=Math.round(r/60);if(i<60)return D(`minutesAgo`,`{{count}}m ago`,{count:i});let a=Math.round(i/60);if(a<24)return D(`hoursAgo`,`{{count}}h ago`,{count:a});let ee=Math.round(a/24);if(ee<30)return D(`daysAgo`,`{{count}}d ago`,{count:ee});try{return new Date(e).toLocaleDateString(t)}catch{return e}},[D,t]),O=(0,b.useCallback)(e=>{switch(e){case`pending`:return D(`statusPending`,`Pending`);case`approved`:return D(`statusApproved`,`Approved`);case`rejected`:return D(`statusRejected`,`Rejected`);case`recalled`:return D(`statusRecalled`,`Recalled`);case`returned`:return D(`statusReturned`,`Returned for revision`);default:return e}},[D]),k=(0,b.useCallback)((e,t)=>{let n=e?.code??``,r=e?.status??0;return n===`NOT_IMPLEMENTED`||r===501?D(`recallUnavailable`,`Recall is not available on this deployment.`):n===`THROTTLED`||r===429?D(`remindThrottled`,`A reminder was sent recently — try again later.`):r===404?D(`requestGone`,`This request no longer exists. Refresh the list.`):n===`FORBIDDEN`||r===403?D(`notAllowed`,`You are not allowed to perform this action.`):n===`INVALID_STATE`||r===409?D(`alreadyDecided`,`This request was already decided. Refresh the list.`):e?.message||t},[D]);function pt({status:e}){return(0,C.jsx)(ne,{variant:`outline`,className:m(`font-medium`,rt[e]??``),children:O(e)})}let ht=(0,b.useCallback)(e=>`/apps/${x||`setup`}/${encodeURIComponent(e.object_name)}/record/${encodeURIComponent(e.record_id)}`,[x]),[A,gt]=(0,b.useState)(`pending`),[j,_t]=(0,b.useState)([]),[vt,yt]=(0,b.useState)(!1),[bt,xt]=(0,b.useState)(!1),[St,Ct]=(0,b.useState)(null),[wt,Tt]=(0,b.useState)(null),[Et,Dt]=(0,b.useState)(0),[M,Ot]=(0,b.useState)(null),[N,kt]=(0,b.useState)(null),[At,jt]=(0,b.useState)([]),[Mt,Nt]=(0,b.useState)(!1),[P,F]=(0,b.useState)(``),[I,Pt]=(0,b.useState)(``),[L,Ft]=(0,b.useState)(null),[R,It]=(0,b.useState)(``),[Lt,Rt]=(0,b.useState)(``),[zt,Bt]=(0,b.useState)(`all`),[Vt,Ht]=(0,b.useState)(`all`),[z,Ut]=(0,b.useState)(`all`),[B,Wt]=(0,b.useState)(new Set),[Gt,Kt]=(0,b.useState)(!1),[V,qt]=(0,b.useState)(null),[Jt,Yt]=(0,b.useState)(null),[Xt,Zt]=(0,b.useState)(!1),[H,Qt]=(0,b.useState)(``),[$t,en]=(0,b.useState)(!1),[tn,nn]=(0,b.useState)(``),[rn,an]=(0,b.useState)(!1),[on,sn]=(0,b.useState)(``),[cn,ln]=(0,b.useState)(!1),[un,dn]=(0,b.useState)(``),[U,W]=(0,b.useState)(!1),[fn,pn]=(0,b.useState)([]),[mn,hn]=(0,b.useState)(-1);(0,b.useEffect)(()=>{if(A===`pending`)return;let e=window.setTimeout(()=>Rt(R),350);return()=>window.clearTimeout(e)},[R,A]);let G=(0,b.useCallback)(async()=>{yt(!0),Tt(null);try{let e=[];if(A===`pending`)e=T.length?(await S.listRequests({status:`pending`,approverId:T})).data:[],Dt(e.length),Ct(null);else{let t={q:Lt||void 0,status:z===`all`?void 0:z,limit:nt,offset:0};if(A===`submitted`){let n=i?.id;if(n){let r=await S.listRequests({submitterId:n,...t});e=r.data,Ct(r.total??r.data.length)}else e=[],Ct(0)}else{let n=await S.listRequests(t);e=n.data,Ct(n.total??n.data.length)}T.length&&S.listRequests({status:`pending`,approverId:T}).then(e=>Dt(e.data.length)).catch(()=>{})}e.sort((e,t)=>(E(t)||``).localeCompare(E(e)||``)),_t(e)}catch(e){Tt(e?.message||String(e)),_t([])}finally{yt(!1)}},[A,T,i?.id,Lt,z]);(0,b.useEffect)(()=>{G()},[G]);let gn=(0,b.useCallback)(async()=>{if(!(A===`pending`||bt)){xt(!0);try{let e=await S.listRequests({submitterId:A===`submitted`?i?.id??void 0:void 0,q:Lt||void 0,status:z===`all`?void 0:z,limit:nt,offset:j.length});_t(t=>{let n=new Set(t.map(e=>e.id));return[...t,...e.data.filter(e=>!n.has(e.id))]}),e.total!=null&&Ct(e.total)}catch(e){y.error(k(e,D(`loadFailed`,`Failed to load request`)))}finally{xt(!1)}}},[A,bt,i?.id,Lt,z,j.length,k,D]),K=(0,b.useCallback)(async e=>{Ot(e),Nt(!0),F(``),Pt(``);try{let[t,n]=await Promise.all([S.getRequest(e),S.listActions(e)]);kt(t.data),jt(n.data)}catch(e){y.error(k(e,D(`loadFailed`,`Failed to load request`))),kt(null),jt([])}finally{Nt(!1)}},[k,D]),_n=()=>{Ot(null),kt(null),jt([]),F(``),Pt(``)},q=(0,b.useCallback)(e=>{if(I.trim())return I.trim();if(!e)return i?.id||``;let t=new Set(e.pending_approvers||[]);for(let e of T)if(t.has(e))return e;return i?.id||``},[I,T,i?.id]),J=(0,b.useCallback)(()=>{T.length&&S.listRequests({status:`pending`,approverId:T}).then(e=>Dt(e.data.length)).catch(()=>{})},[T]),vn=(0,b.useCallback)(async e=>{if(!N)return;let t=e===`recall`&&i?.id||q(N);if(!t){y.error(D(`noActor`,`Cannot determine the acting identity`));return}Ft(e);try{let n={actor_id:t,comment:P.trim()||void 0},r=await(e===`approve`?S.approve:e===`reject`?S.reject:S.recall)(N.id,n);if(y.success(e===`approve`?r.finalized?D(`approvedFinal`,`Approved`):D(`approvedWaiting`,`Approved — waiting on the remaining approvers`):e===`reject`?D(`rejectedToast`,`Rejected`):D(`recalledToast`,`Request recalled`)),F(``),e!==`recall`&&A===`pending`){let e=Rn.current,t=e.findIndex(e=>e.id===N.id),n=e[t+1]??e[t-1];G(),n&&n.id!==N.id?K(n.id):_n();return}let[i,a]=await Promise.all([S.getRequest(N.id),S.listActions(N.id)]);kt(i.data),jt(a.data),G()}catch(e){y.error(k(e,D(`actionFailed`,`Action failed`)))}finally{Ft(null)}},[N,q,P,G,i?.id,k,D,A,K]),Y=(0,b.useCallback)(async e=>{let[t,n]=await Promise.all([S.getRequest(e),S.listActions(e)]);kt(t.data),jt(n.data),G()},[G]),yn=(0,b.useCallback)(async()=>{if(!(!N||!H.trim())){W(!0);try{await S.reassign(N.id,{actor_id:q(N),to:H.trim(),comment:P.trim()||void 0}),y.success(D(`reassignSuccess`,`Handed to {{to}}`,{to:H.trim()})),Zt(!1),Qt(``),F(``),await Y(N.id),J()}catch(e){y.error(k(e,D(`actionFailed`,`Action failed`)))}finally{W(!1)}}},[N,H,P,q,Y,J,k,D]),bn=(0,b.useCallback)(async()=>{if(N){W(!0);try{let e=await S.remind(N.id,{actor_id:i?.id});y.success(D(`remindSuccess`,`Reminder sent to {{count}} approver(s)`,{count:e.notified})),await Y(N.id)}catch(e){y.error(k(e,D(`actionFailed`,`Action failed`)))}finally{W(!1)}}},[N,i?.id,Y,k,D]),xn=(0,b.useCallback)(async()=>{if(!(!N||!tn.trim())){W(!0);try{await S.requestInfo(N.id,{actor_id:q(N),comment:tn.trim()}),y.success(D(`requestInfoSent`,`Sent back to the requester for more information`)),en(!1),nn(``),await Y(N.id)}catch(e){y.error(k(e,D(`actionFailed`,`Action failed`)))}finally{W(!1)}}},[N,tn,q,Y,k,D]),Sn=(0,b.useCallback)(async()=>{if(N){W(!0);try{let e=await S.sendBack(N.id,{actor_id:q(N),comment:on.trim()||void 0});y.success(e.autoRejected?D(`sendBackAutoRejected`,`Revision limit reached — the request was auto-rejected`):D(`sendBackSuccess`,`Sent back for revision — the requester can now edit and resubmit`)),an(!1),sn(``),await Y(N.id),J()}catch(e){y.error(k(e,D(`actionFailed`,`Action failed`)))}finally{W(!1)}}},[N,on,q,Y,J,k,D]),Cn=(0,b.useCallback)(async()=>{if(N){ln(!0);try{await S.resubmit(N.id,{actor_id:i?.id,comment:P.trim()||void 0}),y.success(D(`resubmitSuccess`,`Resubmitted — a new approval round has opened`)),F(``),await Y(N.id),J()}catch(e){y.error(k(e,D(`actionFailed`,`Action failed`)))}finally{ln(!1)}}},[N,P,i?.id,Y,J,k,D]),wn=(0,b.useCallback)(async()=>{if(!(!N||!un.trim())){W(!0);try{await S.comment(N.id,{actor_id:i?.id,comment:un.trim()}),dn(``),await Y(N.id)}catch(e){y.error(k(e,D(`actionFailed`,`Action failed`)))}finally{W(!1)}}},[N,un,i?.id,Y,k,D]),Tn=(0,b.useCallback)(async()=>{if(!fn.length)try{let e=``.replace(/\/$/,``);pn(((await(await fetch(`${e}/api/v1/data/sys_user?limit=100`,{credentials:`include`})).json()).records||[]).filter(e=>e.email&&e.name&&e.id!==i?.id).map(e=>({name:String(e.name),email:String(e.email)})))}catch{}},[fn.length,i?.id]),En=(0,b.useMemo)(()=>{if(!N||N.status!==`pending`)return!1;let e=new Set(N.pending_approvers||[]);return T.some(t=>e.has(t))||I.trim().length>0},[N,T,I]),Dn=(0,b.useMemo)(()=>!N||N.status!==`pending`?!1:N.submitter_id===i?.id||I.trim().length>0,[N,i?.id,I]),On=(0,b.useMemo)(()=>!N||N.status!==`returned`?!1:N.submitter_id===i?.id||I.trim().length>0,[N,i?.id,I]),kn=(0,b.useMemo)(()=>{let e=new Set;for(let t of j)e.add(at(t));return Array.from(e).sort()},[j]),An=(0,b.useMemo)(()=>{let e=new Set;for(let t of j)t.object_name&&e.add(t.object_name);return Array.from(e).sort()},[j]),X=(0,b.useMemo)(()=>{let e=R.trim().toLowerCase();return j.filter(t=>zt!==`all`&&at(t)!==zt||Vt!==`all`&&t.object_name!==Vt||z!==`all`&&t.status!==z?!1:A!==`pending`||!e?!0:[t.process_name,t.process_label,t.step_label,t.object_name,t.record_id,t.record_title,t.submitter_id,t.submitter_name,...t.pending_approvers||[]].filter(Boolean).join(` `).toLowerCase().includes(e))},[j,R,zt,Vt,z,A]),Z=(0,b.useMemo)(()=>M?X.findIndex(e=>e.id===M):-1,[X,M]);(0,b.useEffect)(()=>{if(B.size===0)return;let e=new Set(X.map(e=>e.id)),t=!1,n=new Set;for(let r of B)e.has(r)?n.add(r):t=!0;t&&Wt(n)},[X,B]),(0,b.useEffect)(()=>{mn>=X.length&&hn(X.length-1)},[X.length,mn]);let Q=(0,b.useCallback)(e=>{if(e.status!==`pending`)return!1;let t=new Set(T);return(e.pending_approvers||[]).some(e=>t.has(e))},[T]),$=(0,b.useMemo)(()=>X.filter(e=>B.has(e.id)&&Q(e)),[X,B,Q]),jn=X.filter(e=>e.status===`pending`),Mn=jn.length>0&&jn.every(e=>B.has(e.id)),Nn=(0,b.useCallback)(()=>{Wt(e=>{if(Mn)return new Set;let t=new Set(e);for(let e of jn)t.add(e.id);return t})},[Mn,jn]),Pn=(0,b.useCallback)(e=>{Wt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Fn=(0,b.useCallback)(async e=>{let t=$;if(t.length===0)return;Kt(!0);let n=0,r=[];for(let a of t){let t=new Set(a.pending_approvers||[]),ee=T.find(e=>t.has(e))||i?.id||``;try{await(e===`approve`?S.approve:S.reject)(a.id,{actor_id:ee}),n++}catch{r.push(a.record_title||w(a.record_id))}}if(Kt(!1),Wt(new Set),r.length===0)y.success(e===`approve`?D(`bulkApproved`,`Approved {{count}} requests`,{count:n}):D(`bulkRejected`,`Rejected {{count}} requests`,{count:n}));else{let e=r.slice(0,3).join(`, `);y.error(D(`bulkPartial`,`{{ok}} succeeded, {{fail}} failed: {{which}}`,{ok:n,fail:r.length,which:e+(r.length>3?`…`:``)}))}G(),J()},[$,T,i?.id,G,J,D]),In=(0,b.useCallback)(async e=>{if(!Q(e)||Jt)return;let t=new Set(e.pending_approvers||[]),n=T.find(e=>t.has(e))||i?.id||``;Yt(e.id);try{let t=await S.approve(e.id,{actor_id:n});y.success(t.finalized?D(`inlineApproved`,`Approved "{{title}}"`,{title:e.record_title||w(e.record_id)}):D(`approvedWaiting`,`Approved — waiting on the remaining approvers`)),G(),J()}catch(e){y.error(k(e,D(`actionFailed`,`Action failed`)))}finally{Yt(null)}},[Q,Jt,T,i?.id,G,J,k,D]),Ln=(0,b.useCallback)(async()=>{let e=V;if(!e)return;let t=new Set(e.pending_approvers||[]),n=T.find(e=>t.has(e))||i?.id||``;Yt(e.id),qt(null);try{await S.reject(e.id,{actor_id:n}),y.success(D(`inlineRejected`,`Rejected "{{title}}"`,{title:e.record_title||w(e.record_id)})),G(),J()}catch(e){y.error(k(e,D(`actionFailed`,`Action failed`)))}finally{Yt(null)}},[V,T,i?.id,G,J,k,D]),Rn=(0,b.useRef)(X);Rn.current=X;let zn=(0,b.useRef)(mn);zn.current=mn,(0,b.useEffect)(()=>{let e=e=>{if(M||V)return;let t=e.target,n=t?.tagName;if(n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||t?.isContentEditable||document.querySelector(`[role="alertdialog"]`))return;let r=Rn.current;if(!r.length)return;let i=zn.current;e.key===`j`||e.key===`ArrowDown`?(e.preventDefault(),hn(Math.min(i+1,r.length-1))):e.key===`k`||e.key===`ArrowUp`?(e.preventDefault(),hn(Math.max(i-1,0))):e.key===`Enter`&&i>=0&&r[i]?(e.preventDefault(),K(r[i].id)):(e.key===`x`||e.key===` `)&&i>=0&&r[i]&&A===`pending`?(e.preventDefault(),Pn(r[i].id)):e.key===`a`&&i>=0&&r[i]?(e.preventDefault(),In(r[i])):e.key===`r`&&i>=0&&r[i]&&Q(r[i])&&(e.preventDefault(),qt(r[i]))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[M,V,A,K,Pn,In,Q]),(0,b.useEffect)(()=>{if(!M)return;let e=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;let t=e.target,n=t?.tagName;if(n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||t?.isContentEditable||document.querySelector(`[role="alertdialog"]`))return;let r=Rn.current,i=r.findIndex(e=>e.id===M);if(i<0)return;let a=e.key===`ArrowLeft`?r[i-1]:r[i+1];a&&(e.preventDefault(),K(a.id))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[M,K]);let Bn=!!R||zt!==`all`||Vt!==`all`||z!==`all`,Vn=e=>{gt(e),Ut(`all`),Bt(`all`),Ht(`all`),It(``),hn(-1)};function Hn({r:e}){return(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`div`,{className:`font-medium truncate`,children:at(e)}),(0,C.jsxs)(`div`,{className:`text-xs text-muted-foreground truncate`,children:[ot(e)||`—`,(e.round??1)>1&&(0,C.jsx)(`span`,{className:`ml-1.5 text-violet-600 dark:text-violet-400`,children:D(`roundChip`,`Round {{n}}`,{n:e.round})})]})]})}function Un({r:e}){return(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsxs)(r,{to:ht(e),onClick:e=>e.stopPropagation(),className:`inline-flex items-center gap-1 text-sm hover:underline truncate max-w-full`,title:e.record_id,children:[(0,C.jsx)(`span`,{className:`truncate`,children:e.record_title||w(e.record_id)}),(0,C.jsx)(ue,{className:`h-3 w-3 shrink-0 text-muted-foreground`})]}),(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground truncate`,children:lt(e)})]})}function Wn({r:e}){if(!Q(e))return null;let t=Jt===e.id;return(0,C.jsxs)(`div`,{className:`flex items-center gap-1 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity`,onClick:e=>e.stopPropagation(),children:[(0,C.jsx)(d,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-emerald-700 hover:text-emerald-800 hover:bg-emerald-50 dark:text-emerald-400`,disabled:t,onClick:()=>void In(e),"aria-label":D(`approve`,`Approve`),children:(0,C.jsx)(Ee,{className:`h-4 w-4`})}),(0,C.jsx)(d,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-red-600 hover:text-red-700 hover:bg-red-50 dark:text-red-400`,disabled:t,onClick:()=>qt(e),"aria-label":D(`reject`,`Reject`),children:(0,C.jsx)(Ie,{className:`h-4 w-4`})})]})}return(0,C.jsxs)(`div`,{className:`flex flex-col gap-4 sm:gap-6 p-4 sm:p-6 max-w-6xl`,children:[(0,C.jsxs)(`header`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`h1`,{className:`text-2xl font-semibold flex items-center gap-2`,children:[(0,C.jsx)(qe,{className:`h-6 w-6`}),D(`title`,`Approvals Inbox`)]}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:D(`subtitle`,`Review and act on approval requests.`)})]}),(0,C.jsxs)(d,{variant:`outline`,size:`sm`,onClick:G,disabled:vt,className:`self-start sm:self-auto`,children:[(0,C.jsx)(se,{className:`h-4 w-4 mr-2 ${vt?`animate-spin`:``}`}),D(`refresh`,`Refresh`)]})]}),wt&&(0,C.jsxs)(We,{variant:`destructive`,children:[(0,C.jsx)(Oe,{className:`h-4 w-4`}),(0,C.jsx)(je,{children:wt})]}),(0,C.jsxs)(ze,{value:A,onValueChange:Vn,children:[(0,C.jsxs)(Ne,{children:[(0,C.jsxs)(De,{value:`pending`,children:[D(`tabMyPending`,`My Pending`),Et>0&&(0,C.jsx)(ne,{variant:`secondary`,className:`ml-2`,children:Et})]}),(0,C.jsx)(De,{value:`submitted`,children:D(`tabSubmitted`,`Submitted by me`)}),(0,C.jsx)(De,{value:`all`,children:D(`tabAll`,`All`)})]}),(0,C.jsxs)(Ge,{value:A,className:`mt-4 space-y-3`,children:[!vt&&(j.length>0||A!==`pending`&&(Lt||z!==`all`))&&(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsxs)(`div`,{className:`relative flex-1 min-w-[200px] max-w-sm`,children:[(0,C.jsx)(be,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,C.jsx)(Re,{value:R,onChange:e=>It(e.target.value),placeholder:D(`searchPlaceholder`,`Search record, process, requester…`),className:`pl-8 h-8 text-sm`}),R&&(0,C.jsx)(`button`,{type:`button`,onClick:()=>It(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,"aria-label":D(`clearSearch`,`Clear search`),children:(0,C.jsx)(xe,{className:`h-3.5 w-3.5`})})]}),A!==`pending`&&(0,C.jsxs)(ie,{value:z,onValueChange:Ut,children:[(0,C.jsx)(Se,{className:`h-8 w-auto min-w-[130px] text-sm`,children:(0,C.jsx)(we,{placeholder:D(`statusFilter`,`Status`)})}),(0,C.jsxs)(Ce,{children:[(0,C.jsx)(o,{value:`all`,children:D(`allStatuses`,`All statuses`)}),(0,C.jsx)(o,{value:`pending`,children:O(`pending`)}),(0,C.jsx)(o,{value:`approved`,children:O(`approved`)}),(0,C.jsx)(o,{value:`rejected`,children:O(`rejected`)}),(0,C.jsx)(o,{value:`recalled`,children:O(`recalled`)}),(0,C.jsx)(o,{value:`returned`,children:O(`returned`)})]})]}),kn.length>1&&(0,C.jsxs)(ie,{value:zt,onValueChange:Bt,children:[(0,C.jsx)(Se,{className:`h-8 w-auto min-w-[140px] text-sm`,children:(0,C.jsx)(we,{placeholder:D(`processFilter`,`Process`)})}),(0,C.jsxs)(Ce,{children:[(0,C.jsx)(o,{value:`all`,children:D(`allProcesses`,`All processes`)}),kn.map(e=>(0,C.jsx)(o,{value:e,children:e},e))]})]}),An.length>1&&(0,C.jsxs)(ie,{value:Vt,onValueChange:Ht,children:[(0,C.jsx)(Se,{className:`h-8 w-auto min-w-[140px] text-sm`,children:(0,C.jsx)(we,{placeholder:D(`objectFilter`,`Object`)})}),(0,C.jsxs)(Ce,{children:[(0,C.jsx)(o,{value:`all`,children:D(`allObjects`,`All objects`)}),An.map(e=>(0,C.jsx)(o,{value:e,children:e},e))]})]}),Bn&&(0,C.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:D(`filterCount`,`{{shown}} of {{total}}`,{shown:X.length,total:j.length})})]}),A===`pending`&&B.size>0&&(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 rounded-md border bg-accent/30 text-sm`,children:[(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`strong`,{children:B.size}),` `,D(`selected`,`selected`),$.length!==B.size&&(0,C.jsx)(`span`,{className:`text-muted-foreground ml-1`,children:D(`actionableCount`,`({{count}} actionable)`,{count:$.length})})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsxs)(h,{children:[(0,C.jsx)(Le,{asChild:!0,children:(0,C.jsxs)(d,{size:`sm`,disabled:Gt||$.length===0,children:[(0,C.jsx)(Ee,{className:`h-3.5 w-3.5 mr-1`}),D(`approveN`,`Approve {{count}}`,{count:$.length||``})]})}),(0,C.jsxs)(f,{children:[(0,C.jsxs)(u,{children:[(0,C.jsx)(g,{children:D(`bulkApproveTitle`,`Approve {{count}} requests?`,{count:$.length})}),(0,C.jsx)(v,{children:D(`bulkApproveBody`,`Each request is approved with your identity and its flow continues down the approve branch.`)})]}),(0,C.jsxs)(l,{children:[(0,C.jsx)(s,{children:D(`cancel`,`Cancel`)}),(0,C.jsx)(_,{onClick:()=>Fn(`approve`),children:D(`approveN`,`Approve {{count}}`,{count:$.length})})]})]})]}),(0,C.jsxs)(h,{children:[(0,C.jsx)(Le,{asChild:!0,children:(0,C.jsxs)(d,{size:`sm`,variant:`outline`,disabled:Gt||$.length===0,className:`border-destructive text-destructive hover:bg-destructive hover:text-destructive-foreground`,children:[(0,C.jsx)(Ie,{className:`h-3.5 w-3.5 mr-1`}),D(`rejectN`,`Reject {{count}}`,{count:$.length||``})]})}),(0,C.jsxs)(f,{children:[(0,C.jsxs)(u,{children:[(0,C.jsx)(g,{children:D(`bulkRejectTitle`,`Reject {{count}} requests?`,{count:$.length})}),(0,C.jsx)(v,{children:D(`bulkRejectBody`,`This rejects the selected requests and notifies their submitters.`)})]}),(0,C.jsxs)(l,{children:[(0,C.jsx)(s,{children:D(`cancel`,`Cancel`)}),(0,C.jsx)(_,{onClick:()=>Fn(`reject`),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:D(`rejectN`,`Reject {{count}}`,{count:$.length})})]})]})]}),(0,C.jsx)(d,{size:`sm`,variant:`ghost`,onClick:()=>Wt(new Set),disabled:Gt,children:D(`clear`,`Clear`)})]})]}),vt?(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(ge,{className:`h-10 w-full`}),(0,C.jsx)(ge,{className:`h-10 w-full`}),(0,C.jsx)(ge,{className:`h-10 w-full`})]}):j.length===0?(0,C.jsx)(`div`,{className:`flex items-center justify-center min-h-[240px] rounded-md border border-dashed`,children:(0,C.jsxs)(ve,{children:[(0,C.jsx)(le,{children:D(`emptyTitle`,`No requests`)}),(0,C.jsx)(Qe,{children:A===`pending`?D(`emptyPending`,`You're all caught up — nothing is waiting on you.`):D(`emptyOther`,`Nothing here yet.`)}),A===`pending`&&(0,C.jsx)(d,{variant:`link`,size:`sm`,className:`mt-1`,onClick:()=>Vn(`all`),children:D(`emptyViewAll`,`Browse all requests`)})]})}):X.length===0?(0,C.jsx)(`div`,{className:`flex items-center justify-center min-h-[160px] rounded-md border border-dashed text-sm text-muted-foreground`,children:D(`noMatches`,`No matches for current filters.`)}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(He,{className:`hidden md:block`,children:(0,C.jsx)(pe,{className:`p-0`,children:(0,C.jsxs)(Ve,{children:[(0,C.jsx)(Xe,{children:(0,C.jsxs)(ke,{children:[A===`pending`&&(0,C.jsx)(p,{className:`w-10`,children:(0,C.jsx)(me,{checked:Mn,onCheckedChange:Nn,"aria-label":D(`selectAll`,`Select all`),disabled:jn.length===0})}),(0,C.jsx)(p,{children:D(`colRequest`,`Request`)}),(0,C.jsx)(p,{children:D(`colRecord`,`Record`)}),(0,C.jsx)(p,{children:D(`colRequester`,`Requester`)}),(0,C.jsx)(p,{children:D(`colStatus`,`Status`)}),(0,C.jsx)(p,{children:D(`colWaiting`,`Submitted`)}),(0,C.jsx)(p,{className:`w-20`,"aria-label":D(`colActions`,`Actions`)})]})}),(0,C.jsx)(Je,{children:X.map((e,t)=>(0,C.jsxs)(ke,{className:m(`group cursor-pointer hover:bg-accent/50`,mn===t&&`ring-2 ring-inset ring-ring bg-accent/30`),onClick:()=>{hn(t),K(e.id)},children:[A===`pending`&&(0,C.jsx)(c,{className:`w-10`,onClick:e=>e.stopPropagation(),children:(0,C.jsx)(me,{checked:B.has(e.id),onCheckedChange:()=>Pn(e.id),disabled:e.status!==`pending`,"aria-label":D(`selectRow`,`Select request`)})}),(0,C.jsx)(c,{children:(0,C.jsx)(Hn,{r:e})}),(0,C.jsx)(c,{children:(0,C.jsx)(Un,{r:e})}),(0,C.jsx)(c,{children:(0,C.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,C.jsx)(Pe,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,C.jsx)(`span`,{className:`truncate`,title:e.submitter_id||``,children:st(e)})]})}),(0,C.jsx)(c,{children:(0,C.jsx)(pt,{status:e.status})}),(0,C.jsxs)(c,{className:m(`text-xs whitespace-nowrap`,ut(e)),title:it(E(e)),children:[(0,C.jsx)(Me,{className:`h-3 w-3 inline mr-1`}),ft(E(e)),e.status===`pending`&&e.sla_due_at&&(0,C.jsx)(`div`,{className:m(`mt-0.5 text-[10px] font-medium`,Date.parse(e.sla_due_at)<Date.now()?`text-red-600 dark:text-red-400`:`text-muted-foreground`),children:Date.parse(e.sla_due_at)<Date.now()?D(`slaOverdue`,`SLA overdue {{dur}}`,{dur:dt(Date.now()-Date.parse(e.sla_due_at))}):D(`slaRemaining`,`SLA {{dur}} left`,{dur:dt(Date.parse(e.sla_due_at)-Date.now())})})]}),(0,C.jsx)(c,{className:`w-20`,children:(0,C.jsx)(Wn,{r:e})})]},e.id))})]})})}),(0,C.jsx)(`div`,{className:`md:hidden space-y-2`,children:X.map(e=>(0,C.jsx)(He,{className:`cursor-pointer active:bg-accent/50`,onClick:()=>void K(e.id),children:(0,C.jsxs)(pe,{className:`p-3 space-y-1.5`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,C.jsx)(`div`,{className:`font-medium text-sm truncate`,children:at(e)}),(0,C.jsx)(pt,{status:e.status})]}),(0,C.jsxs)(`div`,{className:`text-sm truncate`,children:[e.record_title||w(e.record_id),(0,C.jsx)(`span`,{className:`text-muted-foreground text-xs ml-1.5`,children:lt(e)})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-1 truncate`,children:[(0,C.jsx)(Pe,{className:`h-3 w-3`}),st(e)]}),(0,C.jsxs)(`span`,{className:m(`inline-flex items-center gap-1 whitespace-nowrap`,ut(e)),children:[(0,C.jsx)(Me,{className:`h-3 w-3`}),ft(E(e))]})]}),Q(e)&&(0,C.jsxs)(`div`,{className:`flex gap-2 pt-1`,onClick:e=>e.stopPropagation(),children:[(0,C.jsxs)(d,{size:`sm`,className:`h-7 flex-1`,disabled:Jt===e.id,onClick:()=>void In(e),children:[(0,C.jsx)(Ee,{className:`h-3.5 w-3.5 mr-1`}),D(`approve`,`Approve`)]}),(0,C.jsxs)(d,{size:`sm`,variant:`outline`,className:`h-7 flex-1 border-destructive text-destructive`,disabled:Jt===e.id,onClick:()=>qt(e),children:[(0,C.jsx)(Ie,{className:`h-3.5 w-3.5 mr-1`}),D(`reject`,`Reject`)]})]})]})},e.id))}),A!==`pending`&&St!=null&&(0,C.jsxs)(`div`,{className:`flex items-center justify-center gap-3 py-1`,children:[(0,C.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:D(`loadedOf`,`Loaded {{loaded}} of {{total}}`,{loaded:j.length,total:St})}),j.length<St&&(0,C.jsx)(d,{size:`sm`,variant:`outline`,disabled:bt,onClick:()=>void gn(),children:bt?D(`loadingMore`,`Loading…`):D(`loadMore`,`Load more`)})]}),(0,C.jsx)(`div`,{className:`hidden md:block text-[11px] text-muted-foreground`,children:D(`keyboardHint`,`Keyboard: j/k move · Enter open · x select · a approve · r reject`)})]})]})]}),(0,C.jsx)(h,{open:Xt,onOpenChange:e=>{e||(Zt(!1),Qt(``))},children:(0,C.jsxs)(f,{children:[(0,C.jsxs)(u,{children:[(0,C.jsx)(g,{children:D(`reassignTitle`,`Hand this approval to someone else?`)}),(0,C.jsx)(v,{children:D(`reassignBody`,`Your approver slot moves to the person you pick — they are notified and can act immediately.`)})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(Be,{htmlFor:`reassign-to`,className:`text-xs`,children:D(`reassignTo`,`New approver`)}),(0,C.jsx)(Re,{id:`reassign-to`,list:`reassign-user-options`,value:H,onChange:e=>Qt(e.target.value),placeholder:D(`reassignToPlaceholder`,`Pick a user or type an email / role:<name>`),className:`mt-1`}),(0,C.jsx)(`datalist`,{id:`reassign-user-options`,children:fn.map(e=>(0,C.jsx)(`option`,{value:e.email,children:e.name},e.email))})]}),(0,C.jsxs)(l,{children:[(0,C.jsx)(s,{children:D(`cancel`,`Cancel`)}),(0,C.jsx)(_,{disabled:!H.trim()||U,onClick:()=>void yn(),children:D(`reassignBtn`,`Reassign`)})]})]})}),(0,C.jsx)(h,{open:$t,onOpenChange:e=>{e||(en(!1),nn(``))},children:(0,C.jsxs)(f,{children:[(0,C.jsxs)(u,{children:[(0,C.jsx)(g,{children:D(`requestInfoTitle`,`Ask the requester for more information?`)}),(0,C.jsx)(v,{children:D(`requestInfoBody`,`The request stays pending; the requester is notified and can reply on the thread.`)})]}),(0,C.jsx)(Ye,{value:tn,onChange:e=>nn(e.target.value),rows:3,placeholder:D(`requestInfoPlaceholder`,`What do you need from the requester?`)}),(0,C.jsxs)(l,{children:[(0,C.jsx)(s,{children:D(`cancel`,`Cancel`)}),(0,C.jsx)(_,{disabled:!tn.trim()||U,onClick:()=>void xn(),children:D(`requestInfoBtn`,`Request info`)})]})]})}),(0,C.jsx)(h,{open:rn,onOpenChange:e=>{e||(an(!1),sn(``))},children:(0,C.jsxs)(f,{children:[(0,C.jsxs)(u,{children:[(0,C.jsx)(g,{children:D(`sendBackTitle`,`Send this request back for revision?`)}),(0,C.jsx)(v,{children:D(`sendBackBody`,`This round ends and the record unlocks so the requester can fix the data. When they resubmit, a fresh approval round opens for all approvers.`)})]}),(0,C.jsx)(Ye,{value:on,onChange:e=>sn(e.target.value),rows:3,placeholder:D(`sendBackPlaceholder`,`What needs to be fixed before this can be approved?`)}),(0,C.jsxs)(l,{children:[(0,C.jsx)(s,{children:D(`cancel`,`Cancel`)}),(0,C.jsx)(_,{disabled:U,onClick:()=>void Sn(),children:D(`sendBackBtn`,`Send back`)})]})]})}),(0,C.jsx)(h,{open:!!V,onOpenChange:e=>!e&&qt(null),children:(0,C.jsxs)(f,{children:[(0,C.jsxs)(u,{children:[(0,C.jsx)(g,{children:D(`rejectOneTitle`,`Reject "{{title}}"?`,{title:V?V.record_title||w(V.record_id):``})}),(0,C.jsx)(v,{children:D(`rejectOneBody`,`This rejects the request and notifies the submitter.`)})]}),(0,C.jsxs)(l,{children:[(0,C.jsx)(s,{children:D(`cancel`,`Cancel`)}),(0,C.jsx)(_,{onClick:()=>void Ln(),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:D(`reject`,`Reject`)})]})]})}),(0,C.jsx)(_e,{open:!!M,onOpenChange:e=>!e&&_n(),children:(0,C.jsxs)(ce,{className:`w-full sm:max-w-xl overflow-y-auto`,children:[(0,C.jsxs)(he,{children:[(0,C.jsx)(ye,{children:N?at(N):D(`drawerTitle`,`Approval Request`)}),(0,C.jsx)(fe,{children:N?ot(N)||lt(N):``})]}),N&&Z>=0&&X.length>1&&(0,C.jsxs)(`div`,{className:`flex items-center justify-between mt-2 text-xs text-muted-foreground`,children:[(0,C.jsxs)(d,{variant:`ghost`,size:`sm`,className:`h-7 px-2`,disabled:Z<=0,onClick:()=>{let e=X[Z-1];e&&K(e.id)},children:[(0,C.jsx)(ae,{className:`h-4 w-4 mr-0.5`}),D(`prevRequest`,`Previous`)]}),(0,C.jsx)(`span`,{children:D(`positionOf`,`{{index}} of {{total}}`,{index:Z+1,total:X.length})}),(0,C.jsxs)(d,{variant:`ghost`,size:`sm`,className:`h-7 px-2`,disabled:Z>=X.length-1,onClick:()=>{let e=X[Z+1];e&&K(e.id)},children:[D(`nextRequest`,`Next`),(0,C.jsx)(oe,{className:`h-4 w-4 ml-0.5`})]})]}),Mt?(0,C.jsxs)(`div`,{className:`space-y-2 mt-6`,children:[(0,C.jsx)(ge,{className:`h-6 w-3/4`}),(0,C.jsx)(ge,{className:`h-6 w-1/2`}),(0,C.jsx)(ge,{className:`h-20 w-full`})]}):N?(0,C.jsxs)(`div`,{className:`space-y-4 mt-6`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,C.jsx)(pt,{status:N.status}),(N.round??1)>1&&(0,C.jsx)(ne,{variant:`outline`,className:`text-[10px] border-violet-200 text-violet-700 dark:border-violet-500/30 dark:text-violet-400`,children:D(`roundChip`,`Round {{n}}`,{n:N.round})}),(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:it(E(N)),children:[(0,C.jsx)(Me,{className:`h-3 w-3`}),D(`submittedAgo`,`Submitted {{when}}`,{when:ft(E(N))})]}),N.completed_at&&(0,C.jsxs)(`span`,{children:[`· `,D(`completedAt`,`Completed {{when}}`,{when:ft(N.completed_at)})]}),N.status===`pending`&&N.sla_due_at&&(0,C.jsx)(ne,{variant:`outline`,className:m(`text-[10px]`,Date.parse(N.sla_due_at)<Date.now()?`border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-400`:`border-border text-muted-foreground`),children:Date.parse(N.sla_due_at)<Date.now()?D(`slaOverdue`,`SLA overdue {{dur}}`,{dur:dt(Date.now()-Date.parse(N.sla_due_at))}):D(`slaRemaining`,`SLA {{dur}} left`,{dur:dt(Date.parse(N.sla_due_at)-Date.now())})})]}),(0,C.jsx)(He,{children:(0,C.jsxs)(pe,{className:`p-4 space-y-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsxs)(r,{to:ht(N),className:`text-base font-semibold hover:underline inline-flex items-center gap-1.5`,children:[(0,C.jsx)(`span`,{className:`truncate`,children:N.record_title||w(N.record_id)}),(0,C.jsx)(ue,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}),(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:lt(N)})]}),(0,C.jsx)(`div`,{className:`text-right text-xs text-muted-foreground shrink-0`,children:(0,C.jsxs)(`div`,{className:`inline-flex items-center gap-1`,children:[(0,C.jsx)(Pe,{className:`h-3 w-3`}),(0,C.jsx)(`span`,{title:N.submitter_id||``,children:st(N)})]})})]}),mt(N.payload,N.payload_display).length>0&&(0,C.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-2 text-sm border-t pt-3`,children:mt(N.payload,N.payload_display).map(([e,t])=>(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e}),(0,C.jsx)(`div`,{className:`truncate`,title:t,children:t})]},e))}),N.status===`pending`&&(N.pending_approvers||[]).length>0&&(0,C.jsxs)(`div`,{className:`border-t pt-3`,children:[(0,C.jsx)(`div`,{className:`text-[11px] text-muted-foreground mb-1`,children:D(`waitingOn`,`Waiting on`)}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:(N.pending_approvers||[]).map((e,t)=>(0,C.jsx)(ne,{variant:`outline`,className:`text-[11px]`,title:e,children:ct(e,N)},t))})]})]})}),(N.flow_steps?.length??0)>1&&(0,C.jsx)(`div`,{className:`flex items-center px-1`,"aria-label":D(`stepProgress`,`Approval steps`),children:N.flow_steps.map((e,t)=>(0,C.jsxs)(b.Fragment,{children:[t>0&&(0,C.jsx)(`div`,{className:m(`h-px flex-1 mx-2`,e.state===`done`||e.state===`current`?`bg-emerald-300 dark:bg-emerald-700`:`bg-border`)}),(0,C.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,C.jsx)(`span`,{className:m(`flex items-center justify-center h-5 w-5 rounded-full text-[10px] font-semibold`,e.state===`done`&&`bg-emerald-500 text-white`,e.state===`current`&&`bg-amber-500 text-white ring-2 ring-amber-200 dark:ring-amber-500/30`,e.state===`upcoming`&&`bg-muted text-muted-foreground border`),children:e.state===`done`?(0,C.jsx)(Fe,{className:`h-3 w-3`}):t+1}),(0,C.jsx)(`span`,{className:m(`text-xs`,e.state===`current`?`font-medium`:`text-muted-foreground`),children:e.label})]})]},e.id))}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h3`,{className:`text-sm font-semibold mb-3`,children:D(`history`,`Activity`)}),At.length===0?(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:D(`noActions`,`No actions yet.`)}):(0,C.jsx)(`ol`,{className:`relative space-y-3 pl-5 before:absolute before:left-[7px] before:top-1 before:bottom-1 before:w-px before:bg-border`,children:At.map(e=>{let t=e.action===`approve`?`bg-emerald-500`:e.action===`reject`?`bg-destructive`:e.action===`submit`?`bg-blue-500`:e.action===`reassign`?`bg-indigo-500`:e.action===`remind`||e.action===`request_info`?`bg-amber-500`:e.action===`comment`?`bg-slate-400`:e.action===`escalate`?`bg-red-500`:e.action===`revise`?`bg-violet-500`:e.action===`resubmit`?`bg-blue-500`:`bg-muted-foreground`,n=e.actor_id===`system:sla`?D(`systemSlaActor`,`System (SLA)`):e.actor_name??(e.actor_id&&e.actor_id===N.submitter_id?st(N):w(e.actor_id)),r=e.action===`submit`?D(`actSubmit`,`Submitted`):e.action===`approve`?D(`actApprove`,`Approved`):e.action===`reject`?D(`actReject`,`Rejected`):e.action===`recall`?D(`actRecall`,`Recalled`):e.action===`reassign`?D(`actReassign`,`Reassigned`):e.action===`remind`?D(`actRemind`,`Reminder sent`):e.action===`request_info`?D(`actRequestInfo`,`Requested more info`):e.action===`comment`?D(`actComment`,`Commented`):e.action===`escalate`?D(`actEscalate`,`SLA escalated`):e.action===`revise`?D(`actRevise`,`Sent back for revision`):e.action===`resubmit`?D(`actResubmit`,`Resubmitted`):e.action;return(0,C.jsxs)(`li`,{className:`relative text-xs`,children:[(0,C.jsx)(`span`,{className:`absolute -left-[18px] top-1 h-3 w-3 rounded-full ring-2 ring-background ${t}`,"aria-hidden":!0}),(0,C.jsxs)(`div`,{className:`flex items-baseline gap-1.5 flex-wrap`,children:[(0,C.jsx)(`span`,{className:`font-medium`,children:r}),(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,C.jsx)(`span`,{title:e.actor_id||``,children:n}),(0,C.jsx)(`span`,{className:`ml-auto text-muted-foreground text-[10px]`,title:it(e.created_at),children:ft(e.created_at)})]}),e.comment&&(0,C.jsxs)(`div`,{className:`text-muted-foreground italic mt-0.5`,children:[`"`,e.comment,`"`]})]},e.id)})}),N.status===`pending`&&(En||Dn)&&(0,C.jsxs)(`div`,{className:`flex items-center gap-2 mt-3`,children:[(0,C.jsx)(Re,{value:un,onChange:e=>dn(e.target.value),onKeyDown:e=>{e.key===`Enter`&&un.trim()&&(e.preventDefault(),wn())},placeholder:D(`replyPlaceholder`,`Reply on this request…`),className:`h-8 text-sm`}),(0,C.jsx)(d,{size:`sm`,variant:`outline`,className:`h-8 px-2 shrink-0`,disabled:!un.trim()||U,onClick:()=>void wn(),children:(0,C.jsx)(Ze,{className:`h-3.5 w-3.5`})})]})]}),N.payload!=null&&(0,C.jsxs)(`details`,{className:`group`,children:[(0,C.jsx)(`summary`,{className:`cursor-pointer text-xs text-muted-foreground hover:text-foreground select-none`,children:D(`rawData`,`Raw data (JSON)`)}),(0,C.jsxs)(`div`,{className:`mt-2`,children:[(0,C.jsx)(`div`,{className:`flex justify-end`,children:(0,C.jsxs)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(JSON.stringify(N.payload,null,2)),y.success(D(`copied`,`Copied`))}catch{y.error(D(`copyFailed`,`Copy failed`))}},className:`text-[10px] text-muted-foreground hover:text-foreground inline-flex items-center gap-1`,children:[(0,C.jsx)(Te,{className:`h-3 w-3`}),D(`copy`,`Copy`)]})}),(0,C.jsx)(`pre`,{className:`text-[11px] bg-muted/50 rounded p-2 overflow-auto max-h-48 mt-1`,children:JSON.stringify(N.payload,null,2)})]})]}),N.status===`pending`&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)($e,{}),(0,C.jsxs)(`div`,{className:`space-y-3`,children:[et&&(0,C.jsxs)(`details`,{className:`group`,children:[(0,C.jsx)(`summary`,{className:`cursor-pointer text-xs text-muted-foreground hover:text-foreground select-none`,children:D(`overrideActor`,`Act as another identity (admin)`)}),(0,C.jsxs)(`div`,{className:`mt-2`,children:[(0,C.jsx)(Be,{htmlFor:`actor-override`,className:`text-xs`,children:D(`actor`,`Actor`)}),(0,C.jsx)(`input`,{id:`actor-override`,type:`text`,value:I,onChange:e=>Pt(e.target.value),placeholder:`${D(`auto`,`Auto`)}: ${q(N)||`—`}`,className:`w-full mt-1 px-3 py-2 text-sm border rounded-md bg-background`}),(0,C.jsx)(`div`,{className:`text-[10px] text-muted-foreground mt-1`,children:D(`overrideHint`,`e.g. role:sales_manager. Leave blank to use the auto-detected identity.`)})]})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(Be,{htmlFor:`comment`,className:`text-xs`,children:D(`comment`,`Comment (optional)`)}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-1.5`,children:[D(`quickPhrase1`,`Approved — meets requirements.`),D(`quickPhrase2`,`Approved with conditions — please monitor execution.`),D(`quickPhrase3`,`Please add supporting material and resubmit.`)].map(e=>(0,C.jsx)(`button`,{type:`button`,onClick:()=>F(e),className:`text-[11px] px-2 py-0.5 rounded-full border text-muted-foreground hover:text-foreground hover:bg-accent transition-colors`,children:e},e))}),(0,C.jsx)(Ye,{id:`comment`,value:P,onChange:e=>F(e.target.value),rows:2,className:`mt-1`})]}),(0,C.jsxs)(`div`,{className:`flex gap-2 flex-wrap`,children:[(0,C.jsxs)(d,{size:`sm`,onClick:()=>vn(`approve`),disabled:!En||L!==null,children:[(0,C.jsx)(Ee,{className:`h-4 w-4 mr-1`}),L===`approve`?D(`approving`,`Approving…`):D(`approve`,`Approve`)]}),(0,C.jsxs)(h,{children:[(0,C.jsx)(Le,{asChild:!0,children:(0,C.jsxs)(d,{size:`sm`,variant:`outline`,disabled:!En||L!==null,className:`border-destructive text-destructive hover:bg-destructive hover:text-destructive-foreground`,children:[(0,C.jsx)(Ie,{className:`h-4 w-4 mr-1`}),L===`reject`?D(`rejecting`,`Rejecting…`):D(`reject`,`Reject`)]})}),(0,C.jsxs)(f,{children:[(0,C.jsxs)(u,{children:[(0,C.jsx)(g,{children:D(`rejectTitle`,`Reject this request?`)}),(0,C.jsx)(v,{children:D(`rejectBody`,`This marks the request as rejected and notifies the submitter.`)})]}),(0,C.jsxs)(l,{children:[(0,C.jsx)(s,{children:D(`cancel`,`Cancel`)}),(0,C.jsx)(_,{onClick:()=>vn(`reject`),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:D(`reject`,`Reject`)})]})]})]}),En&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(d,{size:`sm`,variant:`outline`,disabled:L!==null||U,className:`border-violet-300 text-violet-700 hover:bg-violet-50 dark:text-violet-400`,onClick:()=>an(!0),children:[(0,C.jsx)(Ue,{className:`h-4 w-4 mr-1`}),D(`sendBackBtn`,`Send back`)]}),(0,C.jsxs)(d,{size:`sm`,variant:`outline`,disabled:L!==null||U,className:`border-amber-300 text-amber-700 hover:bg-amber-50 dark:text-amber-400`,onClick:()=>en(!0),children:[(0,C.jsx)(Ae,{className:`h-4 w-4 mr-1`}),D(`requestInfoBtn`,`Request info`)]}),(0,C.jsxs)(d,{size:`sm`,variant:`outline`,disabled:L!==null||U,onClick:()=>{Tn(),Zt(!0)},children:[(0,C.jsx)(Ke,{className:`h-4 w-4 mr-1`}),D(`reassignBtn`,`Reassign`)]})]}),Dn&&(0,C.jsxs)(d,{size:`sm`,variant:`outline`,disabled:U,onClick:()=>void bn(),children:[(0,C.jsx)(re,{className:`h-4 w-4 mr-1`}),D(`remindBtn`,`Send reminder`)]}),Dn&&(0,C.jsxs)(h,{children:[(0,C.jsx)(Le,{asChild:!0,children:(0,C.jsxs)(d,{size:`sm`,variant:`outline`,disabled:L!==null,children:[(0,C.jsx)(de,{className:`h-4 w-4 mr-1`}),L===`recall`?D(`recalling`,`Recalling…`):D(`recall`,`Recall`)]})}),(0,C.jsxs)(f,{children:[(0,C.jsxs)(u,{children:[(0,C.jsx)(g,{children:D(`recallTitle`,`Recall this request?`)}),(0,C.jsx)(v,{children:D(`recallBody`,`This withdraws your request. Approvers can no longer act on it, and the record is unlocked.`)})]}),(0,C.jsxs)(l,{children:[(0,C.jsx)(s,{children:D(`cancel`,`Cancel`)}),(0,C.jsx)(_,{onClick:()=>vn(`recall`),children:D(`recall`,`Recall`)})]})]})]})]}),!En&&(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:Dn?D(`whyDisabledSubmitter`,`You submitted this request, so you can recall it — but only the assigned approvers can approve or reject.`):D(`whyDisabled`,`Only the assigned approvers can act on this request. It is waiting on: {{who}}.`,{who:(N.pending_approvers||[]).map(e=>ct(e,N)).join(`, `)||`—`})})]})]}),On&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)($e,{}),(0,C.jsxs)(`div`,{className:`space-y-3`,children:[(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:D(`returnedHint`,`An approver sent this back to you. The record is unlocked — fix the data, then resubmit to start a new approval round.`)}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(Be,{htmlFor:`resubmit-comment`,className:`text-xs`,children:D(`comment`,`Comment (optional)`)}),(0,C.jsx)(Ye,{id:`resubmit-comment`,value:P,onChange:e=>F(e.target.value),rows:2,className:`mt-1`,placeholder:D(`resubmitPlaceholder`,`What did you change?`)})]}),(0,C.jsxs)(`div`,{className:`flex gap-2 flex-wrap`,children:[(0,C.jsx)(d,{asChild:!0,size:`sm`,variant:`outline`,children:(0,C.jsxs)(r,{to:ht(N),children:[(0,C.jsx)(ue,{className:`h-4 w-4 mr-1`}),D(`editRecordBtn`,`Edit record`)]})}),(0,C.jsxs)(d,{size:`sm`,disabled:cn,onClick:()=>void Cn(),children:[(0,C.jsx)(se,{className:m(`h-4 w-4 mr-1`,cn&&`animate-spin`)}),cn?D(`resubmitting`,`Resubmitting…`):D(`resubmitBtn`,`Resubmit`)]}),(0,C.jsxs)(h,{children:[(0,C.jsx)(Le,{asChild:!0,children:(0,C.jsxs)(d,{size:`sm`,variant:`outline`,disabled:cn,children:[(0,C.jsx)(de,{className:`h-4 w-4 mr-1`}),D(`recall`,`Recall`)]})}),(0,C.jsxs)(f,{children:[(0,C.jsxs)(u,{children:[(0,C.jsx)(g,{children:D(`abandonTitle`,`Abandon this revision?`)}),(0,C.jsx)(v,{children:D(`abandonBody`,`This withdraws the request instead of resubmitting it. The approval ends here.`)})]}),(0,C.jsxs)(l,{children:[(0,C.jsx)(s,{children:D(`cancel`,`Cancel`)}),(0,C.jsx)(_,{onClick:()=>vn(`recall`),children:D(`recall`,`Recall`)})]})]})]})]})]})]})]}):null]})})]})}export{ht as ApprovalsInboxPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-CMxvf4Kt.js";import{_ as t,l as n,t as r,u as i}from"./vendor-react-DR370ovB.js";import{r as a}from"./framework-DCMHw4uc.js";import{Bt as o,Ht as s,Ut as c,Vt as l,Wt as u,ai as d,hr as f,vi as p,w as m}from"./ui-components-D1FYlKrM.js";import{r as h}from"./vendor-ui-utils-rQOI1gAo.js";import{i as g,s as _,t as v}from"./assistantBus-3d9MxsCF.js";import{a as y,i as b,n as ee,o as te,t as ne}from"./useReconcileOnError-Cxzq30_3.js";import{a as re,d as x,f as ie,h as ae,r as S,t as C,u as w}from"./plugin-chatbot-76fXVh9-.js";import{b as T,n as oe}from"./marketplaceApi-CucX7DD9.js";var E=e(t(),1),D=r(),O={data_chat:{zh:`智能助手`,en:`Assistant`},metadata_assistant:{zh:`元数据开发助手`,en:`Metadata Assistant`}};function k(e,t,n){let r=t?O[t]:void 0;return r?e?r.zh:r.en:n}function A(e,t,n,r,i){let a=(e??``).toLowerCase().startsWith(`zh`),o=k(a,n,r),s=i.slice(0,2).map(e=>e.label||e.name);if(a){let e=[s[0]?`查询最近创建的${s[0]}`:`帮我查询最近的数据`,s[0]?`统计${s[0]}的总数量`:`统计各对象的记录数量`,s[1]?`${s[1]}有哪些字段?`:`当前应用里有哪些数据对象?`].filter(Boolean);return{agentLabel:o,labels:{emptyTitle:`你好,我是${o}`,emptyDescription:`随时帮你查询和分析「${t}」中的数据。试试下面的问题,或直接输入你的需求。`,clear:`清空对话`,sendHint:`发送`,agentActivity:`执行过程`,toolCompleted:`已完成`,toolRunning:`运行中`,toolAwaitingApproval:`等待确认`,toolFailed:`失败`,toolDetailsHidden:`已隐藏工具参数和原始结果,仅保留过程摘要。`,copy:`复制`,copied:`已复制`,regenerate:`重新生成`,model:`模型`,submit:`发送`,uploadFiles:`上传文件`,stopResponse:`停止生成`,trace:`调试 trace`,viewTrace:`查看调试 trace`},placeholder:`向${o}提问…`,loadingPlaceholder:`正在加载助手…`,title:`${t} 智能助手`,newChat:`开启新对话`,share:`分享对话`,reviewDraft:e=>`查看 ${e} 项变更`,publishDrafts:`发布`,published:`已发布`,publishOk:`已发布,对象已生效。`,publishFailed:`发布失败`,seedWarn:`已发布,但部分示例数据未能载入。`,openBuiltApp:`打开应用`,suggestions:e}}let c=[s[0]?`Show the latest ${s[0]}`:`Show my most recent records`,s[0]?`How many ${s[0]} are there?`:`Count records by status`,s[1]?`What fields does ${s[1]} have?`:`What data can I work with here?`].filter(Boolean);return{agentLabel:o,labels:{emptyTitle:`Hi, I'm ${o}`,emptyDescription:`I can help you query and analyze your ${t} data. Try a prompt below, or just type your question.`,clear:`Clear`,sendHint:`to send`,agentActivity:`Agent activity`,toolCompleted:`Completed`,toolRunning:`Running`,toolAwaitingApproval:`Awaiting approval`,toolFailed:`Failed`,toolDetailsHidden:`Tool inputs and raw results are hidden in this view.`,copy:`Copy`,copied:`Copied`,regenerate:`Regenerate`,model:`Model`,submit:`Submit`,uploadFiles:`Upload files`,stopResponse:`Stop response`,trace:`trace`,viewTrace:`View trace`},placeholder:`Ask ${o}...`,loadingPlaceholder:`Loading assistant...`,title:`${t} Assistant`,newChat:`New chat`,share:`Share conversation`,reviewDraft:e=>`Review ${e} change${e===1?``:`s`}`,publishDrafts:`Publish`,published:`Published`,publishOk:`Published — objects are now live.`,publishFailed:`Publish failed`,seedWarn:`Published, but some sample data failed to load.`,openBuiltApp:`Open app`,suggestions:c}}var j=`/api/v1/ai`;function M(e){if(e)return e.replace(/\/$/,``);let t={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_SENTRY_DSN:`https://1373a588ceb9da150b11e64bf85f583d@o4510356161757184.ingest.us.sentry.io/4511439670673408`,VITE_SENTRY_ENVIRONMENT:`production`,VITE_SENTRY_SEND_DEFAULT_PII:`true`,VITE_SERVER_URL:``,VITE_USE_MOCK_SERVER:`false`},n=t.VITE_AI_BASE_URL;return n?n.replace(/\/$/,``):`${(t.VITE_SERVER_URL??``).replace(/\/$/,``)}${j}`}function se(e,t){if(!e||e.type!==`object`)return null;let n=e.label||e.name||`this object`;return(t??``).toLowerCase().startsWith(`zh`)?[`为「${n}」补充字段`,`为「${n}」建议校验规则`,`添加一个状态选项字段`]:[`Add fields to ${n}`,`Suggest validations for ${n}`,`Add a status picklist field`]}var N=new Set([`view`,`record`,`page`,`dashboard`,`design`,`report`,`metadata`]);function P(e){try{return decodeURIComponent(e)}catch{return e}}function ce(e,t){let n=e.split(`/`).filter(Boolean),r=n.indexOf(`apps`);if(r===-1||n.length<r+3)return{};let i=P(n[r+2]);if(N.has(i)||!t.some(e=>e.name===i))return{};let a=n[r+3]?P(n[r+3]):void 0,o=a&&a!==`new`?a:void 0;return{objectName:i,...o?{recordId:o}:{}}}function F({appLabel:e,appName:t,objects:r,agents:y,agentsLoading:x,activeAgent:w,onAgentChange:O,showAgentPicker:k,chatApi:j,apiBase:M,defaultOpen:N=!1,conversationId:P,initialMessages:F}){let{language:I}=a(),L=i(),R=n(),z=E.useMemo(()=>ce(R.pathname,r),[R.pathname,r]),{editor:B}=_(),V=E.useMemo(()=>!F||F.length===0?[]:ae(F),[F]),H=E.useMemo(()=>y.find(e=>e.name===w)?.label??w??e,[y,w,e]),U=E.useMemo(()=>A(I,e,w,H,r),[I,e,w,H,r]),W=E.useMemo(()=>se(B,I),[B,I]),{errorSuppressed:le,handleChatError:ue,setMessagesRef:de,resetSuppression:G}=ne({chatApi:j,conversationId:P}),{messages:K,isLoading:q,error:fe,sendMessage:J,stop:pe,reload:me,clear:Y,setMessages:X}=ie({api:j,conversationId:P,onError:ue,body:{context:{activeApp:e,appName:t,objects:r.map(e=>({name:e.name,label:e.label})),agentName:w,autoPublishAiBuilds:T().features.autoPublishAiBuilds,...z.objectName?{objectName:z.objectName}:{},...z.recordId?{recordId:z.recordId}:{},...B?{editing:B}:{}}},initialMessages:V,autoResponse:!j,autoResponseText:r.length>0?`I can help you work with ${r.map(e=>e.label||e.name).join(`, `)}. What would you like to do?`:`Thanks for your message! I'm here to help you navigate and manage your data.`,autoResponseDelay:600});E.useEffect(()=>{de.current=X},[X]),E.useEffect(()=>{te(P,b(K))},[P,K]);let Z=C({messages:K,apiBase:M,continueConversation:e=>{G(),J(e)}}),Q=k&&y.length>1?(0,D.jsxs)(o,{value:w,onValueChange:O,disabled:x,children:[(0,D.jsx)(c,{className:`h-7 w-[180px] text-xs`,"data-testid":`floating-chatbot-agent-picker`,children:(0,D.jsx)(u,{placeholder:`Choose agent...`})}),(0,D.jsx)(l,{align:`end`,children:y.map(e=>(0,D.jsxs)(s,{value:e.name,className:`text-xs`,children:[(0,D.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description?(0,D.jsx)(`span`,{className:`block text-muted-foreground text-[10px] truncate max-w-[220px]`,children:e.description}):null]},e.name))})]}):null,[he,$]=E.useState(!1),ge=E.useMemo(()=>M.replace(/\/v1\/ai$/,``).replace(/\/ai$/,``)||`/api`,[M]),_e=(0,D.jsxs)(D.Fragment,{children:[K.length>0?(0,D.jsx)(f,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,"aria-label":U.newChat,title:U.newChat,"data-testid":`floating-chatbot-new`,onClick:Y,children:(0,D.jsx)(d,{className:`h-4 w-4`})}):null,P?(0,D.jsx)(f,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,"aria-label":U.share,title:U.share,"data-testid":`floating-chatbot-share`,onClick:()=>$(!0),children:(0,D.jsx)(p,{className:`h-4 w-4`})}):null]});return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(S,{onUpgrade:()=>window.open(oe(),`_blank`,`noopener,noreferrer`),floatingConfig:{position:`bottom-right`,defaultOpen:N,panelWidth:420,panelHeight:560,title:U.title,triggerSize:56},headerExtra:Q,headerActions:_e,messages:K,labels:U.labels,showAvatars:!0,hideClearBar:!0,assistantAvatarFallback:U.agentLabel,suggestions:K.length===0?W??U.suggestions:void 0,placeholder:w?U.placeholder:x?U.loadingPlaceholder:U.placeholder,onSendMessage:e=>{G(),J(e)},onClear:Y,onStop:q?pe:void 0,onReload:me,isLoading:q,error:le?void 0:fe,enableMarkdown:!0,onToolApprove:Z.decide,toolDecisions:Z.decisions,toolApproveLabel:`Approve & run`,toolDenyLabel:`Reject`,toolDenyReason:`Operator rejected from chat`,onReviewDraft:e=>{e[0]&&g(e[0])},toolReviewLabel:U.reviewDraft,onOpenBuiltApp:e=>L(`/apps/${encodeURIComponent(e)}`),openBuiltAppLabel:U.openBuiltApp,onPreviewDraftApp:(e,t)=>L(t?.materialized?`/apps/${encodeURIComponent(e)}`:`/apps/${encodeURIComponent(e)}?preview=draft`),onDraftArtifacts:e=>{for(let t of e)v(t)},fetchPendingDraftCount:ee,onPublishDrafts:async e=>{try{let t=await fetch(`/api/v1/packages/${encodeURIComponent(e)}/publish-drafts`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:`{}`}),n=await t.json().catch(()=>null);if(!t.ok||n?.success===!1)throw Error(n?.error?.message||`HTTP ${t.status}`);let r=n?.data?.failedCount??n?.failedCount??0;if(r)throw Error(String(r));let i=n?.data?.seedApplied??n?.seedApplied;i&&i.success===!1?h.warning(U.seedWarn,{description:i.error??(Array.isArray(i.errors)&&i.errors.length?String(i.errors[0]):void 0)}):h.success(U.publishOk);let a=(n?.data?.published??n?.published??[]).find(e=>e?.type===`app`&&e?.name);return a?.name&&L(`/apps/${encodeURIComponent(a.name)}`),{ok:!0,health:re(n)}}catch(e){return h.error(U.publishFailed,{description:e instanceof Error?e.message:void 0}),!1}},publishDraftsLabel:U.publishDrafts,publishedLabel:U.published,autoPublishDrafts:T().features.autoPublishAiBuilds}),P&&(0,D.jsx)(m,{open:he,onOpenChange:$,objectName:`ai_conversations`,recordId:P,recordLabel:`this conversation`,apiBase:ge})]})}function I({appLabel:e,appName:t,objects:n,apiBase:r,defaultAgent:i,showAgentPicker:a,defaultOpen:o=!1,userId:s}){let c=E.useMemo(()=>M(r),[r]),l={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_SENTRY_DSN:`https://1373a588ceb9da150b11e64bf85f583d@o4510356161757184.ingest.us.sentry.io/4511439670673408`,VITE_SENTRY_ENVIRONMENT:`production`,VITE_SENTRY_SEND_DEFAULT_PII:`true`,VITE_SERVER_URL:``,VITE_USE_MOCK_SERVER:`false`},u=l.VITE_AI_DEFAULT_AGENT,d=a??l.VITE_AI_SHOW_AGENT_PICKER===`true`,{agents:f,isLoading:p,error:m}=x({apiBase:c}),[h,g]=E.useState(void 0);E.useEffect(()=>{if(!h&&f.length>0){let e=w(f,i??u);e&&g(e)}},[f,h,i,u]);let _=h?`${c}/agents/${encodeURIComponent(h)}/chat`:void 0,{conversationId:v,initialMessages:b}=y({userId:s,scope:h,apiBase:c});return(0,D.jsx)(F,{appLabel:e,appName:t,objects:n,agents:f,agentsLoading:p,agentsError:m,activeAgent:h,onAgentChange:g,showAgentPicker:d,chatApi:_,apiBase:c,defaultOpen:o,conversationId:v,initialMessages:b},`${_??`local`}:${v??`pending`}`)}export{I as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e,r as t}from"./rolldown-runtime-CMxvf4Kt.js";import{_ as n,f as r,t as i}from"./vendor-react-DR370ovB.js";import{f as a}from"./infrastructure-CJNwTVno.js";import{T as o,r as s,w as c}from"./framework-DCMHw4uc.js";import{Bn as l,H as u,Ha as d,Hn as f,Is as p,Ln as m,Ls as h,Ms as g,Qr as _,R as v,Rn as y,Sr as b,Ui as x,Vn as S,Vr as C,Xi as w,_c as T,cc as E,hr as D,z as O,za as k,zn as ee,zr as A}from"./ui-components-D1FYlKrM.js";import{r as j}from"./vendor-ui-utils-rQOI1gAo.js";import"./AdapterProvider-DQfb2hDB.js";import{n as te}from"./plugin-form-DjP7n76r.js";import"./MetadataProvider-xgIDLxXw.js";import{r as ne}from"./ExpressionProvider-B9tL1RMW.js";import{C as re,r as M}from"./mergeServerFields-DLHgCyyI.js";import{n as N}from"./utils-29quoGQV.js";import{n as ie,r as ae,t as oe}from"./MetadataInspector-BcJZckHC.js";import{r as se,t as P}from"./RuntimeDraftBar-CpfEHMPU.js";import{n as ce}from"./skeletons-Y2db5nbR.js";import{n as le}from"./plugin-dashboard-lpyBUnU3.js";import{n as F,t as I}from"./DashboardWidgetInspector-BhjBPVJV.js";var L=e(n(),1),R=i();function ue({open:e,onClose:t,schema:n,selectedWidgetId:r,onSelectWidget:i,onSave:a,onChange:o,onRemoveWidget:c,name:l,metadataClient:u,onAfterChange:d}){let{t:f}=s(),p=(0,L.useMemo)(()=>M(),[]),[m,h]=(0,L.useState)(!1),[g,_]=(0,L.useState)(0),v=(0,L.useCallback)(e=>{h(!0),o({...n??{},...e})},[n,o]),y=(0,L.useCallback)(e=>{o(e),h(!1)},[o]),x=(0,L.useCallback)(e=>{i(e&&e.kind===`widget`?e.id:null)},[i]),S=Array.isArray(n?.widgets)?n.widgets:[],w=r?S.find(e=>e?.id===r):null;if(!e)return null;let T=typeof n?.name==`string`?n.name:``,O=w?f(`widget.editor.title`,{defaultValue:`Edit widget`}):f(`dashboard.editor.title`,{defaultValue:`Edit dashboard`});return(0,R.jsxs)(`aside`,{className:`hidden sm:flex w-[440px] shrink-0 flex-col border-l bg-background h-full`,"data-testid":`dashboard-config-panel`,role:`complementary`,"aria-label":O,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-4 py-2.5 shrink-0`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[w&&(0,R.jsx)(D,{variant:`ghost`,size:`sm`,onClick:()=>i(null),className:`h-7 w-7 p-0`,"aria-label":f(`dashboard.editor.backToDashboard`,{defaultValue:`Back to dashboard`}),title:f(`dashboard.editor.backToDashboard`,{defaultValue:`Back to dashboard`}),"data-testid":`dashboard-config-back`,children:(0,R.jsx)(E,{className:`h-4 w-4`})}),(0,R.jsx)(`div`,{className:`text-sm font-medium truncate`,children:O})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[w&&c&&(0,R.jsx)(D,{variant:`ghost`,size:`sm`,onClick:()=>c(r),className:`h-7 w-7 p-0 text-destructive hover:text-destructive`,"aria-label":f(`widget.editor.delete`,{defaultValue:`Delete widget`}),title:f(`widget.editor.delete`,{defaultValue:`Delete widget`}),"data-testid":`widget-delete-button`,children:(0,R.jsx)(C,{className:`h-3.5 w-3.5`})}),(0,R.jsx)(D,{variant:`ghost`,size:`sm`,onClick:t,className:`h-7 w-7 p-0`,"aria-label":f(`common.close`,{defaultValue:`Close`}),"data-testid":`dashboard-config-close`,children:(0,R.jsx)(b,{className:`h-4 w-4`})})]})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:w?(0,R.jsx)(I,{type:`dashboard`,name:T,draft:n??{},selection:{kind:`widget`,id:r},onPatch:v,onClearSelection:()=>i(null),onSelectionChange:x,readOnly:!1,locale:p}):(0,R.jsx)(F,{type:`dashboard`,name:T,draft:n??{},onPatch:v,onSelectionChange:x,readOnly:!1,locale:p})}),(0,R.jsxs)(`div`,{"data-testid":`dashboard-config-footer`,className:`flex items-center justify-end gap-2 border-t px-4 py-2.5 shrink-0`,children:[(0,R.jsx)(P,{type:`dashboard`,name:l||T||void 0,metadataClient:u,dirty:m,onResume:y,savedSignal:g,onAfterChange:d}),(0,R.jsx)(D,{size:`sm`,onClick:()=>{a(n??{}),h(!1),_(e=>e+1)},"data-testid":`dashboard-config-save`,children:f(`common.save`,{defaultValue:`Save`})})]})]})}var z=t({DashboardView:()=>U}),B=[{type:`metric`,label:`KPI Metric`,Icon:A},{type:`bar`,label:`Bar Chart`,Icon:h},{type:`line`,label:`Line Chart`,Icon:p},{type:`pie`,label:`Pie Chart`,Icon:g},{type:`table`,label:`Table`,Icon:_},{type:`pivot`,label:`Pivot`,Icon:k}],V=0;function H(){return V+=1,`widget_${Date.now()}_${V}`}function de(e){return!e.widgets?.length||!e.widgets.some(e=>!e.id)?e:{...e,widgets:e.widgets.map(e=>e.id?e:{...e,id:H()})}}function fe(e){let t=B.find(t=>t.type===e);return t?`New ${t.label}`:`New Widget`}function U({dataSource:e}){let{dashboardName:t}=r(),{showDebug:n}=ie(),i=c(),p=re(),{t:h}=s(),{dashboardLabel:g,dashboardDescription:_}=T(),{user:b}=a(),C=b?.role===`admin`,[E,k]=(0,L.useState)(!0),[A,M]=(0,L.useState)(!1),[P,F]=(0,L.useState)(null),[I,z]=(0,L.useState)(null),V=(0,L.useCallback)(e=>{z(t=>(t&&t.resolve(e),null))},[]),U=(0,L.useCallback)(e=>new Promise(t=>{let n;if(typeof e==`string`){let t=e.match(/^(create|new|add|edit|update)_(.+)$/);if(t){let e=t[1];n={objectName:t[2],mode:e===`edit`||e===`update`?`edit`:`create`}}else n={objectName:e,mode:`create`}}else n=e;z({schema:n,resolve:t})}),[]),pe=(0,L.useMemo)(()=>({export_dashboard_pdf:async()=>{j.info(h(`dashboardActions.pdfPreparing`));try{return window.print(),{success:!0}}catch(e){return j.error(h(`dashboardActions.exportFailed`,{message:e?.message||String(e)})),{success:!1,error:e?.message||String(e)}}},forecast_dashboard:async()=>(j.info(h(`dashboardActions.forecastSoon`)),{success:!0})}),[h]);(0,L.useEffect)(()=>{k(!0),J(null),M(!1),F(null),queueMicrotask(()=>k(!1))},[t]);let{dashboards:me,objects:W,refresh:G}=o(),{app:he}=ne(),K=ae(me,t,he?._packageId),[q,J]=(0,L.useState)(null);(0,L.useEffect)(()=>{A||J(null)},[K]);let Y=(0,L.useCallback)(async e=>{try{p&&await se(`dashboard`,t,e,{metadataClient:p}),G().catch(()=>{})}catch(e){let t=e instanceof Error?e.message:String(e);console.warn(`[DashboardView] Auto-save failed:`,e),j.error(`Failed to save dashboard: ${t}`)}},[p,t,G]),ge=(0,L.useCallback)(()=>{J(de(K)),M(!0)},[K]),_e=(0,L.useCallback)(()=>{M(!1),F(null)},[]),ve=(0,L.useCallback)(e=>{if(!q)return;let t=H(),n={id:t,title:fe(e),type:e,layout:{x:0,y:q.widgets?.length??0,w:q.columns??2,h:1}},r={...q,widgets:[...q.widgets||[],n]};J(r),Y(r),F(t)},[q,Y]),ye=(0,L.useCallback)(e=>{if(!q)return;let t={...q,widgets:q.widgets.filter(t=>t.id!==e)};J(t),Y(t),P===e&&F(null)},[q,P,Y]),X=(0,L.useCallback)(e=>{let t=q||K;if(!t)return;let n={...t,widgets:e};J(n),Y(n)},[q,K,Y]),be=(q||K)??null,Z=(0,L.useMemo)(()=>new Set((W||[]).map(e=>e?.name).filter(Boolean)),[W]),Q=q||K,$=(0,L.useMemo)(()=>{if(!Q||Z.size===0)return Q;let e=Q.widgets;if(!Array.isArray(e)||e.length===0)return Q;let t=e.filter(e=>{let t=e?.requiresObject??e?.object;return t?Z.has(t):!0});return t.length===e.length?Q:{...Q,widgets:t}},[Q,Z]);return E?(0,R.jsx)(ce,{}):K?(0,R.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-background`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col sm:flex-row justify-between sm:items-center gap-3 sm:gap-4 p-4 sm:p-6 border-b shrink-0`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(()=>{let e=N(($||K).title,h),t=N(K.label,h),n=g({name:K.name,label:t});return(0,R.jsx)(`h1`,{className:`text-lg sm:text-xl md:text-2xl font-bold tracking-tight truncate`,children:e||n||K.name})})(),(()=>{let e=($||K).description??K.description,t=_({name:K.name,description:N(e,h)});return t?(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:t}):null})()]}),(0,R.jsxs)(`div`,{className:`shrink-0 flex items-center gap-1.5`,children:[A&&(0,R.jsx)(`div`,{className:`flex items-center gap-1 mr-2`,role:`toolbar`,"aria-label":`Add widgets`,"data-testid":`dashboard-widget-toolbar`,children:B.map(({type:e,label:t,Icon:n})=>(0,R.jsxs)(`button`,{type:`button`,"data-testid":`dashboard-add-${e}`,onClick:()=>ve(e),className:`inline-flex items-center gap-1 rounded-md border border-input bg-background px-2 py-1.5 text-[11px] font-medium text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,title:`Add ${t}`,"aria-label":`Add ${t} widget`,children:[(0,R.jsx)(x,{className:`h-3 w-3`}),(0,R.jsx)(n,{className:`h-3 w-3`})]},e))}),C&&(0,R.jsxs)(`button`,{type:`button`,onClick:ge,className:`inline-flex items-center gap-1.5 rounded-md border border-input bg-background px-2.5 py-1.5 text-xs font-medium text-muted-foreground shadow-sm hover:bg-accent hover:text-accent-foreground`,"data-testid":`dashboard-edit-button`,children:[(0,R.jsx)(w,{className:`h-3.5 w-3.5`}),h(`common.edit`,{defaultValue:`Edit`})]})]})]}),(0,R.jsxs)(`div`,{className:`flex-1 overflow-hidden flex flex-col sm:flex-row relative`,children:[(0,R.jsx)(`div`,{className:`flex-1 min-w-0 overflow-auto p-2 sm:p-4 md:p-6`,children:(0,R.jsx)(le,{schema:$,dataSource:e,designMode:A,selectedWidgetId:P,onWidgetClick:F,onWidgetsReorder:X,modalHandler:U,scriptHandlers:pe,hideHeaderText:!0})}),(0,R.jsx)(ue,{open:A&&C,onClose:_e,schema:be,selectedWidgetId:P,onSelectWidget:F,onSave:Y,onChange:J,onRemoveWidget:ye,name:t,metadataClient:p,onAfterChange:()=>G().catch(()=>{})}),(0,R.jsx)(oe,{open:n,sections:[{title:`Dashboard Configuration`,data:$}]})]}),I&&I.schema?.objectName?(0,R.jsx)(te,{schema:{type:`object-form`,formType:`modal`,objectName:I.schema.objectName,mode:I.schema.mode||`create`,recordId:I.schema.recordId,title:I.schema.title,description:I.schema.description,fields:I.schema.fields,open:!0,onOpenChange:e=>{e||V({success:!1})},onSuccess:e=>{V({success:!0,reload:!0,data:e})},onCancel:()=>{V({success:!1})},showSubmit:!0,showCancel:!0},dataSource:i}):I?(0,R.jsx)(m,{open:!0,onOpenChange:e=>{e||V({success:!1})},children:(0,R.jsxs)(y,{children:[(0,R.jsxs)(S,{children:[(0,R.jsx)(f,{children:I.schema?.title||h(`actionDialog.defaultActionTitle`)}),I.schema?.description&&(0,R.jsx)(ee,{children:I.schema.description})]}),(0,R.jsxs)(l,{children:[(0,R.jsx)(D,{variant:`outline`,onClick:()=>V({success:!1}),children:h(`actionDialog.cancel`)}),(0,R.jsx)(D,{onClick:()=>V({success:!0}),children:h(`actionDialog.ok`)})]})]})}):null]}):(0,R.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,R.jsxs)(v,{children:[(0,R.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,R.jsx)(d,{className:`h-6 w-6 text-muted-foreground`})}),(0,R.jsx)(u,{children:h(`empty.dashboardNotFound`)}),(0,R.jsx)(O,{children:h(`empty.dashboardNotFoundDescription`,{name:t})})]})})}export{z as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-CMxvf4Kt.js";import{_ as t,t as n}from"./vendor-react-DR370ovB.js";import{R as r,l as i,m as a}from"./vendor-objectstack-BNd856rx.js";import{$n as o,Br as s,Bt as c,Fs as l,Ht as u,Is as d,Ms as f,Na as p,Ps as m,Qr as h,Rs as g,Si as _,Sr as v,Ui as y,Ut as b,Vo as x,Vt as S,Wo as C,Wt as w,es as ee,hr as T,io as E,js as D,nn as O,on as k,pc as A,to as j}from"./ui-components-D1FYlKrM.js";import{_ as M,b as N,g as P,h as F,i as I,n as te,p as ne,t as re,v as L,y as R}from"./mergeServerFields-DLHgCyyI.js";var z=e(t(),1),B={metric:{id:`metric`,label:`Metric (KPI)`,category:`kpi`,icon:j},bar:{id:`bar`,label:`Bar chart`,category:`chart`,icon:m},"horizontal-bar":{id:`horizontal-bar`,label:`Horizontal bar`,category:`chart`,icon:l},line:{id:`line`,label:`Line chart`,category:`chart`,icon:d},area:{id:`area`,label:`Area chart`,category:`chart`,icon:g},pie:{id:`pie`,label:`Pie chart`,category:`chart`,icon:f},donut:{id:`donut`,label:`Donut chart`,category:`chart`,icon:x},scatter:{id:`scatter`,label:`Scatter plot`,category:`chart`,icon:D},funnel:{id:`funnel`,label:`Funnel`,category:`chart`,icon:s},table:{id:`table`,label:`Data table`,category:`data`,icon:h},pivot:{id:`pivot`,label:`Pivot table`,category:`data`,icon:C},list:{id:`list`,label:`Record list`,category:`data`,icon:p},custom:{id:`custom`,label:`Custom widget`,category:`custom`,icon:ee}},V={kpi:`Single value`,chart:`Charts`,data:`Tabular`,custom:`Custom`},H=[`kpi`,`chart`,`data`,`custom`].map(e=>({category:e,types:Object.values(B).filter(t=>t.category===e)})),U=A,W=n();function G({onAdd:e,label:t=`Add widget`}){let[n,r]=z.useState(!1),[i,a]=z.useState(``),o=z.useRef(null),s=z.useRef(null);z.useEffect(()=>{if(!n){a(``);return}let e=e=>{o.current?.contains(e.target)||r(!1)},t=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),queueMicrotask(()=>s.current?.focus()),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[n]);let c=z.useMemo(()=>{let e=i.trim().toLowerCase();return e?H.map(t=>({category:t.category,types:t.types.filter(t=>t.id.toLowerCase().includes(e)||t.label.toLowerCase().includes(e))})).filter(e=>e.types.length):H},[i]);return(0,W.jsxs)(`div`,{ref:o,className:`relative`,children:[(0,W.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded border border-dashed px-3 py-1.5 text-xs text-muted-foreground hover:bg-muted/30 hover:text-foreground`,onClick:()=>r(e=>!e),children:[(0,W.jsx)(y,{className:`h-3 w-3`}),t]}),n&&(0,W.jsxs)(`div`,{className:`absolute right-0 top-full z-40 mt-1 w-72 rounded-md border bg-popover shadow-md`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 border-b px-2 py-1.5`,children:[(0,W.jsx)(_,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,W.jsx)(`input`,{ref:s,type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:`Search widgets…`,className:`w-full bg-transparent text-xs outline-none placeholder:text-muted-foreground`})]}),(0,W.jsx)(`div`,{className:`max-h-72 overflow-auto py-1`,children:c.length===0?(0,W.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:`No matches.`}):c.map(t=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`px-3 pt-2 pb-1 text-[10px] uppercase tracking-wider text-muted-foreground`,children:V[t.category]}),t.types.map(t=>(0,W.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs hover:bg-accent`,onClick:()=>{e(t.id),r(!1)},children:[(0,W.jsx)(B[t.id]?.icon??U,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,W.jsx)(`span`,{className:`font-medium truncate`,children:t.label}),(0,W.jsx)(`code`,{className:`ml-auto text-[10px] text-muted-foreground`,children:t.id})]},t.id))]},t.category))})]})]})}var K={io:`input`,unrepresentable:`any`},q=new Set([`widgets`,`label`,`description`,`name`]),J,Y=!1;function ie(){if(J||Y)return J;try{J=r(i,K)}catch(e){Y=!0,typeof console<`u`&&console.warn(`[dashboard-schema] failed to derive Dashboard JSONSchema from spec`,e)}return J}var X;function ae(){if(X)return X;if(!(!a||typeof a!=`object`)){try{let e=JSON.parse(JSON.stringify(a));for(let t of e.sections??[])t.fields=(t.fields??[]).filter(e=>{let t=typeof e==`string`?e:e?.field;return!q.has(t)});e.sections=(e.sections??[]).filter(e=>(e.fields??[]).length>0),X=e}catch(e){typeof console<`u`&&console.warn(`[dashboard-schema] failed to prepare dashboardForm from spec`,e);return}return X}}var oe=new Set([`name`,`label`,`description`,`widgets`]);function se({draft:e,onPatch:t,readOnly:n,locale:r,onSelectionChange:i,serverSchema:a}){let s=z.useCallback(e=>I(e,r),[r]),c=typeof e.label==`string`?e.label:``,l=typeof e.description==`string`?e.description:``,u=z.useMemo(()=>Array.isArray(e.widgets)?e.widgets:[],[e.widgets]),d=e=>{let n=N(`widget`,u.map(e=>e?.id).filter(Boolean)),r=B[e],a=r?`New ${r.label.toLowerCase()}`:`New widget`;t({widgets:M(u,{id:n,type:e,title:a,...r?.defaults??{}})}),i?.({kind:`widget`,id:n,label:a})},f=e=>{t({widgets:R(u,e,null)})},p=(e,n)=>{e!==n&&t({widgets:L(u,e,n)})},m=(e,t)=>{e?.id&&i?.({kind:`widget`,id:e.id,label:e.title||e.id||`Widget ${t+1}`})},[h,g]=z.useState(null),[_,y]=z.useState(null),{schema:b,form:x}=z.useMemo(()=>re({bundledSchema:ie(),bundledForm:ae(),serverSchema:a,excludeFields:oe,sectionTitle:I(`engine.inspector.moreFields`,r)}),[a,r]);return(0,W.jsxs)(F,{kindLabel:s(`engine.inspector.dashboard.kind`),title:String(c||e.name||s(`engine.inspector.dashboard.kind`)),onClose:()=>{},closeLabel:s(`engine.inspector.dashboard.close`),hideClose:!0,children:[(0,W.jsx)(P,{label:s(`engine.inspector.dashboard.label`),value:c,onCommit:e=>t({label:e}),placeholder:s(`engine.inspector.dashboard.labelPlaceholder`),disabled:n}),(0,W.jsx)(P,{label:s(`engine.inspector.dashboard.description`),value:l,onCommit:e=>t({description:e}),placeholder:s(`engine.inspector.dashboard.descriptionPlaceholder`),disabled:n}),(0,W.jsxs)(`div`,{className:`border-t pt-3 space-y-1.5`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(k,{className:`text-xs text-muted-foreground`,children:s(`engine.inspector.dashboard.widgets`)}),(0,W.jsx)(o,{variant:`outline`,className:`text-[10px]`,children:u.length})]}),u.length===0?(0,W.jsx)(`p`,{className:`rounded-md border border-dashed bg-muted/30 px-3 py-3 text-center text-[11px] text-muted-foreground`,children:s(`engine.inspector.dashboard.widgetsEmpty`)}):(0,W.jsx)(`div`,{className:`space-y-1`,children:u.map((e,t)=>{let r=B[e?.type]?.icon??U;return(0,W.jsxs)(`div`,{draggable:!n,onDragStart:()=>g(t),onDragEnd:()=>{g(null),y(null)},onDragOver:e=>{e.preventDefault(),y(t)},onDrop:()=>{h!=null&&h!==t&&p(h,t),g(null),y(null)},className:`group flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs hover:bg-accent`+(_===t&&h!==null&&h!==t?` border-primary`:``),children:[!n&&(0,W.jsx)(E,{className:`h-3.5 w-3.5 shrink-0 cursor-grab text-muted-foreground`}),(0,W.jsx)(r,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,W.jsx)(`button`,{type:`button`,className:`min-w-0 flex-1 truncate text-left font-medium`,onClick:()=>m(e,t),title:e?.title||e?.id,children:e?.title||e?.id||`Widget ${t+1}`}),(0,W.jsx)(`code`,{className:`text-[10px] text-muted-foreground`,children:e?.type}),!n&&(0,W.jsx)(T,{type:`button`,variant:`ghost`,size:`sm`,className:`h-6 w-6 shrink-0 p-0 opacity-0 group-hover:opacity-100`,onClick:()=>f(t),title:s(`engine.inspector.dashboard.removeWidget`),"aria-label":s(`engine.inspector.dashboard.removeWidget`),children:(0,W.jsx)(v,{className:`h-3.5 w-3.5`})})]},e?.id??t)})}),!n&&(0,W.jsx)(G,{onAdd:d,label:s(`engine.inspector.add.widget`)})]}),(0,W.jsx)(`div`,{className:`border-t pt-3`,children:b?(0,W.jsx)(te,{schema:b,form:x,value:e,hiddenFields:[`name`,`label`,`description`,`widgets`],readOnly:n,onChange:e=>t(e)}):(0,W.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:s(`engine.inspector.dashboard.noSchema`)})})]})}var ce=[{value:`metric`,label:`KPI Metric`},{value:`bar`,label:`Bar Chart`},{value:`line`,label:`Line Chart`},{value:`pie`,label:`Pie Chart`},{value:`table`,label:`Table`},{value:`grid`,label:`Grid`}],Z=[`count`,`sum`,`avg`,`min`,`max`],le=[`default`,`blue`,`teal`,`orange`,`purple`,`success`,`warning`,`danger`];function ue(e,t){let n=Array.isArray(e.widgets)?e.widgets:[],r=n.findIndex(e=>e?.id===t);return r<0?null:{widget:n[r],index:r}}function de({draft:e,selection:t,onPatch:n,onClearSelection:r,onSelectionChange:i,readOnly:a,locale:o}){if(t.kind!==`widget`)return(0,W.jsx)($,{message:`Unsupported selection kind: ${t.kind}`,onClose:r,locale:o});let s=ue(e,t.id);if(!s)return(0,W.jsx)($,{message:`The selected widget was removed from the draft.`,onClose:r,locale:o});let{widget:l,index:d}=s,f=Array.isArray(e.widgets)?e.widgets:[];function p(e){let t=[...f];t[d]={...t[d],...e},n({widgets:t})}let m=l,h=typeof m.dataset==`string`?m.dataset:``,g=Array.isArray(m.dimensions)?m.dimensions.join(`, `):``,_=Array.isArray(m.values)?m.values.join(`, `):``,y=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function x(e){n({widgets:L(f,d,e)}),l.id&&i?.({kind:`widget`,id:l.id,label:l.title??void 0})}return(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:I(`engine.inspector.widget.kind`,o)}),(0,W.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:l.title||t.label||`Widget ${d+1}`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,W.jsx)(ne,{index:d,total:f.length,onMove:x,upLabel:I(`engine.inspector.reorder.up`,o),downLabel:I(`engine.inspector.reorder.down`,o),disabled:a}),(0,W.jsx)(T,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:r,title:I(`engine.inspector.widget.close`,o),"aria-label":I(`engine.inspector.widget.close`,o),children:(0,W.jsx)(v,{className:`h-3.5 w-3.5`})})]})]}),(0,W.jsx)(Q,{id:`widget-title`,label:I(`engine.inspector.widget.title`,o),children:(0,W.jsx)(O,{id:`widget-title`,value:l.title??``,onChange:e=>p({title:e.target.value}),disabled:a})}),(0,W.jsx)(Q,{id:`widget-type`,label:I(`engine.inspector.widget.type`,o),children:(0,W.jsxs)(c,{value:l.type??`metric`,onValueChange:e=>p({type:e}),disabled:a,children:[(0,W.jsx)(b,{id:`widget-type`,children:(0,W.jsx)(w,{})}),(0,W.jsx)(S,{children:ce.map(e=>(0,W.jsx)(u,{value:e.value,children:e.label},e.value))})]})}),(0,W.jsxs)(`div`,{className:`space-y-3 rounded-md border border-dashed border-primary/40 bg-primary/5 p-3`,children:[(0,W.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-primary/80`,children:I(`engine.inspector.widget.datasetSection`,o)}),(0,W.jsxs)(Q,{id:`widget-dataset`,label:I(`engine.inspector.widget.dataset`,o),children:[(0,W.jsx)(O,{id:`widget-dataset`,value:h,placeholder:I(`engine.inspector.widget.datasetPlaceholder`,o),onChange:e=>p({dataset:e.target.value||void 0}),disabled:a}),(0,W.jsx)(`p`,{className:`text-[10px] leading-snug text-muted-foreground`,children:I(`engine.inspector.widget.datasetHint`,o)})]}),h&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Q,{id:`widget-dimensions`,label:I(`engine.inspector.widget.dimensions`,o),children:[(0,W.jsx)(O,{id:`widget-dimensions`,value:g,placeholder:I(`engine.inspector.widget.dimensionsPlaceholder`,o),onChange:e=>p({dimensions:y(e.target.value)}),disabled:a}),(0,W.jsx)(`p`,{className:`text-[10px] leading-snug text-muted-foreground`,children:I(`engine.inspector.widget.dimensionsHint`,o)})]}),(0,W.jsxs)(Q,{id:`widget-values`,label:I(`engine.inspector.widget.values`,o),children:[(0,W.jsx)(O,{id:`widget-values`,value:_,placeholder:I(`engine.inspector.widget.valuesPlaceholder`,o),onChange:e=>p({values:y(e.target.value)}),disabled:a}),(0,W.jsx)(`p`,{className:`text-[10px] leading-snug text-muted-foreground`,children:I(`engine.inspector.widget.valuesHint`,o)})]})]})]}),(0,W.jsx)(Q,{id:`widget-object`,label:I(`engine.inspector.widget.object`,o),children:(0,W.jsx)(O,{id:`widget-object`,value:l.object??``,placeholder:`e.g. order`,onChange:e=>p({object:e.target.value}),disabled:a})}),(0,W.jsx)(Q,{id:`widget-value-field`,label:I(`engine.inspector.widget.valueField`,o),children:(0,W.jsx)(O,{id:`widget-value-field`,value:l.valueField??``,placeholder:`e.g. amount`,onChange:e=>p({valueField:e.target.value}),disabled:a})}),(0,W.jsx)(Q,{id:`widget-category-field`,label:I(`engine.inspector.widget.categoryField`,o),children:(0,W.jsx)(O,{id:`widget-category-field`,value:l.categoryField??``,placeholder:`e.g. status`,onChange:e=>p({categoryField:e.target.value}),disabled:a})}),(0,W.jsx)(Q,{id:`widget-aggregate`,label:I(`engine.inspector.widget.aggregate`,o),children:(0,W.jsxs)(c,{value:l.aggregate??`count`,onValueChange:e=>p({aggregate:e}),disabled:a,children:[(0,W.jsx)(b,{id:`widget-aggregate`,children:(0,W.jsx)(w,{})}),(0,W.jsx)(S,{children:Z.map(e=>(0,W.jsx)(u,{value:e,children:e},e))})]})}),(0,W.jsx)(Q,{id:`widget-color`,label:I(`engine.inspector.widget.color`,o),children:(0,W.jsxs)(c,{value:l.colorVariant??`default`,onValueChange:e=>p({colorVariant:e}),disabled:a,children:[(0,W.jsx)(b,{id:`widget-color`,children:(0,W.jsx)(w,{})}),(0,W.jsx)(S,{children:le.map(e=>(0,W.jsx)(u,{value:e,children:e},e))})]})}),(0,W.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,W.jsx)(Q,{id:`widget-w`,label:I(`engine.inspector.widget.width`,o),children:(0,W.jsx)(O,{id:`widget-w`,type:`number`,min:1,value:l.layout?.w??1,onChange:e=>p({layout:{...l.layout??{},w:Number(e.target.value)||1}}),disabled:a})}),(0,W.jsx)(Q,{id:`widget-h`,label:I(`engine.inspector.widget.height`,o),children:(0,W.jsx)(O,{id:`widget-h`,type:`number`,min:1,value:l.layout?.h??1,onChange:e=>p({layout:{...l.layout??{},h:Number(e.target.value)||1}}),disabled:a})})]}),!a&&(0,W.jsx)(`div`,{className:`pt-2 border-t`,children:(0,W.jsx)(T,{type:`button`,variant:`outline`,size:`sm`,className:`w-full text-destructive hover:text-destructive`,onClick:()=>{let t=Array.isArray(e.widgets)?[...e.widgets]:[];t.splice(d,1),n({widgets:t}),r()},children:I(`engine.inspector.widget.remove`,o)})})]})}function Q({id:e,label:t,children:n}){return(0,W.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,W.jsx)(k,{htmlFor:e,className:`text-xs font-medium text-muted-foreground`,children:t}),n]})}function $({message:e,onClose:t,locale:n}){return(0,W.jsxs)(`div`,{className:`space-y-3 rounded-md border border-dashed p-4 text-sm text-muted-foreground`,children:[(0,W.jsx)(`p`,{children:e}),(0,W.jsx)(T,{type:`button`,variant:`outline`,size:`sm`,onClick:t,children:I(`engine.inspector.widget.close`,n)})]})}export{B as i,se as n,G as r,de as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-CMxvf4Kt.js";import{_ as t,t as n}from"./vendor-react-DR370ovB.js";import{w as r}from"./framework-DCMHw4uc.js";import{$n as i,Fi as a,Ft as o,Gi as s,Gt as c,It as l,Jn as u,Lt as d,Ma as f,Mt as p,Pt as m,Rt as h,Xn as g,Yn as _,Zn as v,_s as y,bs as b,ct as x,dt as S,ft as C,hr as w,is as T,ls as E,lt as D,nn as O,on as k,ot as A,qn as j,st as M,tt as N,ut as P,wr as F}from"./ui-components-D1FYlKrM.js";import"./src-ChUzpvnF.js";var I=e(t(),1),L=n();function R({status:e}){let t={success:{icon:y,cls:`text-emerald-600 border-emerald-300`},completed:{icon:y,cls:`text-emerald-600 border-emerald-300`},failed:{icon:E,cls:`text-red-600 border-red-300`},error:{icon:E,cls:`text-red-600 border-red-300`},running:{icon:f,cls:`text-blue-600 border-blue-300 animate-pulse`},pending:{icon:T,cls:`text-amber-600 border-amber-300`},skipped:{icon:b,cls:`text-muted-foreground`}}[e]??{icon:b,cls:`text-muted-foreground`},n=t.icon;return(0,L.jsxs)(i,{variant:`outline`,className:`text-[10px] font-mono inline-flex items-center gap-1 ${t.cls}`,children:[(0,L.jsx)(n,{className:`h-3 w-3`}),e]})}function z(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function B(e,t){switch(t){case`number`:{if(e===``)return;let t=Number(e);return Number.isNaN(t)?e:t}case`boolean`:return e===`true`;case`object`:case`list`:case`array`:if(e.trim()===``)return;try{return JSON.parse(e)}catch{return e}default:return e}}function V({data:e}){return(0,L.jsx)(`pre`,{className:`rounded border bg-muted/30 p-2 text-xs font-mono overflow-auto whitespace-pre-wrap break-all max-h-96`,children:JSON.stringify(e,null,2)})}function H(){let e=r()?.getClient?.(),[t,n]=(0,I.useState)([]),[i,o]=(0,I.useState)(!0),[s,c]=(0,I.useState)(null),[l,d]=(0,I.useState)(``),[f,m]=(0,I.useState)(0),h=(0,I.useCallback)(async()=>{if(!e?.meta?.getItems){c(`meta.getItems is not available on this client`),o(!1);return}o(!0),c(null);try{let t=await e.meta.getItems(`flow`),r=(Array.isArray(t)?t:Array.isArray(t?.items)?t.items:Array.isArray(t?.value)?t.value:[]).map(e=>({name:e?.spec?.name??e?.name,label:e?.spec?.label,spec:e?.spec??e,updatedAt:e?.updatedAt??e?.updated_at})).filter(e=>e.name);n(r),!l&&r.length>0&&d(r[0].name)}catch(e){c(e?.message??String(e))}finally{o(!1)}},[e,l]);(0,I.useEffect)(()=>{h()},[h]);let y=(0,I.useMemo)(()=>t.find(e=>e.name===l)??null,[t,l]);return(0,L.jsxs)(`div`,{className:`flex flex-col gap-4 p-4 sm:p-6`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight flex items-center gap-2`,children:[(0,L.jsx)(F,{className:`h-5 w-5`}),`Flow Runs`]}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Pick a flow, trigger a test run with sample inputs, and inspect recent run history`})]}),(0,L.jsxs)(j,{children:[(0,L.jsx)(g,{className:`pb-3`,children:(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(v,{className:`text-base`,children:`Flow`}),(0,L.jsx)(_,{children:`Select a flow definition to test`})]}),(0,L.jsxs)(w,{variant:`outline`,size:`sm`,onClick:h,disabled:i,children:[(0,L.jsx)(a,{className:`h-3.5 w-3.5 mr-2 ${i?`animate-spin`:``}`}),`Refresh`]})]})}),(0,L.jsxs)(u,{children:[i&&(0,L.jsx)(p,{className:`h-9 w-72`}),s&&(0,L.jsx)(`p`,{className:`text-sm text-red-500 font-mono break-all`,children:s}),!i&&!s&&t.length===0&&(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No flow definitions found.`}),!i&&!s&&t.length>0&&(0,L.jsx)(`select`,{value:l,onChange:e=>d(e.target.value),className:`flex h-9 w-full max-w-md rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm focus:outline-none focus:ring-1 focus:ring-ring`,children:t.map(e=>(0,L.jsx)(`option`,{value:e.name,children:e.label?`${e.label} (${e.name})`:e.name},e.name))})]})]}),y&&(0,L.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,L.jsx)(U,{client:e,flow:y.spec,onExecuted:()=>m(e=>e+1)}),(0,L.jsx)(W,{client:e,flowName:y.name,refreshKey:f})]})]})}function U({client:e,flow:t,onExecuted:n}){let r=(0,I.useMemo)(()=>(t?.variables??[]).filter(e=>e?.isInput),[t]),[a,o]=(0,I.useState)({}),[c,l]=(0,I.useState)(!1),[d,p]=(0,I.useState)(null),[m,h]=(0,I.useState)(null);(0,I.useEffect)(()=>{o({}),p(null),h(null)},[t?.name]);let b=(e,t)=>o(n=>({...n,[e]:t}));return(0,L.jsxs)(j,{children:[(0,L.jsxs)(g,{className:`pb-3`,children:[(0,L.jsx)(v,{className:`text-base`,children:`Test Run`}),(0,L.jsx)(_,{children:`Provide input values and invoke the flow`})]}),(0,L.jsxs)(u,{className:`space-y-3`,children:[r.length===0&&(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This flow declares no input variables. Click Run to invoke with no parameters.`}),r.map(e=>(0,L.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,L.jsxs)(k,{htmlFor:`var-${e.name}`,className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`font-mono text-xs`,children:e.name}),(0,L.jsx)(i,{variant:`outline`,className:`text-[10px] font-mono`,children:e.type})]}),e.type===`boolean`?(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(C,{id:`var-${e.name}`,checked:a[e.name]===`true`,onCheckedChange:t=>b(e.name,t?`true`:`false`)}),(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a[e.name]===`true`?`true`:`false`})]}):e.type===`object`||e.type===`list`||e.type===`array`?(0,L.jsx)(N,{id:`var-${e.name}`,placeholder:`JSON ${e.type}`,value:a[e.name]??``,onChange:t=>b(e.name,t.target.value),className:`font-mono text-xs min-h-[80px]`}):(0,L.jsx)(O,{id:`var-${e.name}`,type:e.type===`number`?`number`:`text`,value:a[e.name]??``,onChange:t=>b(e.name,t.target.value)})]},e.name)),(0,L.jsx)(`div`,{className:`pt-1`,children:(0,L.jsxs)(w,{onClick:async()=>{if(!e?.automation?.execute){h(`automation.execute is not available on this client`);return}l(!0),h(null),p(null);try{let i={};for(let e of r){let t=a[e.name];t!==void 0&&(i[e.name]=B(t,e.type))}p(await e.automation.execute(t.name,{params:i})),n?.()}catch(e){h(e?.message??String(e))}finally{l(!1)}},disabled:c,size:`sm`,children:[c?(0,L.jsx)(f,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,L.jsx)(s,{className:`h-3.5 w-3.5 mr-2`}),c?`Running…`:`Run Flow`]})}),(d||m)&&(0,L.jsxs)(`div`,{className:`pt-2 border-t mt-2 space-y-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[m||d?.success===!1?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(E,{className:`h-4 w-4 text-red-500`}),` Failed`]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(y,{className:`h-4 w-4 text-emerald-500`}),` Result`]}),typeof d?.durationMs==`number`&&(0,L.jsxs)(i,{variant:`secondary`,className:`text-[10px] font-mono`,children:[d.durationMs,` ms`]})]}),m&&(0,L.jsx)(`p`,{className:`text-sm text-red-500 font-mono break-all`,children:m}),d&&(0,L.jsx)(V,{data:d})]})]})]})}function W({client:e,flowName:t,refreshKey:n}){let[r,s]=(0,I.useState)([]),[y,b]=(0,I.useState)(!0),[C,T]=(0,I.useState)(null),[E,O]=(0,I.useState)(null),[k,N]=(0,I.useState)(null),[F,B]=(0,I.useState)(!1),[H,U]=(0,I.useState)(null),W=(0,I.useCallback)(async()=>{if(!e?.automation?.listRuns){T(`automation.listRuns is not available on this client`),b(!1);return}b(!0),T(null);try{let n=await e.automation.listRuns(t,{limit:20});s(Array.isArray(n)?n:n?.items??n?.runs??[])}catch(e){T(e?.message??String(e))}finally{b(!1)}},[e,t]);(0,I.useEffect)(()=>{W()},[W,n]);let G=async n=>{O(n),N(null),U(null),B(!0);try{let r=await e.automation.getRun(t,n);N(r?.run??r)}catch(e){U(e?.message??String(e))}finally{B(!1)}};return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(j,{children:[(0,L.jsx)(g,{className:`pb-3`,children:(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(v,{className:`text-base`,children:`Recent Runs`}),(0,L.jsx)(_,{className:`font-mono text-xs`,children:t})]}),(0,L.jsxs)(w,{variant:`outline`,size:`sm`,onClick:W,disabled:y,children:[y?(0,L.jsx)(f,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,L.jsx)(a,{className:`h-3.5 w-3.5 mr-2`}),`Refresh`]})]})}),(0,L.jsxs)(u,{children:[y&&(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(p,{className:`h-8 w-full`}),(0,L.jsx)(p,{className:`h-8 w-full`}),(0,L.jsx)(p,{className:`h-8 w-full`})]}),!y&&C&&(0,L.jsx)(`p`,{className:`text-sm text-red-500 font-mono break-all`,children:C}),!y&&!C&&r.length===0&&(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground py-6 text-center`,children:`No runs yet. Use the Test Run panel to invoke this flow.`}),!y&&!C&&r.length>0&&(0,L.jsxs)(A,{children:[(0,L.jsx)(P,{children:(0,L.jsxs)(S,{children:[(0,L.jsx)(D,{children:`Run`}),(0,L.jsx)(D,{children:`Status`}),(0,L.jsx)(D,{children:`Started`}),(0,L.jsx)(D,{className:`text-right`,children:`Duration`})]})}),(0,L.jsx)(M,{children:r.map(e=>(0,L.jsxs)(S,{className:`cursor-pointer`,onClick:()=>G(e.id),children:[(0,L.jsxs)(x,{className:`font-mono text-xs`,children:[e.id.slice(0,12),`…`]}),(0,L.jsx)(x,{children:(0,L.jsx)(R,{status:e.status})}),(0,L.jsx)(x,{className:`text-xs text-muted-foreground`,children:z(e.startedAt)}),(0,L.jsx)(x,{className:`text-right font-mono text-xs`,children:typeof e.durationMs==`number`?`${e.durationMs} ms`:`—`})]},e.id))})]})]})]}),(0,L.jsx)(m,{open:!!E,onOpenChange:e=>{e||(O(null),N(null))},children:(0,L.jsxs)(o,{side:`right`,className:`w-full sm:max-w-2xl p-0 flex flex-col`,children:[(0,L.jsxs)(d,{className:`p-4 border-b`,children:[(0,L.jsxs)(h,{className:`font-mono text-sm break-all`,children:[`Run `,E]}),(0,L.jsx)(l,{children:k&&(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,L.jsx)(R,{status:k.status}),typeof k.durationMs==`number`&&(0,L.jsxs)(i,{variant:`secondary`,className:`text-[10px] font-mono`,children:[k.durationMs,` ms`]}),(0,L.jsx)(`span`,{className:`text-xs`,children:z(k.startedAt)})]})})]}),(0,L.jsxs)(c,{className:`flex-1 p-4`,children:[F&&(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(p,{className:`h-16 w-full`}),(0,L.jsx)(p,{className:`h-16 w-full`}),(0,L.jsx)(p,{className:`h-16 w-full`})]}),H&&(0,L.jsx)(`p`,{className:`text-sm text-red-500 font-mono break-all`,children:H}),!F&&k&&(0,L.jsx)(`div`,{className:`space-y-3`,children:Array.isArray(k.steps)&&k.steps.length>0?k.steps.map((e,t)=>(0,L.jsxs)(`div`,{className:`rounded-md border p-3 space-y-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,L.jsxs)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:[`#`,t+1]}),(0,L.jsx)(`span`,{className:`font-mono text-sm font-medium`,children:e.nodeLabel||e.nodeId}),e.nodeType&&(0,L.jsx)(i,{variant:`outline`,className:`text-[10px] font-mono`,children:e.nodeType}),(0,L.jsx)(R,{status:e.status}),typeof e.durationMs==`number`&&(0,L.jsxs)(i,{variant:`secondary`,className:`text-[10px] font-mono ml-auto`,children:[e.durationMs,` ms`]})]}),e.input!==void 0&&(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground mb-1`,children:`Input`}),(0,L.jsx)(V,{data:e.input})]}),e.output!==void 0&&(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground mb-1`,children:`Output`}),(0,L.jsx)(V,{data:e.output})]}),e.error&&(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`text-[10px] uppercase text-red-500 mb-1`,children:`Error`}),(0,L.jsx)(V,{data:e.error})]})]},`${e.nodeId}-${t}`)):(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground mb-1`,children:`Run`}),(0,L.jsx)(V,{data:k})]})})]})]})})]})}export{H as FlowRunsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-CMxvf4Kt.js";import{_ as t,p as n,t as r,u as i}from"./vendor-react-DR370ovB.js";import{F as a,L as o,T as s,r as c,w as l}from"./framework-DCMHw4uc.js";import{H as u,I as d,R as f,Wo as p,z as m}from"./ui-components-D1FYlKrM.js";import"./MetadataProvider-xgIDLxXw.js";import{t as h}from"./RecordDetailView-Dg0FtCgX.js";import{c as ee}from"./plugins-views-DvIN271Q.js";var g=e(t(),1),_=`uf_`;function v(e){let t={};return e.forEach((e,n)=>{if(n.startsWith(_)&&e!==``){let r=n.slice(3);t[r]=e.split(`,`).map(e=>{try{return decodeURIComponent(e)}catch{return e}})}}),Object.keys(t).length>0?t:void 0}function y(e,t){let n=new URLSearchParams(e);for(let[e,r]of Object.entries(t)){let t=_+e;r&&r.length>0?n.set(t,r.map(e=>encodeURIComponent(String(e))).join(`,`)):n.delete(t)}return n}var b=r();function x(e){return Array.isArray(e?.columns)&&e.columns.length>0}function S(e,t){let n=e?.listViews||e?.list_views||{},r=(t?[n[`${e?.name}.${t}`],n[t],...t==="default"||t===`list`?[e?.list]:[]]:[e?.list,...Object.values(n)]).filter(Boolean);return r.find(x)??r[0]}var C=new Set([`id`,`created_at`,`createdAt`,`updated_at`,`updatedAt`,`deleted_at`,`deletedAt`,`created_by`,`createdBy`,`updated_by`,`updatedBy`,`_version`,`_rev`]);function w(e){if(Array.isArray(e?.compactLayout)&&e.compactLayout.length>0)return e.compactLayout.filter(t=>e.fields?.[t]);let t=e?.fields;return t&&typeof t==`object`?Object.entries(t).filter(([e,t])=>t&&!t.hidden&&!C.has(e)).map(([e])=>e).slice(0,6):[]}function T(e,t){let n=e?.fields;if(!(!n||typeof n!=`object`))return Object.entries(n).find(([e,n])=>n&&!n.hidden&&!C.has(e)&&t(e,n))?.[0]}var E=new Set([`select`,`multiselect`,`radio`,`enum`,`boolean`]),D=new Set([`date`,`datetime`,`time`]),O=new Set([`image`,`file`,`attachment`,`avatar`,`photo`]);function k(e){let t=T(e,(e,t)=>E.has(t.type))??T(e,e=>/status|stage|state|priority|category|kind/i.test(e));return t?{groupField:t,groupByField:t}:void 0}function A(e){return T(e,(e,t)=>D.has(t.type))??T(e,e=>/date|due|start|end|deadline|schedule/i.test(e))}function j(e){let t=A(e);return t?{startDateField:t}:void 0}function M(e){let t=T(e,(e,t)=>O.has(t.type));return t?{coverField:t}:void 0}var N=new Set([`location`,`geo`,`geolocation`,`geopoint`,`point`]);function P(e){let t=T(e,(e,t)=>D.has(t.type)&&/start|begin|kickoff/i.test(e))??T(e,(e,t)=>D.has(t.type));if(!t)return;let n=T(e,(e,n)=>D.has(n.type)&&e!==t&&/end|due|finish|deadline|close/i.test(e))??T(e,(e,n)=>D.has(n.type)&&e!==t);if(!n)return;let r=T(e,(e,t)=>(t.type===`number`||t.type===`percent`)&&/progress|percent|complete/i.test(e));return{startDateField:t,endDateField:n,...r?{progressField:r}:{}}}function F(e){let t=T(e,(e,t)=>N.has(t.type))??T(e,e=>/location|address|geo|coords?|place|venue/i.test(e));return t?{locationField:t}:void 0}function I({page:e,className:t,onConfigChange:r}){let{t:_}=c(),{objects:C}=s(),T=l(),E=i(),[D,O]=n(),[A]=g.useState(()=>v(new URLSearchParams(window.location.search))),N=g.useCallback(e=>{O(t=>y(t,e),{replace:!0})},[O]),I=e?.interfaceConfig||{},L=g.useMemo(()=>(C||[]).find(e=>e.name===I.source),[C,I.source]),R=g.useMemo(()=>S(L,I.sourceView),[L,I.sourceView]),z=I.recordAction===`page`||I.recordAction===`modal`||I.recordAction===`none`?I.recordAction:`drawer`,B=g.useCallback(e=>`/apps/${window.location.pathname.split(`/`)[2]||``}/${I.source}/record/${encodeURIComponent(String(e))}`,[I.source]),V=a({navigation:{mode:z===`none`?`none`:z},objectName:I.source,onNavigate:e=>E(B(e))}),H=D.get(`recordId`),U=g.useCallback((e,t)=>{if(z===`none`)return;let n=e?.id??e?._id;if(t&&(t.metaKey||t.ctrlKey||t.button===1)&&n!=null){window.open(B(n),`_blank`);return}if((z===`drawer`||z===`modal`)&&n!=null){O(e=>{let t=new URLSearchParams(e);return t.set(`recordId`,String(n)),t});return}V.handleClick(e,t)},[z,B,V,O]),W=g.useCallback(()=>{O(e=>{let t=new URLSearchParams(e);return t.delete(`recordId`),t})},[O]);g.useEffect(()=>{H&&!V.isOpen?V.open({id:H}):!H&&V.isOpen&&V.close()},[H]);let G=L?.name,K=!!R&&!x(R),q=R?.name??(I.sourceView?`${I.source}.${I.sourceView}`:void 0),[J,Y]=g.useState(null);g.useEffect(()=>{let e=!1;if(Y(null),!(!G||!I.source||!K||!q))return(async()=>{try{let t=T,n=null;typeof t?.listViewOverrides==`function`&&(n=(await t.listViewOverrides(I.source))?.[q]??null),!x(n)&&typeof t?.getView==`function`&&(n=await t.getView(I.source,q)),!e&&n&&typeof n==`object`&&Y(n)}catch{}})(),()=>{e=!0}},[G,I.source,I.sourceView,K,q,T]);let X=g.useMemo(()=>J?{...R,...J}:R,[R,J]),Z=JSON.stringify(X??null),Q=g.useMemo(()=>{if(!L)return;let e=X||{},t=I.appearance??e.appearance,n=t?.allowedVisualizations||[],r=new Set(n),i=I.userActions||{},a=e.kanban??(r.has(`kanban`)?k(L):void 0),o=e.calendar??(r.has(`calendar`)?j(L):void 0),s=e.timeline??(r.has(`timeline`)?j(L):void 0),c=e.gallery??(r.has(`gallery`)?M(L):void 0),l=e.gantt??(r.has(`gantt`)?P(L):void 0),u=e.options?.map??(r.has(`map`)?F(L):void 0),d=[...Array.isArray(e.filter)?e.filter:[],...Array.isArray(I.filterBy)?I.filterBy:[]],f=x(I)?I.columns:x(e)?e.columns:w(L),p=Array.isArray(I.sort)&&I.sort.length?I.sort:e.sort;return{type:`list-view`,objectName:L.name,viewType:n[0]??e.type??`grid`,fields:f,...d.length?{filters:d}:{},...p?.length?{sort:p}:{},grouping:e.grouping,rowColor:e.rowColor,pagination:e.pagination,searchableFields:e.searchableFields,emptyState:e.emptyState,kanban:a,calendar:o,gallery:c,timeline:s,gantt:l,...u||e.options?{options:{...e.options??{},...u?{map:u}:{}}}:{},userFilters:I.userFilters??e.userFilters,appearance:t,showViewSwitcher:n.length>1,showRecordCount:I.showRecordCount,addRecord:I.addRecord,showSearch:i.search!==!1,showSort:i.sort!==!1,showFilters:i.filter===!0,showDensity:i.rowHeight===!0,showHideFields:!1,showGroup:!1,showColor:!1,allowExport:!1,inlineEdit:!1}},[G,Z,I]);if(!L||!Q)return(0,b.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,b.jsxs)(f,{children:[(0,b.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,b.jsx)(p,{className:`h-6 w-6 text-muted-foreground`})}),(0,b.jsx)(u,{children:_(`empty.objectNotFound`,{defaultValue:`Source object not found`})}),(0,b.jsx)(m,{children:_(`empty.interfacePageSourceMissing`,{defaultValue:`This interface page references "{{name}}", which is not available.`,name:I.source||`?`})})]})});let $=Array.isArray(I.buttons)&&I.buttons.length?I.buttons.map(e=>(L.actions||[]).find(t=>t?.name===e)).filter(Boolean).map(e=>({...e,locations:[`list_toolbar`]})):[];return(0,b.jsxs)(`div`,{className:t??`h-full flex flex-col`,"data-testid":`interface-list-page`,children:[(0,b.jsxs)(`div`,{className:`px-4 pt-4 pb-2 shrink-0 flex items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`h1`,{className:`text-lg font-semibold leading-tight`,children:typeof e.label==`string`?e.label:e.name}),typeof e.description==`string`&&e.description&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground mt-0.5`,children:e.description})]}),$.length>0&&(0,b.jsx)(`div`,{className:`shrink-0`,"data-testid":`interface-page-buttons`,children:(0,b.jsx)(o,{schema:{type:`action:bar`,location:`list_toolbar`,actions:$,size:`sm`,variant:`outline`}})})]}),(0,b.jsx)(`div`,{className:`flex-1 min-h-0 overflow-auto`,children:(0,b.jsx)(ee,{schema:Q,dataSource:T,userFilterSelections:A,onUserFilterSelectionsChange:N,onSortChange:r?e=>r({sort:e}):void 0,onColumnStateChange:r?e=>{e?.order?.length&&r({columns:e.order})}:void 0,onRowClick:z===`none`?void 0:U})}),V.isOverlay&&(0,b.jsx)(d,{...V,setIsOpen:e=>{e||W()},title:typeof e.label==`string`?e.label:I.source||`Record`,children:e=>(0,b.jsx)(h,{objectNameOverride:I.source,recordIdOverride:String(e?.id??e?._id??H??``),embedded:!0,dataSource:T,objects:C,onEdit:()=>{}})})]})}export{y as n,v as r,I as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as e,t,u as n}from"./vendor-react-DR370ovB.js";import{r}from"./framework-DCMHw4uc.js";import{Jn as i,hr as a,ja as o,qn as s}from"./ui-components-D1FYlKrM.js";var c=t();function l(){let t=n(),{appName:l}=e(),{t:u}=r(),d=l?`/apps/${l}`:`/`;return(0,c.jsx)(`div`,{className:`container mx-auto max-w-2xl px-6 py-16`,children:(0,c.jsx)(s,{children:(0,c.jsxs)(i,{className:`flex flex-col items-center gap-4 py-12 text-center`,children:[(0,c.jsx)(`div`,{className:`rounded-full bg-muted p-3`,children:(0,c.jsx)(o,{className:`h-6 w-6 text-muted-foreground`})}),(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h2`,{className:`text-lg font-semibold`,children:u(`marketplace.accessDenied.title`)}),(0,c.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:u(`marketplace.accessDenied.description`)})]}),(0,c.jsx)(a,{variant:`outline`,onClick:()=>t(d),children:u(`marketplace.action.backHome`)})]})})})}export{l as t};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{o as e,r as t}from"./rolldown-runtime-CMxvf4Kt.js";import{_ as n,f as r,t as i,u as a}from"./vendor-react-DR370ovB.js";import{d as ee}from"./infrastructure-CJNwTVno.js";import{T as te,r as ne}from"./framework-DCMHw4uc.js";import{$n as o,Bn as re,Bo as ie,Bt as ae,Er as s,Hn as oe,Ht as se,Io as ce,Jn as le,Kn as c,Ks as l,Ln as ue,Lo as de,Ma as u,Mt as d,Rn as fe,Ut as pe,Vn as me,Vr as f,Vt as he,Wo as ge,Wt as _e,Xn as ve,Zn as ye,_i as be,_s as p,bs as m,cc as xe,cn as Se,es as h,fa as g,gi as Ce,gn as we,ho as Te,hr as _,on as v,qn as Ee,sn as De,ua as Oe,un as y,ys as ke,zn as Ae}from"./ui-components-D1FYlKrM.js";import"./MetadataProvider-xgIDLxXw.js";import{n as je}from"./assistantBus-3d9MxsCF.js";import{_ as Me,a as Ne,b,c as Pe,g as Fe,h as Ie,i as Le,m as Re,o as ze,p as Be,r as x,s as Ve,t as He,u as Ue}from"./marketplaceApi-CucX7DD9.js";import{n as We,t as Ge}from"./usePackageL10n-shLsxEAx.js";import{t as Ke}from"./MarketplaceAccessDenied-DvMKTKZG.js";var S=e(n(),1),C=i();function qe(e){let t=e.replace(/\r\n/g,`
|
|
2
|
-
`).split(`
|
|
3
|
-
`),n=[],r=0;for(;r<t.length;){let e=t[r];if(e.startsWith("```")){let i=e.slice(3).trim();r++;let a=[];for(;r<t.length&&!t[r].startsWith("```");)a.push(t[r]),r++;r++,n.push({type:`code`,text:a.join(`
|
|
4
|
-
`),lang:i});continue}let i=/^(#{1,3})\s+(.*)$/.exec(e);if(i){let e=i[1].length;n.push({type:`h${e}`,text:i[2].trim()}),r++;continue}if(/^[-*]\s+/.test(e)){let e=[];for(;r<t.length&&/^[-*]\s+/.test(t[r]);)e.push(t[r].replace(/^[-*]\s+/,``)),r++;n.push({type:`ul`,items:e});continue}if(/^\d+\.\s+/.test(e)){let e=[];for(;r<t.length&&/^\d+\.\s+/.test(t[r]);)e.push(t[r].replace(/^\d+\.\s+/,``)),r++;n.push({type:`ol`,items:e});continue}if(!e.trim()){r++;continue}let a=[];for(;r<t.length&&t[r].trim()&&!/^#{1,3}\s+/.test(t[r])&&!/^[-*]\s+/.test(t[r])&&!/^\d+\.\s+/.test(t[r])&&!t[r].startsWith("```");)a.push(t[r]),r++;n.push({type:`p`,text:a.join(` `)})}return n}function w(e){let t=[],n=e,r=0,i=[{re:/`([^`]+)`/,render:e=>(0,C.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[0.85em]`,children:e[1]},`k${r++}`)},{re:/\*\*([^*]+)\*\*/,render:e=>(0,C.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e[1]},`k${r++}`)},{re:/\*([^*]+)\*/,render:e=>(0,C.jsx)(`em`,{children:e[1]},`k${r++}`)},{re:/\[([^\]]+)\]\(([^)]+)\)/,render:e=>(0,C.jsx)(`a`,{href:e[2],target:`_blank`,rel:`noopener noreferrer`,className:`text-violet-600 underline-offset-2 hover:underline dark:text-violet-400`,children:e[1]},`k${r++}`)}];for(;n;){let e=-1,r=null,a=null;for(let t of i){let i=t.re.exec(n);i&&(e===-1||i.index<e)&&(e=i.index,r=i,a=t)}if(!r||!a){t.push(n);break}e>0&&t.push(n.slice(0,e)),t.push(a.render(r)),n=n.slice(e+r[0].length)}return(0,C.jsx)(C.Fragment,{children:t.map((e,t)=>(0,C.jsx)(S.Fragment,{children:e},t))})}function Je({source:e,className:t}){let n=qe(e);return(0,C.jsx)(`div`,{className:`flex flex-col gap-4 text-sm leading-relaxed text-foreground/90 ${t??``}`,children:n.map((e,t)=>{switch(e.type){case`h1`:return(0,C.jsx)(`h2`,{className:`mt-2 text-xl font-bold tracking-tight`,children:w(e.text??``)},t);case`h2`:return(0,C.jsx)(`h3`,{className:`mt-3 text-base font-semibold tracking-tight`,children:w(e.text??``)},t);case`h3`:return(0,C.jsx)(`h4`,{className:`mt-2 text-sm font-semibold tracking-tight text-foreground/80`,children:w(e.text??``)},t);case`p`:return(0,C.jsx)(`p`,{children:w(e.text??``)},t);case`ul`:return(0,C.jsx)(`ul`,{className:`ml-1 flex list-none flex-col gap-1.5`,children:(e.items??[]).map((e,t)=>(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{"aria-hidden":`true`,className:`mt-1.5 inline-block h-1.5 w-1.5 shrink-0 rounded-full bg-violet-500/70`}),(0,C.jsx)(`span`,{children:w(e)})]},t))},t);case`ol`:return(0,C.jsx)(`ol`,{className:`ml-5 flex list-decimal flex-col gap-1.5 marker:text-muted-foreground`,children:(e.items??[]).map((e,t)=>(0,C.jsx)(`li`,{className:`pl-1`,children:w(e)},t))},t);case`code`:return(0,C.jsx)(`pre`,{className:`overflow-x-auto rounded-lg border bg-muted/40 p-3 text-xs leading-relaxed`,children:(0,C.jsx)(`code`,{className:`font-mono`,children:e.text})},t)}return null})})}var T={node:`In-process · full trust`,sandbox:`Sandboxed`,worker:`Out-of-process`};function E({icon:e,label:t,items:n}){return!n||n.length===0?null:(0,C.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,C.jsx)(e,{className:`h-3.5 w-3.5 mt-0.5 text-muted-foreground shrink-0`,"aria-hidden":`true`}),(0,C.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,C.jsx)(`div`,{className:`text-xs font-medium`,children:t}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-0.5`,children:n.map(e=>(0,C.jsx)(`code`,{className:`font-mono text-[11px] px-1 py-0.5 rounded bg-muted break-all`,children:e},e))})]})]})}function Ye({version:e}){let{t}=ne();if(!e?.contains_code)return null;let n=e.permissions??{},r=(n.services?.length??0)+(n.hooks?.length??0)+(n.network?.length??0)+(n.fs?.length??0)>0;return(0,C.jsxs)(`div`,{className:`rounded-md border border-amber-500/30 bg-amber-500/5 p-3 space-y-3 text-sm`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,C.jsx)(h,{className:`h-4 w-4 text-amber-600 shrink-0`,"aria-hidden":`true`}),t(`marketplace.disclosure.containsCode`,{defaultValue:`This package contains code`})]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[e.runtime&&(0,C.jsx)(o,{variant:`outline`,children:t(`marketplace.disclosure.runtime.${e.runtime}`,{defaultValue:T[e.runtime]??e.runtime})}),e.platform_verified?(0,C.jsxs)(o,{variant:`outline`,className:`gap-1 border-green-500/40 text-green-700 dark:text-green-400`,children:[(0,C.jsx)(Ce,{className:`h-3 w-3`,"aria-hidden":`true`}),t(`marketplace.disclosure.reviewed`,{defaultValue:`Reviewed & approved`})]}):(0,C.jsxs)(o,{variant:`outline`,className:`gap-1 border-amber-500/40 text-amber-700 dark:text-amber-400`,children:[(0,C.jsx)(be,{className:`h-3 w-3`,"aria-hidden":`true`}),t(`marketplace.disclosure.unreviewed`,{defaultValue:`Not yet reviewed`})]}),e.signed&&(0,C.jsxs)(o,{variant:`outline`,className:`gap-1`,children:[(0,C.jsx)(p,{className:`h-3 w-3`,"aria-hidden":`true`}),t(`marketplace.disclosure.signed`,{defaultValue:`Signed`})]})]}),r?(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t(`marketplace.disclosure.grantsIntro`,{defaultValue:`On install, this package will be granted:`})}),(0,C.jsx)(E,{icon:l,label:t(`marketplace.disclosure.services`,{defaultValue:`Platform services`}),items:n.services??void 0}),(0,C.jsx)(E,{icon:s,label:t(`marketplace.disclosure.hooks`,{defaultValue:`Lifecycle hooks`}),items:n.hooks??void 0}),(0,C.jsx)(E,{icon:g,label:t(`marketplace.disclosure.network`,{defaultValue:`Network access`}),items:n.network??void 0}),(0,C.jsx)(E,{icon:Te,label:t(`marketplace.disclosure.fs`,{defaultValue:`Filesystem access`}),items:n.fs??void 0})]}):(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t(`marketplace.disclosure.noPermissions`,{defaultValue:`Requests no special permissions.`})})]})}var D=t({MarketplacePackagePage:()=>O});function O(){let e=a(),{packageId:t,appName:n}=r(),i=ee(),{t:s,language:l}=ne(),be=n?`/apps/${n}`:``,{refresh:h}=te(),[g,Ce]=(0,S.useState)(null),[Te,qe]=(0,S.useState)(!0),[w,T]=(0,S.useState)(null),[E,D]=(0,S.useState)(!1),[O,Xe]=(0,S.useState)([]),[Ze,k]=(0,S.useState)(!1),[A,j]=(0,S.useState)(null),[M,N]=(0,S.useState)(``),[Qe,$e]=(0,S.useState)({}),[P,et]=(0,S.useState)(!1),[tt,nt]=(0,S.useState)(!1),[F,rt]=(0,S.useState)(!1),[I,L]=(0,S.useState)(null),[R,it]=(0,S.useState)(null),[z,B]=(0,S.useState)(null),[V,H]=(0,S.useState)(null),[U,W]=(0,S.useState)(null),[at,G]=(0,S.useState)([]),[K,q]=(0,S.useState)(!1),[J,Y]=(0,S.useState)(null);(0,S.useEffect)(()=>{if(!b().features.installLocal)return;let e=!1;return(async()=>{let t=await Ue();e||G(t)})(),()=>{e=!0}},[t,J]),(0,S.useEffect)(()=>{if(!t)return;let e=b().defaultEnvironmentId??``,n=!1;return(async()=>{let r=await x(t,e);n||!r||(B(r),it(r.version))})(),()=>{n=!0}},[t]),(0,S.useEffect)(()=>{let e=!1;return(async()=>{if(t){qe(!0),T(null);try{let n=await Le(t);e||Ce(n)}catch(t){e||T(t?.message??String(t))}finally{e||qe(!1)}}})(),()=>{e=!0}},[t]);let ot=async()=>{D(!0),L(null),j(null);let e=b().defaultEnvironmentId;if(e){k(!1),N(e),Xe([]);return}k(!0);try{let[e,n]=await Promise.all([Ve(),Pe()]),r=e.filter(e=>{let t=e.organization_id;return t?n.has(String(t)):!1});Xe(r),$e({});let i=t;i&&Promise.all(r.map(async e=>{try{let t=await x(i,e.id);return t?[e.id,t.version]:null}catch{return null}})).then(e=>{let t={};for(let n of e)n&&(t[n[0]]=n[1]);$e(t)}),e.length>0&&r.length===0?j(s(`marketplace.install.noPermission`)):r.length===1&&N(r[0].id)}catch(e){let t=e?.status;j(t===401||t===403?s(`marketplace.install.signInFirst`):e?.message??String(e))}finally{k(!1)}},st=async()=>{if(!(!t||!M)){rt(!0),L(null);try{it(((await ze({packageId:t,environmentId:M,seedSampleData:P}))?.installation?.version??g?.package?.latest_version?.version??g?.versions?.[0]?.version??``)||`installed`);try{let e=b().defaultEnvironmentId||M;if(e){let n=await x(t,e);n&&B(n)}}catch{}let e=b().defaultEnvironmentId;if(!e||e===M)try{if(typeof sessionStorage<`u`)for(let e of Object.keys(sessionStorage))e.startsWith(`objectui:metadata:`)&&sessionStorage.removeItem(e);await h()}catch{}L({ok:!0,message:s(`marketplace.install.success`)}),je()}catch(e){L({ok:!1,message:e?.message??String(e)})}finally{rt(!1)}}},ct=async()=>{if(t){q(!0),Y(null);try{let e=await Ne({packageId:t});try{await h(`app`)}catch{}Y({ok:!0,message:s(`marketplace.install.localSuccess`,{version:e.version,name:g?.package?Ge(g.package,l).displayName:e.manifestId})}),je()}catch(e){let t=e?.code,n=e?.message??String(e);t===`manifest_conflict`?n=s(`marketplace.install.localManifestConflict`,{message:n}):t===`unauthorized`?n=s(`marketplace.install.localUnauthorized`):t===`marketplace_unavailable`&&(n=s(`marketplace.install.localMarketplaceUnavailable`)),Y({ok:!1,message:n})}finally{q(!1)}}},lt=async()=>{if($&&confirm(s(`marketplace.uninstall.confirm`,{manifestId:$.manifestId,version:$.version}))){q(!0),Y(null);try{await Me($.manifestId);try{await h(`app`)}catch{}Y({ok:!0,message:s(`marketplace.uninstall.successInDetail`,{manifestId:$.manifestId})})}catch(e){Y({ok:!1,message:e?.message??String(e)})}finally{q(!1)}}},ut=async()=>{if(z){H(`reseed`),W(null);try{let e=await Fe(z.installationId);e.ok?(B({...z,withSampleData:!0}),W({ok:!0,text:s(`marketplace.detail.reseedQueued`)||`Sample data will be re-seeded on next environment access.`})):W({ok:!1,text:e.error||`Re-seed failed`})}finally{H(null)}}},dt=async()=>{if(z&&confirm(s(`marketplace.detail.purgeConfirm`)||`Delete all sample records seeded by this package? User-added records will NOT be touched.`)){H(`purge`),W(null);try{let e=await Re(z.installationId);if(e.ok){B({...z,withSampleData:!1});let t=e.deleted??0;W({ok:!0,text:t>0?s(`marketplace.detail.purgeSuccess`,{count:t})||`Removed ${t} sample record(s).`:s(`marketplace.detail.purgeNoData`)||`No sample records found to purge.`})}else W({ok:!1,text:e.error||`Purge failed`})}finally{H(null)}}},ft=async()=>{if($){H(`reseed`),W(null);try{let e=await Ie($.manifestId);G(e=>e.map(e=>e.manifestId===$.manifestId?{...e,withSampleData:!0}:e));let t=e.inserted??0,n=e.updated??0;W({ok:!0,text:s(`marketplace.detail.reseedLocalSuccess`,{inserted:t,updated:n})||`Sample data re-seeded (inserted=${t}, updated=${n}).`})}catch(e){W({ok:!1,text:e?.message||`Re-seed failed`})}finally{H(null)}}},pt=async()=>{if($&&confirm(s(`marketplace.detail.purgeConfirm`)||`Delete all sample records seeded by this package? User-added records will NOT be touched.`)){H(`purge`),W(null);try{let e=await Be($.manifestId);G(e=>e.map(e=>e.manifestId===$.manifestId?{...e,withSampleData:!1}:e));let t=e.deleted??0;W({ok:!0,text:t>0?s(`marketplace.detail.purgeSuccess`,{count:t})||`Removed ${t} sample record(s).`:s(`marketplace.detail.purgeNoData`)||`No sample records found to purge.`})}catch(e){W({ok:!1,text:e?.message||`Purge failed`})}finally{H(null)}}};if(Te)return(0,C.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl flex flex-col gap-6 p-4 sm:p-6`,children:[(0,C.jsx)(d,{className:`h-8 w-32`}),(0,C.jsx)(d,{className:`h-16 w-full`}),(0,C.jsx)(d,{className:`h-64 w-full`})]});if(w||!g)return(0,C.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl flex flex-col gap-6 p-4 sm:p-6`,children:[(0,C.jsxs)(_,{variant:`ghost`,size:`sm`,onClick:()=>e(`${be}/system/marketplace`),children:[(0,C.jsx)(xe,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),s(`marketplace.back`)]}),(0,C.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-destructive/30 bg-destructive/5 p-4 text-sm`,children:[(0,C.jsx)(m,{className:`h-4 w-4 mt-0.5 text-destructive`,"aria-hidden":`true`}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`font-medium text-destructive`,children:s(`marketplace.load.packageFailed`)}),(0,C.jsx)(`div`,{className:`text-muted-foreground mt-1`,children:w??s(`marketplace.load.notFound`)})]})]})]});let X=g.package,Z=Ge(X,l),Q=X.latest_version?.version??g.versions[0]?.version??null,$=at.find(e=>e.manifestId===X.manifest_id)??null,mt=!!X.latest_version?.contains_code,ht=!!R&&R!==`installed`&&!!Q&&R!==Q,gt=b().features.installLocal,_t=!Q||K||F||!gt&&!!R&&!ht,vt=gt?{label:s(K?`marketplace.action.working`:$?`marketplace.action.reinstall`:`marketplace.action.install`),onClick:ct}:{label:F?s(`marketplace.action.installing`):R?ht?s(`marketplace.action.updateTo`,{defaultValue:`Update`,version:Q}):s(`marketplace.action.installed`,{defaultValue:`Installed`}):s(`marketplace.action.installToCloud`),onClick:ot},yt=X.category?s(`marketplace.category.${X.category}`,{defaultValue:X.category}):null;return i?(0,C.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl flex flex-col gap-6 p-4 sm:p-6`,children:[(0,C.jsxs)(_,{variant:`ghost`,size:`sm`,className:`self-start -ml-2 text-muted-foreground hover:text-foreground`,onClick:()=>e(`${be}/system/marketplace`),children:[(0,C.jsx)(xe,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),s(`marketplace.back`)]}),(0,C.jsxs)(`div`,{className:`flex items-start gap-5 flex-wrap sm:flex-nowrap rounded-2xl border bg-gradient-to-br from-primary/5 via-background to-background p-6 sm:p-8`,children:[(0,C.jsx)(We,{iconUrl:X.icon_url,displayName:Z.displayName,manifestId:X.manifest_id,className:`h-20 w-20 rounded-2xl shadow-sm ring-1 ring-border shrink-0`,initialClassName:`text-3xl font-bold`}),(0,C.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,C.jsx)(`h1`,{className:`text-2xl sm:text-3xl font-bold tracking-tight truncate`,children:Z.displayName||X.manifest_id}),X.homepage_url&&(0,C.jsxs)(`a`,{href:X.homepage_url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,title:s(`marketplace.detail.homepage`),children:[(0,C.jsx)(ce,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,C.jsx)(`span`,{className:`hidden sm:inline`,children:s(`marketplace.detail.homepage`)})]})]}),(0,C.jsxs)(`div`,{className:`text-sm text-muted-foreground mt-2 flex flex-wrap items-center gap-1.5`,children:[(0,C.jsx)(`code`,{className:`font-mono text-xs px-1.5 py-0.5 rounded bg-muted`,children:X.manifest_id}),Q&&(0,C.jsx)(o,{variant:`outline`,children:s(`marketplace.versionBadge`,{version:Q})}),X.publisher&&X.publisher!==`private`&&(0,C.jsx)(o,{variant:X.publisher===`objectstack`?`default`:`secondary`,children:X.publisher}),yt&&(0,C.jsx)(o,{variant:`outline`,children:yt}),X.license&&(0,C.jsx)(o,{variant:`outline`,className:`font-normal`,children:X.license}),$&&(0,C.jsxs)(o,{variant:`default`,className:`bg-green-600 hover:bg-green-600 gap-1`,children:[(0,C.jsx)(p,{className:`h-3 w-3`,"aria-hidden":`true`}),s(`marketplace.detail.installedV`,{version:$.version})]}),!$&&R&&(0,C.jsxs)(o,{variant:`default`,className:`bg-green-600 hover:bg-green-600 gap-1`,children:[(0,C.jsx)(p,{className:`h-3 w-3`,"aria-hidden":`true`}),s(`marketplace.detail.installedV`,{version:R})]}),ht&&(0,C.jsxs)(o,{variant:`default`,className:`bg-amber-500 hover:bg-amber-500 gap-1`,children:[(0,C.jsx)(ke,{className:`h-3 w-3`,"aria-hidden":`true`}),s(`marketplace.detail.updateAvailable`,{defaultValue:`Update available`}),` → v`,Q]})]}),Z.description&&(0,C.jsx)(`p`,{className:`text-sm sm:text-base text-foreground/80 mt-3 max-w-2xl leading-relaxed`,children:Z.description})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0 self-start`,children:[(0,C.jsxs)(_,{onClick:vt.onClick,disabled:_t,size:`lg`,className:`min-w-[8rem]`,children:[(0,C.jsx)(ie,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),vt.label]}),$&&(0,C.jsxs)(De,{children:[(0,C.jsx)(we,{asChild:!0,children:(0,C.jsx)(_,{variant:`outline`,size:`lg`,className:`px-2.5`,"aria-label":s(`marketplace.detail.moreOptions`),children:(0,C.jsx)(de,{className:`h-4 w-4`,"aria-hidden":`true`})})}),(0,C.jsxs)(Se,{align:`end`,className:`w-56`,children:[(0,C.jsxs)(y,{onSelect:ft,disabled:V!==null,children:[V===`reseed`?(0,C.jsx)(u,{className:`h-4 w-4 mr-2 animate-spin`,"aria-hidden":`true`}):(0,C.jsx)(ge,{className:`h-4 w-4 mr-2`,"aria-hidden":`true`}),$.withSampleData?s(`marketplace.detail.reseedAgain`)||`Re-seed sample data`:s(`marketplace.detail.addSampleData`)||`Add sample data`]}),(0,C.jsxs)(y,{onSelect:pt,disabled:V!==null||!$.withSampleData,className:`text-destructive focus:text-destructive`,children:[V===`purge`?(0,C.jsx)(u,{className:`h-4 w-4 mr-2 animate-spin`,"aria-hidden":`true`}):(0,C.jsx)(f,{className:`h-4 w-4 mr-2`,"aria-hidden":`true`}),s(`marketplace.detail.purgeSampleData`)||`Purge sample data`]}),(0,C.jsxs)(y,{onSelect:lt,disabled:K,className:`text-destructive focus:text-destructive`,children:[(0,C.jsx)(f,{className:`h-4 w-4 mr-2`,"aria-hidden":`true`}),s(`marketplace.detail.uninstallFromRuntime`)]})]})]}),!$&&z&&!b().cloudUrl&&(0,C.jsxs)(De,{children:[(0,C.jsx)(we,{asChild:!0,children:(0,C.jsx)(_,{variant:`outline`,size:`lg`,className:`px-2.5`,"aria-label":s(`marketplace.detail.moreOptions`)||`More options`,children:(0,C.jsx)(de,{className:`h-4 w-4`,"aria-hidden":`true`})})}),(0,C.jsxs)(Se,{align:`end`,className:`w-56`,children:[(0,C.jsxs)(y,{onSelect:ut,disabled:V!==null,children:[V===`reseed`?(0,C.jsx)(u,{className:`h-4 w-4 mr-2 animate-spin`,"aria-hidden":`true`}):(0,C.jsx)(ge,{className:`h-4 w-4 mr-2`,"aria-hidden":`true`}),z.withSampleData?s(`marketplace.detail.reseedAgain`)||`Re-seed sample data`:s(`marketplace.detail.addSampleData`)||`Add sample data`]}),(0,C.jsxs)(y,{onSelect:dt,disabled:V!==null||!z.withSampleData,className:`text-destructive focus:text-destructive`,children:[V===`purge`?(0,C.jsx)(u,{className:`h-4 w-4 mr-2 animate-spin`,"aria-hidden":`true`}):(0,C.jsx)(f,{className:`h-4 w-4 mr-2`,"aria-hidden":`true`}),s(`marketplace.detail.purgeSampleData`)||`Purge sample data`]})]})]})]})]}),U&&(0,C.jsxs)(`div`,{role:`status`,className:`flex items-start gap-2 rounded-md border p-3 text-sm ${U.ok?`border-green-500/30 bg-green-500/5 text-green-700 dark:text-green-400`:`border-destructive/30 bg-destructive/5 text-destructive`}`,children:[U.ok?(0,C.jsx)(p,{className:`h-4 w-4 mt-0.5 shrink-0`,"aria-hidden":`true`}):(0,C.jsx)(m,{className:`h-4 w-4 mt-0.5 shrink-0`,"aria-hidden":`true`}),(0,C.jsx)(`div`,{className:`flex-1`,children:U.text}),(0,C.jsx)(`button`,{type:`button`,className:`text-xs underline opacity-60 hover:opacity-100`,onClick:()=>W(null),children:s(`marketplace.action.dismiss`)})]}),J&&(0,C.jsxs)(`div`,{role:`status`,className:`flex items-start gap-2 rounded-md border p-3 text-sm whitespace-pre-wrap ${J.ok?`border-green-500/30 bg-green-500/5 text-green-700 dark:text-green-400`:`border-destructive/30 bg-destructive/5 text-destructive`}`,children:[J.ok?(0,C.jsx)(p,{className:`h-4 w-4 mt-0.5 shrink-0`,"aria-hidden":`true`}):(0,C.jsx)(m,{className:`h-4 w-4 mt-0.5 shrink-0`,"aria-hidden":`true`}),(0,C.jsx)(`div`,{className:`flex-1`,children:J.message}),(0,C.jsx)(`button`,{type:`button`,className:`text-xs underline opacity-60 hover:opacity-100`,onClick:()=>Y(null),children:s(`marketplace.action.dismiss`)})]}),(0,C.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-3`,children:[(0,C.jsx)(`div`,{className:`lg:col-span-2 space-y-4`,children:(0,C.jsxs)(Ee,{children:[(0,C.jsx)(ve,{children:(0,C.jsx)(ye,{className:`text-base`,children:s(`marketplace.detail.about`)})}),(0,C.jsx)(le,{children:Z.readme?(0,C.jsx)(Je,{source:Z.readme}):(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s(`marketplace.detail.noReadme`)})})]})}),(0,C.jsx)(`div`,{className:`space-y-4`,children:(0,C.jsxs)(Ee,{children:[(0,C.jsx)(ve,{children:(0,C.jsx)(ye,{className:`text-base`,children:s(`marketplace.detail.versions`)})}),(0,C.jsx)(le,{children:g.versions.length===0?(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s(`marketplace.detail.noApprovedVersions`)}):(0,C.jsx)(`ul`,{className:`space-y-3`,children:g.versions.map(e=>(0,C.jsxs)(`li`,{className:`space-y-1 text-sm`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,C.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,C.jsx)(Oe,{className:`h-3.5 w-3.5 text-muted-foreground`,"aria-hidden":`true`}),(0,C.jsxs)(`code`,{className:`font-mono`,children:[`v`,e.version]}),e.is_prerelease&&(0,C.jsx)(o,{variant:`outline`,className:`text-xs`,children:s(`marketplace.detail.prerelease`)})]}),(0,C.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.published_at?new Date(e.published_at).toLocaleDateString():`—`})]}),e.release_notes&&e.release_notes.trim()&&(0,C.jsx)(`p`,{className:`whitespace-pre-line pl-5 text-xs text-muted-foreground`,children:e.release_notes.trim()})]},e.id))})})]})})]}),(0,C.jsx)(ue,{open:E,onOpenChange:e=>{D(e),e||(L(null),nt(!1))},children:(0,C.jsxs)(fe,{children:[(0,C.jsxs)(me,{children:[(0,C.jsx)(oe,{children:s(`marketplace.install.dialogTitle`,{name:Z.displayName||X.manifest_id})}),(0,C.jsx)(Ae,{children:b().defaultEnvironmentId?s(`marketplace.install.dialogDescCurrent`,{host:typeof window<`u`?window.location.host:``}):s(`marketplace.install.dialogDescPicker`)})]}),Ze?(0,C.jsx)(d,{className:`h-10 w-full`}):A?(0,C.jsxs)(`div`,{className:`rounded-md border border-amber-500/30 bg-amber-500/5 p-3 text-sm space-y-2`,children:[(0,C.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,C.jsx)(m,{className:`h-4 w-4 mt-0.5 text-amber-600`,"aria-hidden":`true`}),(0,C.jsx)(`div`,{className:`flex-1`,children:A})]}),(0,C.jsx)(`a`,{href:He(X.id),target:`_blank`,rel:`noopener noreferrer`,children:(0,C.jsxs)(_,{variant:`outline`,size:`sm`,className:`w-full`,children:[(0,C.jsx)(ce,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),s(`marketplace.action.openOnCloud`)]})})]}):b().defaultEnvironmentId?(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(c,{id:`seed`,checked:P,onCheckedChange:e=>et(e===!0)}),(0,C.jsx)(v,{htmlFor:`seed`,className:`text-sm font-normal cursor-pointer`,children:s(`marketplace.install.includeSampleData`)})]}):O.length===0?(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s(`marketplace.install.noEnvs`)}):(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(v,{htmlFor:`env-select`,children:s(`marketplace.install.environment`)}),(0,C.jsxs)(ae,{value:M,onValueChange:N,children:[(0,C.jsx)(pe,{id:`env-select`,children:(0,C.jsx)(_e,{placeholder:s(`marketplace.install.environmentPlaceholder`)})}),(0,C.jsx)(he,{children:O.map(e=>{let t=Qe[e.id],n=!!t&&!!Q&&t!==`installed`&&t!==Q;return(0,C.jsxs)(se,{value:e.id,children:[e.display_name||e.hostname||e.id,e.plan&&(0,C.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,e.plan]}),t&&(n?(0,C.jsxs)(`span`,{className:`text-amber-600`,children:[` · `,s(`marketplace.install.updateTo`,{defaultValue:`Update → v{{version}}`,version:Q})]}):(0,C.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,s(`marketplace.install.installedVersion`,{defaultValue:`Installed v{{version}}`,version:t})]}))]},e.id)})})]})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(c,{id:`seed`,checked:P,onCheckedChange:e=>et(e===!0)}),(0,C.jsx)(v,{htmlFor:`seed`,className:`text-sm font-normal cursor-pointer`,children:s(`marketplace.install.includeSampleData`)})]})]}),mt&&!A&&(0,C.jsxs)(`div`,{className:`space-y-3`,children:[(0,C.jsx)(Ye,{version:X.latest_version}),(0,C.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,C.jsx)(c,{id:`ack-perms`,checked:tt,onCheckedChange:e=>nt(e===!0)}),(0,C.jsx)(v,{htmlFor:`ack-perms`,className:`text-sm font-normal cursor-pointer leading-snug`,children:s(`marketplace.disclosure.acknowledge`,{defaultValue:`I understand this package runs code and grants the permissions above.`})})]})]}),I&&(0,C.jsx)(`div`,{className:`rounded-md border p-3 text-sm ${I.ok?`border-green-500/30 bg-green-500/5 text-green-700`:`border-destructive/30 bg-destructive/5 text-destructive`}`,children:I.message}),(0,C.jsxs)(re,{children:[(0,C.jsx)(_,{variant:`outline`,onClick:()=>D(!1),children:s(`marketplace.action.close`)}),!A&&(0,C.jsx)(_,{onClick:st,disabled:!M||F||I?.ok===!0||mt&&!tt,children:s(F?`marketplace.action.installing`:`marketplace.action.install`)})]})]})})]}):(0,C.jsx)(Ke,{})}export{D as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e,r as t}from"./rolldown-runtime-CMxvf4Kt.js";import{_ as n,f as r,t as i,u as a}from"./vendor-react-DR370ovB.js";import{d as ee}from"./infrastructure-CJNwTVno.js";import{r as o}from"./framework-DCMHw4uc.js";import{$n as s,Ii as c,Jn as l,Mt as u,Si as d,Xn as f,Yn as p,Zn as m,_s as h,bi as g,bs as _,ei as v,hr as y,nn as te,qn as b,ua as x}from"./ui-components-D1FYlKrM.js";import{n as ne}from"./assistantBus-3d9MxsCF.js";import{a as S,b as re,d as ie,f as C,l as ae,o as oe,u as se}from"./marketplaceApi-CucX7DD9.js";import{n as w,t as T}from"./usePackageL10n-shLsxEAx.js";import{t as ce}from"./MarketplaceAccessDenied-DvMKTKZG.js";var E=t({MarketplacePage:()=>A}),D=e(n(),1),O=i();function k(){let{language:e,t}=o();return n=>{if(!n)return``;let r=new Date(n);if(Number.isNaN(r.getTime()))return``;let i=Math.floor((Date.now()-r.getTime())/864e5);if(i<1)return t(`marketplace.relativeTime.today`);try{let t=new Intl.RelativeTimeFormat(e||`en`,{numeric:`auto`});return i<30?t.format(-i,`day`):i<365?t.format(-Math.floor(i/30),`month`):t.format(-Math.floor(i/365),`year`)}catch{return i<30?t(`marketplace.relativeTime.daysAgo`,{count:i}):i<365?t(`marketplace.relativeTime.monthsAgo`,{count:Math.floor(i/30)}):t(`marketplace.relativeTime.yearsAgo`,{count:Math.floor(i/365)})}}}function A(){let e=a(),{appName:t}=r(),n=ee(),{t:i,language:E}=o(),A=k(),j=t?`/apps/${t}`:``,[M,N]=(0,D.useState)([]),[P,F]=(0,D.useState)(!0),[I,L]=(0,D.useState)(null),[R,z]=(0,D.useState)(``),[B,V]=(0,D.useState)(``),[H,U]=(0,D.useState)([]),[W,le]=(0,D.useState)([]),[G,K]=(0,D.useState)(null),[q,J]=(0,D.useState)(null),[Y,ue]=(0,D.useState)(new Set),de=(0,D.useMemo)(()=>{let e=new Map;for(let t of H)e.set(t.manifestId,t);return e},[H]),X=async()=>{F(!0),L(null);try{let[e,t,n,r]=await Promise.all([ie({limit:100}),se(),C(),ae()]);N(e.items??[]),U(t),le(n.items??[]);let i=new Set;for(let e of t)i.add(e.manifestId);for(let e of r.items)i.add(e.manifestId);ue(i)}catch(e){L(e?.message??String(e)),N([])}finally{F(!1)}};(0,D.useEffect)(()=>{X()},[]);let fe=async e=>{K(e.id),J(null);try{re().features.installLocal?await S({packageId:e.manifest_id||e.id,versionId:`latest`}):await oe({packageId:e.id,environmentId:``,seedSampleData:!0}),J({ok:!0,text:i(`marketplace.org.installed`,{defaultValue:`Installed ${e.display_name}`,name:e.display_name})}),await X(),ne()}catch(e){J({ok:!1,text:e?.message??String(e)})}finally{K(null)}},Z=(0,D.useMemo)(()=>{let e=new Set;for(let t of M)t.category&&e.add(t.category);return Array.from(e).sort()},[M]),Q=e=>{let t=`marketplace.category.${e}`,n=i(t,{defaultValue:e});return n===t?e:n},$=(0,D.useMemo)(()=>{let e=R.trim().toLowerCase();return M.filter(t=>{if(B&&t.category!==B)return!1;if(!e)return!0;let n=T(t,E);return`${n.displayName} ${t.manifest_id} ${n.description??``}`.toLowerCase().includes(e)})},[M,R,B,E]);return n?(0,O.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6`,children:[(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-4 flex-wrap`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(v,{className:`h-6 w-6 text-primary`,"aria-hidden":`true`}),(0,O.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:i(`marketplace.title`)})]}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:i(`marketplace.subtitle`)})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsxs)(y,{variant:`outline`,size:`sm`,onClick:()=>e(`${j}/system/marketplace/installed`),children:[(0,O.jsx)(g,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),H.length>0?i(`marketplace.installedCount`,{count:H.length}):i(`marketplace.installed`)]}),(0,O.jsxs)(y,{variant:`outline`,size:`sm`,onClick:()=>void X(),disabled:P,children:[(0,O.jsx)(c,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),i(`marketplace.refresh`)]})]})]}),(0,O.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3`,children:[(0,O.jsxs)(`div`,{className:`relative flex-1`,children:[(0,O.jsx)(d,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`,"aria-hidden":`true`}),(0,O.jsx)(te,{value:R,onChange:e=>z(e.target.value),placeholder:i(`marketplace.searchPlaceholder`),className:`pl-9`,"aria-label":i(`marketplace.searchAria`)})]}),Z.length>0&&(0,O.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,O.jsx)(y,{size:`sm`,variant:B===``?`default`:`outline`,onClick:()=>V(``),children:i(`marketplace.all`)}),Z.map(e=>(0,O.jsx)(y,{size:`sm`,variant:B===e?`default`:`outline`,onClick:()=>V(e),children:Q(e)},e))]})]}),I&&(0,O.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-destructive/30 bg-destructive/5 p-4 text-sm`,children:[(0,O.jsx)(_,{className:`h-4 w-4 mt-0.5 text-destructive`,"aria-hidden":`true`}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`font-medium text-destructive`,children:i(`marketplace.load.failed`)}),(0,O.jsx)(`div`,{className:`text-muted-foreground mt-1`,children:I}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mt-2`,dangerouslySetInnerHTML:{__html:i(`marketplace.load.failedHint`)}})]})]}),W.length>0&&(0,O.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(v,{className:`h-5 w-5 text-primary`,"aria-hidden":`true`}),(0,O.jsx)(`h2`,{className:`text-sm font-semibold`,children:i(`marketplace.org.heading`,{defaultValue:`Your organization`})}),(0,O.jsx)(s,{variant:`secondary`,className:`text-xs`,children:W.length})]}),q&&(0,O.jsx)(`div`,{className:`rounded-md border p-3 text-sm ${q.ok?`border-green-500/30 bg-green-500/5 text-green-700 dark:text-green-400`:`border-destructive/30 bg-destructive/5 text-destructive`}`,children:q.text}),(0,O.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:W.map(e=>{let t=Y.has(e.manifest_id);return(0,O.jsxs)(b,{className:`flex flex-col`,"data-testid":`org-card-${e.manifest_id}`,children:[(0,O.jsxs)(f,{className:`flex flex-row items-start gap-3 pb-2`,children:[(0,O.jsx)(w,{iconUrl:e.icon_url,displayName:e.display_name,manifestId:e.manifest_id}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(m,{className:`text-base truncate`,children:e.display_name}),(0,O.jsx)(p,{className:`text-xs truncate`,children:(0,O.jsx)(`code`,{className:`font-mono`,children:e.manifest_id})})]}),e.visibility&&(0,O.jsx)(s,{variant:`outline`,className:`shrink-0 text-xs`,children:e.visibility})]}),(0,O.jsxs)(l,{className:`flex-1 flex flex-col gap-2`,children:[(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground line-clamp-2`,children:e.description||i(`marketplace.noDescription`)}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2 mt-auto pt-2 flex-wrap`,children:[e.latest_version&&(0,O.jsxs)(s,{variant:`outline`,className:`text-xs`,children:[(0,O.jsx)(x,{className:`h-3 w-3 mr-1`,"aria-hidden":`true`}),i(`marketplace.versionBadge`,{version:e.latest_version})]}),(0,O.jsx)(`div`,{className:`ml-auto`,children:t?(0,O.jsxs)(s,{variant:`default`,className:`text-xs bg-green-600 hover:bg-green-600`,children:[(0,O.jsx)(h,{className:`h-3 w-3 mr-1`,"aria-hidden":`true`}),i(`marketplace.org.installedBadge`,{defaultValue:`Installed`})]}):(0,O.jsx)(y,{size:`sm`,onClick:()=>void fe(e),disabled:G===e.id,children:G===e.id?i(`marketplace.org.installing`,{defaultValue:`Installing…`}):i(`marketplace.org.install`,{defaultValue:`Install`})})})]})]})]},e.id)})}),(0,O.jsx)(`div`,{className:`border-b pt-2`})]}),P&&M.length===0?(0,O.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,O.jsxs)(b,{children:[(0,O.jsxs)(f,{className:`pb-2`,children:[(0,O.jsx)(u,{className:`h-10 w-10 rounded-lg mb-2`}),(0,O.jsx)(u,{className:`h-5 w-3/4`}),(0,O.jsx)(u,{className:`h-4 w-1/2 mt-1`})]}),(0,O.jsx)(l,{children:(0,O.jsx)(u,{className:`h-12 w-full`})})]},t))}):$.length===0?(0,O.jsx)(`div`,{className:`text-center py-12 text-sm text-muted-foreground`,children:M.length===0?i(`marketplace.noApprovedYet`):i(`marketplace.noMatchFilters`)}):(0,O.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:$.map(t=>{let n=de.get(t.manifest_id),r=T(t,E);return(0,O.jsxs)(b,{className:`cursor-pointer transition-colors hover:bg-accent/50 flex flex-col`,onClick:()=>e(`${j}/system/marketplace/${t.id}`),role:`link`,tabIndex:0,onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),e(`${j}/system/marketplace/${t.id}`))},"data-testid":`marketplace-card-${t.manifest_id}`,children:[(0,O.jsxs)(f,{className:`flex flex-row items-start gap-3 pb-2`,children:[(0,O.jsx)(w,{iconUrl:t.icon_url,displayName:r.displayName,manifestId:t.manifest_id}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(m,{className:`text-base truncate`,children:r.displayName}),(0,O.jsx)(p,{className:`text-xs truncate`,children:(0,O.jsx)(`code`,{className:`font-mono`,children:t.manifest_id})})]}),t.publisher&&t.publisher!==`private`&&(0,O.jsx)(s,{variant:t.publisher===`objectstack`?`default`:`secondary`,className:`shrink-0`,children:t.publisher})]}),(0,O.jsxs)(l,{className:`flex-1 flex flex-col gap-2`,children:[(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground line-clamp-2`,children:r.description||i(`marketplace.noDescription`)}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2 mt-auto pt-2 flex-wrap`,children:[n&&(0,O.jsxs)(s,{variant:`default`,className:`text-xs bg-green-600 hover:bg-green-600`,children:[(0,O.jsx)(h,{className:`h-3 w-3 mr-1`,"aria-hidden":`true`}),i(`marketplace.installedBadge`,{version:n.version})]}),t.latest_version?.version&&(0,O.jsxs)(s,{variant:`outline`,className:`text-xs`,children:[(0,O.jsx)(x,{className:`h-3 w-3 mr-1`,"aria-hidden":`true`}),i(`marketplace.versionBadge`,{version:t.latest_version.version})]}),t.category&&(0,O.jsx)(s,{variant:`outline`,className:`text-xs`,children:Q(t.category)}),t.latest_version?.published_at&&(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground ml-auto`,children:A(t.latest_version.published_at)})]})]})]},t.id)})})]}):(0,O.jsx)(ce,{})}export{E as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-CMxvf4Kt.js";import{_ as t,t as n}from"./vendor-react-DR370ovB.js";import{$ as r,r as i}from"./framework-DCMHw4uc.js";import{Es as a,Os as o,Xo as s,ks as c}from"./ui-components-D1FYlKrM.js";function l(e,t,n){if(!(!e||t==null)){if(n){let r=e.find(e=>e.name===t&&e._packageId===n);if(r)return r}return e.find(e=>e.name===t)}}var u=e(t(),1),d=n();function f({sections:e,open:t}){if(!t)return null;let{t:n}=i(),[r,l]=(0,u.useState)([`0`]),[f,p]=(0,u.useState)(null),m=async(e,t)=>{try{await navigator.clipboard.writeText(JSON.stringify(e,null,2)),p(t),setTimeout(()=>p(null),2e3)}catch(e){console.error(`Failed to copy:`,e)}},h=e=>{l(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])};return(0,d.jsxs)(`div`,{className:`w-80 border-l bg-background p-0 overflow-hidden flex flex-col shrink-0 z-20 transition-all`,children:[(0,d.jsxs)(`div`,{className:`px-4 py-3 border-b bg-muted/5 flex items-center justify-between`,children:[(0,d.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:n(`layout.metadata.panelTitle`)}),(0,d.jsx)(`span`,{className:`text-[10px] text-muted-foreground/60`,children:n(`layout.metadata.jsonBadge`)})]}),(0,d.jsx)(`div`,{className:`flex-1 overflow-auto`,children:e.map((e,t)=>{let i=String(t),l=r.includes(i),u=f===t;return(0,d.jsxs)(`div`,{className:`border-b last:border-b-0`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 hover:bg-muted/5 transition-colors`,children:[(0,d.jsxs)(`button`,{onClick:()=>h(i),className:`flex-1 flex items-center justify-between text-left`,children:[(0,d.jsx)(`h4`,{className:`text-xs font-semibold text-foreground`,children:e.title}),l?(0,d.jsx)(o,{className:`h-3 w-3 text-muted-foreground ml-2`}):(0,d.jsx)(a,{className:`h-3 w-3 text-muted-foreground ml-2`})]}),(0,d.jsx)(`button`,{onClick:()=>m(e.data,t),className:`p-1 hover:bg-muted rounded transition-colors ml-2`,title:n(`layout.metadata.copyJson`),children:u?(0,d.jsx)(c,{className:`h-3 w-3 text-green-600`}):(0,d.jsx)(s,{className:`h-3 w-3 text-muted-foreground`})})]}),l&&(0,d.jsx)(`div`,{className:`px-4 pb-4`,children:(0,d.jsx)(`div`,{className:`relative rounded-md border border-border/50 bg-muted/5 overflow-hidden`,children:(0,d.jsx)(`pre`,{className:`text-[11px] leading-relaxed p-3 overflow-auto max-h-96 font-mono text-foreground/90`,children:JSON.stringify(e.data,null,2)})})})]},t)})})]})}function p(){let[e,t]=(0,u.useState)((0,u.useMemo)(()=>{try{return typeof window<`u`?r(window.location.search).enabled:!1}catch{return!1}},[]));return{showDebug:e,toggleDebug:()=>t(e=>!e)}}export{p as n,l as r,f as t};
|