@objectstack/console 17.5.0 → 17.7.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/CHANGELOG.md +806 -0
- package/dist/.objectstack-injection.json +2 -2
- package/dist/.objectui-sha +1 -1
- package/dist/assets/{ActionResultDialog-CLdIyOW6.js → ActionResultDialog-ChYnuROr.js} +3 -3
- package/dist/assets/{AiPendingActionsPage-OKYz66yR.js → AiPendingActionsPage-Dh3-i4BB.js} +1 -1
- package/dist/assets/{ApiConsolePage-CcrKovu8.js → ApiConsolePage-CKYEqlMs.js} +1 -1
- package/dist/assets/AppDocsIndex-B5Tky2xg.js +1 -0
- package/dist/assets/{AppManagementPage-D_xz8cTZ.js → AppManagementPage-ZwyvnHpM.js} +1 -1
- package/dist/assets/ApprovalsInboxPage-DD4fe0Em.js +1 -0
- package/dist/assets/{AuditLogPage-CoghqsZb.js → AuditLogPage-Sed6iMqP.js} +1 -1
- package/dist/assets/BookPage-DYjUsQIc.js +1 -0
- package/dist/assets/{ComponentNavView-BxsixSU9.js → ComponentNavView-DrlxM4SY.js} +1 -1
- package/dist/assets/CreateViewDialog-Cp72x_O7.js +1 -0
- package/dist/assets/DashboardView-juicRxcP.js +1 -0
- package/dist/assets/DocPage-CxJaQ-pC.js +1 -0
- package/dist/assets/{DocsIndex-B2zw_HAp.js → DocsIndex-LALVtIVR.js} +1 -1
- package/dist/assets/{DocsLayout-DezZ8x7_.js → DocsLayout-BAwlJQQf.js} +1 -1
- package/dist/assets/DocsSlug-CkF1E-Zs.js +1 -0
- package/dist/assets/ExpressionProvider-Dr0e99r1.js +1 -0
- package/dist/assets/FlowRunsPage-R3W3t2s4.js +1 -0
- package/dist/assets/{IntegrationsPage-2leVkVDH.js → IntegrationsPage-DIuFLEbF.js} +2 -2
- package/dist/assets/InterfaceListPage-BfoCldGu.js +1 -0
- package/dist/assets/{MarketplaceInstalledPage-EPPHSitW.js → MarketplaceInstalledPage-DyjhcUNB.js} +1 -1
- package/dist/assets/MarketplacePackagePage-BbO27Pgs.js +4 -0
- package/dist/assets/{MarketplacePage-BnQKykgv.js → MarketplacePage-DO2_b64U.js} +1 -1
- package/dist/assets/{MetadataInspector-BWxLkr0O.js → MetadataInspector-BQyu9pOE.js} +1 -1
- package/dist/assets/ObjectDataPage-DIY-yefK.js +1 -0
- package/dist/assets/PageView-C-qWu3Jw.js +1 -0
- package/dist/assets/ProfilePage-Qp8DL8CF.js +1 -0
- package/dist/assets/{PublicFormsPage-DlE6tck_.js → PublicFormsPage-D3AT2EH9.js} +1 -1
- package/dist/assets/RecordDetailView-B3XBEgk2.js +3 -0
- package/dist/assets/RecordFormPage-CcoZfUJ3.js +1 -0
- package/dist/assets/ReportDefaultInspector-DVcWM6sh.js +1 -0
- package/dist/assets/ReportView-pJCFptzp.js +2 -0
- package/dist/assets/RuntimeDraftBar-DObTyFu2.js +1 -0
- package/dist/assets/SchemaForm-BWSWYMLE.js +3 -0
- package/dist/assets/SearchResultsPage-ChVIzFob.js +1 -0
- package/dist/assets/{SettingsHub-BGKIj-Zq.js → SettingsHub-CPP9FDe8.js} +1 -1
- package/dist/assets/SettingsView-CrHAROu9.js +1 -0
- package/dist/assets/{SkeletonDetail-C8fMI-Mu.js → SkeletonDetail-CP-35B8x.js} +1 -1
- package/dist/assets/{af-BfSmLD34.js → af-Bhbso4Pg.js} +1 -1
- package/dist/assets/ai-BAPiCsNk.js +3 -0
- package/dist/assets/app-shell-eager-leaves-D9tgfJOe.js +1 -0
- package/dist/assets/{ar-B9ttrM75.js → ar-DG8TAFtm.js} +1 -1
- package/dist/assets/{ar-DZ-C1rn-cyl.js → ar-DZ-BtSien-d.js} +1 -1
- package/dist/assets/{ar-EG-BaDxKP_o.js → ar-EG-DpXC0zoY.js} +1 -1
- package/dist/assets/{ar-MA-DbxNEcmd.js → ar-MA-D1qVJLyE.js} +1 -1
- package/dist/assets/{ar-SA-DeC5LXcX.js → ar-SA-BIYKNgv8.js} +1 -1
- package/dist/assets/{ar-TN-C9KpTFJz.js → ar-TN-mUR5Mq3s.js} +1 -1
- package/dist/assets/{az-cMerDwRO.js → az-B7IqwHGK.js} +1 -1
- package/dist/assets/{be-ZTSbszQh.js → be-CnZyPaSX.js} +1 -1
- package/dist/assets/{be-tarask-BXZEUrgX.js → be-tarask--uMMCC7l.js} +1 -1
- package/dist/assets/{bg-BDogpmn5.js → bg-CZwuirtY.js} +1 -1
- package/dist/assets/{bn-Cz04uxmh.js → bn-BbOX0r-z.js} +1 -1
- package/dist/assets/{bs-CpFnCl-j.js → bs-B5W75cYR.js} +1 -1
- package/dist/assets/{ca-CHC4M52Z.js → ca-Be69LdIM.js} +1 -1
- package/dist/assets/{ckb-Dxw-RNm8.js → ckb-B-nKM1Vn.js} +1 -1
- package/dist/assets/contracts-DieHW666.js +1 -0
- package/dist/assets/{createDerive-DvA_JGNq.js → createDerive-CynsXU-B.js} +1 -1
- package/dist/assets/{cs-DsFaJ5Z7.js → cs-qHngxH7l.js} +1 -1
- package/dist/assets/{cy-FH4JFDTs.js → cy-DscO2Pgf.js} +1 -1
- package/dist/assets/{da-D1pVjaAq.js → da-vibkaLMF.js} +1 -1
- package/dist/assets/data-adapter-BDsrq0TX.js +2 -0
- package/dist/assets/{de-AT-DUMQCisj.js → de-AT--JneEuBw.js} +1 -1
- package/dist/assets/{de-DKrxSvnP.js → de-BCT78XYW.js} +1 -1
- package/dist/assets/default-inspector-registry-Dktr6x_q.js +1 -0
- package/dist/assets/dist-yh3dYtHt.js +14 -0
- package/dist/assets/drillUrlFilters-N0RngQg6.js +1 -0
- package/dist/assets/{el-l3-bHySV.js → el-Cl0y9T2b.js} +1 -1
- package/dist/assets/en-AU-By42tTB7.js +1 -0
- package/dist/assets/{en-CA-DGH5NF0a.js → en-CA-BqEEoj-Y.js} +1 -1
- package/dist/assets/en-GB-Cx8B9nkB.js +1 -0
- package/dist/assets/en-IE-CX9nv6uO.js +1 -0
- package/dist/assets/en-IN-ByGSBHa4.js +1 -0
- package/dist/assets/en-NZ-BPMwa2ZN.js +1 -0
- package/dist/assets/en-ZA-lj_N4R6c.js +1 -0
- package/dist/assets/{eo-CL6CXHZx.js → eo-oOXROuhF.js} +1 -1
- package/dist/assets/{es-BIJ0rksI.js → es-EudscwjH.js} +1 -1
- package/dist/assets/{et-BGgMzjm1.js → et-CB-5LLh6.js} +1 -1
- package/dist/assets/{eu-CqvAoRrX.js → eu-B4-hcseX.js} +1 -1
- package/dist/assets/{fa-IR-DNz3oA1-.js → fa-IR-CogavcMJ.js} +1 -1
- package/dist/assets/{fi-DNSfKWuW.js → fi-CIBE0mYa.js} +1 -1
- package/dist/assets/{formatLong-CHb9WA3O.js → formatLong-qqgm7lV1.js} +1 -1
- package/dist/assets/{fr-CA-CotiswPx.js → fr-CA-BugXMutW.js} +1 -1
- package/dist/assets/{fr-DYRJCirJ.js → fr-CDReXYWW.js} +1 -1
- package/dist/assets/{fr-CH-CpiEYWpc.js → fr-CH-fiTiB6X1.js} +1 -1
- package/dist/assets/framework-CAuH4h0L.js +35 -0
- package/dist/assets/{fy-B69yM3FE.js → fy-t_GzIAg_.js} +1 -1
- package/dist/assets/{gd-BAy8AsX6.js → gd-CSncIxtN.js} +1 -1
- package/dist/assets/{getIcon-BEVyC4y3.js → getIcon-BDkBRQFw.js} +1 -1
- package/dist/assets/{gl-soLn_weL.js → gl-_138Mj2S.js} +1 -1
- package/dist/assets/{gu-B19Yo9yC.js → gu-COfH-YUT.js} +1 -1
- package/dist/assets/{he-DYTPo33p.js → he-BXL4lOKY.js} +1 -1
- package/dist/assets/{hi-D2dIK7Oy.js → hi-kXuYI0TJ.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-CExufvVt.js → highlighted-body-OFNGDK62-CK7x7Gzm.js} +1 -1
- package/dist/assets/{hr-BV-VOPMu.js → hr-DAOsQWzI.js} +1 -1
- package/dist/assets/{ht-C7MM4qkS.js → ht-Ch8SKz8p.js} +1 -1
- package/dist/assets/{hu-Rha1m2Ym.js → hu-q6W_rWPT.js} +1 -1
- package/dist/assets/{hy-CiTNgbdV.js → hy-0M8OmwnM.js} +1 -1
- package/dist/assets/i18n-DTfZonAM.js +17 -0
- package/dist/assets/i18n-locale-ar-O6rs-Cir.js +4 -0
- package/dist/assets/i18n-locale-de-CMc1jk4a.js +4 -0
- package/dist/assets/i18n-locale-en-CbRQO81h.js +4 -0
- package/dist/assets/i18n-locale-es-t47nyoCX.js +4 -0
- package/dist/assets/i18n-locale-fr-E425EqJM.js +4 -0
- package/dist/assets/i18n-locale-ja-y_fk77fz.js +4 -0
- package/dist/assets/i18n-locale-ko-CdnY2uCg.js +4 -0
- package/dist/assets/i18n-locale-pt-BaUOXS6y.js +4 -0
- package/dist/assets/i18n-locale-ru-pFlhX9wg.js +4 -0
- package/dist/assets/i18n-locale-zh-Dkj4ROTN.js +4 -0
- package/dist/assets/i18n-runtime-CdWyaiOD.js +1 -0
- package/dist/assets/{id-Cijsfjt-.js → id-BM_H1_jv.js} +1 -1
- package/dist/assets/index-ocmkyCt6.js +19 -0
- package/dist/assets/index-v2Ijn9Gr.css +2 -0
- package/dist/assets/{infrastructure-BHSync5f.js → infrastructure-CSnL6ntj.js} +2 -2
- package/dist/assets/integration-7NqwVHuJ.js +1 -0
- package/dist/assets/{is-xS1WTyeC.js → is-B_7jXZfS.js} +1 -1
- package/dist/assets/isSameWeek-D90tBsli.js +1 -0
- package/dist/assets/{it-C2i_c9sd.js → it-CBM0J9cD.js} +1 -1
- package/dist/assets/{it-CH-l516ZNXj.js → it-CH-BQltCNsR.js} +1 -1
- package/dist/assets/{ja-D9_ewLny.js → ja-DBjnsx21.js} +1 -1
- package/dist/assets/{ja-Hira-D_6ExgHw.js → ja-Hira-BZfSmj1i.js} +1 -1
- package/dist/assets/{ka-BYHGyees.js → ka-HwpuKgUY.js} +1 -1
- package/dist/assets/{kk-CbTFtuqb.js → kk-DLKA9paj.js} +1 -1
- package/dist/assets/{km-Dr2gwhIn.js → km-BU5kermq.js} +1 -1
- package/dist/assets/{kn-CprH8JD7.js → kn-BNFqbCoi.js} +1 -1
- package/dist/assets/{ko-CsFS2u5i.js → ko-D8n4uMqQ.js} +1 -1
- package/dist/assets/{lb-CbFKN7Ob.js → lb-B1empQ7m.js} +1 -1
- package/dist/assets/{lt-Bq0xkLp0.js → lt-gMukpK3G.js} +1 -1
- package/dist/assets/{lv-Cj6vg6Qo.js → lv-D2O5AnsZ.js} +1 -1
- package/dist/assets/{match-CiPp9BME.js → match-BTF6WqJh.js} +1 -1
- package/dist/assets/{match-C_jFGO9e.js → match-Cyum2eeW.js} +1 -1
- package/dist/assets/{match-Co4ivumx.js → match-ScHH8kYk.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-D4H6EVJQ.js +1 -0
- package/dist/assets/metadata-admin-CEhVmXFv.js +9 -0
- package/dist/assets/{mk-MXFM99YL.js → mk-D-Zl0xVN.js} +1 -1
- package/dist/assets/{mn-D5Q9B6Jt.js → mn-jJbTslgD.js} +1 -1
- package/dist/assets/{ms-CCzPRldx.js → ms-CUuJHLA4.js} +1 -1
- package/dist/assets/{mt-mjJpN6xW.js → mt-yIcbfxKY.js} +1 -1
- package/dist/assets/{nb-BIlNqdEb.js → nb-D9WNypoj.js} +1 -1
- package/dist/assets/{nl-BE-FwXjQsmV.js → nl-BE-B1vKiw2h.js} +1 -1
- package/dist/assets/{nl-D2uBtIxG.js → nl-DC7b5e90.js} +1 -1
- package/dist/assets/{nn-B0loJ7SV.js → nn-uP4yJ9s0.js} +1 -1
- package/dist/assets/{oc-U7-yH1sO.js → oc-DHTqadJI.js} +1 -1
- package/dist/assets/{pl-mTy0JYgi.js → pl-Bxnnizf5.js} +1 -1
- package/dist/assets/plugin-calendar-b7C35ANT.js +1 -0
- package/dist/assets/plugin-charts-b-yVtmdI.js +7 -0
- package/dist/assets/plugin-chatbot-D1KW_oIO.js +122 -0
- package/dist/assets/plugin-dashboard-DTkPoPEb.js +6 -0
- package/dist/assets/plugin-form-UIRm-FpQ.js +1 -0
- package/dist/assets/plugin-gantt-9dtc8zzX.js +63 -0
- package/dist/assets/plugin-grid-Cp4RKtMJ.js +10 -0
- package/dist/assets/plugin-kanban-B2JOPZIJ.js +1 -0
- package/dist/assets/plugin-map-CBJcVJYk.js +1 -0
- package/dist/assets/{plugin-markdown-D1nTQc1T.js → plugin-markdown-CNlDzqP-.js} +1 -1
- package/dist/assets/plugin-report-IZzgQb-Q.js +59 -0
- package/dist/assets/plugin-timeline-DsmtjcJ3.js +1 -0
- package/dist/assets/plugin-tree-DTRPBdhe.js +1 -0
- package/dist/assets/plugin-view-D9ixsNDG.js +1 -0
- package/dist/assets/plugins-views-CnvkdSJK.js +3 -0
- package/dist/assets/{pt-BR-2KtO5Js1.js → pt-BR-D416seHT.js} +1 -1
- package/dist/assets/{pt-Bet5OOQf.js → pt-DwHBy9_c.js} +1 -1
- package/dist/assets/{ro-37U6sgzi.js → ro-DDf1X3Np.js} +1 -1
- package/dist/assets/{ru-CyuAY-5E.js → ru-8eM3mcgK.js} +1 -1
- package/dist/assets/{runtime-metadata-persistence-afAW-MeD.js → runtime-metadata-persistence-DX29lQ62.js} +1 -1
- package/dist/assets/{se-DeJabuC6.js → se-D4JvQeRX.js} +1 -1
- package/dist/assets/{sk-DWEpjfkR.js → sk-DvpgttGI.js} +1 -1
- package/dist/assets/{sl-4oSvNhIR.js → sl-B3gCZ-_a.js} +1 -1
- package/dist/assets/{sq-BjkBCaXW.js → sq-CVaTmL0V.js} +1 -1
- package/dist/assets/{sr-Dxm1DsRS.js → sr-CnH5Ffyz.js} +1 -1
- package/dist/assets/{sr-Latn-Dawg6oP2.js → sr-Latn-Dw9w61q6.js} +1 -1
- package/dist/assets/src-BUry7633.js +2 -0
- package/dist/assets/{src-C8NYjdVm.js → src-DMDT5a27.js} +1 -1
- package/dist/assets/src-ZxH3AOCu.js +16 -0
- package/dist/assets/{studioEntry-nXQP3iL0.js → studioEntry-DAqcBFtr.js} +1 -1
- package/dist/assets/{submitRedirect-jK-cEIbP.js → submitRedirect-iy0oOi7I.js} +1 -1
- package/dist/assets/{sv-CROOGJGz.js → sv-CU7wdxyK.js} +1 -1
- package/dist/assets/{ta-BZnTmFI_.js → ta-DPH6q0HR.js} +1 -1
- package/dist/assets/{te-BN0v0x5t.js → te-BSaThkGV.js} +1 -1
- package/dist/assets/{th-CBjKhp_U.js → th-NXP8_Qb8.js} +1 -1
- package/dist/assets/{tr-x0Ne4N4H.js → tr-DDXoH663.js} +1 -1
- package/dist/assets/types-zod-ChJ30y25.js +1 -0
- package/dist/assets/{ug-sgzNhsKo.js → ug-Guus6pPe.js} +1 -1
- package/dist/assets/ui-components-D8wcRNrt.js +37 -0
- package/dist/assets/ui-layout-BYO3rRIl.js +1 -0
- package/dist/assets/{uk-o_DQ5VHJ.js → uk-uiy4vsp8.js} +1 -1
- package/dist/assets/use-book-data-DFTswcKm.js +1 -0
- package/dist/assets/{useActionModal-CSvbHkQ7.js → useActionModal-h52Z5Pkl.js} +1 -1
- package/dist/assets/useCanAuthorMetadata-TDrVrYGB.js +1 -0
- package/dist/assets/useDatasetCatalog-BOd0Ybr1.js +1 -0
- package/dist/assets/useNavSelDeepLink-67Y4qCNO.js +1 -0
- package/dist/assets/useNavTargetLabel-D8lRdb6O.js +1 -0
- package/dist/assets/useOpenRecordList-C7oqUD3F.js +1 -0
- package/dist/assets/{usePackageL10n-CMx66am-.js → usePackageL10n-Jl2XiF2F.js} +1 -1
- package/dist/assets/{useSettingsLabel-Kkr2q0Oo.js → useSettingsLabel-CSpBDTdy.js} +1 -1
- package/dist/assets/{uz-Cyrl-DbtkQtz_.js → uz-Cyrl-Cmb5bvbf.js} +1 -1
- package/dist/assets/{uz-Be41d4jl.js → uz-DJWxoTz4.js} +1 -1
- package/dist/assets/vendor-objectstack-C4eD5dbT.js +139 -0
- package/dist/assets/{vi-84mZmklk.js → vi-Bb3QoIJC.js} +1 -1
- package/dist/assets/{zh-CN-DD1reegJ.js → zh-CN-C-Hts1ZR.js} +1 -1
- package/dist/assets/{zh-HK-B05u30WI.js → zh-HK-CtBAZ_ZS.js} +1 -1
- package/dist/assets/{zh-TW-Bb-WimPD.js → zh-TW-B7DDahD-.js} +1 -1
- package/dist/chunk-membership.json +116 -104
- package/dist/eager-closure.json +126 -120
- package/dist/index.html +4 -4
- package/dist/sdui.manifest.json +998 -115
- package/package.json +1 -1
- package/dist/assets/AppDocsIndex-F4zDq2zz.js +0 -1
- package/dist/assets/ApprovalsInboxPage-DrEUmaDb.js +0 -1
- package/dist/assets/CreateViewDialog-xyKlpLEW.js +0 -1
- package/dist/assets/DashboardView-CGC-_Om8.js +0 -1
- package/dist/assets/DocPage-CIZE5kdj.js +0 -1
- package/dist/assets/DocsSlug-DXdFdwlS.js +0 -1
- package/dist/assets/ExpressionProvider-DZfMwyMs.js +0 -1
- package/dist/assets/FlowRunsPage-CvY3nJMF.js +0 -1
- package/dist/assets/InterfaceListPage-BdECC_i3.js +0 -1
- package/dist/assets/MarketplacePackagePage-C7NOu2Ir.js +0 -4
- package/dist/assets/ObjectDataPage-BIzp65Mo.js +0 -1
- package/dist/assets/PageView-CVLgCRSF.js +0 -1
- package/dist/assets/ProfilePage-D2qGgxPK.js +0 -1
- package/dist/assets/RecordDetailView-DQKydU7X.js +0 -3
- package/dist/assets/RecordFormPage-BTjwxJIA.js +0 -1
- package/dist/assets/ReportDefaultInspector-DdsQAkd7.js +0 -1
- package/dist/assets/ReportView-GIdKJdOt.js +0 -2
- package/dist/assets/RuntimeDraftBar-BbMdi3Kp.js +0 -1
- package/dist/assets/SchemaForm-C8X1ve4p.js +0 -3
- package/dist/assets/SearchResultsPage-Jwhqsdyo.js +0 -1
- package/dist/assets/SettingsView-D8SMKdrc.js +0 -1
- package/dist/assets/app-shell-eager-leaves-CDVclng4.js +0 -1
- package/dist/assets/appRoute-DbnWDEa1.js +0 -1
- package/dist/assets/data-adapter-DMbe6Njk.js +0 -1
- package/dist/assets/default-inspector-registry-CpL3fFhl.js +0 -1
- package/dist/assets/dist-BXrEV1ag.js +0 -13
- package/dist/assets/drillUrlFilters-hi-2d3DW.js +0 -1
- package/dist/assets/en-AU-C6x7mDhH.js +0 -1
- package/dist/assets/en-GB-0-nho2eK.js +0 -1
- package/dist/assets/en-IE-2fC3BkfV.js +0 -1
- package/dist/assets/en-IN-C1QcFhxn.js +0 -1
- package/dist/assets/en-NZ-C80ptZT7.js +0 -1
- package/dist/assets/en-ZA-ByZDrjeb.js +0 -1
- package/dist/assets/framework-DcWkeiND.js +0 -35
- package/dist/assets/i18n-CEKxYdmD.js +0 -9
- package/dist/assets/i18n-locale-ar-DN7sl3GF.js +0 -4
- package/dist/assets/i18n-locale-de-C40JErvb.js +0 -4
- package/dist/assets/i18n-locale-en-CITPDIHy.js +0 -4
- package/dist/assets/i18n-locale-es-C8DdWN6c.js +0 -4
- package/dist/assets/i18n-locale-fr-COIdEZZl.js +0 -4
- package/dist/assets/i18n-locale-ja-DYF_rU_s.js +0 -4
- package/dist/assets/i18n-locale-ko-B-ODYAtX.js +0 -4
- package/dist/assets/i18n-locale-pt-CK1SyBIm.js +0 -4
- package/dist/assets/i18n-locale-ru-jLzvShMO.js +0 -4
- package/dist/assets/i18n-locale-zh-Bf9Gbbvl.js +0 -4
- package/dist/assets/i18n-runtime-CTgAQF4N.js +0 -1
- package/dist/assets/index-CLyvpiGc.css +0 -2
- package/dist/assets/index-CfnfGw5W.js +0 -20
- package/dist/assets/isSameWeek-DWYeNyh8.js +0 -1
- package/dist/assets/mermaid-GHXKKRXX-DVLc_uym.js +0 -1
- package/dist/assets/metadata-admin-CybaOCdO.js +0 -9
- package/dist/assets/nav-selection-Dzm_mA3C.js +0 -1
- package/dist/assets/plugin-calendar-CKRBcML7.js +0 -1
- package/dist/assets/plugin-charts-DGTJxXCB.js +0 -7
- package/dist/assets/plugin-chatbot-DwtwNA-y.js +0 -122
- package/dist/assets/plugin-dashboard-C1AYKmGX.js +0 -6
- package/dist/assets/plugin-form-CV8ZY04-.js +0 -1
- package/dist/assets/plugin-gantt-BRIb2_8G.js +0 -63
- package/dist/assets/plugin-grid-C9h7mRVv.js +0 -11
- package/dist/assets/plugin-kanban-BcJ0Dhys.js +0 -1
- package/dist/assets/plugin-map-D24ZUOUj.js +0 -1
- package/dist/assets/plugin-report-BfGintAq.js +0 -59
- package/dist/assets/plugin-timeline-CbBRq_qt.js +0 -1
- package/dist/assets/plugin-tree-BNX2A5J5.js +0 -1
- package/dist/assets/plugin-view-DzWQWYyH.js +0 -1
- package/dist/assets/plugins-views-DraK4xz0.js +0 -3
- package/dist/assets/src-B8lv0plz.js +0 -18
- package/dist/assets/src-DoDvT77T.js +0 -1
- package/dist/assets/types-zod-Y2RwUUeJ.js +0 -1
- package/dist/assets/ui-components-BTB1NkUW.js +0 -37
- package/dist/assets/ui-layout-bZfafwJa.js +0 -1
- package/dist/assets/use-book-data-C3eyZJSG.js +0 -1
- package/dist/assets/useOpenRecordList-B5-qaFUx.js +0 -1
- package/dist/assets/vendor-objectstack-XuWC71M9.js +0 -266
- package/dist/assets/vendor-zod-CHLW1iCr.js +0 -64
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{h as n,t as r,v as i}from"./vendor-react-BggL7APJ.js";import{$ as a,A as o,Ar as s,Bn as c,Br as l,Dn as u,Hr as d,Mr as f,Nr as p,Pr as m,Ur as h,Vr as g,bt as _,d as v,dt as y,f as b,j as x,jr as S,kr as C,ni as w,nt as T,p as E,qn as D,v as O,vi as k,vt as ee,xt as te,yt as ne,zr as A}from"./ui-components-BTB1NkUW.js";import{At as re,Dr as ie,Er as j,Hi as M,J as N,Lr as P,Oi as F,Pr as I,Pt as ae,Sr as oe,Ui as L,Wi as R,Y as z,ct as se,ft as ce,g as le,i as ue,ji as de,kt as fe,l as pe,o as me,s as he,ut as ge,v as _e,wi as ve}from"./framework-DcWkeiND.js";import{g as ye,h as B,p as be}from"./i18n-runtime-CTgAQF4N.js";import{r as xe}from"./vendor-ui-utils-DIUdEYii.js";import{t as Se}from"./vendor-icon-check-vpu9Zukp.js";import{t as V}from"./vendor-icon-chevron-down-BEf_jTEE.js";import{t as Ce}from"./vendor-icon-file-text-7BKAVNof.js";import{t as H}from"./vendor-icon-plus-BlfcDDsa.js";import{t as we}from"./vendor-icon-x-CcLtgRNL.js";import{_ as U,c as Te,d as W,f as Ee,l as De,m as Oe,o as G,s as K,t as q,v as ke,y as J}from"./vendor-dndkit-CqQIoA27.js";import{c as Ae,o as je}from"./plugin-grid-C9h7mRVv.js";var Y=e(i(),1),Me=(0,Y.createContext)(!0);function Ne(){return(0,Y.useContext)(Me)}var Pe=t({default:()=>Je}),X=r(),Z=(...e)=>e.filter(Boolean).join(` `),Q=B({"kanban.addCard":`Add card`,"kanban.noCards":`No cards`,"kanban.cardTitlePlaceholder":`Enter card title…`},`kanban.noCards`),Fe=`Uncategorized`,Ie=`data-swimlane-scroll-row`,Le=`px-2 pl-36 sm:pl-44`;function Re(e,t,n,r){return oe(e,t,n,r)}function ze({card:e,onCardClick:t,conditionalFormatting:n,objectFields:r}){let{attributes:i,listeners:a,setNodeRef:o,transform:s,transition:c,isDragging:u}=G({id:e.id}),f={transform:J.Transform.toString(s),transition:c,opacity:u?.5:void 0},p=Re(e,n,ae(),r);return(0,X.jsx)(`div`,{ref:o,style:f,...i,...a,role:`listitem`,"aria-label":e.title,onClick:n=>t?.(e,n),children:(0,X.jsxs)(A,{className:`mb-2 cursor-grab active:cursor-grabbing border-border border-l-4 border-l-primary/40 bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group touch-manipulation`,style:p,children:[e.coverImage&&(0,X.jsx)(`div`,{className:`w-full h-32 overflow-hidden rounded-t-lg`,children:(0,X.jsx)(`img`,{src:e.coverImage,alt:``,className:`w-full h-full object-cover`,loading:`lazy`})}),(0,X.jsxs)(d,{className:`p-2 sm:p-4 pb-2`,children:[(0,X.jsx)(h,{className:`text-xs sm:text-sm font-semibold tracking-tight text-foreground group-hover:text-primary transition-colors leading-snug line-clamp-2`,children:e.title}),!(e.cardFieldCells&&e.cardFieldCells.length>0)&&(e.cardSubtitle??e.description)&&(0,X.jsx)(g,{className:`text-xs text-muted-foreground line-clamp-2 sm:line-clamp-none`,children:e.cardSubtitle??e.description})]}),(e.cardFieldCells&&e.cardFieldCells.length>0||e.badges&&e.badges.length>0)&&(0,X.jsxs)(l,{className:`p-2 sm:p-4 pt-0 space-y-1.5`,children:[e.cardFieldCells&&e.cardFieldCells.length>0&&(0,X.jsx)(`dl`,{className:`space-y-1 text-xs`,children:e.cardFieldCells.map(e=>(0,X.jsxs)(`div`,{className:`min-w-0 truncate text-foreground/85`,title:e.label||e.field,children:[(0,X.jsx)(`dt`,{className:`sr-only`,children:e.label||e.field}),(0,X.jsx)(`dd`,{className:`min-w-0 truncate`,children:e.node})]},e.field))}),e.badges&&e.badges.length>0&&(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.badges.map((e,t)=>(0,X.jsx)(w,{variant:e.colorClass?`outline`:e.variant||`default`,className:Z(`text-xs font-normal`,e.colorClass),style:e.colorStyle,children:e.label},t))})]})]})})}function Be({columnId:e,onAdd:t}){let{t:n}=Q(),[r,i]=Y.useState(!1),[a,o]=Y.useState(``),s=Y.useRef(null),c=()=>{let n=a.trim();n&&(t(e,n),o(``)),i(!1)};return r?(0,X.jsx)(`div`,{className:`mt-2 space-y-2`,children:(0,X.jsx)(D,{ref:s,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),c()):e.key===`Escape`&&(o(``),i(!1))},onBlur:c,placeholder:n(`kanban.cardTitlePlaceholder`),className:`text-sm`,autoFocus:!0})}):(0,X.jsxs)(k,{variant:`ghost`,size:`sm`,className:`w-full mt-2 text-muted-foreground hover:text-foreground`,onClick:()=>{i(!0),setTimeout(()=>s.current?.focus(),0)},children:[(0,X.jsx)(H,{className:`h-4 w-4 mr-1`}),n(`kanban.addCard`)]})}function Ve(e){return e&&e.width!=null?`shrink-0`:`w-[85vw] sm:w-80 shrink-0`}var He=56;function Ue(e,t){return t?{className:`shrink-0`,style:{...e,width:He}}:{className:Ve(e),style:e}}function We({column:e,collapsed:t,collapsible:n,onToggle:r,className:i}){return n?(0,X.jsxs)(`button`,{type:`button`,className:Z(`inline-flex items-center gap-1 min-w-0 hover:text-foreground transition-colors`,t&&`flex-col`,i),"aria-expanded":!t,onClick:r,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:Z(`text-[10px] transition-transform shrink-0`,t?``:`rotate-90`),children:`▶`}),(0,X.jsx)(`span`,{className:Z(`truncate`,t&&`[writing-mode:vertical-rl] rotate-180`),children:e.title})]}):i?(0,X.jsx)(`span`,{className:i,children:e.title}):(0,X.jsx)(X.Fragment,{children:e.title})}function Ge(e,t){return t?`${e}+`:String(e)}function Ke({column:e,cards:t,onCardClick:n,quickAdd:r,onQuickAdd:i,conditionalFormatting:a,objectFields:o,columnStyle:s,suppressEmptyPlaceholder:l,countsAreWindowed:u,collapsed:d,onToggleCollapse:f}){let{t:p}=Q(),m=t||[],{setNodeRef:h,isOver:g}=G({id:e.id,data:{type:`column`}}),_=e.limit&&m.length>=e.limit,v=d===!0,y=Ue(s,v);return(0,X.jsxs)(`div`,{ref:h,role:`group`,"aria-label":e.title,style:y.style,className:Z(`relative flex flex-col rounded-xl border border-border/60 bg-muted/15 snap-start max-h-full min-h-0 transition-all duration-200 shadow-sm hover:shadow-md overflow-hidden`,y.className,g&&`ring-2 ring-primary/60 bg-primary/5`,e.className),children:[(0,X.jsx)(`div`,{className:Z(`border-b border-border/40`,v?`px-1 py-3`:`px-3 sm:px-4 pt-3 pb-2.5`),children:(0,X.jsxs)(`div`,{className:Z(`flex gap-2`,v?`flex-col items-center`:`items-center justify-between`),children:[(0,X.jsx)(`h3`,{id:`kanban-col-${e.id}`,className:Z(`text-xs sm:text-[13px] font-semibold tracking-tight truncate text-foreground/85 uppercase`,v&&`min-w-0`),children:(0,X.jsx)(We,{column:e,collapsed:v,collapsible:f!=null,onToggle:()=>f?.()})}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,X.jsxs)(`span`,{className:Z(`inline-flex items-center justify-center min-w-[22px] h-[20px] px-1.5 rounded-md text-[11px] font-medium tabular-nums`,_?`bg-destructive/10 text-destructive ring-1 ring-inset ring-destructive/30`:`bg-muted/70 text-muted-foreground`),children:[Ge(m.length,u),e.limit&&(0,X.jsx)(`span`,{className:`text-muted-foreground/70 font-normal`,children:` / ${e.limit}`})]}),_&&(0,X.jsx)(w,{variant:`destructive`,className:`text-[10px] h-[20px] px-1.5`,children:`Full`})]})]})}),!v&&(0,X.jsxs)(c,{className:`flex-1 p-4`,children:[(0,X.jsx)(q,{items:m.map(e=>e.id),strategy:K,children:(0,X.jsxs)(`div`,{className:`space-y-2`,role:`list`,"aria-label":`${e.title} cards`,children:[m.length===0&&!l&&(0,X.jsxs)(`div`,{className:Z(`flex flex-col items-center justify-center py-6 rounded-md border-2 border-dashed transition-colors gap-1`,g?`border-primary/60 bg-primary/10 text-primary`:`border-border/40 text-muted-foreground/60`),children:[!g&&r&&i&&(0,X.jsx)(H,{className:`h-3.5 w-3.5 opacity-60`,"aria-hidden":!0}),(0,X.jsxs)(`span`,{className:`text-xs`,children:[g?`↓ `:``,p(`kanban.noCards`)]})]}),m.map(e=>(0,X.jsx)(ze,{card:e,onCardClick:n,conditionalFormatting:a,objectFields:o},e.id))]})}),r&&i&&(0,X.jsx)(Be,{columnId:e.id,onAdd:i})]})]})}function qe({children:e}){let t=N();return(0,X.jsx)(X.Fragment,{children:e(t)})}function Je({columns:e,onCardMove:t,onCardClick:n,className:r,quickAdd:i,onQuickAdd:a,coverImageField:o,conditionalFormatting:s,objectFields:c,swimlaneField:l,countsAreWindowed:u}){return z()?(0,X.jsx)(qe,{children:d=>(0,X.jsx)(Ye,{columns:e,onCardMove:t,onCardClick:n,className:r,dnd:d,quickAdd:i,onQuickAdd:a,coverImageField:o,conditionalFormatting:s,objectFields:c,swimlaneField:l,countsAreWindowed:u})}):(0,X.jsx)(Ye,{columns:e,onCardMove:t,onCardClick:n,className:r,dnd:null,quickAdd:i,onQuickAdd:a,coverImageField:o,conditionalFormatting:s,objectFields:c,swimlaneField:l,countsAreWindowed:u})}function Ye({columns:e,onCardMove:t,onCardClick:n,className:r,dnd:i,quickAdd:a,onQuickAdd:o,coverImageField:s,conditionalFormatting:c,objectFields:l,swimlaneField:u,countsAreWindowed:d}){let{t:f}=Q(),[p,m]=Y.useState(null),h=Ne(),g=Y.useRef(null),{width:_}=T(g),v=Y.useMemo(()=>_?_<480?{width:Math.max(_-32,220)}:_<720?{width:280}:{width:320}:{},[_]),b=u?`objectui:kanban-collapsed:${u}`:null,[x,S]=Y.useState(()=>{if(!b)return new Set;try{let e=localStorage.getItem(b);if(e){let t=JSON.parse(e);if(Array.isArray(t))return new Set(t.filter(e=>typeof e==`string`))}}catch{}return new Set}),[C,w]=Y.useState(()=>new Map),E=Y.useCallback(e=>C.get(String(e.id))??e.collapsed===!0,[C]),D=Y.useCallback((e,t)=>{w(n=>{let r=new Map(n);return r.set(String(e),t),r})},[]),O=Y.useMemo(()=>(e||[]).map(e=>({...e,cards:e.cards||[]})),[e]),[k,ee]=Y.useState(O),[te,ne]=Y.useState(O);te!==O&&(ne(O),ee(O));let A=Y.useMemo(()=>{if(!u)return null;let e=k.flatMap(e=>e.cards),t=new Set;return e.forEach(e=>{let n=e[u];t.add(n==null?Fe:String(n))}),Array.from(t).sort()},[k,u]),re=Y.useCallback(e=>{S(t=>{let n=new Set(t);if(n.has(e)?n.delete(e):n.add(e),b)try{localStorage.setItem(b,JSON.stringify([...n]))}catch{}return n})},[b]),ie=ke(U(W,{activationConstraint:{distance:5}}),U(Ee,{activationConstraint:{delay:200,tolerance:5}})),j=e=>{let{active:t}=e,n=N(t.id);if(m(n),i&&n){let e=P(n.id);e&&i.startDrag({id:n.id,type:`kanban-card`,data:n,sourceId:e.id})}},M=e=>{let{active:n,over:r}=e;if(m(null),!r){i&&i.endDrag();return}let a=n.id,o=r.id;if(a===o){i&&i.endDrag();return}let s=P(a),c=P(o)||F(o);if(!s||!c){i&&i.endDrag();return}if(s.id!==c.id){let e=[...s.cards],n=[...c.cards],r=e.findIndex(e=>e.id===a),i=o===c.id?n.length:n.findIndex(e=>e.id===o),[l]=e.splice(r,1);n.push(l),ee(t=>t.map(t=>t.id===s.id?{...t,cards:e}:t.id===c.id?{...t,cards:n}:t)),t&&t(a,s.id,c.id,i)}i&&i.endDrag(c.id)},N=Y.useCallback(e=>{for(let t of k){let n=t.cards.find(t=>t.id===e);if(n)return n}return null},[k]),P=Y.useCallback(e=>k.find(t=>t.cards.some(t=>t.id===e))||null,[k]),F=Y.useCallback(e=>k.find(t=>t.id===e)||null,[k]),I=Y.useRef(null),[ae,oe]=Y.useState(0);Y.useEffect(()=>{let e=I.current;if(!e)return;let t=()=>{let t=e.clientWidth;if(t<=0)return;let n=Math.round(e.scrollLeft/t);oe(Math.max(0,Math.min(k.length-1,n)))};return t(),e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},[k.length]);let L=Y.useRef(0),R=Y.useCallback(e=>{let t=e.currentTarget,n=t.scrollLeft;if(n===L.current)return;L.current=n;let r=g.current;if(r)for(let e of r.querySelectorAll(`[${Ie}]`))e!==t&&e.scrollLeft!==n&&(e.scrollLeft=n)},[]),z=Y.useCallback(e=>{e&&e.scrollLeft!==L.current&&(e.scrollLeft=L.current)},[]);return(0,X.jsxs)(Te,{sensors:ie,collisionDetection:Oe,onDragStart:j,onDragEnd:M,children:[(0,X.jsxs)(`div`,{ref:g,className:`flex flex-col min-w-0 min-h-0 h-full`,children:[k.length>1&&(0,X.jsx)(`div`,{className:`flex sm:hidden items-center justify-center gap-1.5 px-3 pb-2`,"aria-hidden":!0,children:k.map((e,t)=>(0,X.jsx)(`span`,{className:Z(`h-1.5 rounded-full transition-all`,t===ae?`w-4 bg-foreground/70`:`w-1.5 bg-muted-foreground/30`)},e.id))}),(()=>{let e=k.reduce((e,t)=>e+(t.cards?.length||0),0)===0;return(0,X.jsxs)(X.Fragment,{children:[e&&h&&(0,X.jsx)(`div`,{className:`px-4 sm:px-6 pt-3`,children:(0,X.jsx)(y,{role:`status`,"aria-live":`polite`,showIcon:!1,className:`rounded-lg border border-dashed border-border/60 bg-muted/10 py-8 gap-2 [&>h3]:text-sm [&>h3]:font-medium [&>h3]:text-foreground/80`,title:f(`kanban.noCards`)})}),A?(0,X.jsxs)(`div`,{className:Z(`flex flex-col gap-2 px-4 sm:px-6 pb-3 sm:pb-4 min-w-0 overflow-x-hidden overflow-y-auto`,r),role:`region`,"aria-label":`Kanban board with swimlanes`,children:[(0,X.jsx)(`div`,{className:`flex shrink-0 gap-3 sm:gap-4 ${Le} pt-3 sm:pt-4 overflow-x-auto sticky top-0 z-10 bg-background`,ref:z,onScroll:R,"data-swimlane-scroll-row":``,children:k.map(e=>{let t=E(e),n=Ue(v,t);return(0,X.jsxs)(`div`,{style:n.style,className:Z(n.className,`text-center`),children:[(0,X.jsx)(We,{column:e,collapsed:t,collapsible:e.collapsed===!0,onToggle:()=>D(e.id,!t),className:` text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase`}),!t&&(0,X.jsxs)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:[`(`,Ge(e.cards.length,d),`)`]})]},e.id)})}),A.map(e=>{let t=x.has(e),r=k.reduce((t,n)=>t+n.cards.filter(t=>(t[u]==null?Fe:String(t[u]))===e).length,0);return(0,X.jsxs)(`div`,{className:`border rounded-lg bg-muted/10`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-muted/30 transition-colors`,onClick:()=>re(e),"aria-expanded":!t,children:[(0,X.jsx)(`span`,{className:Z(`transition-transform text-xs`,t?``:`rotate-90`),children:`▶`}),(0,X.jsx)(`span`,{className:` text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:e}),(0,X.jsxs)(`span`,{className:` text-xs text-muted-foreground`,children:[`(`,Ge(r,d),`)`]})]}),!t&&(0,X.jsx)(`div`,{className:`flex gap-3 sm:gap-4 overflow-x-auto ${Le} pb-3`,ref:z,onScroll:R,"data-swimlane-scroll-row":``,children:k.map(t=>{let r=t.cards.filter(t=>(t[u]==null?Fe:String(t[u]))===e),i=E(t),a=Ue(v,i);return(0,X.jsx)(`div`,{style:a.style,className:Z(a.className,`min-h-[60px] rounded-md bg-card/20 p-2`),children:!i&&(0,X.jsx)(q,{items:r.map(e=>e.id),strategy:K,children:(0,X.jsx)(`div`,{className:`space-y-2`,role:`list`,"aria-label":`${t.title} - ${e} cards`,children:r.map(e=>(0,X.jsx)(ze,{card:e,onCardClick:n,conditionalFormatting:c,objectFields:l},e.id))})})},t.id)})})]},e)})]}):(0,X.jsx)(`div`,{ref:I,className:Z(`flex gap-3 sm:gap-4 overflow-x-auto snap-x snap-mandatory px-4 sm:px-6 py-3 sm:py-4 [-webkit-overflow-scrolling:touch] min-w-0 min-h-0 h-full`,r),role:`region`,"aria-label":`Kanban board`,children:k.map(t=>(0,X.jsx)(Ke,{column:t,cards:t.cards,onCardClick:n,quickAdd:a,onQuickAdd:o,conditionalFormatting:c,objectFields:l,columnStyle:v,suppressEmptyPlaceholder:e||!h,countsAreWindowed:d,collapsed:E(t),onToggleCollapse:t.collapsed===!0?()=>D(t.id,!E(t)):void 0},t.id))})]})})()]}),(0,X.jsx)(De,{dropAnimation:{duration:200,easing:`cubic-bezier(0.18, 0.67, 0.6, 1.22)`},children:(0,X.jsx)(`div`,{"aria-live":`assertive`,"aria-label":p?`Dragging ${p.title}`:void 0,className:Z(p&&`motion-safe:rotate-2 motion-safe:scale-[1.03] motion-safe:transition-transform shadow-2xl shadow-primary/25 ring-1 ring-primary/40 rounded-xl cursor-grabbing`),children:p?(0,X.jsx)(ze,{card:p,conditionalFormatting:c,objectFields:l}):null})})]})}function Xe(e,t,n,r){if(!e||!t)return[];let i={...t,[n]:r},a=[];for(let[r,o]of Object.entries(e)){if(r===n||!o||typeof o!=`object`)continue;let e=o;if(e.requiredWhen==null||!M(t[r]))continue;let s=j({visibleWhen:e.visibleWhen,readonlyWhen:e.readonlyWhen,requiredWhen:e.requiredWhen},i,{required:e.required===!0,readonly:e.readonly===!0},t,void 0,`field '${r}'`);s.required&&s.visible&&!s.readonly&&x(e.type)&&a.push({name:r,def:{name:r,...e}})}return a}function Ze({open:e,fields:t,submitting:n,onCancel:r,onSubmit:i}){let a=ye(),[c,l]=Y.useState({}),[u,d]=Y.useState(!1),h=t.filter(e=>M(c[e.name]));return(0,X.jsx)(C,{open:e,onOpenChange:e=>{e||r()},children:(0,X.jsxs)(s,{className:`sm:max-w-md`,children:[(0,X.jsxs)(p,{children:[(0,X.jsx)(m,{children:a(`kanban.requiredFieldsTitle`,`Complete required fields`)}),(0,X.jsx)(S,{children:a(`kanban.requiredFieldsDescription`,`This move makes the fields below required. Fill them in to continue.`)})]}),(0,X.jsx)(`div`,{className:`flex flex-col gap-4 py-2`,children:t.map(e=>{let t=M(c[e.name]);return(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`span`,{className:`text-sm font-medium`,children:[e.label,(0,X.jsx)(`span`,{className:`text-destructive ml-0.5`,"aria-hidden":`true`,children:`*`})]}),(0,X.jsx)(o,{field:e.def,value:c[e.name],onChange:t=>l(n=>({...n,[e.name]:t})),readonly:n,error:u&&t?a(`common.required`,`Required`):void 0}),u&&t&&(0,X.jsx)(`span`,{className:`text-xs text-destructive`,children:a(`common.required`,`Required`)})]},e.name)})}),(0,X.jsxs)(f,{children:[(0,X.jsx)(k,{variant:`outline`,onClick:r,disabled:n,children:a(`common.cancel`,`Cancel`)}),(0,X.jsx)(k,{onClick:()=>{if(h.length>0){d(!0);return}i(c)},disabled:n,children:a(`kanban.moveCard`,`Move card`)})]})]})})}var Qe={"detail.recordDetail":`Record Detail`,"detail.recordDetailWithLabel":`{{label}} Detail`};function $e(e){return typeof e==`number`&&Number.isInteger(e)&&e>0}function et(e,t){return $e(e)?e:t}function tt(e,t){return e==null||$e(e)?null:`[ObjectUI] ObjectKanban row cap: ${typeof t==`string`&&t?`object-kanban on ${t}`:`object-kanban`} declared limit: ${String(e)}, which is not a positive integer. A row cap must be a positive integer (the spec refuses zero and negative values), so it was ignored and this board fell back to its default row cap (100).`}var nt=B(Qe,`detail.recordDetail`);function rt(e,t){if(Array.isArray(e)&&e.length>0)return e;let n=t?.highlightFields;return Array.isArray(n)?n.filter(e=>!!t?.fields?.[e]):[]}function it(e){if(e?.cardTitle)return e.cardTitle;if(e?.titleField)return e.titleField}var $=({schema:e,dataSource:t,className:n,data:r,loading:i,onRowClick:o,onCardClick:s,...c})=>{let{translateOptions:l,fieldLabel:u}=be(),d=ye(),{t:f}=nt(),p=Array.isArray(r),[m,h]=(0,Y.useState)([]),[g,y]=(0,Y.useState)(!1),x=e.objectName??``,{ready:S,def:C}=_e(x,t),[w,T]=(0,Y.useState)(p?i??!1:!1),[D,k]=(0,Y.useState)(null),[A,re]=(0,Y.useState)(0),j=fe(e.bind),M=a(),[N,ae]=(0,Y.useState)(null),oe=!(!p&&!j&&!e.data&&e.objectName&&t&&typeof t.find==`function`)||N!==null&&N.key===x;(0,Y.useEffect)(()=>{if(!p&&t?.onMutation&&e.objectName)return t.onMutation(t=>{t.resource===e.objectName&&re(e=>e+1)})},[t,e.objectName,p]),(0,Y.useEffect)(()=>{p&&i!==void 0&&T(i)},[i,p]),(0,Y.useEffect)(()=>{let t=tt(e.limit,e.objectName);t&&console.warn(t)},[e.limit,e.objectName]);let L=JSON.stringify(e.sort??null),R=ce(),z=ge(e.filter,R),pe=le(!p&&!j&&!e.data&&e.objectName||void 0);(0,Y.useEffect)(()=>{if(p||!S)return;let n=!0,r=()=>{n&&ae(e=>e!==null&&e.key===x?e:{key:x})};return e.objectName&&!j&&!e.data&&(async()=>{if(!t||typeof t.find!=`function`||!e.objectName){r();return}n&&T(!0);try{let r=ve(C?.fields),i=M?.isLoaded?r.filter(t=>M.checkField(e.objectName,t,`read`)):r,a={$filter:z,$orderby:ie(e.sort),$top:et(e.limit,100),...i.length>0?{$expand:i}:{}},o=await t.find(e.objectName,a),s=de(o);n&&(h(s),y(s.length>=a.$top),k(null))}catch(e){console.error(`[ObjectKanban] Fetch error:`,e),n&&k(e)}finally{n&&T(!1),r()}})(),()=>{n=!1}},[e.objectName,x,t,j,e.data,z,L,e.limit,p,S,C,A,M,pe]);let B=(p?r:void 0)||j||e.data||m,Se=g&&B===m,V=(0,Y.useMemo)(()=>{if(!Array.isArray(B))return[];let t=it(e),n=P(C);return B.map(r=>{let i;if(t&&(i=r[t],typeof i==`string`&&(i=i.trim())),!i){let e=I(C,r),t=r.id??r._id;e===`Untitled`||t!=null&&e===`Record #${t}`||(i=e)}let a=e=>e>=1e6?`$${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e}`,o=/^[A-Za-z0-9_-]{12,32}$/,s=e=>{if(typeof e!=`string`||!o.test(e))return!1;let t=/[A-Z]/.test(e),n=/[a-z]/.test(e),r=/[0-9_-]/.test(e);return t&&n||t&&r||n&&r},c=e=>{let t=r[e];if(!F(t)){if(typeof t==`object`){let e=t;for(let t of[`name`,`full_name`,`display_name`,`label`,`title`,`username`]){let n=e[t];if(typeof n==`string`&&n.trim())return n.trim()}return}if(typeof t!=`string`)return String(t);if(!s(t))return t}},d=[],f=rt(e.cardFields,C),p=new Set([...t?[t]:[],...n?[n]:[],`name`,`full_name`,`title`,`subject`,`display_name`]),m=[],h=[];if(f.length>0)for(let t of f){if(p.has(t))continue;let n=C?.fields?.[t],i=r[t];if(!F(i)){if(n?.type===`picklist`||n?.type===`multipicklist`||Array.isArray(n?.options)&&n.options.length>0){let r=n?.options?.find(e=>String(e.value).toLowerCase()===String(i).toLowerCase()),a=r?.label||String(i),o=C?.name||e.objectName,s=o?l(o,t,[{value:String(r?.value??i),label:a}])[0]?.label??a:a,c=b(r?.color),u=c?c.className:v(r?.color,i);if(s===``)continue;m.push({label:s,colorClass:u,colorStyle:c?.style})}else{let r=O(n??{type:`text`}),a=E(r),o=(0,X.jsx)(a,{value:i,field:n??{name:t,type:r}});h.push({field:t,label:u(C?.name||e.objectName||``,t,n?.label||t),node:o})}}}else{let e=[`amount`,`value`,`deal_value`,`expected_value`,`opportunity_value`].find(e=>typeof r[e]==`number`);e&&d.push(a(r[e]));let t=[`company`,`company_name`,`account`,`account_name`,`organization`],n;for(let e of t){let t=c(e);if(t){n=t;break}}n&&(!i||!String(i).includes(n))&&d.push(n);let o=[`owner`,`owner_name`,`assignee`,`assignee_name`],s;for(let e of o){let t=c(e);if(t){s=t;break}}s&&d.push(`@${s}`);for(let e of[`priority`,`severity`,`industry`,`rating`]){let t=r[e];if(t!=null&&t!==``){let n=(C?.fields?.[e])?.options?.find(e=>String(e.value).toLowerCase()===String(t).toLowerCase()),r=n?.label||String(t),i=b(n?.color),a=i?i.className:v(n?.color,t);if(r===``)continue;if(m.push({label:r,colorClass:a,colorStyle:i?.style}),m.length>=2)break}}}let g=r.description,_=(F(g)||typeof g==`string`&&s(g))&&d.length>0?d.join(` · `):void 0;return{...r,id:r.id||r._id,title:i||I(C,r),..._?{cardSubtitle:_}:{},...h.length>0?{cardFieldCells:h}:{},...!Array.isArray(r.badges)&&m.length>0?{badges:m}:{}}})},[B,e,C]),Ce=(0,Y.useMemo)(()=>{let t=t=>{if(!e.objectName||!e.groupBy)return t;let n=l(e.objectName,e.groupBy,[{value:String(t.id),label:t.title}])[0];return n?.label?{...t,title:n.label}:t};if(e.columns&&e.columns.length>0){if(typeof e.columns[0]==`string`){if(!e.groupBy)return e.columns.map(e=>({id:e,title:e}))}else return e.columns.map(t)}if(e.groupBy&&C?.fields?.[e.groupBy]?.options){let t=C.fields[e.groupBy].options.map(e=>({value:e.value,label:e.label}));return(e.objectName?l(e.objectName,e.groupBy,t):t).map(e=>({id:e.value,title:e.label}))}if(e.groupBy&&V.length>0){let t=new Set(V.map(t=>t[e.groupBy]));return Array.from(t).map(e=>({id:String(e),title:String(e)}))}return[]},[e.columns,e.groupBy,e.objectName,V,C,l]),H=e.swimlaneField||e.grouping?.fields?.[0]?.field,we={...e,data:V,columns:Ce,className:n||e.className,...H?{swimlaneField:H}:{}},U=e.navigation??{mode:`drawer`},Te=o??s;!Te&&(U.mode===`drawer`||U.mode===`modal`||U.mode===`split`||U.mode);let W=se({navigation:U,objectName:e.objectName,onRowClick:Te}),{anchorRef:Ee,captureAnchor:De}=te(),Oe=e.objectName?f(`detail.recordDetailWithLabel`,{label:e.objectName.charAt(0).toUpperCase()+e.objectName.slice(1).replace(/_/g,` `)}):f(`detail.recordDetail`),G=Y.useCallback(async(n,r,i,a)=>{let o=e.groupBy,s=e.objectName;if(o&&(p||h(e=>e.map(e=>String(e.id??e._id)===String(n)?{...e,[o]:i}:e)),s&&t?.update))try{await t.update(s,String(n),{[o]:i,...a??{}}),a&&!p&&h(e=>e.map(e=>String(e.id??e._id)===String(n)?{...e,...a}:e))}catch(e){console.warn(`[ObjectKanban] Failed to persist card move`,e),xe.error(ue(e)??(he(e)?d(`errors.unauthorized`,`You are not authorized to perform this action.`):me(e)??d(`table.saveFailed`,`Save failed`))),h(e=>e.map(e=>String(e.id??e._id)===String(n)?{...e,[o]:r}:e))}},[e.groupBy,e.objectName,t,p,d]),[K,q]=(0,Y.useState)(null),[ke,J]=(0,Y.useState)(!1),Ne=Y.useCallback(async(t,n,r,i)=>{let a=e.groupBy;if(!a||n===r||r===`__uncolumned__`)return;let o=(Array.isArray(B)?B:[]).find(e=>String(e?.id??e?._id)===String(t)),s=Xe(C?.fields,o,a,r);if(s.length>0){q({cardId:t,fromColumnId:n,toColumnId:r,fields:s});return}await G(t,n,r)},[e.groupBy,B,C,G]),Pe=(0,Y.useMemo)(()=>{if(!K)return[];let t=C?.name||e.objectName||``;return K.fields.map(e=>{let n=e.def.options,r=t&&Array.isArray(n)?l(t,e.name,n):n,i=typeof e.def.label==`string`?e.def.label:``;return{...e,def:{...e.def,...r?{options:r}:{}},label:u(t,e.name,i||e.name)}})},[K,C,e.objectName,l,u]);if(D)return(0,X.jsxs)(`div`,{className:`p-4 border border-destructive/50 rounded bg-destructive/10 text-destructive`,children:[`Error loading kanban data: `,D.message]});let Z=n=>{if(!W.isOverlay||!W.isOpen||!W.selectedRecord)return null;let r=e.objectName,i=W.selectedRecord,a=i.id??i._id;if(!r||a==null)return null;let o=it(e),s=o&&i[o]?String(i[o]):Oe;return(0,X.jsx)(ee,{...W,title:s,mainContent:n,popoverAnchorRef:Ee,storageKey:_(r),legacyStorageKey:ne(r),width:W.width??`min(960px, 60vw)`,children:()=>(0,X.jsx)(`div`,{className:`px-6 pt-6 pb-6`,children:(0,X.jsx)(Ae,{record:i,objectName:r,recordId:a,dataSource:t,objectSchema:C,onClose:W.close,fullPageHref:je(r,a)??void 0,onFieldSave:async(e,n)=>{t?.update&&(await t.update(r,String(a),{[e]:n}),h(t=>t.map(t=>String(t.id??t._id)===String(a)?{...t,[e]:n}:t)))},onDelete:async()=>{t?.delete&&(await t.delete(r,String(a)),h(e=>e.filter(e=>String(e.id??e._id)!==String(a))))}})})})},Q=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Me.Provider,{value:oe,children:(0,X.jsx)(yt,{objectFields:C?.fields,onCardMove:Ne,schema:{...we,countsAreWindowed:Se,onCardClick:(e,t)=>{De(t),W.handleClick(e,t)}}})}),K&&(0,X.jsx)(Ze,{open:!0,fields:Pe,submitting:ke,onCancel:()=>q(null),onSubmit:async e=>{let t=K;J(!0);try{await G(t.cardId,t.fromColumnId,t.toColumnId,e)}finally{J(!1),q(null)}}})]});if(W.isOverlay&&W.mode===`split`&&W.isOpen&&W.selectedRecord){let e=Z(Q);if(e)return(0,X.jsx)(X.Fragment,{children:e})}return(0,X.jsxs)(X.Fragment,{children:[Q,Z()]})},at=(...e)=>e.filter(Boolean).join(` `),ot=({columnId:e,fields:t,onSubmit:n,onCancel:r,defaultValues:i})=>{let[a,o]=Y.useState(()=>{let e={};for(let n of t)e[n.name]=i?.[n.name]??n.defaultValue??``;return e}),s=Y.useRef(null);Y.useEffect(()=>{let e=setTimeout(()=>s.current?.focus(),0);return()=>clearTimeout(e)},[]);let c=Y.useCallback((e,t)=>{o(n=>({...n,[e]:t}))},[]),l=Y.useCallback(()=>{Object.values(a).some(e=>typeof e==`string`?e.trim().length>0:e!=null)&&n(e,a)},[e,a,n]),u=Y.useCallback(e=>{e.key===`Enter`?(e.preventDefault(),l()):e.key===`Escape`&&(e.preventDefault(),r())},[l,r]);return(0,X.jsxs)(`div`,{className:`mt-2 rounded-lg border border-primary/30 bg-card p-3 space-y-2 shadow-sm`,onKeyDown:u,role:`form`,"aria-label":`Quick add card`,children:[t.map((t,n)=>(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`label`,{htmlFor:`qa-${e}-${t.name}`,className:`text-xs text-muted-foreground`,children:t.label??t.name}),st(t,a[t.name],c,n===0?s:void 0,`qa-${e}-${t.name}`)]},t.name)),(0,X.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,X.jsxs)(k,{type:`button`,size:`sm`,className:`h-7 text-xs gap-1`,onClick:l,children:[(0,X.jsx)(Se,{className:`h-3 w-3`}),`Save`]}),(0,X.jsxs)(k,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 text-xs gap-1`,onClick:r,children:[(0,X.jsx)(we,{className:`h-3 w-3`}),`Cancel`]})]})]})};function st(e,t,n,r,i){let a=`text-sm h-8`;switch(e.type){case`select`:return(0,X.jsxs)(`select`,{ref:r,id:i,value:t??``,onChange:t=>n(e.name,t.target.value),className:at(a,`w-full rounded-md border border-input bg-background px-2 py-1 text-sm ring-offset-background`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`),children:[(0,X.jsx)(`option`,{value:``,children:e.placeholder??`Select ${e.label??e.name}...`}),(e.options??[]).map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]});case`number`:return(0,X.jsx)(D,{ref:r,id:i,type:`number`,value:t??``,onChange:t=>n(e.name,t.target.value===``?``:Number(t.target.value)),placeholder:e.placeholder??`Enter ${e.label??e.name}...`,className:a});default:return(0,X.jsx)(D,{ref:r,id:i,type:`text`,value:t??``,onChange:t=>n(e.name,t.target.value),placeholder:e.placeholder??`Enter ${e.label??e.name}...`,className:a})}}var ct=(...e)=>e.filter(Boolean).join(` `),lt=({templates:e,onSelect:t,columnId:n})=>{let[r,i]=Y.useState(!1),a=Y.useRef(null);Y.useEffect(()=>{if(!r)return;let e=e=>{a.current&&!a.current.contains(e.target)&&i(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r]);let o=Y.useCallback(e=>{e.key===`Escape`&&i(!1)},[]);return(0,X.jsxs)(`div`,{ref:a,className:`relative`,onKeyDown:o,children:[(0,X.jsxs)(k,{variant:`ghost`,size:`sm`,className:`w-full mt-2 text-muted-foreground hover:text-foreground gap-1`,onClick:()=>i(e=>!e),"aria-haspopup":`listbox`,"aria-expanded":r,"aria-label":`Add card to ${n}`,children:[(0,X.jsx)(H,{className:`h-4 w-4`}),`Add Card`,(0,X.jsx)(V,{className:ct(`h-3 w-3 transition-transform`,r?`rotate-180`:``)})]}),r&&(0,X.jsxs)(`div`,{className:`absolute z-50 mt-1 w-full rounded-md border border-border bg-popover p-1 shadow-md`,role:`listbox`,"aria-label":`Card templates`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground transition-colors`,role:`option`,"aria-selected":!1,onClick:()=>{t(null),i(!1)},children:[(0,X.jsx)(H,{className:`h-4 w-4 text-muted-foreground`}),(0,X.jsx)(`span`,{className:`font-mono text-xs`,children:`Custom`})]}),e.length>0&&(0,X.jsx)(`div`,{className:`my-1 h-px bg-border`,role:`separator`}),e.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground transition-colors`,role:`option`,"aria-selected":!1,onClick:()=>{t(e),i(!1)},children:[(0,X.jsx)(Ce,{className:`h-4 w-4 text-muted-foreground`}),(0,X.jsx)(`span`,{className:`font-mono text-xs truncate`,children:e.name})]},e.id))]})]})};function ut({swimlanes:e,onCardMove:t}){let[n,r]=(0,Y.useState)(null),i=(0,Y.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.id,n);return t},[e]),a=(0,Y.useCallback)((e,t)=>{if(e===t)return!0;let n=i.get(t);return n?!n.acceptFrom||n.acceptFrom.includes(e):!1},[i]),o=(0,Y.useCallback)((e,n,i,o)=>a(n,i)?(t?.({cardId:e,fromSwimlane:n,toSwimlane:i,columnId:o}),r(null),!0):!1,[a,t]),s=(0,Y.useCallback)(e=>{r(e)},[]),c=(0,Y.useCallback)(()=>{r(null)},[]);return{handleCrossSwimlaneMove:o,isDraggingAcrossSwimlanes:n!==null,startCrossSwimlaneDrag:s,endCrossSwimlaneDrag:c,canMoveTo:a}}function dt({cards:e,onReorderComplete:t}){let[n,r]=(0,Y.useState)(e),[i,a]=(0,Y.useState)(!1);!ft(n,e)&&!i&&r(e);let o=(0,Y.useCallback)(()=>{r(e),a(!1)},[e]);return{reorderedCards:n,onReorder:(0,Y.useCallback)((e,t)=>{r(n=>{if(e<0||t<0||e>=n.length||t>=n.length)return n;let r=[...n],[i]=r.splice(e,1);return r.splice(t,0,i),r})},[]),isDragging:i,startDrag:(0,Y.useCallback)(()=>{a(!0)},[]),endDrag:(0,Y.useCallback)(()=>{a(!1),r(e=>(t?.(e),e))},[t]),reset:o}}function ft(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n].id!==t[n].id)return!1;return!0}var pt=t({CardTemplates:()=>lt,InlineQuickAdd:()=>ot,KANBAN_UNCOLUMNED_ID:()=>mt,KanbanRenderer:()=>yt,ObjectKanban:()=>$,ObjectKanbanRenderer:()=>St,bucketCardsIntoColumns:()=>_t,kanbanComponents:()=>bt,useCrossSwimlaneMove:()=>ut,useQuickAddReorder:()=>dt}),mt=`__uncolumned__`,ht=B({"kanban.uncategorized":`Uncategorized`},`kanban.uncategorized`);function gt(e,t,n,r){let i=e.filter(e=>e!==``);if(i.length===0)return;let a=e=>typeof e==`string`?JSON.stringify(e):String(e),o=n.map(e=>a(e.id)).join(`, `);for(let e of i)console.warn(`[plugin-kanban] ${t[e].length} record(s) with ${JSON.stringify(r)} = ${JSON.stringify(e)} match no lane id and are shown in the trailing "Uncategorized" lane. Lanes match the stored option value by lane id only, never by lane title (objectui#10069). Available lane ids: [${o}].`)}function _t(e,t,n,r,i){let a=e=>{if(!r)return e;let t=e[r];if(!t)return e;let n=typeof t==`string`?t:t?.url;return n?{...e,coverImage:n}:e};if(!t||!n||!Array.isArray(t))return e.map(e=>({...e,cards:(e.cards||[]).map(a)}));let o=Object.create(null);e.forEach(e=>{e.id&&(o[String(e.id).toLowerCase()]=e.id)});let s=t.reduce((e,t)=>{let r=String(t[n]??``),i=o[r.toLowerCase()]??r;return e[i]||(e[i]=[]),e[i].push(a(t)),e},Object.create(null)),c=e.map(e=>({...e,cards:[...(e.cards||[]).map(a),...s[e.id]||[]]})),l=new Set(e.map(e=>typeof e.id==`symbol`?e.id:String(e.id))),u=Object.keys(s).filter(e=>!l.has(e)),d=u.flatMap(e=>s[e]);return gt(u,s,e,n),d.length>0&&c.push({id:mt,title:i,cards:d}),c}var vt=Y.lazy(()=>n(()=>Promise.resolve().then(()=>Pe),void 0,import.meta.url)),yt=({schema:e,objectFields:t,onCardMove:n})=>{let{t:r}=ht(),i=Y.useMemo(()=>_t(e.columns??[],e.data,e.groupBy,e.coverImageField,r(`kanban.uncategorized`)),[e,r]);return(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(u,{className:`w-full h-[600px]`}),children:(0,X.jsx)(vt,{columns:i,onCardMove:n,onCardClick:e.onCardClick,className:e.className,quickAdd:e.quickAdd,onQuickAdd:e.onQuickAdd,coverImageField:e.coverImageField,conditionalFormatting:e.conditionalFormatting,objectFields:t,swimlaneField:e.swimlaneField,countsAreWindowed:e.countsAreWindowed})})},bt={"object-kanban":$},xt={filter:!0,sort:!0,limit:`limit`},St=R(({schema:e,...t})=>{let{dataSource:n}=re()||{},r=n??void 0;return(0,X.jsx)(pe,{schema:e,mapping:xt,dataSource:r,testId:`object-kanban`,errorTitle:`This board’s data source could not be resolved`,children:e=>(0,X.jsx)($,{schema:e,dataSource:r,...t})})});L.register(`object-kanban`,St,{namespace:`plugin-kanban`,label:`Object Kanban`,category:`view`,inputs:[{name:`objectName`,type:`string`,required:!0},{name:`columns`,type:`array`},{name:`filter`,type:`array`,description:"Filter criteria in JSON-rules form, narrowing the records the board fetches. Lowered to `$filter` on the query."},{name:`limit`,type:`number`,description:"Row cap — the most records the board fetches, lowered to the query’s top-level `$top` (renderer default 100). The board renders every fetched record into a lane and offers no pagination, so this is the author’s window on the object rather than a page size. PRECEDENCE: a node-level `dataSource` binding’s own `limit` wins outright; the `pagination.pageSize` of a view that binding names fills this key only when the node leaves it unset."},{name:`groupBy`,type:`string`,description:"Record field whose value buckets cards into lanes. Its picklist options become the lanes when `columns` is absent, and a drag between lanes writes the target lane’s value back to the record. A value matching no lane lands in the trailing “Uncategorized” lane rather than disappearing."},{name:`cardTitle`,type:`string`,description:"Record field rendered as the card title. Read AHEAD of `titleField`, which is the legacy spelling of the same choice; when neither yields a value the shared record-display resolver names the card."},{name:`titleField`,type:`string`,description:"Legacy spelling of `cardTitle` — the record field rendered as the card title. `cardTitle` wins when both are authored."},{name:`swimlaneField`,type:`string`,description:"Record field that splits the board into horizontal swimlanes. When absent the board falls back to `grouping.fields[0].field`."},{name:`coverImageField`,type:`string`,description:"Record field holding a card cover image — a URL string, or a file object carrying a `url`. Any other value leaves the card without a cover."},{name:`data`,type:`array`,description:"Inline records to render instead of fetching. Authoring it SUPPRESSES the board’s own query entirely. Members are records: the board reads `id` (or `_id`) as the card identity, the `groupBy` field’s value as the lane, the card-title field, `coverImageField`, and every `cardFields` entry. Records handed down by a parent view and a `bind` expression both take priority over it."},{name:`cardFields`,type:`array`,description:"Record field NAMES rendered as cells on each card, in the order written. Members are bare names, not entry objects. An explicit list wins over the object’s `highlightFields` role; unlike that fallback it is NOT filtered against the object definition, so a name the object no longer declares simply renders no cell. An empty array reads as omitted."},{name:`grouping`,type:`object`,description:"Only `grouping.fields[0].field` is read, and only as the FALLBACK for `swimlaneField`: it names the record field that splits the board into horizontal swimlanes when no `swimlaneField` is authored. An explicit `swimlaneField` wins. Every other position inside `grouping`, later `fields` entries included, is inert on this board."},{name:`conditionalFormatting`,type:`array`,description:"Per-card style rules, each evaluated against that card’s own record. Two member dialects are accepted: the native `{ field, operator, value, backgroundColor?, borderColor? }` and the spec CEL `{ condition, backgroundColor?, borderColor? }`. A matching rule colours that card alone. A rule comparing a relation field sees the stored foreign key rather than the expanded record."}]});export{pt as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{_ as n,h as r,t as i,v as a}from"./vendor-react-BggL7APJ.js";import{$ as o,On as s,bi as c,vt as l}from"./ui-components-BTB1NkUW.js";import{Ai as ee,At as u,Dr as d,Ir as te,Pr as ne,Rt as f,Ui as p,Wi as re,ct as ie,ft as ae,g as oe,ir as se,ki as ce,l as le,n as ue,ut as de,v as fe,wi as pe,zt as me}from"./framework-DcWkeiND.js";import{t as he}from"./types-zod-Y2RwUUeJ.js";var m=e(a(),1),ge=m.createContext(null);function h(e,t){let n=Array.isArray(e)?e[0]:e?e.x:0,r=Array.isArray(e)?e[1]:e?e.y:0,i=Array.isArray(t)?t[0]:t?t.x:0,a=Array.isArray(t)?t[1]:t?t.y:0;return n===i&&r===a}function g(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!g(e[n],t[n]))return!1;return!0}if(Array.isArray(t))return!1;if(typeof e==`object`&&typeof t==`object`){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!t.hasOwnProperty(r)||!g(e[r],t[r]))return!1;return!0}return!1}function _(e){return{center:e.getCenter(),zoom:e.getZoom(),bearing:e.getBearing(),pitch:e.getPitch(),elevation:e.getCenterElevation?.()??0,padding:e.getPadding()}}function v(e){return{longitude:e.center.lng,latitude:e.center.lat,zoom:e.zoom,pitch:e.pitch,bearing:e.bearing,padding:e.padding}}function _e(e,t){let n=t.viewState||t,r={};if(`longitude`in n&&`latitude`in n&&(n.longitude!==e.center.lng||n.latitude!==e.center.lat)){let t=e.center.constructor;r.center=new t(n.longitude,n.latitude)}return`zoom`in n&&n.zoom!==e.zoom&&(r.zoom=n.zoom),`bearing`in n&&n.bearing!==e.bearing&&(r.bearing=n.bearing),`pitch`in n&&n.pitch!==e.pitch&&(r.pitch=n.pitch),n.padding&&e.padding&&!g(n.padding,e.padding)&&(r.padding=n.padding),r}function y(e,t,n,r){return e.min===t.min&&e.max===t.max?!1:(e.min>=t.min?(e.max!==t.max&&r(e.max),e.min!==t.min&&n(e.min)):(e.min!==t.min&&n(e.min),e.max!==t.max&&r(e.max)),!0)}function ve(e,t,n){return y(t,n,t=>e.setMinZoom(t),t=>e.setMaxZoom(t))}function b(e,t,n){return y(t,n,t=>e.setMinPitch(t),t=>e.setMaxPitch(t))}var ye=[`type`,`source`,`source-layer`,`minzoom`,`maxzoom`,`filter`,`layout`];function x(e){if(!e)return null;if(typeof e==`string`||(`toJS`in e&&(e=e.toJS()),!e.layers))return e;let t={};for(let n of e.layers)t[n.id]=n;let n=e.layers.map(e=>{let n=null;`interactive`in e&&(n=Object.assign({},e),delete n.interactive);let r=t[e.ref];if(r){n||=Object.assign({},e),delete n.ref;for(let e of ye)e in r&&(n[e]=r[e])}return n||e});return{...e,layers:n}}var S={version:8,sources:{},layers:[]},C={minZoom:0,maxZoom:22,minPitch:0,maxPitch:85,maxBounds:[-180,-85.051129,180,85.051129],projection:`mercator`,renderWorldCopies:!0},be={mousedown:`onMouseDown`,mouseup:`onMouseUp`,mouseover:`onMouseOver`,mousemove:`onMouseMove`,click:`onClick`,dblclick:`onDblClick`,mouseenter:`onMouseEnter`,mouseleave:`onMouseLeave`,mouseout:`onMouseOut`,contextmenu:`onContextMenu`,touchstart:`onTouchStart`,touchend:`onTouchEnd`,touchmove:`onTouchMove`,touchcancel:`onTouchCancel`},w={movestart:`onMoveStart`,move:`onMove`,moveend:`onMoveEnd`,dragstart:`onDragStart`,drag:`onDrag`,dragend:`onDragEnd`,zoomstart:`onZoomStart`,zoom:`onZoom`,zoomend:`onZoomEnd`,rotatestart:`onRotateStart`,rotate:`onRotate`,rotateend:`onRotateEnd`,pitchstart:`onPitchStart`,pitch:`onPitch`,pitchend:`onPitchEnd`},T={wheel:`onWheel`,boxzoomstart:`onBoxZoomStart`,boxzoomend:`onBoxZoomEnd`,boxzoomcancel:`onBoxZoomCancel`,resize:`onResize`,load:`onLoad`,render:`onRender`,idle:`onIdle`,remove:`onRemove`,data:`onData`,styledata:`onStyleData`,sourcedata:`onSourceData`,error:`onError`},xe=[`maxBounds`,`projection`,`renderWorldCopies`],E=[`scrollZoom`,`boxZoom`,`dragRotate`,`dragPan`,`keyboard`,`doubleClickZoom`,`touchZoomRotate`,`touchPitch`],D=class e{constructor(e,t,n){this._map=null,this._internalUpdate=!1,this._hoveredFeatures=null,this._propsedCameraUpdate=null,this._styleComponents={},this._onEvent=e=>{let t=this.props[T[e.type]];t?t(e):e.type===`error`&&console.error(e.error)},this._onCameraEvent=e=>{if(this._internalUpdate)return;e.viewState=this._propsedCameraUpdate||v(_(this._map));let t=this.props[w[e.type]];t&&t(e)},this._onCameraUpdate=e=>this._internalUpdate?e:(this._propsedCameraUpdate=v(e),_e(e,this.props)),this._onPointerEvent=e=>{(e.type===`mousemove`||e.type===`mouseout`)&&this._updateHover(e);let t=this.props[be[e.type]];t&&(this.props.interactiveLayerIds&&e.type!==`mouseover`&&e.type!==`mouseout`&&(e.features=this._hoveredFeatures||this._queryRenderedFeatures(e.point)),t(e),delete e.features)},this._MapClass=e,this.props=t,this._initialize(n)}get map(){return this._map}setProps(e){let t=this.props;this.props=e;let n=this._updateSettings(e,t),r=this._updateSize(e),i=this._updateViewState(e);this._updateStyle(e,t),this._updateStyleComponents(e),this._updateHandlers(e,t),(n||r||i&&!this._map.isMoving())&&this.redraw()}static reuse(t,n){let r=e.savedMaps.pop();if(!r)return null;let i=r.map,a=i.getContainer();for(n.className=a.className;a.childNodes.length>0;)n.appendChild(a.childNodes[0]);i._container=n;let o=i._resizeObserver;o&&(o.disconnect(),o.observe(n)),r.setProps({...t,styleDiffing:!1}),i.resize();let{initialViewState:s}=t;return s&&(s.bounds?i.fitBounds(s.bounds,{...s.fitBoundsOptions,duration:0}):r._updateViewState(s)),i.isStyleLoaded()?i.fire(`load`):i.once(`style.load`,()=>i.fire(`load`)),i._update(),r}_initialize(e){let{props:t}=this,{mapStyle:n=S}=t,r={...t,...t.initialViewState,container:e,style:x(n)},i=r.initialViewState||r.viewState||r;if(Object.assign(r,{center:[i.longitude||0,i.latitude||0],zoom:i.zoom||0,pitch:i.pitch||0,bearing:i.bearing||0}),t.gl){let e=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=e,t.gl)}let a=new this._MapClass(r);i.padding&&a.setPadding(i.padding),t.cursor&&(a.getCanvas().style.cursor=t.cursor);let o=a;typeof o.setTransformCameraUpdate==`function`?o.setTransformCameraUpdate(this._onCameraUpdate):o.transformCameraUpdate=this._onCameraUpdate,a.on(`style.load`,()=>{this._styleComponents={light:a.getLight(),sky:a.getSky(),projection:a.getProjection?.(),terrain:a.getTerrain()},this._updateStyleComponents(this.props)}),a.on(`sourcedata`,()=>{this._updateStyleComponents(this.props)});for(let e in be)a.on(e,this._onPointerEvent);for(let e in w)a.on(e,this._onCameraEvent);for(let e in T)a.on(e,this._onEvent);this._map=a}recycle(){this.map.getContainer().querySelector(`[mapboxgl-children]`)?.remove(),e.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){let e=this._map;e.style&&(e._frame&&=(e._frame.cancel(),null),e._render())}_updateSize(e){let{viewState:t}=e;if(t){let e=this._map,n=e.getCanvas();if(t.width!==n.clientWidth||t.height!==n.clientHeight)return e.resize(),!0}return!1}_updateViewState(e){let t=this._map,n=_(t);if(!t.isMoving()){let r=_e(n,e);if(Object.keys(r).length>0)return this._internalUpdate=!0,t.jumpTo(r),this._internalUpdate=!1,!0}return!1}_updateConstraints(e,t){let n=ve(this._map,{min:e.minZoom??C.minZoom,max:e.maxZoom??C.maxZoom},{min:t.minZoom??C.minZoom,max:t.maxZoom??C.maxZoom}),r=b(this._map,{min:e.minPitch??C.minPitch,max:e.maxPitch??C.maxPitch},{min:t.minPitch??C.minPitch,max:t.maxPitch??C.maxPitch});return n||r}_updateSettings(e,t){let n=this._map,r=!1;for(let i of xe)if((i in e||i in t)&&!g(e[i],t[i])){r=!0;let t=i in e?e[i]:C[i];n[`set${i[0].toUpperCase()}${i.slice(1)}`]?.call(n,t)}let i=this._updateConstraints(e,t);return r||i}_updateStyle(e,t){if(e.cursor!==t.cursor&&(this._map.getCanvas().style.cursor=e.cursor||``),e.mapStyle!==t.mapStyle){let{mapStyle:t=S,styleDiffing:n=!0}=e,r={diff:n};`localIdeographFontFamily`in e&&(r.localIdeographFontFamily=e.localIdeographFontFamily),this._map.setStyle(x(t),r)}}_updateStyleComponents({light:e,projection:t,sky:n,terrain:r}){let i=this._map,a=this._styleComponents;i.style?._loaded&&(e&&!g(e,a.light)&&(a.light=e,i.setLight(e)),t&&!g(t,a.projection)&&t!==a.projection?.type&&(a.projection=typeof t==`string`?{type:t}:t,i.setProjection?.(a.projection)),n&&!g(n,a.sky)&&(a.sky=n,i.setSky(n)),r!==void 0&&!g(r,a.terrain)&&(!r||i.getSource(r.source))&&(a.terrain=r,i.setTerrain(r)))}_updateHandlers(e,t){let n=this._map;for(let r of E){let i=e[r]??!0;g(i,t[r]??!0)||(i?n[r].enable(i):n[r].disable())}}_queryRenderedFeatures(e){let t=this._map,{interactiveLayerIds:n=[]}=this.props;try{return t.queryRenderedFeatures(e,{layers:n.filter(t.getLayer.bind(t))})}catch{return[]}}_updateHover(e){let{props:t}=this;if(t.interactiveLayerIds&&(t.onMouseMove||t.onMouseEnter||t.onMouseLeave)){let t=e.type,n=this._hoveredFeatures?.length>0,r=this._queryRenderedFeatures(e.point),i=r.length>0;!i&&n&&(e.type=`mouseleave`,this._onPointerEvent(e)),this._hoveredFeatures=r,i&&!n&&(e.type=`mouseenter`,this._onPointerEvent(e)),e.type=t}else this._hoveredFeatures=null}};D.savedMaps=[];var Se=[`setMaxBounds`,`setMinZoom`,`setMaxZoom`,`setMinPitch`,`setMaxPitch`,`setRenderWorldCopies`,`setProjection`,`setStyle`,`addSource`,`removeSource`,`addLayer`,`removeLayer`,`setLayerZoomRange`,`setFilter`,`setPaintProperty`,`setLayoutProperty`,`setLight`,`setTerrain`,`setFog`,`remove`];function Ce(e){if(!e)return null;let t=e.map,n={getMap:()=>t};for(let e of we(t))!(e in n)&&!Se.includes(e)&&(n[e]=t[e].bind(t));return n}function we(e){let t=new Set,n=e;for(;n;){for(let r of Object.getOwnPropertyNames(n))r[0]!==`_`&&typeof e[r]==`function`&&r!==`fire`&&r!==`setEventedParent`&&t.add(r);n=Object.getPrototypeOf(n)}return Array.from(t)}var O=typeof document<`u`?m.useLayoutEffect:m.useEffect;function k(e,t){let{RTLTextPlugin:n,maxParallelImageRequests:r,workerCount:i,workerUrl:a}=t;if(n&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()===`unavailable`){let{pluginUrl:t,lazy:r=!0}=typeof n==`string`?{pluginUrl:n}:n;e.setRTLTextPlugin(t,e=>{e&&console.error(e)},r)}r!==void 0&&e.setMaxParallelImageRequests(r),i!==void 0&&e.setWorkerCount(i),a!==void 0&&e.setWorkerUrl(a)}var A=m.createContext(null);function j(e,t){let n=(0,m.useContext)(ge),[i,a]=(0,m.useState)(null),o=(0,m.useRef)(),{current:s}=(0,m.useRef)({mapLib:null,map:null});(0,m.useEffect)(()=>{let t=e.mapLib,i=!0,c;return Promise.resolve(t||r(()=>import(`./maplibre-gl-Dw-skPj7.js`),[],import.meta.url)).then(t=>{if(!i)return;if(!t)throw Error(`Invalid mapLib`);let r=`Map`in t?t:t.default;if(!r.Map)throw Error(`Invalid mapLib`);k(r,e),e.reuseMaps&&(c=D.reuse(e,o.current)),c||=new D(r.Map,e,o.current),s.map=Ce(c),s.mapLib=r,a(c),n?.onMapMount(s.map,e.id)}).catch(t=>{let{onError:n}=e;n?n({type:`error`,target:null,originalEvent:null,error:t}):console.error(t)}),()=>{i=!1,c&&(n?.onMapUnmount(e.id),e.reuseMaps?c.recycle():c.destroy())}},[]),O(()=>{i&&i.setProps(e)}),(0,m.useImperativeHandle)(t,()=>s.map,[i]);let c=(0,m.useMemo)(()=>({position:`relative`,width:`100%`,height:`100%`,...e.style}),[e.style]);return m.createElement(`div`,{id:e.id,ref:o,style:c},i&&m.createElement(A.Provider,{value:s},m.createElement(`div`,{"mapboxgl-children":``,style:{height:`100%`}},e.children)))}var Te=m.forwardRef(j),M=e(n(),1),N=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function P(e,t){if(!e||!t)return;let n=e.style;for(let e in t){let r=t[e];n[e]=Number.isFinite(r)&&!N.test(e)?`${r}px`:r}}function F(e,t){if(e===t)return null;let n=I(e),r=I(t),i=[];for(let e of r)n.has(e)||i.push(e);for(let e of n)r.has(e)||i.push(e);return i.length===0?null:i}function I(e){return new Set(e?e.trim().split(/\s+/):[])}var Ee=(0,m.memo)((0,m.forwardRef)((e,t)=>{let{map:n,mapLib:r}=(0,m.useContext)(A),i=(0,m.useRef)({props:e}),a=(0,m.useMemo)(()=>{let t=!1;m.Children.forEach(e.children,e=>{e&&(t=!0)});let n={...e,element:t?document.createElement(`div`):void 0},o=new r.Marker(n);return o.setLngLat([e.longitude,e.latitude]),o.getElement().addEventListener(`click`,e=>{i.current.props.onClick?.({type:`click`,target:o,originalEvent:e})}),o.on(`dragstart`,e=>{let t=e;t.lngLat=a.getLngLat(),i.current.props.onDragStart?.(t)}),o.on(`drag`,e=>{let t=e;t.lngLat=a.getLngLat(),i.current.props.onDrag?.(t)}),o.on(`dragend`,e=>{let t=e;t.lngLat=a.getLngLat(),i.current.props.onDragEnd?.(t)}),o},[]);(0,m.useEffect)(()=>(a.addTo(n.getMap()),()=>{a.remove()}),[]);let{longitude:o,latitude:s,offset:c,style:l,draggable:ee=!1,popup:u=null,rotation:d=0,rotationAlignment:te=`auto`,pitchAlignment:ne=`auto`}=e;(0,m.useEffect)(()=>{P(a.getElement(),l)},[l]),(0,m.useImperativeHandle)(t,()=>a,[]);let f=i.current.props;(a.getLngLat().lng!==o||a.getLngLat().lat!==s)&&a.setLngLat([o,s]),c&&!h(a.getOffset(),c)&&a.setOffset(c),a.isDraggable()!==ee&&a.setDraggable(ee),a.getRotation()!==d&&a.setRotation(d),a.getRotationAlignment()!==te&&a.setRotationAlignment(te),a.getPitchAlignment()!==ne&&a.setPitchAlignment(ne),a.getPopup()!==u&&a.setPopup(u);let p=F(f.className,e.className);if(p)for(let e of p)a.toggleClassName(e);return i.current.props=e,(0,M.createPortal)(e.children,a.getElement())})),De=(0,m.memo)((0,m.forwardRef)((e,t)=>{let{map:n,mapLib:r}=(0,m.useContext)(A),i=(0,m.useMemo)(()=>document.createElement(`div`),[]),a=(0,m.useRef)({props:e}),o=(0,m.useMemo)(()=>{let t={...e},n=new r.Popup(t);return n.setLngLat([e.longitude,e.latitude]),n.once(`open`,e=>{a.current.props.onOpen?.(e)}),n},[]);if((0,m.useEffect)(()=>{let e=e=>{a.current.props.onClose?.(e)};return o.on(`close`,e),o.setDOMContent(i).addTo(n.getMap()),()=>{o.off(`close`,e),o.isOpen()&&o.remove()}},[]),(0,m.useEffect)(()=>{P(o.getElement(),e.style)},[e.style]),(0,m.useImperativeHandle)(t,()=>o,[]),o.isOpen()){let t=a.current.props;(o.getLngLat().lng!==e.longitude||o.getLngLat().lat!==e.latitude)&&o.setLngLat([e.longitude,e.latitude]),e.offset&&!g(t.offset,e.offset)&&o.setOffset(e.offset),(t.anchor!==e.anchor||t.maxWidth!==e.maxWidth)&&(o.options.anchor=e.anchor,o.setMaxWidth(e.maxWidth));let n=F(t.className,e.className);if(n)for(let e of n)o.toggleClassName(e);a.current.props=e}return(0,M.createPortal)(e.children,i)}));function L(e,t,n,r){let i=(0,m.useContext)(A),a=(0,m.useMemo)(()=>e(i),[]);return(0,m.useEffect)(()=>{let e=r||n||t,o=typeof t==`function`&&typeof n==`function`?t:null,s=typeof n==`function`?n:typeof t==`function`?t:null,{map:c}=i;return c.hasControl(a)||(c.addControl(a,e?.position),o&&o(i)),()=>{s&&s(i),c.hasControl(a)&&c.removeControl(a)}},[]),a}function R(e){let t=L(({mapLib:t})=>new t.AttributionControl(e),{position:e.position});return(0,m.useEffect)(()=>{P(t._container,e.style)},[e.style]),null}(0,m.memo)(R);function z(e){let t=L(({mapLib:t})=>new t.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return(0,m.useEffect)(()=>{P(t._controlContainer,e.style)},[e.style]),null}(0,m.memo)(z);function Oe(e,t){let n=(0,m.useRef)({props:e}),r=L(({mapLib:t})=>{let r=new t.GeolocateControl(e),i=r._setupUI;return r._setupUI=()=>{r._container.hasChildNodes()||i()},r.on(`geolocate`,e=>{n.current.props.onGeolocate?.(e)}),r.on(`error`,e=>{n.current.props.onError?.(e)}),r.on(`outofmaxbounds`,e=>{n.current.props.onOutOfMaxBounds?.(e)}),r.on(`trackuserlocationstart`,e=>{n.current.props.onTrackUserLocationStart?.(e)}),r.on(`trackuserlocationend`,e=>{n.current.props.onTrackUserLocationEnd?.(e)}),r},{position:e.position});return n.current.props=e,(0,m.useImperativeHandle)(t,()=>r,[]),(0,m.useEffect)(()=>{P(r._container,e.style)},[e.style]),null}(0,m.memo)((0,m.forwardRef)(Oe));function ke(e){let t=L(({mapLib:t})=>new t.NavigationControl(e),{position:e.position});return(0,m.useEffect)(()=>{P(t._container,e.style)},[e.style]),null}var Ae=(0,m.memo)(ke);function B(e){let t=L(({mapLib:t})=>new t.ScaleControl(e),{position:e.position}),n=(0,m.useRef)(e),r=n.current;n.current=e;let{style:i}=e;return e.maxWidth!==void 0&&e.maxWidth!==r.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==r.unit&&t.setUnit(e.unit),(0,m.useEffect)(()=>{P(t._container,i)},[i]),null}(0,m.memo)(B);function je(e){let t=L(({mapLib:t})=>new t.TerrainControl(e),{position:e.position});return(0,m.useEffect)(()=>{P(t._container,e.style)},[e.style]),null}(0,m.memo)(je);function V(e){let t=L(({mapLib:t})=>new t.LogoControl(e),{position:e.position});return(0,m.useEffect)(()=>{P(t._container,e.style)},[e.style]),null}(0,m.memo)(V);function H(e){let t=L(({mapLib:t})=>{let n=t.GlobeControl;if(!n)throw Error(`GlobeControl is not supported by this version of MapLibre GL JS`);return new n(e)},{position:e.position});return(0,m.useEffect)(()=>{P(t._container,e.style)},[e.style]),null}(0,m.memo)(H);function U(e){return e>=-180&&e<180?e:((e+180)%360+360)%360-180}var W=e=>Math.min(85,Math.max(-85,e));function Me(e){if(e.length===0)return null;let t=e.map(([e])=>U(e)).sort((e,t)=>e-t),n=e.map(([,e])=>W(e)),r=t.length,i=t[0]+360-t[r-1],a=0;for(let e=1;e<r;e++){let n=t[e]-t[e-1];n>i&&(i=n,a=e)}let o=t[a],s=t[(a+r-1)%r],c=a===0?s:s+360;return[[o,Math.min(...n)],[c,Math.max(...n)]]}function Ne(e){let[[t,n],[r,i]]=e;return{longitude:U((t+r)/2),latitude:(n+i)/2}}var G=i(),Pe=`https://demotiles.maplibre.org/style.json`,K=Object.keys(he.shape).filter(e=>e!==`style`);function Fe(e){return f(e,`view-data`)}var q=()=>!1,Ie=new Set;function J(e){if(!q())return;let t=e.filter;if(!t||typeof t!=`object`||Array.isArray(t)||!Object.prototype.hasOwnProperty.call(t,`map`))return;let n=t.map;if(!n||typeof n!=`object`)return;let r;try{r=`${e.type??`map`}::${e.objectName??``}::${JSON.stringify(n)}`}catch{r=`${e.type??`map`}::${e.objectName??``}::<unserializable>`}Ie.has(r)||(Ie.add(r),console.warn("[ObjectMap] `filter.map` is no longer read as map configuration, so this map has NO coordinate binding and renders the \"Map configuration required\" refusal (objectui#8169 — the `latitude` / `longitude` / `location` defaults are gone). `filter` is the query filter; the map config belongs under the declared `map` input — move it to `schema.map` (`{ type: 'object-map', map: { latitudeField, longitudeField, titleField } }`). The old spelling was never documented and could not survive a `dataSource` binding, whose merged filter is an `and` node with no `map` key at all (objectstack#7121). If `map` is genuinely a field you are filtering on, ignore this — the filter itself is passed through untouched. objectui#4034."))}var Y=new Set;function Le(e){if(!q())return;let t=e.style;if(typeof t!=`string`||t===``)return;let n=`${e.type??`map`}::${e.objectName??``}::${t}`;Y.has(n)||(Y.add(n),console.warn(`[ObjectMap] A top-level \`style\` is NOT read as a map style, so this map is rendering with the DEFAULT public demo tiles and \`${t}\` was dropped. \`style\` is the base schema's INLINE CSS key (a record of CSS properties), which every node may carry; the map style is \`mapStyle\` — named that way precisely to avoid this collision. Write \`mapStyle: '${t}'\` at the top level, or \`map: { style: '${t}' }\` in the declared config block. On a view, write that same declared \`map: { style: ... }\`: ObjectView / ListView flatten \`options.map\` through a whitelist of the keys \`ObjectMapConfigSchema\` declares, and that whitelist carries \`style\` out under the flat spelling \`mapStyle\` (objectui#9950), so the declared block arrives and is read. \`mapStyle\` is the TOP-LEVEL spelling only — inside the \`map\` block it is undeclared, and the flatten drops it. objectui#5017.`))}var X=new Set;function Z(e){if(!q())return;let t=K.filter(t=>e[t]!==void 0);if(t.length===0)return;let n=`${e.type??`map`}::${e.objectName??``}::${t.join(`,`)}`;X.has(n)||(X.add(n),console.warn(`[ObjectMap] The \`map\` block configures this map, so these top-level keys are IGNORED: ${t.map(e=>`\`${e}\``).join(`, `)}. The \`map\` block is the authoring shape; the flat top-level spelling is the internal form ObjectView/ListView produce when they flatten \`options.map\`, and what the author wrote outranks it. Move anything you still need into \`map\`, or drop the \`map\` block. objectui#5018.`))}function Re(e){J(e),Le(e);let t=e.mapStyle||e.map?.style,n=e.map??null;if(n){let r=he.safeParse(n);return r.success||console.warn(`[ObjectMap] Invalid map configuration:`,r.error.format()),Z(e),{...n,style:n.style||t}}return e.locationField||e.latitudeField?{locationField:e.locationField,latitudeField:e.latitudeField,longitudeField:e.longitudeField,titleField:e.titleField,descriptionField:e.descriptionField,zoom:e.zoom,center:e.center,style:t}:{style:t}}function ze(e){return!!e.locationField||!!(e.latitudeField&&e.longitudeField)}function Be(e,t){if(t.latitudeField&&t.longitudeField){let n=e[t.latitudeField],r=e[t.longitudeField];if(typeof n==`number`&&typeof r==`number`)return[n,r]}if(t.locationField){let n=e[t.locationField];if(typeof n==`object`&&n){let e=n.lat||n.latitude,t=n.lng||n.lon||n.longitude;if(typeof e==`number`&&typeof t==`number`)return[e,t]}if(typeof n==`string`){let e=n.split(`,`).map(e=>parseFloat(e.trim()));if(e.length===2&&!isNaN(e[0])&&!isNaN(e[1]))return[e[0],e[1]]}if(Array.isArray(n)&&n.length===2){let e=parseFloat(n[0]),t=parseFloat(n[1]);if(!isNaN(e)&&!isNaN(t))return[e,t]}}return null}function Ve(e,t,n=50){if(e.length<=1||t>=15)return e.map(e=>({id:e.id,coordinates:e.coordinates,markers:[e],isCluster:!1}));let r=n/2**t,i=new Map;e.forEach(e=>{let t=`${Math.floor(e.coordinates[0]/r)}:${Math.floor(e.coordinates[1]/r)}`;i.has(t)||i.set(t,[]),i.get(t).push(e)});let a=[];return i.forEach((e,t)=>{if(e.length===1)a.push({id:e[0].id,coordinates:e[0].coordinates,markers:e,isCluster:!1});else{let n=e.reduce((e,t)=>e+t.coordinates[0],0)/e.length,r=e.reduce((e,t)=>e+t.coordinates[1],0)/e.length;a.push({id:`cluster-${t}`,coordinates:[n,r],markers:e,isCluster:!0})}}),a}var Q=({schema:e,dataSource:t,className:n,data:r,onMarkerClick:i,onRowClick:a,onEdit:u,onDelete:f,enableClustering:p,clusterRadius:re=50})=>{let[le,he]=(0,m.useState)([]),[ge,h]=(0,m.useState)(!0),[g,_]=(0,m.useState)(null),[v,_e]=(0,m.useState)(null),[y,ve]=(0,m.useState)(null),[b,ye]=(0,m.useState)(``),x=s(),S=(0,m.useRef)(null),[C,be]=(0,m.useState)(null),[w,T]=(0,m.useState)(null),[xe,E]=(0,m.useState)(!1),[D,Se]=(0,m.useState)(null),Ce=(0,m.useCallback)(e=>{Se(e?.error?.message||`Failed to load the map style/tiles.`)},[]),we=(0,m.useCallback)(()=>{if(typeof navigator>`u`||!navigator.geolocation){T(`Geolocation is not available in this browser.`);return}E(!0),T(null),navigator.geolocation.getCurrentPosition(e=>{let{longitude:t,latitude:n}=e.coords;be({lng:t,lat:n}),E(!1);try{S.current?.flyTo({center:[t,n],zoom:12,duration:800})}catch{}},e=>{E(!1),T(e.message||`Unable to retrieve location.`)},{enableHighAccuracy:!1,timeout:8e3,maximumAge:6e4})},[]),O=(0,m.useMemo)(()=>Fe(e),[e]),k=(0,m.useMemo)(()=>Re(e),[e]),A=O?.provider===`value`,j=O?.provider,M=O?.provider===`object`?O.object:void 0,N=O?.provider===`value`?O.items:void 0,P=me(e,O),{ready:F,def:I}=fe(P??``,A?void 0:t),L=o(),R=!Array.isArray(r)&&j===`object`,z=oe(R?M:void 0),Oe=(0,m.useRef)(z),ke=(0,m.useRef)(null),B=(0,m.useRef)(0),je=ae(),V=de(e.filter,je);(0,m.useEffect)(()=>{if(R&&!F){h(!0);return}let n=[r,j,M,N,t,A,V,e.sort,I,L],i=ke.current,a=i!==null&&i.length===n.length&&n.every((e,t)=>Object.is(e,i[t])),o=z!==Oe.current;Oe.current=z;let s=o&&a,c=++B.current,l=()=>B.current===c,u=(e,t)=>{l()&&(he(e),_e(t),_(null),ke.current=n)};return(async()=>{try{if(s||h(!0),Array.isArray(r)){u(r,null);return}if(A&&j===`value`){let t=await new se({items:N??[]}).find(``,{$filter:V,$orderby:d(e.sort),...ee()}),n=ce(t);u(n.rows,n);return}if(!t||typeof t.find!=`function`)throw Error(`DataSource required for object/api providers`);if(j===`object`){let n=M,r=pe(I?.fields),i=L?.isLoaded?r.filter(e=>L.checkField(n,e,`read`)):r,a=await t.find(n,{$filter:V,$orderby:d(e.sort),...ee(),...i.length>0?{$expand:i}:{}}),o=ce(a);u(o.rows,o)}else j===`api`&&(console.warn(`API provider not yet implemented for ObjectMap`),u([],null))}catch(e){s?console.error(`[ObjectMap] Failed to refresh data:`,e):l()&&_(e)}finally{l()&&h(!1)}})(),()=>{B.current+=1}},[r,j,M,N,t,A,V,e.sort,F,I,L,z,R]);let{markers:H,invalidCount:U}=(0,m.useMemo)(()=>{let e=0;return{markers:le.map((t,n)=>{let r=Be(t,k);if(!r)return e++,null;let i=ne(I,t,{titleField:k.titleField,fallback:`Marker`}),a=te(t,k.descriptionField),[o,s]=r;return!isFinite(o)||!isFinite(s)||o<-90||o>90||s<-180||s>180?(e++,null):{id:t.id||t._id||`marker-${n}`,title:i,description:a,coordinates:[s,o],data:t}}).filter(e=>e!==null),invalidCount:e}},[le,k,I]),W=(0,m.useMemo)(()=>H.find(e=>e.id===y),[H,y]),[K,q]=(0,m.useState)(k.zoom||3),Ie=(0,m.useCallback)(e=>{try{let t=e?.target?.getZoom?.();typeof t==`number`&&Number.isFinite(t)&&q(Math.round(t))}catch{}},[]),J=ie({navigation:e.navigation,objectName:e.objectName,onRowClick:a}),Y=(0,m.useMemo)(()=>{if(!b.trim())return H;let e=b.toLowerCase();return H.filter(t=>t.title?.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))},[H,b]),Le=(0,m.useMemo)(()=>p??(e.enableClustering||Y.length>100)?Ve(Y,K,re):Y.map(e=>({id:e.id,coordinates:e.coordinates,markers:[e],isCluster:!1})),[Y,K,p,re,e]),X=(0,m.useMemo)(()=>Me(Y.map(e=>e.coordinates)),[Y]),Z=typeof k.center?.[0]==`number`?k.center[0]:void 0,Q=typeof k.center?.[1]==`number`?k.center[1]:void 0,$=typeof k.zoom==`number`?k.zoom:void 0,He=Z!==void 0||Q!==void 0||$!==void 0,Ue=(0,m.useMemo)(()=>{if(X&&!He)return{bounds:X,fitBoundsOptions:{padding:48,maxZoom:12}};let e=X?Ne(X):{longitude:0,latitude:0};return{longitude:Q??e.longitude,latitude:Z??e.latitude,zoom:$??(X?3:2)}},[X,He,Q,Z,$]);return ze(k)?ge?(0,G.jsx)(`div`,{className:c(`min-w-0 overflow-hidden`,n),children:(0,G.jsx)(`div`,{className:`flex items-center justify-center h-96 bg-muted rounded-lg border`,children:(0,G.jsx)(`div`,{className:`text-muted-foreground`,children:`Loading map...`})})}):g?(0,G.jsx)(`div`,{className:c(`min-w-0 overflow-hidden`,n),children:(0,G.jsx)(`div`,{className:`flex items-center justify-center h-96 bg-muted rounded-lg border`,children:(0,G.jsxs)(`div`,{className:`text-destructive`,children:[`Error: `,g.message]})})}):(0,G.jsxs)(`div`,{className:c(`min-w-0 overflow-hidden`,n),children:[U>0&&(0,G.jsx)(`div`,{className:`mb-2 p-2 text-sm text-yellow-800 bg-yellow-50 border border-yellow-200 rounded`,children:`${U} record${U===1?``:`s`} with missing or invalid coordinates excluded from the map.`}),H.length>0&&(0,G.jsx)(`div`,{className:`mb-2`,children:(0,G.jsx)(`input`,{type:`text`,value:b,onChange:e=>ye(e.target.value),placeholder:`Search locations…`,className:`w-full px-3 py-2 text-sm border rounded-md bg-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring`})}),(0,G.jsxs)(`div`,{className:`relative border rounded-lg overflow-hidden bg-muted h-[300px] sm:h-[400px] md:h-[500px] lg:h-[600px] w-full`,children:[(0,G.jsxs)(Te,{ref:e=>{S.current=e},initialViewState:Ue,style:{width:`100%`,height:`100%`},mapStyle:k.style||Pe,touchZoomRotate:!0,dragRotate:!0,touchPitch:!0,onLoad:Ie,onZoom:e=>q(Math.round(e.viewState.zoom)),onError:Ce,children:[D&&(0,G.jsxs)(`div`,{role:`alert`,className:`absolute inset-x-0 top-0 z-20 p-2 text-sm text-center text-amber-900 bg-amber-50 border-b border-amber-200`,children:[`Map failed to load (`,D,`). Markers below are still listed in the search box;`,` `,k.style?`check the configured map style URL.`:`configure a custom map style for production use.`]}),(0,G.jsx)(Ae,{position:`top-right`,showCompass:!0,showZoom:!0}),(0,G.jsx)(`button`,{type:`button`,onClick:we,disabled:xe,className:`absolute top-2 left-2 z-10 inline-flex items-center justify-center size-9 rounded-md bg-background/95 border shadow-sm hover:bg-background disabled:opacity-50`,"aria-label":`Show my location`,"data-testid":`map-geolocate`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:xe?`⏳`:`🧭`})}),C&&(0,G.jsx)(Ee,{longitude:C.lng,latitude:C.lat,anchor:`center`,children:(0,G.jsx)(`div`,{className:`size-3 rounded-full bg-blue-500 ring-4 ring-blue-500/30 shadow`,"aria-label":`Your location`,"data-testid":`map-user-location`})}),Le.map(e=>e.isCluster?(0,G.jsx)(Ee,{longitude:e.coordinates[0],latitude:e.coordinates[1],anchor:`center`,onClick:t=>{t.originalEvent.stopPropagation();try{let t=Math.min(20,Math.max(K+2,8));S.current?.flyTo({center:[e.coordinates[0],e.coordinates[1]],zoom:t,duration:600})}catch{}},children:(0,G.jsx)(`div`,{className:`flex items-center justify-center rounded-full bg-primary text-primary-foreground font-bold text-xs cursor-pointer hover:scale-110 transition-transform shadow-md`,style:{width:Math.min(48,24+e.markers.length*2),height:Math.min(48,24+e.markers.length*2)},title:`${e.markers.length} markers`,"data-testid":`map-cluster`,children:e.markers.length})},e.id):(0,G.jsx)(Ee,{longitude:e.coordinates[0],latitude:e.coordinates[1],anchor:`bottom`,onClick:t=>{t.originalEvent.stopPropagation();let n=e.markers[0];ve(n.id),J.handleClick(n.data),i?.(n.data)},children:(0,G.jsx)(`div`,{className:`text-2xl cursor-pointer hover:scale-110 transition-transform`,children:`📍`})},e.id)),W&&!x&&(0,G.jsx)(De,{longitude:W.coordinates[0],latitude:W.coordinates[1],anchor:`top`,onClose:()=>ve(null),closeOnClick:!1,children:(0,G.jsxs)(`div`,{className:`p-2 min-w-[150px] sm:min-w-[200px]`,children:[(0,G.jsx)(`h3`,{className:`font-bold text-sm mb-1`,children:W.title}),W.description&&(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:W.description}),(0,G.jsxs)(`div`,{className:`mt-2 text-xs flex gap-2`,children:[u&&(0,G.jsx)(`button`,{type:`button`,className:`text-blue-500 hover:underline`,onClick:()=>u(W.data),children:`Edit`}),f&&(0,G.jsx)(`button`,{type:`button`,className:`text-red-500 hover:underline`,onClick:()=>f(W.data),children:`Delete`})]})]})})]}),W&&x&&(0,G.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 z-30 bg-background border-t shadow-lg rounded-t-2xl p-4 pb-[max(env(safe-area-inset-bottom),1rem)]`,role:`dialog`,"aria-label":`Location details`,"data-testid":`map-mobile-record-sheet`,children:[(0,G.jsx)(`div`,{className:`mx-auto mb-2 h-1 w-10 rounded-full bg-muted`,"aria-hidden":`true`}),(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold truncate`,children:W.title}),W.description&&(0,G.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground line-clamp-3`,children:W.description})]}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>ve(null),className:`text-muted-foreground hover:text-foreground text-lg leading-none px-2`,"aria-label":`Close details`,"data-testid":`map-mobile-record-close`,children:`×`})]}),(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 text-xs`,children:[u&&(0,G.jsx)(`button`,{type:`button`,className:`px-3 py-1.5 rounded-md border bg-card hover:bg-accent`,onClick:()=>u(W.data),children:`Edit`}),f&&(0,G.jsx)(`button`,{type:`button`,className:`px-3 py-1.5 rounded-md border border-destructive/30 text-destructive hover:bg-destructive/10`,onClick:()=>f(W.data),children:`Delete`})]})]}),w&&(0,G.jsx)(`div`,{className:`absolute top-2 left-14 right-2 z-10 text-xs px-3 py-1.5 rounded-md bg-destructive/10 text-destructive border border-destructive/30`,children:w})]}),v&&(0,G.jsx)(ue,{result:v}),J.isOverlay&&(0,G.jsx)(l,{...J,title:`Location Details`,children:e=>(0,G.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,G.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]}):(0,G.jsx)(`div`,{className:c(`min-w-0 overflow-hidden`,n),children:(0,G.jsx)(`div`,{className:`flex items-center justify-center h-96 bg-muted rounded-lg border p-4 text-center`,"data-testid":`map-missing-location-binding`,role:`alert`,children:(0,G.jsxs)(`div`,{className:`text-destructive`,children:[`Map configuration required — declare `,(0,G.jsx)(`code`,{className:`font-mono`,children:`map.locationField`}),` `,`or `,(0,G.jsx)(`code`,{className:`font-mono`,children:`map.latitudeField`}),` +`,` `,(0,G.jsx)(`code`,{className:`font-mono`,children:`map.longitudeField`})]})})})},$=t({ObjectMap:()=>Q,ObjectMapRenderer:()=>Ue}),He={filter:!0,sort:!0},Ue=re(({schema:e,...t})=>{let{dataSource:n}=u()||{};return(0,G.jsx)(le,{schema:e,mapping:He,dataSource:n,testId:`object-map`,errorTitle:`This map’s data source could not be resolved`,children:e=>(0,G.jsx)(Q,{schema:e,dataSource:n,...t})})});p.register(`object-map`,Ue,{namespace:`plugin-map`,label:`Object Map`,category:`view`,inputs:[{name:`objectName`,type:`string`,description:"ObjectQL object name. The record source is one of `data`, `staticData` and `objectName`; the `object-map` schema refuses a block that declares none of them."},{name:`map`,type:`object`,description:`latitudeField, longitudeField, titleField`},{name:`data`,type:`object`,description:"A `{ provider, … }` data-source configuration, read FIRST on the record-source ladder: a map carrying one never reaches `staticData` and never queries `objectName`. `{ provider: 'value', items }` plots those rows and `{ provider: 'object', object }` queries that object, both narrowed by `filter` and ordered by `sort`. The `api` provider is not implemented on the map and plots no markers. A bare array is not this key’s shape and is not a record source: the map falls through to `staticData`, then `objectName`, so inline rows belong under `staticData`."},{name:`staticData`,type:`array`,description:"Inline records, read SECOND on the record-source ladder: a `data` configuration wins and this key is then never reached, while `objectName` is read AFTER it, so a map carrying both plots these rows and never queries that object. `filter` and `sort` narrow and order these rows exactly as they do fetched ones."}]});export{$ as t};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{t as n,v as r}from"./vendor-react-BggL7APJ.js";import{Br as i,Dn as a,Hr as o,Si as s,Ur as c,Vr as l,ni as u,p as d,v as f,vi as p,zr as m}from"./ui-components-BTB1NkUW.js";import{An as h,Bn as g,Cn as _,Dt as v,Ln as y,Nn as b,On as x,Pn as S,Rn as C,S as w,Ui as T,Vn as E,Wn as D,Xr as O,Zr as k,an as A,bn as ee,g as te,ht as j,in as M,jn as ne,on as N,pt as P,qi as re,sn as F,vn as ie,x as ae,zn as oe}from"./framework-DcWkeiND.js";import{g as I,m as L,o as se,p as R,t as z,w as ce}from"./i18n-runtime-CTgAQF4N.js";import{t as B}from"./vendor-icon-download-C3csYSaD.js";import{t as le}from"./vendor-icon-loader-circle-D3PsuVaD.js";import{t as ue}from"./vendor-icon-printer-VcYhF59P.js";import{t as de}from"./vendor-icon-refresh-cw-BGjSPEfJ.js";import{t as fe}from"./vendor-icon-table-2-DMQ6UahM.js";import{t as pe}from"./vendor-icon-triangle-alert-D5n0T3q_.js";var V=e(r(),1),H=n(),me=({schema:e})=>{let{title:t,description:n,data:r,columns:a}=e;e.chart?.type;let s=!!e.chart;return(0,H.jsxs)(m,{className:`h-full flex flex-col ${e.className||``}`,children:[(0,H.jsxs)(o,{children:[t&&(0,H.jsx)(c,{children:t}),n&&(0,H.jsx)(l,{children:n})]}),(0,H.jsxs)(i,{className:`flex-1 overflow-auto space-y-4`,children:[s&&(()=>{let t=e.chart?.type,n=t?T.get(t):null;return n||=T.get(`chart`),n?(0,H.jsx)(`div`,{className:`min-h-[300px] border rounded-lg p-4 bg-background/50`,children:(0,H.jsx)(n,{schema:{...e.chart,data:e.chart.data||r}})}):(0,H.jsxs)(`div`,{className:`min-h-[100px] border rounded-md p-4 bg-muted/20 text-muted-foreground flex items-center justify-center`,children:[`Unknown component type: `,t||`chart`]})})(),r&&r.length>0&&(0,H.jsx)(`div`,{className:`border rounded-lg`,children:(()=>{let e=T.get(`grid`)||T.get(`table`);return e?(0,H.jsx)(e,{schema:{type:`grid`,rowData:r,columnDefs:a,domLayout:`autoHeight`}}):(0,H.jsx)(`div`,{className:`overflow-x-auto`,children:(0,H.jsxs)(`table`,{className:`w-full text-sm text-left`,children:[(0,H.jsx)(`thead`,{className:`text-xs uppercase bg-muted`,children:(0,H.jsx)(`tr`,{children:a?.map(e=>(0,H.jsx)(`th`,{className:`px-6 py-3`,children:e.headerName||e.label||e.field},e.field))})}),(0,H.jsx)(`tbody`,{children:r.map((e,t)=>(0,H.jsx)(`tr`,{className:`bg-background border-b`,children:a?.map(t=>(0,H.jsx)(`td`,{className:`px-6 py-4`,children:e[t.field]},t.field))},t))})]})})})()})]})]})};function U(e,t,n){try{return e.toLocaleString(t,n)}catch{return e.toLocaleString(`en`,n)}}function he(e,t,n){let r=e.fields||[],i=r.map(e=>e.label||e.name),a=t.map(e=>r.map(t=>{let n=e[t.name];return n=ye(n),typeof n==`string`&&(n.includes(`,`)||n.includes(`"`)||n.includes(`
|
|
2
|
-
`))?`"${n.replace(/"/g,`""`)}"`:n??``}));q([...n?.includeHeaders===!1?[]:[i.join(`,`)],...a.map(e=>e.join(`,`))].join(`
|
|
3
|
-
`),n?.filename||`${e.title||`report`}.csv`,`text/csv`)}function ge(e,t,n){let r={title:e.title,description:e.description,generatedAt:new Date().toISOString(),data:t};q(JSON.stringify(r,null,2),n?.filename||`${e.title||`report`}.json`,`application/json`)}function W(e,t,n,r=`en`){let i=e.fields||[],a=xe(n?.orientation),o=be(n?.pageSize);q(`<!DOCTYPE html>
|
|
4
|
-
<html>
|
|
5
|
-
<head>
|
|
6
|
-
<meta charset="utf-8">
|
|
7
|
-
<title>${K(e.title||`Report`)}</title>
|
|
8
|
-
<style>
|
|
9
|
-
@page { size: ${o} ${a}; margin: 20mm; }
|
|
10
|
-
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #333; }
|
|
11
|
-
h1 { font-size: 24px; margin-bottom: 8px; }
|
|
12
|
-
.description { color: #666; margin-bottom: 24px; }
|
|
13
|
-
.meta { color: #999; font-size: 12px; margin-bottom: 16px; }
|
|
14
|
-
table { width: 100%; border-collapse: collapse; margin-top: 16px; }
|
|
15
|
-
th { background: #f5f5f5; text-align: left; padding: 8px 12px; border: 1px solid #ddd; font-weight: 600; }
|
|
16
|
-
td { padding: 8px 12px; border: 1px solid #ddd; }
|
|
17
|
-
tr:nth-child(even) { background: #fafafa; }
|
|
18
|
-
</style>
|
|
19
|
-
</head>
|
|
20
|
-
<body>
|
|
21
|
-
<h1>${K(e.title||`Report`)}</h1>
|
|
22
|
-
${e.description?`<p class="description">${K(e.description)}</p>`:``}
|
|
23
|
-
<p class="meta">Generated: ${new Date().toLocaleString(r)}</p>
|
|
24
|
-
<table>
|
|
25
|
-
<thead><tr>${i.map(e=>`<th>${K(e.label||e.name)}</th>`).join(``)}</tr></thead>
|
|
26
|
-
<tbody>${t.map(e=>`<tr>${i.map(t=>`<td>${K(String(e[t.name]??``))}</td>`).join(``)}</tr>`).join(``)}</tbody>
|
|
27
|
-
</table>
|
|
28
|
-
</body>
|
|
29
|
-
</html>`,n?.filename||`${e.title||`report`}.html`,`text/html`)}function _e(e,t,n,r=`en`){let i=e.fields||[],a=xe(n?.orientation),o=be(n?.pageSize),s=window.open(``,`_blank`);if(!s){W(e,t,{...n,format:`html`,filename:n?.filename?.replace(/\.pdf$/,`.html`)||`${e.title||`report`}.html`},r);return}s.document.write(`<!DOCTYPE html>
|
|
30
|
-
<html>
|
|
31
|
-
<head>
|
|
32
|
-
<meta charset="utf-8">
|
|
33
|
-
<title>${K(e.title||`Report`)}</title>
|
|
34
|
-
<style>
|
|
35
|
-
@page { size: ${o} ${a}; margin: 20mm; }
|
|
36
|
-
@media print { .no-print { display: none; } }
|
|
37
|
-
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #333; }
|
|
38
|
-
h1 { font-size: 24px; margin-bottom: 8px; }
|
|
39
|
-
.description { color: #666; margin-bottom: 24px; }
|
|
40
|
-
.meta { color: #999; font-size: 12px; margin-bottom: 16px; }
|
|
41
|
-
table { width: 100%; border-collapse: collapse; margin-top: 16px; }
|
|
42
|
-
th { background: #f5f5f5; text-align: left; padding: 8px 12px; border: 1px solid #ddd; font-weight: 600; }
|
|
43
|
-
td { padding: 8px 12px; border: 1px solid #ddd; }
|
|
44
|
-
tr:nth-child(even) { background: #fafafa; }
|
|
45
|
-
</style>
|
|
46
|
-
</head>
|
|
47
|
-
<body>
|
|
48
|
-
<h1>${K(e.title||`Report`)}</h1>
|
|
49
|
-
${e.description?`<p class="description">${K(e.description)}</p>`:``}
|
|
50
|
-
<p class="meta">Generated: ${new Date().toLocaleString(r)}</p>
|
|
51
|
-
<table>
|
|
52
|
-
<thead><tr>${i.map(e=>`<th>${K(e.label||e.name)}</th>`).join(``)}</tr></thead>
|
|
53
|
-
<tbody>${t.map(e=>`<tr>${i.map(t=>`<td>${K(String(e[t.name]??``))}</td>`).join(``)}</tr>`).join(``)}</tbody>
|
|
54
|
-
</table>
|
|
55
|
-
</body>
|
|
56
|
-
</html>`),s.document.close(),s.onload=()=>{s.print()}}function ve(e,t,n){let r=e.fields||[],i=r.map(e=>e.label||e.name),a=t.map(e=>r.map(t=>{let n=e[t.name];return n=ye(n),typeof n==`string`&&(n.includes(`,`)||n.includes(`"`)||n.includes(`
|
|
57
|
-
`)||n.includes(` `))?`"${n.replace(/"/g,`""`)}"`:n??``}));q(``+[...n?.includeHeaders===!1?[]:[i.join(` `)],...a.map(e=>e.join(` `))].join(`
|
|
58
|
-
`),n?.filename||`${e.title||`report`}.tsv`,`text/tab-separated-values`)}function G(e,t,n,r,i=`en`){switch(e){case`csv`:he(t,n,r);break;case`json`:ge(t,n,r);break;case`html`:W(t,n,r,i);break;case`pdf`:_e(t,n,r,i);break;case`excel`:ve(t,n,r);break;default:console.warn(`Unsupported export format: ${e}`)}}function K(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function ye(e){if(typeof e==`string`&&e.length>0){let t=e.charAt(0);if(t===`=`||t===`+`||t===`-`||t===`@`||t===`|`)return`\t${e}`}return e}function be(e){return[`A4`,`A3`,`Letter`,`Legal`].includes(e||``)?e:`A4`}function xe(e){return e===`landscape`?`landscape`:`portrait`}function q(e,t,n){let r=new Blob([e],{type:`${n};charset=utf-8`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}function J(e,t,n=`en`){if(e==null||e===``)return``;let r=t?.type,i=t?.format;if(r===`date`||i===`date`||Se(e))return Ce(e);if(r===`number`||typeof e==`number`){let t=typeof e==`number`?e:Number(e);return isNaN(t)?String(e):i===`currency`||i===`currency_cny`?`¥${U(t,n,{minimumFractionDigits:0,maximumFractionDigits:0})}`:i===`currency_usd`?`$${U(t,n,{minimumFractionDigits:0,maximumFractionDigits:0})}`:i===`percent`?`${U(t,n,{minimumFractionDigits:1,maximumFractionDigits:1})}%`:U(t,n)}return String(e)}function Se(e){return typeof e==`string`&&/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2})?/.test(e)}function Ce(e){try{let t=ie(e);return isNaN(t.getTime())?String(e):`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}catch{return String(e)}}function we(e,t){if(!t||t.length===0||!e||e.length===0)return null;let n=t[0],r=n.field,i=new Map;for(let t of e){let e=String(t[r]??`(empty)`);i.has(e)||i.set(e,[]),i.get(e).push(t)}let a=[];for(let[e,t]of i)a.push({key:e,label:`${n.label||r}: ${e}`,rows:t});let o=n.sort===`desc`?-1:1;return a.sort((e,t)=>e.key.localeCompare(t.key)*o),a}function Te(e,t,n){if(!e)return 0;let r=e.map(e=>Number(e[t])||0);switch(n){case`count`:return e.length;case`sum`:return r.reduce((e,t)=>e+t,0);case`avg`:return r.length>0?(r.reduce((e,t)=>e+t,0)/r.length).toFixed(2):0;case`min`:return r.length>0?Math.min(...r):0;case`max`:return r.length>0?Math.max(...r):0;case`distinct`:return new Set(e.map(e=>e[t])).size;default:return``}}var Y=({schema:e,onRefresh:t})=>{let{report:n,data:r,showToolbar:h=!0,allowExport:g=!0,allowPrint:_=!0,loading:v=!1}=e,y=I(),b=z(),x=e=>{if(!n){console.warn(`ReportViewer: Cannot export, no report defined`);return}G(e,n,r||[],n.exportConfigs?.[e],b)},S=y(`common.printDialogHint`,`Opens your browser’s print dialog (not a PDF export)`),C=()=>{window.print()},w=()=>{t?.()},T=(e,t)=>Te(r,e,t),E=(e,t)=>{let r=n?.conditionalFormatting;if(r&&Array.isArray(r))for(let n of r){if(n.field!==e)continue;let r=String(t??``),i=String(n.value??``),a=!1;switch(n.operator){case`equals`:a=r===i;break;case`not_equals`:a=r!==i;break;case`contains`:a=r.includes(i);break;case`greater_than`:a=Number(t)>Number(n.value);break;case`less_than`:a=Number(t)<Number(n.value)}if(a){let e={};return n.backgroundColor&&(e.backgroundColor=n.backgroundColor),n.textColor&&(e.color=n.textColor),e}}},D=(e,t)=>{if(e==null||e===``)return``;if(t.renderAs===`badge`&&(!t.type||t.type===`string`||t.type===`text`)){let n=t.colorMap?.[String(e)]||``;return(0,H.jsx)(u,{className:n,children:String(e)})}if(t.aggregation)return J(e,t,b);if(t.type){let n={...t};t.colorMap&&!n.options&&(n.options=Object.entries(t.colorMap).map(([e,t])=>({value:e,label:e,color:t})));let r=d(f(n));return(0,H.jsx)(r,{value:e,field:n})}return J(e,t,b)};return n?(0,H.jsxs)(`div`,{className:`space-y-4`,children:[h&&(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 p-4 bg-card rounded-lg border`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-lg font-semibold`,children:n.title}),n.description&&(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.description})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,"data-print-hide":!0,children:[n.refreshInterval&&(0,H.jsxs)(p,{variant:`outline`,size:`sm`,onClick:w,children:[(0,H.jsx)(de,{className:`h-4 w-4 mr-2`}),`Refresh`]}),_&&(0,H.jsxs)(p,{variant:`outline`,size:`sm`,onClick:C,"aria-label":`Print: ${S}`,title:S,children:[(0,H.jsx)(ue,{className:`h-4 w-4 mr-2`}),`Print`]}),g&&n.showExportButtons&&(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsxs)(p,{variant:`outline`,size:`sm`,onClick:()=>x(`pdf`),children:[(0,H.jsx)(B,{className:`h-4 w-4 mr-2`}),`PDF`]}),(0,H.jsxs)(p,{variant:`outline`,size:`sm`,onClick:()=>x(`excel`),children:[(0,H.jsx)(B,{className:`h-4 w-4 mr-2`}),`Excel`]}),(0,H.jsxs)(p,{variant:`outline`,size:`sm`,onClick:()=>x(`csv`),children:[(0,H.jsx)(B,{className:`h-4 w-4 mr-2`}),`CSV`]})]})]})]}),(0,H.jsxs)(m,{children:[(0,H.jsxs)(o,{children:[!h&&n.title&&(0,H.jsx)(c,{children:n.title}),!h&&n.description&&(0,H.jsx)(l,{children:n.description})]}),(0,H.jsxs)(i,{className:`space-y-6`,children:[v&&(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[1,2,3].map(e=>(0,H.jsx)(m,{children:(0,H.jsxs)(i,{className:`p-4 space-y-2`,children:[(0,H.jsx)(a,{className:`h-4 w-20`}),(0,H.jsx)(a,{className:`h-8 w-28`})]})},e))}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(a,{className:`h-10 w-full`}),[1,2,3,4,5].map(e=>(0,H.jsx)(a,{className:`h-8 w-full`},e))]})]}),!v&&n.sections?.map((e,t)=>e.visible===!1?null:(0,H.jsxs)(`div`,{className:`space-y-2`,children:[e.title&&e.type!==`header`&&(0,H.jsx)(`h3`,{className:`text-lg font-semibold border-b pb-2`,children:e.title}),e.type===`header`&&e.title&&(0,H.jsx)(`div`,{className:`text-2xl font-bold py-4`,children:e.title}),e.type===`summary`&&(0,H.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:n.fields?.filter(e=>e.showInSummary).map((e,t)=>(0,H.jsx)(m,{children:(0,H.jsxs)(i,{className:`p-4`,children:[(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.label||e.name}),(0,H.jsx)(`div`,{className:`text-2xl font-bold`,children:J(T(e.name,e.aggregation),e,b)})]})},t))}),e.type===`table`&&(0,H.jsx)(`div`,{className:`border rounded-lg overflow-x-auto`,children:(0,H.jsxs)(`table`,{className:`w-full text-sm min-w-[600px]`,children:[(0,H.jsx)(`thead`,{className:`bg-muted`,children:(0,H.jsx)(`tr`,{children:e.columns?.map((e,t)=>(0,H.jsx)(`th`,{className:`px-4 py-2 font-medium ${e.type===`number`?`text-right`:`text-left`}`,children:e.label||e.name},t))})}),(0,H.jsx)(`tbody`,{children:(()=>{let t=we(r||[],n.groupBy||[]);return t?t.map(t=>(0,H.jsxs)(V.Fragment,{children:[(0,H.jsx)(`tr`,{className:`bg-muted/60`,children:(0,H.jsxs)(`td`,{colSpan:e.columns?.length||1,className:`px-4 py-2 font-semibold text-sm`,children:[t.label,` (`,t.rows.length,`)`]})}),t.rows.map((t,n)=>(0,H.jsx)(`tr`,{className:`border-t hover:bg-muted/50 even:bg-muted/20`,children:e.columns?.map((e,n)=>(0,H.jsx)(`td`,{className:`px-4 py-2 ${e.type===`number`?`text-right tabular-nums`:``}`,style:E(e.name,t[e.name]),children:D(t[e.name],e)},n))},n))]},t.key)):r?.map((t,n)=>(0,H.jsx)(`tr`,{className:`border-t hover:bg-muted/50 even:bg-muted/20`,children:e.columns?.map((e,n)=>(0,H.jsx)(`td`,{className:`px-4 py-2 ${e.type===`number`?`text-right tabular-nums`:``}`,style:E(e.name,t[e.name]),children:D(t[e.name],e)},n))},n))})()})]})}),e.type===`text`&&e.text&&(0,H.jsx)(`div`,{className:`prose max-w-none`,children:(0,H.jsx)(`p`,{children:e.text})}),e.type===`page-break`&&(0,H.jsx)(`div`,{className:`border-t-2 border-dashed my-8 print:page-break-after-always`}),Array.isArray(e.content)?e.content.map((e,t)=>(0,H.jsx)(j,{schema:P(e)},t)):s(e.content,e=>(0,H.jsx)(j,{schema:P(e)}))]},t)),!n.sections&&r&&r.length>0&&(0,H.jsx)(`div`,{className:`border rounded-lg overflow-x-auto`,children:(0,H.jsxs)(`table`,{className:`w-full text-sm min-w-[600px]`,children:[(0,H.jsx)(`thead`,{className:`bg-muted`,children:(0,H.jsx)(`tr`,{children:n.fields?.map((e,t)=>(0,H.jsx)(`th`,{className:`px-4 py-2 font-medium ${e.type===`number`?`text-right`:`text-left`}`,children:e.label||e.name},t))})}),(0,H.jsx)(`tbody`,{children:r.map((e,t)=>(0,H.jsx)(`tr`,{className:`border-t hover:bg-muted/50 even:bg-muted/20`,children:n.fields?.map((t,n)=>(0,H.jsx)(`td`,{className:`px-4 py-2 ${t.type===`number`?`text-right tabular-nums`:``}`,style:E(t.name,e[t.name]),children:D(e[t.name],t)},n))},t))})]})})]})]})]}):(0,H.jsx)(m,{children:(0,H.jsx)(i,{className:`p-8 text-center text-muted-foreground`,children:`No report to display`})})};function Ee(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.dataset==`string`&&t.dataset.length>0||t.type===`joined`&&Array.isArray(t.blocks)&&t.blocks.some(e=>typeof e?.dataset==`string`)}var De=new Set,Oe=()=>!1;function ke(e,t){if(!Oe())return;let n=e.filter;if(n===void 0)return;let r=`${t}:${n&&typeof n==`object`?Object.keys(n).sort().join(`,`):String(n)}`;De.has(r)||(De.add(r),console.warn(`[ObjectUI] ${t} carries \`filter\`, which is not an authorable key. Did you mean \`filter\` → \`runtimeFilter\`? NO filter was applied — it renders UNFILTERED, showing rows the report was scoped to exclude. \`ReportSchema\` (\`@objectstack/spec\`) is strict and rejects \`filter\`, so this document did not come through the validated path; the renderer no longer reads it either. Fix the producer: rename \`filter\` to \`runtimeFilter\`. (objectui#5137)`))}function Ae(e){return`Report \`${e.name??`(unnamed)`}\``}function je(e,t){return e?typeof e==`string`?e:typeof e==`object`&&typeof e.default==`string`?e.default:t:t}function X(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&!!e):[]}function Me(e){if(!Array.isArray(e))return;let t={};for(let n of e){let e=n&&typeof n==`object`?n.by:void 0;typeof e==`string`&&e&&(t[e]=n.direction===`desc`?`desc`:`asc`)}return Object.keys(t).length>0?t:void 0}function Ne(e,t,n){if(!e)return;let r=new Set([...t,...n]),i={};for(let[t,n]of Object.entries(e))r.has(t)&&(i[t]=n);return Object.keys(i).length>0?i:void 0}function Z(e,t,n,r,i,a,o){let[s,c]=V.useState({status:`idle`,rows:[]}),l=Ne(o,t,n),u=JSON.stringify(r??null),d=JSON.stringify(a??null),f=JSON.stringify(l??null),p=`${e}|${t.join(`,`)}|${n.join(`,`)}|${u}|${d}|${f}`,[m,h]=V.useState(void 0),g=te(m),_=V.useRef(null);return V.useEffect(()=>{let o=i;if(!o||typeof o.queryDataset!=`function`){_.current=null,h(void 0),c({status:`error`,rows:[],error:`This data source does not support dataset queries.`});return}if(!e||n.length===0){_.current=null,h(void 0),c({status:`idle`,rows:[]});return}let s=!1,u=_.current===p;return _.current=p,u||(h(void 0),c({status:`loading`,rows:[]})),o.queryDataset(e,{dimensions:t,measures:n,...r&&Object.keys(r).length>0?{runtimeFilter:r}:{},...a?{totals:{groupings:a}}:{},...l?{order:l}:{}}).then(e=>{s||(h(typeof e?.object==`string`&&e.object?e.object:void 0),c({status:`ok`,rows:Array.isArray(e?.rows)?e.rows:[],fields:Array.isArray(e?.fields)?e.fields:[],object:e?.object,dimensionFields:e?.dimensionFields,drillRawRows:Array.isArray(e?.drillRawRows)?e.drillRawRows:void 0,drillRanges:Array.isArray(e?.drillRanges)?e.drillRanges:void 0,totals:Array.isArray(e?.totals)?e.totals:void 0}))}).catch(e=>{s||c({status:`error`,rows:[],error:String(e?.message??e)})}),()=>{s=!0}},[p,g]),s}function Pe(...e){try{return M(...e)}catch(e){if(!(e instanceof re))throw e;return console.warn(`[DatasetReportRenderer] drill-down refused — the drilled list cannot be scoped: ${e.message}`),null}}function Fe({dataset:e}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-center rounded-md border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground`,children:[`This report binds the “`,e,`” dataset — choose at least one measure (values) to render.`]})}function Q({status:e,error:t}){return e===`error`?(0,H.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive`,children:[(0,H.jsx)(pe,{className:`h-3.5 w-3.5 mt-0.5 shrink-0`}),(0,H.jsx)(`span`,{className:`break-words`,children:t})]}):(0,H.jsxs)(`div`,{className:`flex items-center gap-2 p-4 text-xs text-muted-foreground`,children:[(0,H.jsx)(le,{className:`h-4 w-4 animate-spin`}),` Running report…`]})}function Ie(){return(0,H.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 rounded-md border border-dashed bg-muted/20 p-6 text-xs text-muted-foreground`,children:[(0,H.jsx)(fe,{className:`h-6 w-6`}),` The dataset returned no rows for this report’s scope.`]})}var Le=`cursor-pointer hover:bg-accent/40`;function Re({dataset:e,rows:t,values:n,runtimeFilter:r,dataSource:i,onDrill:a,order:o,withTotals:s}){let c=Z(e,t,n,r,i,s&&t.length>0?[[]]:void 0,o),{fieldLabel:l}=R(),u=I(),d=z(),f=ae(c.object,c.dimensionFields,t);if(n.length===0)return(0,H.jsx)(Fe,{dataset:e});if(c.status===`loading`||c.status===`idle`)return(0,H.jsx)(Q,{status:c.status});if(c.status===`error`)return(0,H.jsx)(Q,{status:`error`,error:c.error});if(c.rows.length===0)return(0,H.jsx)(Ie,{});let p=!!a&&t.length>0,m=c.dimensionFields?t.filter(e=>e in c.dimensionFields):[],h=(n,i)=>{let o={};for(let e of t)o[e]=n[e];let s=c.drillRanges?.[i],l=!!s&&Object.keys(s).length>0,u;if(c.object&&(m.length>0||l)){let e=Pe(c.drillRawRows?.[i],m,c.dimensionFields??{},r,s);if(e===null)return;u=e}a({dataset:e,groupKey:o,runtimeFilter:r,object:c.object,objectFilter:u})},{measureField:g,headerLabel:_}=A(c.fields,c.object,l,L(u)),v=[...t,...n],y=C(c.rows,f),b=s?c.totals?.find(e=>Array.isArray(e.dimensions)&&e.dimensions.length===0)?.rows?.[0]:void 0,x=u(`report.total`,`Total`);return(0,H.jsx)(`div`,{className:`overflow-auto max-h-[70vh] rounded-md border`,children:(0,H.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,H.jsx)(`thead`,{className:`bg-muted/40`,children:(0,H.jsx)(`tr`,{children:v.map(e=>(0,H.jsx)(`th`,{className:`px-2 py-1.5 text-left font-medium whitespace-nowrap`,children:_(e)},e))})}),(0,H.jsxs)(`tbody`,{children:[y.map((e,t)=>(0,H.jsx)(`tr`,{className:`border-t${p?` ${Le}`:``}`,"data-testid":p?`dataset-drill-row`:void 0,onClick:p?()=>h(c.rows[t],t):void 0,children:v.map(t=>(0,H.jsx)(`td`,{className:`px-2 py-1 tabular-nums whitespace-nowrap`,children:n.includes(t)?F(e[t],g(t)?.format,g(t)?.currency,g(t)?.percentScale,d):N(e[t],d)},t))},t)),b&&(0,H.jsxs)(`tr`,{className:`border-t bg-muted/30 font-medium`,"data-testid":`dataset-report-total-row`,children:[t.length>0&&(0,H.jsx)(`td`,{colSpan:t.length,className:`px-2 py-1 whitespace-nowrap`,children:x}),n.map(e=>(0,H.jsx)(`td`,{className:`px-2 py-1 tabular-nums whitespace-nowrap`,children:F(b[e],g(e)?.format,g(e)?.currency,g(e)?.percentScale,d)},e))]})]})]})})}function ze(e){switch(e){case`summary`:return`summary`;case`matrix`:return`matrix`;case`joined`:return`joined`;default:return`tabular`}}function Be(e){switch(e){case`bar`:case`column`:case`horizontal-bar`:case`line`:case`area`:case`pie`:case`donut`:case`funnel`:case`scatter`:case`treemap`:case`sankey`:case`radar`:case`combo`:return{kind:`series`,chartType:e};case`gauge`:case`solid-gauge`:case`metric`:case`kpi`:case`bullet`:return{kind:`single_value`};case`table`:case`pivot`:return{kind:`tabular`};default:return{kind:`unsupported`,type:String(e)}}}function Ve(e){let[,t]=V.useReducer(e=>e+1,0);return V.useEffect(()=>{if(T.get(e))return;let n=typeof T.subscribe==`function`?T.subscribe(()=>{T.get(e)&&t()}):void 0,r=T.loadLazy?.(e);return r&&typeof r.then==`function`&&r.then(()=>t()).catch(()=>{}),n},[e]),T.get(e)}function He(e,t,n){if(Array.isArray(e)&&t)for(let r of e){if(!r||typeof r!=`object`)continue;let{name:e,label:i}=r;if(e===t)return se(i,n)||void 0}}function Ue({dataset:e,chart:t,runtimeFilter:n,dataSource:r,order:i}){let a=typeof t.xAxis==`string`?t.xAxis:``,o=typeof t.yAxis==`string`?t.yAxis:``,s=Be(t.type),c=s.kind===`series`||s.kind===`single_value`,l=Z(e,s.kind===`series`&&a?[a]:[],c&&o?[o]:[],n,r,void 0,i),u=Ve(`chart`),{fieldLabel:d,fieldOptionLabel:f}=R(),p=I(),m=z(),{language:g}=ce(),v=V.useMemo(()=>a?[a]:[],[a]),T=w(l.object,l.dimensionFields,v),{categoryColors:E,dimensionLabels:D,categoryOrder:O}=V.useMemo(()=>{if(!T)return{categoryColors:null,dimensionLabels:null,categoryOrder:null};let{metaByPath:e,relabel:t}=T,n=t[0]?.path,r=n?e[n]:void 0,i=n?y(r?.options,S(r,f)):void 0;return{categoryColors:ne(i),dimensionLabels:b(e,t,f),categoryOrder:x(i)}},[T,f]),k=se(t.title,g)||void 0;if(s.kind===`tabular`)return null;if(s.kind===`unsupported`)return(0,H.jsxs)(`div`,{className:`rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground`,"data-testid":`dataset-report-chart-unsupported`,children:[`Chart type “`,s.type,`” is not a spec chart type — the grouped table below carries this report’s numbers.`]});if(s.kind===`series`&&!a||!o)return null;if(l.status===`loading`||l.status===`idle`)return(0,H.jsxs)(`div`,{className:`flex items-center gap-2 p-4 text-xs text-muted-foreground`,children:[(0,H.jsx)(le,{className:`h-4 w-4 animate-spin`}),` Loading chart…`]});if(l.status===`error`||l.rows.length===0)return null;let{measureField:te,headerLabel:j}=A(l.fields,l.object,d,L(p)),M=He(t.series,o,g)??j(o);if(s.kind===`single_value`){let e=te(o);return(0,H.jsxs)(`div`,{className:`rounded-md border bg-card p-3`,"data-testid":`dataset-report-metric`,children:[k?(0,H.jsx)(`h3`,{className:`mb-2 text-sm font-semibold`,children:k}):null,(0,H.jsxs)(`div`,{className:`flex flex-col gap-0.5 py-2`,children:[(0,H.jsx)(`span`,{className:`text-2xl font-semibold tabular-nums`,children:F(l.rows[0]?.[o],e?.format,e?.currency,e?.percentScale,m)}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:M})]})]})}if(!u)return null;let{data:N,xAxisKey:P,series:re}=h(C(l.rows,D),[a],[o],l.fields,{nullCategoryLabel:p(`chart.nullCategory`,`(None)`),builtinAggregateLabels:L(p)}),ie=_(re,t.series).map(e=>e.dataKey===o?{...e,label:M}:e),{title:ae,...oe}=ee(t,E);return(0,H.jsxs)(`div`,{className:`rounded-md border bg-card p-3`,"data-testid":`dataset-report-chart`,children:[k?(0,H.jsx)(`h3`,{className:`mb-2 text-sm font-semibold`,children:k}):null,(0,H.jsx)(u,{schema:{chartType:s.chartType,data:N,xAxisKey:P,series:ie,height:280,isAnimationActive:!1,...oe,...O?{categoryOrder:O}:{}}})]})}function $(e,t){return oe(e.map(e=>E(t[e])))}function We(e,t,n){return e.map(e=>N(t[e],n)).join(` / `)}function Ge({dataset:e,rows:t,columnsAcross:n,values:r,runtimeFilter:i,dataSource:a,onDrill:o,order:s}){let c=Z(e,[...t,...n],r,i,a,[t,n,[]],s),l=I(),{fieldLabel:u}=R(),d=z(),f=ae(c.object,c.dimensionFields,[...t,...n]),p=V.useMemo(()=>{if(c.status!==`ok`)return null;let e=[],r=[],i=new Set,a=new Set,o=new Map;return C(c.rows,f).forEach((s,l)=>{let u=c.rows[l],f=$(t,s),p=$(n,s);if(!i.has(f)){i.add(f);let n={},r={};for(let e of t)n[e]=u[e],r[e]=s[e];e.push({id:f,label:We(t,s,d),key:n,display:r})}if(!a.has(p)){a.add(p);let e={},t={};for(let r of n)e[r]=u[r],t[r]=s[r];r.push({id:p,label:We(n,s,d),key:e,display:t})}o.set(g(f,p),{row:u,index:l})}),{rowHeaders:e,colHeaders:r,cells:o}},[c,t,n,f,d]);if(r.length===0)return(0,H.jsx)(Fe,{dataset:e});if(c.status===`loading`||c.status===`idle`)return(0,H.jsx)(Q,{status:c.status});if(c.status===`error`)return(0,H.jsx)(Q,{status:`error`,error:c.error});if(!p||p.rowHeaders.length===0)return(0,H.jsx)(Ie,{});let{measureField:m,headerLabel:h}=A(c.fields,c.object,u,L(l)),_=l(`report.total`,`Total`),v=!!o,y=c.dimensionFields?[...t,...n].filter(e=>e in c.dimensionFields):[],b=(t,n,r)=>{let a=c.drillRanges?.[r],s=!!a&&Object.keys(a).length>0,l;if(c.object&&(y.length>0||s)){let e=Pe(c.drillRawRows?.[r],y,c.dimensionFields??{},i,a);if(e===null)return;l=e}o({dataset:e,groupKey:{...t,...n},runtimeFilter:i,object:c.object,objectFilter:l})},x=p.colHeaders.flatMap(e=>r.map(t=>({col:e,measure:t,header:r.length===1?e.label:`${e.label} · ${h(t)}`}))),S=e=>{let t=c.totals?.find(t=>Array.isArray(t.dimensions)&&t.dimensions.join(`,`)===e.join(`,`))?.rows;return t&&C(t,f)},w=new Map;for(let e of S(t)??[])w.set($(t,e),e);let T=new Map;for(let e of S(n)??[])T.set($(n,e),e);let E=S([])?.[0],D=w.size>0,O=T.size>0;return(0,H.jsx)(`div`,{className:`overflow-auto max-h-[70vh] rounded-md border`,"data-testid":`dataset-matrix`,children:(0,H.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,H.jsx)(`thead`,{className:`bg-muted/40`,children:(0,H.jsxs)(`tr`,{children:[t.map(e=>(0,H.jsx)(`th`,{className:`px-2 py-1.5 text-left font-medium whitespace-nowrap`,children:h(e)},e)),x.map(e=>(0,H.jsx)(`th`,{className:`px-2 py-1.5 text-right font-medium whitespace-nowrap`,children:e.header},`${e.col.id}-${e.measure}`)),D&&r.map(e=>(0,H.jsx)(`th`,{className:`px-2 py-1.5 text-right font-medium whitespace-nowrap`,"data-testid":`matrix-total-col-header`,children:r.length===1?_:`${_} · ${h(e)}`},`total-${e}`))]})}),(0,H.jsxs)(`tbody`,{children:[p.rowHeaders.map(e=>(0,H.jsxs)(`tr`,{className:`border-t`,children:[t.map(t=>(0,H.jsx)(`td`,{className:`px-2 py-1 whitespace-nowrap font-medium`,children:N(e.display[t],d)},t)),x.map(t=>{let n=p.cells.get(g(e.id,t.col.id)),r=n?.row[t.measure],i=v&&n!=null;return(0,H.jsx)(`td`,{className:`px-2 py-1 text-right tabular-nums whitespace-nowrap${i?` ${Le}`:``}`,"data-testid":i?`dataset-drill-cell`:void 0,onClick:i?()=>b(e.key,t.col.key,n.index):void 0,children:F(r,m(t.measure)?.format,m(t.measure)?.currency,m(t.measure)?.percentScale,d)},`${t.col.id}-${t.measure}`)}),D&&r.map(t=>(0,H.jsx)(`td`,{className:`px-2 py-1 text-right tabular-nums whitespace-nowrap font-medium`,"data-testid":`matrix-row-total`,children:F(w.get(e.id)?.[t],m(t)?.format,m(t)?.currency,m(t)?.percentScale,d)},`total-${t}`))]},e.id)),O&&(0,H.jsxs)(`tr`,{className:`border-t bg-muted/30 font-medium`,"data-testid":`matrix-total-row`,children:[t.length>0&&(0,H.jsx)(`td`,{colSpan:t.length,className:`px-2 py-1 whitespace-nowrap`,children:_}),x.map(e=>(0,H.jsx)(`td`,{className:`px-2 py-1 text-right tabular-nums whitespace-nowrap`,children:F(T.get(e.col.id)?.[e.measure],m(e.measure)?.format,m(e.measure)?.currency,m(e.measure)?.percentScale,d)},`${e.col.id}-${e.measure}`)),D&&r.map(e=>(0,H.jsx)(`td`,{className:`px-2 py-1 text-right tabular-nums whitespace-nowrap`,"data-testid":`matrix-grand-total`,children:F(E?.[e],m(e)?.format,m(e)?.currency,m(e)?.percentScale,d)},`grand-${e}`))]})]})]})})}var Ke=({report:e,dataSource:t,runtimeFilter:n,onDrill:r,className:i})=>{let a=Ae(e);ke(e,a);let o=D(e.runtimeFilter,n),s=e.drilldown===!1?void 0:r,c=ze(e.type);if(c===`joined`&&Array.isArray(e.blocks))return(0,H.jsx)(`div`,{className:i,"data-testid":`dataset-joined-report`,"data-report-name":e.name,style:{display:`flex`,flexDirection:`column`,gap:24},children:e.blocks.map((e,n)=>{ke(e,`${a} block \`${e.name??n}\``);let r=D(o,e.runtimeFilter),i=X(e.columns),c=Me(e.order),l=ze(e.type),u=l===`matrix`&&i.length>0?(0,H.jsx)(Ge,{dataset:String(e.dataset??``),rows:X(e.rows),columnsAcross:i,values:X(e.values),runtimeFilter:r,dataSource:t,onDrill:s,order:c}):(0,H.jsx)(Re,{dataset:String(e.dataset??``),rows:X(e.rows),values:X(e.values),runtimeFilter:r,dataSource:t,onDrill:s,order:c,withTotals:l===`summary`||l===`matrix`});return(0,H.jsxs)(`section`,{"data-testid":`dataset-report-block`,"data-block-id":e.name??`block-${n}`,className:`flex flex-col gap-2 rounded-lg border bg-card p-4`,children:[(0,H.jsxs)(`header`,{className:`flex flex-col gap-0.5`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold`,children:je(e.label,e.name??`Block ${n+1}`)}),e.description?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:je(e.description,``)}):null]}),u]},e.name??`block-${n}`)})});let l=X(e.columns),u=Me(e.order);if(c===`matrix`&&l.length>0)return(0,H.jsx)(`div`,{className:i,"data-testid":`dataset-report`,"data-report-name":e.name,children:(0,H.jsx)(Ge,{dataset:String(e.dataset??``),rows:X(e.rows),columnsAcross:l,values:X(e.values),runtimeFilter:o,dataSource:t,onDrill:s,order:u})});let d=e.chart&&typeof e.chart==`object`&&e.chart.type?e.chart:null;return(0,H.jsxs)(`div`,{className:`${i??``} flex flex-col gap-3`,"data-testid":`dataset-report`,"data-report-name":e.name,"data-report-presentation":c,children:[d?(0,H.jsx)(Ue,{dataset:String(e.dataset??``),chart:d,runtimeFilter:o,dataSource:t,order:u}):null,(0,H.jsx)(Re,{dataset:String(e.dataset??``),rows:X(e.rows),values:X(e.values),runtimeFilter:o,dataSource:t,onDrill:s,order:u,withTotals:c===`summary`||c===`matrix`})]})},qe=e=>{let{dataSource:t,rows:n,runtimeFilter:r,onDrill:i,className:a}=e,o=V.useContext(v),s=t??o?.dataSource,c=e.schema;if(c&&typeof c==`object`&&c.type===`spec-report`&&c.report&&typeof c.report==`object`&&(c=c.report),Ee(c))return(0,H.jsx)(Ke,{report:c,dataSource:s,runtimeFilter:r,onDrill:i,className:a});if(O(c)){let e={type:`report-viewer`,report:k(c),data:n??[],showToolbar:!1};return(0,H.jsx)(`div`,{className:a,"data-testid":`report-presentation-bridge`,children:(0,H.jsx)(Y,{schema:e})})}return(0,H.jsx)(me,{schema:c})};async function Je(e,t){let{dataSource:n,resource:r,queryParams:i,format:a,exportConfig:o,locale:s}=t,c=a||e.defaultExportFormat||`pdf`;try{let t=(await n.find(r,i)).data||[];return G(c,e,t,{format:c,...e.exportConfigs?.[c],...o},s),{success:!0,recordCount:t.length,format:c}}catch(e){return{success:!1,recordCount:0,format:c,error:e.message}}}function Ye(e,t,n={}){let{columns:r,filename:i,includeAggregationRow:a=!1,locale:o=`en`}=n,s=r||(e.fields||[]).map(Ze),c=s.map(e=>e.header),l=t.map((e,t)=>s.map(n=>{if(n.formula)return n.formula.replace(/\{ROW\}/g,String(t+2));let r=e[n.name];return Qe(r,n.numberFormat,o)}));if(a&&t.length>0){let n=s.map((n,r)=>{let i=(e.fields||[]).find(e=>e.name===n.name);if(i?.aggregation){let e=et(r),n=t.length+1;switch(i.aggregation){case`sum`:return`=SUM(${e}2:${e}${n})`;case`avg`:return`=AVERAGE(${e}2:${e}${n})`;case`count`:return`=COUNTA(${e}2:${e}${n})`;case`min`:return`=MIN(${e}2:${e}${n})`;case`max`:return`=MAX(${e}2:${e}${n})`;default:return``}}return``});l.push(n)}nt(``+[c.join(` `),...l.map(e=>e.join(` `))].join(`
|
|
59
|
-
`),i||`${e.title||`report`}.tsv`,`text/tab-separated-values`)}function Xe(e,t,n,r){return async()=>{let i=e.schedule;if(!i?.enabled)return[];let a=i.formats||[e.defaultExportFormat||`pdf`],o=[];for(let r of a){let i=await Je(e,{dataSource:t,resource:n,format:r});o.push(i)}return r(e,i),o}}function Ze(e){return{name:e.name,header:e.label||e.name}}function Qe(e,t,n=`en`){return e==null?``:typeof e==`number`&&t?U(e,n,$e(t)):tt(String(e))}function $e(e){if(e.includes(`%`))return{style:`percent`,minimumFractionDigits:0};let t=(e.match(/0/g)||[]).length;return{minimumFractionDigits:Math.max(0,t-1),maximumFractionDigits:Math.max(0,t-1)}}function et(e){let t=``,n=e;for(;n>=0;)t=String.fromCharCode(n%26+65)+t,n=Math.floor(n/26)-1;return t}function tt(e){if(e.length>0){let t=e.charAt(0);if(t===`=`||t===`+`||t===`-`||t===`@`||t===`|`)return`'${e}`}return e}function nt(e,t,n){let r=new Blob([e],{type:`${n};charset=utf-8`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}var rt=t({DatasetReportRenderer:()=>Ke,LegacyReportRenderer:()=>me,ReportRenderer:()=>qe,ReportViewer:()=>Y,createScheduleTrigger:()=>Xe,exportAsCSV:()=>he,exportAsExcel:()=>ve,exportAsHTML:()=>W,exportAsJSON:()=>ge,exportAsPDF:()=>_e,exportExcelWithFormulas:()=>Ye,exportReport:()=>G,exportWithLiveData:()=>Je,formatValue:()=>J,isDatasetReport:()=>Ee,mergeFilters:()=>D});T.register(`report`,qe,{namespace:`plugin-report`,label:`Report`,category:`Report`,inputs:[{name:`title`,type:`string`},{name:`description`,type:`string`},{name:`chart`,type:`code`}]}),T.register(`spec-report`,qe,{namespace:`plugin-report`,label:`Spec Report`,category:`Report`,inputs:[{name:`dataset`,type:`string`},{name:`type`,type:`string`}]}),T.register(`report-viewer`,Y,{namespace:`plugin-report`,label:`Report Viewer`,category:`Report`,inputs:[{name:`report`,type:`code`},{name:`showToolbar`,type:`boolean`}]});export{rt as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{t as n,v as r}from"./vendor-react-BggL7APJ.js";import{$ as i,bi as a,vt as o,xi as s}from"./ui-components-BTB1NkUW.js";import{At as c,Dr as l,Ir as u,Li as d,Ui as f,Wi as p,_n as m,ct as h,dn as g,ft as _,g as ee,ji as te,kt as ne,l as v,rn as re,ut as ie,v as ae,vn as y,wi as oe}from"./framework-DcWkeiND.js";import{h as se,p as ce,t as le}from"./i18n-runtime-CTgAQF4N.js";import{i as b}from"./vendor-ui-utils-DIUdEYii.js";import{b as x,g as S,t as C}from"./vendor-zod-CHLW1iCr.js";import{_ as ue}from"./plugin-grid-C9h7mRVv.js";var w={"timeline.bucket.overdue":`Overdue`,"timeline.bucket.today":`Today`,"timeline.bucket.tomorrow":`Tomorrow`,"timeline.bucket.thisWeek":`This week`,"timeline.bucket.nextWeek":`Next week`,"timeline.bucket.later":`Later`,"timeline.bucket.noDate":`No date`,"timeline.bucket.unassigned":`Unassigned`,"timeline.scale.week":`Week {{n}}`,"timeline.scale.quarter":`Q{{quarter}} {{year}}`,"timeline.gantt.rowLabel":`Items`,"timeline.gantt.unusableRange.malformedDate":`Unusable gantt date range — {{path}} is {{value}}, which is not a valid date. Every gantt date has to parse: the startDate and endDate on every row item, plus any minDate / maxDate pinned on the schema.`,"timeline.gantt.unusableRange.inverted":`Unusable gantt date range — minDate {{minDate}} is after maxDate {{maxDate}}. A pinned minDate / maxDate overrides the range computed from the rows, so this axis has no columns and no bar can be placed on it; swap the two values.`,"timeline.gantt.unusableRange.malformedRow":`Unusable gantt rows — {{path}} is {{value}}, which is not a row shape. A gantt draws items as a list of rows, every row as an object with a label and its own items, and every row's items as a list of bars; a null, a number, a string or a plain object in any of those places cannot be drawn.`,"timeline.unsupported.objectBoundGantt":`Unsupported variant "gantt" — an object-bound timeline renders the feed variants ({{variants}}). Gantt needs literal rows, each with its own nested items, so the gantt axis (scale) has no effect here.`,"timeline.unconfigured.noDateAxis":`Timeline date axis required — this view declares no date field, and an object-bound timeline will not invent one. Declare one of: {{fields}}. The first is the spec spelling; the rest are legacy aliases.`},de=`timeline.bucket.today`,T=(e,t)=>Object.entries(t??{}).reduce((e,[t,n])=>e.split(`{{${t}}}`).join(String(n)),w[e]||e),fe=se(w,de),E=e(r(),1),D=n(),O=new Set([`hour`,`day`,`week`,`month`,`quarter`,`year`]);function k(e){let t=e.scale;return typeof t==`string`&&O.has(t)?t:`month`}function A(e,t,n,r=`en`,i=T){let a=[],o=new Date(t),s=new Date(n);if(Number.isNaN(o.getTime())||Number.isNaN(s.getTime())||o>s)return a;let c=new Date(o);switch(e){case`hour`:for(;c<=s;)a.push(c.toLocaleString(r,{month:`short`,day:`numeric`,hour:`numeric`})),c.setHours(c.getHours()+1);break;case`day`:for(;c<=s;)a.push(c.toLocaleDateString(r,{month:`short`,day:`numeric`})),c.setDate(c.getDate()+1);break;case`week`:{let e=1;for(;c<=s;)a.push(i(`timeline.scale.week`,{n:e++})),c.setDate(c.getDate()+7);break}case`quarter`:for(c.setMonth(Math.floor(c.getMonth()/3)*3,1);c<=s;)a.push(i(`timeline.scale.quarter`,{quarter:Math.floor(c.getMonth()/3)+1,year:c.getFullYear()})),c.setMonth(c.getMonth()+3);break;case`year`:for(c.setMonth(0,1);c<=s;)a.push(String(c.getFullYear())),c.setFullYear(c.getFullYear()+1);break;default:for(;c<=s;)a.push(c.toLocaleDateString(r,{month:`short`,year:`numeric`})),c.setMonth(c.getMonth()+1)}return a}function pe(){let e=new Date().toISOString().split(`T`)[0];return{minDate:e,maxDate:e}}function j(e){if(!Array.isArray(e))return{ok:!1,path:`items`,value:e};let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(typeof r!=`object`||!r||Array.isArray(r))return{ok:!1,path:`items[${n}]`,value:r};let i=r.items;if(i&&!Array.isArray(i))return{ok:!1,path:`items[${n}].items`,value:i};t.push({authored:r,label:r.label,items:i||[]})}return{ok:!0,rows:t}}function M(e){let t=e.flatMap(e=>e.items.flatMap(e=>[e.startDate,e.endDate]));if(t.length===0)return pe();let n=Math.min(...t.map(e=>new Date(e).getTime())),r=Math.max(...t.map(e=>new Date(e).getTime()));return{minDate:new Date(n).toISOString().split(`T`)[0],maxDate:new Date(r).toISOString().split(`T`)[0]}}var N=e=>{try{return Date.prototype.getTime.call(e),!0}catch{return!1}};function P(e){return typeof e==`string`?JSON.stringify(e):e===void 0?`undefined`:e===null?`null`:typeof e==`symbol`?e.toString():typeof e==`bigint`?`${e}n`:typeof e==`number`||typeof e==`boolean`?String(e):N(e)?Date.prototype.toString.call(e):Array.isArray(e)?`an array`:typeof e==`function`?`a function`:`an object`}var F=e=>typeof e==`string`||typeof e==`number`&&Number.isFinite(e)||N(e);function I(e,t,n){let r=e=>!F(e)||Number.isNaN(new Date(e).getTime());for(let t=0;t<e.length;t++){let n=e[t].items;for(let e=0;e<n.length;e++)for(let i of[`startDate`,`endDate`]){let a=n[e]?.[i];if(r(a))return{path:`items[${t}].items[${e}].${i}`,value:a}}}for(let[e,i]of[[`minDate`,t],[`maxDate`,n]])if(i&&r(i))return{path:e,value:i}}function L(e,t,n,r){let i=new Date(e).getTime(),a=new Date(t).getTime(),o=new Date(n).getTime(),s=new Date(r).getTime()-o,c=i-o,l=a-i;return s===0?{start:0,width:100}:{start:c/s*100,width:l/s*100}}function R(e,t,n){let r=y(e);return t===`short`?r.toLocaleDateString(n):t===`long`?r.toLocaleDateString(n,{year:`numeric`,month:`long`,day:`numeric`}):Number.isNaN(r.getTime())?String(e):m(e)?g(r):r.toISOString().split(`T`)[0]}function z({label:e,color:t}){let n=t?{backgroundColor:`${t}22`,color:t,borderColor:`${t}55`}:void 0;return(0,D.jsx)(`span`,{className:a(`inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium`,!t&&`bg-muted text-muted-foreground border-transparent`),style:n,children:e})}function B(e){let t=[];for(let n of e){let e=n.group==null?``:String(n.group),r=t[t.length-1];r&&r.key===e?r.items.push(n):t.push({key:e,items:[n]})}return t}var V=({schema:e,className:t,style:n,...r})=>{let{variant:i=`vertical`,items:o=[],dateFormat:c=`short`,onItemClick:l}=e,u=le(),{t:f}=fe();if(i===`vertical`){let e=B(o),i=e.some(e=>e.key!==``),f=(e,t)=>{let n=e.color?{backgroundColor:`${e.color}33`,borderColor:e.color}:void 0,r=e.time?R(e.time,c,u):e.startDate?R(e.startDate,c,u):``,i=e.endDate&&e.endDate!==e.startDate?R(e.endDate,c,u):``,o=Array.isArray(e.meta)?e.meta:[];return(0,D.jsxs)(G,{density:`compact`,className:a(e.className,l&&`cursor-pointer`),onClick:()=>l?.(e),children:[(0,D.jsx)(q,{variant:e.color?`default`:e.variant||`default`,style:n,children:e.icon&&(0,D.jsx)(`span`,{className:`text-xs`,children:e.icon})}),(0,D.jsxs)(Se,{children:[(r||i)&&(0,D.jsxs)(Y,{dateTime:e.time||e.startDate,className:`!mb-1 text-xs`,children:[r,i&&(0,D.jsxs)(`span`,{className:`text-muted-foreground/70`,children:[` → `,i]})]}),e.title&&(0,D.jsx)(J,{className:`text-sm sm:text-base mb-1`,children:e.title}),o.length>0&&(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-1 mb-1`,children:o.map(e=>(0,D.jsx)(z,{label:e.label,color:e.color},e.key))}),e.description&&(0,D.jsx)(X,{className:`text-sm text-muted-foreground line-clamp-2 sm:line-clamp-none`,children:e.description}),s(e.content)]})]},t)};return i?(0,D.jsx)(`div`,{...d(r),className:a(`px-4 sm:px-6 py-2`,t),style:n,children:e.map((e,t)=>(0,D.jsxs)(`section`,{className:`mb-4`,children:[(0,D.jsxs)(`header`,{className:`sticky top-0 z-10 -mx-4 sm:-mx-6 px-4 sm:px-6 py-1.5 backdrop-blur bg-background/90 text-xs font-semibold uppercase tracking-wide text-muted-foreground border-b`,children:[(0,D.jsx)(`span`,{children:e.key}),(0,D.jsx)(`span`,{className:`ml-2 text-muted-foreground/60 font-normal normal-case`,children:e.items.length})]}),(0,D.jsx)(U,{className:`mt-3`,children:e.items.map((e,n)=>f(e,`${t}-${n}`))})]},`${e.key}-${t}`))}):(0,D.jsx)(U,{...d(r),className:t,style:n,children:o.map((e,t)=>f(e,t))})}if(i===`horizontal`)return(0,D.jsx)(Ce,{...d(r),className:a(`overflow-x-auto [-webkit-overflow-scrolling:touch]`,t),style:n,children:o.map((e,t)=>(0,D.jsxs)(we,{className:a(e.className,l&&`cursor-pointer`),onClick:()=>l?.(e),children:[(0,D.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,D.jsx)(q,{variant:e.variant||`default`,children:e.icon&&(0,D.jsx)(`span`,{className:`text-xs`,children:e.icon})}),(0,D.jsxs)(`div`,{className:`mt-4 text-center`,children:[e.time&&(0,D.jsx)(Y,{dateTime:e.time,children:R(e.time,c,u)}),e.title&&(0,D.jsx)(J,{children:e.title}),e.description&&(0,D.jsx)(X,{className:`text-center line-clamp-2 sm:line-clamp-none`,children:e.description}),s(e.content)]})]}),t<o.length-1&&(0,D.jsx)(`div`,{className:`absolute left-full w-16 border-t-2 border-gray-200 top-3`})]},t))});if(i===`gantt`){let i=j(o);if(!i.ok)return(0,D.jsx)(`div`,{className:`p-4 text-destructive`,"data-testid":`timeline-unusable-date-range`,role:`alert`,children:f(`timeline.gantt.unusableRange.malformedRow`,{path:i.path,value:P(i.value)})});let s=i.rows,p=I(s,e.minDate,e.maxDate);if(p)return(0,D.jsx)(`div`,{className:`p-4 text-destructive`,"data-testid":`timeline-unusable-date-range`,role:`alert`,children:f(`timeline.gantt.unusableRange.malformedDate`,{path:p.path,value:P(p.value)})});let m=M(s),h=e.minDate||m.minDate,g=e.maxDate||m.maxDate;if(new Date(h).getTime()>new Date(g).getTime())return(0,D.jsx)(`div`,{className:`p-4 text-destructive`,"data-testid":`timeline-unusable-date-range`,role:`alert`,children:f(`timeline.gantt.unusableRange.inverted`,{minDate:P(h),maxDate:P(g)})});let _=A(k(e),h,g,u,f);return(0,D.jsxs)(Te,{...d(r),className:a(`overflow-x-auto [-webkit-overflow-scrolling:touch]`,t),style:n,children:[(0,D.jsxs)(Ee,{children:[(0,D.jsx)(Z,{className:`flex items-center px-2 sm:px-4 py-2 sm:py-3`,children:(0,D.jsx)(`span`,{className:`font-semibold text-xs sm:text-sm`,children:e.rowLabel||f(`timeline.gantt.rowLabel`)})}),(0,D.jsx)(Q,{children:(0,D.jsx)(`div`,{className:`flex h-full`,children:_.map((e,t)=>(0,D.jsx)(`div`,{className:`flex-1 px-1 sm:px-2 py-2 sm:py-3 border-r text-xs font-medium text-center`,children:e},t))})})]}),(0,D.jsx)(`div`,{children:(0,D.jsxs)(`div`,{className:`flex`,children:[(0,D.jsx)(Z,{children:s.map((e,t)=>(0,D.jsx)($,{children:(0,D.jsx)(De,{title:e.label,className:`truncate`,children:e.label})},t))}),(0,D.jsx)(Q,{className:`relative`,children:s.map((e,t)=>(0,D.jsx)($,{className:`relative`,children:e.items.map((n,r)=>{let i=L(n.startDate,n.endDate,h,g);return(0,D.jsx)(Oe,{start:i.start,width:i.width,variant:n.variant||`default`,onClick:()=>l?.(n,e.authored,t,r),title:`${n.title||``}\n${R(n.startDate,c,u)} - ${R(n.endDate,c,u)}`,children:(0,D.jsx)(ke,{children:n.title})},r)})},t))})]})})]})}return null};f.register(`timeline`,V,{namespace:`plugin-timeline`,skipFallback:!0,label:`Timeline`,category:`data-display`,inputs:[{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`]},{name:`items`,type:`array`,description:`For vertical/horizontal: Array of { time, title, description, variant, icon, content }. For gantt: Array of { label, items: [{ title, startDate, endDate, variant }] }`},{name:`dateFormat`,type:`enum`,enum:[`short`,`long`,`iso`]},{name:`scale`,type:`enum`,enum:[...O]},{name:`rowLabel`,type:`string`},{name:`minDate`,type:`string`,description:`Override auto-calculated min date (YYYY-MM-DD)`},{name:`maxDate`,type:`string`,description:`Override auto-calculated max date (YYYY-MM-DD)`},{name:`className`,type:`string`}],defaultProps:{variant:`vertical`,dateFormat:`short`,items:[{time:`2024-01-15`,title:`Project Started`,description:`Kickoff meeting and initial planning`,variant:`success`,icon:`🚀`},{time:`2024-02-01`,title:`First Milestone`,description:`Completed initial design phase`,variant:`info`,icon:`🎨`},{time:`2024-03-15`,title:`Beta Release`,description:`Released beta version to testers`,variant:`warning`,icon:`⚡`},{time:`2024-04-01`,title:`Launch`,description:`Official product launch`,variant:`success`,icon:`🎉`}]},examples:{vertical:{variant:`vertical`,dateFormat:`long`,items:[{time:`2024-01-15`,title:`Project Started`,description:`Kickoff meeting and initial planning`,variant:`success`},{time:`2024-02-01`,title:`First Milestone`,description:`Completed initial design phase`,variant:`info`}]},horizontal:{variant:`horizontal`,dateFormat:`short`,items:[{time:`2024-01-01`,title:`Q1`,description:`First quarter`,variant:`default`},{time:`2024-04-01`,title:`Q2`,description:`Second quarter`,variant:`info`},{time:`2024-07-01`,title:`Q3`,description:`Third quarter`,variant:`warning`},{time:`2024-10-01`,title:`Q4`,description:`Fourth quarter`,variant:`success`}]},gantt:{variant:`gantt`,dateFormat:`short`,scale:`month`,rowLabel:`Projects`,items:[{label:`Backend Development`,items:[{title:`API Design`,startDate:`2024-01-01`,endDate:`2024-01-31`,variant:`success`},{title:`Implementation`,startDate:`2024-02-01`,endDate:`2024-03-31`,variant:`info`}]},{label:`Frontend Development`,items:[{title:`UI Design`,startDate:`2024-01-15`,endDate:`2024-02-15`,variant:`warning`},{title:`Component Dev`,startDate:`2024-02-15`,endDate:`2024-04-15`,variant:`default`}]},{label:`Testing`,items:[{title:`QA Phase`,startDate:`2024-03-01`,endDate:`2024-04-30`,variant:`danger`}]}]}}});function H(e){return typeof e==`number`&&Number.isInteger(e)&&e>0}function me(e,t){return H(e)?e:t}function he(e,t){return e==null||H(e)?null:`[ObjectUI] ObjectTimeline row cap: ${typeof t==`string`&&t?`object-timeline on ${t}`:`object-timeline`} declared limit: ${String(e)}, which is not a positive integer. A row cap must be a positive integer (the spec refuses zero and negative values), so it was ignored and this timeline fell back to its default row cap (100).`}var ge=[`vertical`,`horizontal`],_e=[`timeline.startDateField`,`timeline.dateField`,`mapping.date`,`startDateField`,`dateField`],ve=S({title:x().optional(),date:x().optional(),description:x().optional(),variant:x().optional()}),ye=S({mapping:ve.optional(),objectName:x().optional(),titleField:x().optional(),dateField:x().optional(),startDateField:x().optional(),endDateField:x().optional(),descriptionField:x().optional(),groupByField:x().optional(),colorField:x().optional(),scale:C([`hour`,`day`,`week`,`month`,`quarter`,`year`]).optional()}),be=({schema:e,dataSource:t,className:n,onRowClick:r,onItemClick:a,...s})=>{let[c,d]=(0,E.useState)([]),[f,p]=(0,E.useState)(()=>{let t=Array.isArray(e.items)&&e.items.length>0,n=Array.isArray(s.data)&&s.data.length>0;return!t&&!n&&!!e.objectName}),[m,g]=(0,E.useState)(null),v=(0,E.useRef)(0),[se,le]=(0,E.useState)(0),b=e.timeline;(0,E.useEffect)(()=>{let t=ye.safeParse(e);t.success||console.warn(`[ObjectTimeline] Invalid timeline configuration:`,t.error.format())},[e]),(0,E.useEffect)(()=>{let t=he(e.limit,e.objectName);t&&console.warn(t)},[e.limit,e.objectName]);let x=ne(e.bind),{ready:S,def:C}=ae(e.objectName??``,t),w=i(),de=_(),T=ie(e.filter,de),O=JSON.stringify(T??null),k=JSON.stringify(e.sort??null),A=!!e.objectName&&!x&&!e.items&&!s.data,pe=ee(A?e.objectName:void 0);(0,E.useEffect)(()=>{let n=++v.current,r=()=>v.current===n,i=async()=>{if(!t||typeof t.find!=`function`||!e.objectName){p(!1);return}p(!0);try{let n=oe(C?.fields),i=w?.isLoaded?n.filter(t=>w.checkField(e.objectName,t,`read`)):n,a=await t.find(e.objectName,{$filter:T,$orderby:l(e.sort),$top:me(e.limit,100),...i.length>0?{$expand:i}:{}}),o=te(a);r()&&(d(o),g(null))}catch(e){console.error(e),r()&&g(e)}finally{r()&&p(!1)}};if(A){if(!S)return;i()}else p(!1)},[e.objectName,t,x,e.items,s.data,se,S,C,O,k,e.limit,w,pe]);let j=s.data||x||c,{t:M}=fe(),{fieldOptionLabel:N}=ce(),P=b?.titleField??e.mapping?.title??e.titleField??`name`,F=b?.startDateField??b?.dateField??e.mapping?.date??e.startDateField??e.dateField,I=b?.endDateField??e.endDateField??F,L=e.mapping?.description??e.descriptionField??`description`,R=e.mapping?.variant??`variant`,z=b?.groupByField??e.groupByField,B=b?.colorField??e.colorField,H=(0,E.useMemo)(()=>{if(e.items)return e.items;if(!j||!Array.isArray(j)||!F)return[];let t=F,n=I??F,r=C?.fields??{},i=e.objectName||``,a=e=>{if(!e||!r[e]?.options)return{};let t={};for(let n of r[e].options)n&&n.value!=null&&(t[String(n.value)]=n);return t},o=[`status`,`priority`].filter(e=>r[e]),s={};for(let e of o)s[e]=a(e);let c=re(r[B??``]),l=(e,t,n)=>{if(t==null||t===``)return null;let r=n[String(t)];return{label:r?.label?N(i,e,String(t),r.label):String(t),color:r?.color}},d=j.map(e=>{let r=e[t],a=e[n],d=B?e[B]:void 0,f=z?e[z]:void 0,p=[];if(i)for(let t of o){let n=l(t,e[t],s[t]||{});n&&p.push({key:t,label:n.label,color:n.color})}return{title:u(e,P),time:r,startDate:r,endDate:a,description:u(e,L),variant:e[R]||`default`,color:c(d),group:f,meta:p,_data:e}}),f=e=>{if(!e)return 1/0;let t=y(e).getTime();return Number.isNaN(t)?1/0:t};d.sort((e,t)=>f(e.startDate)-f(t.startDate));let p=new Date,m=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),h=m(p),g=864e5,_=h-(p.getDay()+6)%7*g+7*g,ee=_+7*g,te=e=>{if(!e)return M(`timeline.bucket.noDate`);let t=m(y(e));return Number.isNaN(t)?M(`timeline.bucket.noDate`):t<h?M(`timeline.bucket.overdue`):t===h?M(`timeline.bucket.today`):t===h+g?M(`timeline.bucket.tomorrow`):M(t<_?`timeline.bucket.thisWeek`:t<ee?`timeline.bucket.nextWeek`:`timeline.bucket.later`)};if(z&&!d.every(e=>e.group==null||e.group===``)){let e=a(z);return d.map(t=>{let n=l(z,t.group,e);return{...t,group:n?n.label:t.group!=null&&t.group!==``?String(t.group):M(`timeline.bucket.unassigned`)}})}return d.map(e=>({...e,group:te(e.startDate)}))},[e.items,j,C,e.objectName,P,F,I,L,R,B,z,M,N]),ve=(0,E.useCallback)(async()=>{le(e=>e+1)},[]),{ref:be,isRefreshing:xe,pullDistance:U}=ue({onRefresh:ve,enabled:!!e.objectName&&!!t}),W=h({navigation:e.navigation,objectName:e.objectName,onRowClick:r??a}),G=b?.scale??e.scale,K=!!e.items;if(!K&&e.variant===`gantt`)return(0,D.jsx)(`div`,{className:`p-4 text-destructive`,"data-testid":`timeline-unsupported-variant`,role:`alert`,children:M(`timeline.unsupported.objectBoundGantt`,{variants:ge.join(`, `)})});if(!K&&!F)return(0,D.jsx)(`div`,{className:`p-4 text-destructive`,"data-testid":`timeline-missing-date-axis`,role:`alert`,children:M(`timeline.unconfigured.noDateAxis`,{fields:_e.join(`, `)})});let q={...e,items:H||[],className:n||e.className,...G?{scale:G}:{},onItemClick:e=>{let t=e._data||e;W.handleClick(t),a?.(t)}};return m?(0,D.jsxs)(`div`,{className:`p-4 text-destructive`,"data-testid":`timeline-error`,role:`alert`,children:[`Error loading timeline: `,m.message]}):f&&(!H||H.length===0)?(0,D.jsxs)(`div`,{className:`flex flex-col h-full min-h-[200px] p-4 gap-3`,"data-testid":`timeline-loading`,role:`status`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,D.jsx)(`span`,{className:`sr-only`,children:`Loading timeline…`}),[0,1,2,3].map(e=>(0,D.jsxs)(`div`,{className:`flex items-start gap-3`,style:{opacity:Math.max(.3,1-e*.18)},children:[(0,D.jsx)(`div`,{className:`h-3 w-3 rounded-full bg-muted/70 animate-pulse mt-1.5 shrink-0`}),(0,D.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,D.jsx)(`div`,{className:`h-4 w-1/3 rounded bg-muted/70 animate-pulse`}),(0,D.jsx)(`div`,{className:`h-3 w-2/3 rounded bg-muted/50 animate-pulse`})]})]},e))]}):(0,D.jsxs)(`div`,{ref:be,className:`relative overflow-auto h-full min-w-0`,"data-testid":`timeline-canvas`,children:[U>0&&(0,D.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:U},children:xe?`Refreshing…`:`Pull to refresh`}),(0,D.jsx)(V,{schema:q}),W.isOverlay&&(0,D.jsx)(o,{...W,title:`Timeline Item`,children:e=>(0,D.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,D.jsxs)(`div`,{className:`flex flex-col`,children:[(0,D.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,D.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})},xe=t({ObjectTimeline:()=>be,ObjectTimelineRenderer:()=>je,TIMELINE_SCALES:()=>O,Timeline:()=>U,TimelineContent:()=>Se,TimelineDescription:()=>X,TimelineGantt:()=>Te,TimelineGanttBar:()=>Oe,TimelineGanttBarContent:()=>ke,TimelineGanttGrid:()=>Q,TimelineGanttHeader:()=>Ee,TimelineGanttLabel:()=>De,TimelineGanttRow:()=>$,TimelineGanttRowLabels:()=>Z,TimelineHorizontal:()=>Ce,TimelineHorizontalItem:()=>we,TimelineItem:()=>G,TimelineMarker:()=>q,TimelineRenderer:()=>V,TimelineTime:()=>Y,TimelineTitle:()=>J,generateTimeScaleHeaders:()=>A,resolveTimelineScale:()=>k,timelineItemVariants:()=>W,timelineMarkerVariants:()=>K}),U=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`ol`,{ref:n,className:a(`relative ml-3 border-l border-gray-200`,e),...t}));U.displayName=`Timeline`;var W=b(`ml-6`,{variants:{density:{default:`mb-10`,compact:`mb-3`,comfortable:`mb-6`}},defaultVariants:{density:`default`}}),G=E.forwardRef(({className:e,density:t,...n},r)=>(0,D.jsx)(`li`,{ref:r,className:a(W({density:t}),e),...n}));G.displayName=`TimelineItem`;var K=b(`absolute -left-3 w-6 h-6 rounded-full border-2 flex items-center justify-center`,{variants:{variant:{default:`bg-blue-200 border-blue-400`,success:`bg-emerald-200 border-emerald-500`,warning:`bg-amber-200 border-amber-500`,danger:`bg-red-200 border-red-500`,info:`bg-purple-200 border-purple-500`,todo:`bg-slate-200 border-slate-400`,"in-progress":`bg-blue-200 border-blue-500`,done:`bg-emerald-200 border-emerald-500`}},defaultVariants:{variant:`default`}}),q=E.forwardRef(({className:e,variant:t=`default`,...n},r)=>(0,D.jsx)(`div`,{ref:r,className:a(K({variant:t}),e),...n}));q.displayName=`TimelineMarker`;var Se=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`div`,{ref:n,className:e,...t}));Se.displayName=`TimelineContent`;var J=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`h3`,{ref:n,className:a(`font-semibold text-lg mb-1`,e),...t}));J.displayName=`TimelineTitle`;var Y=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`time`,{ref:n,className:a(`text-sm font-normal text-gray-500 mb-2 block`,e),...t}));Y.displayName=`TimelineTime`;var X=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`p`,{ref:n,className:a(`text-base text-gray-700`,e),...t}));X.displayName=`TimelineDescription`;var Ce=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`div`,{ref:n,className:a(`relative flex overflow-x-auto py-8`,e),...t}));Ce.displayName=`TimelineHorizontal`;var we=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`div`,{ref:n,className:a(`shrink-0 w-64 relative`,e),...t}));we.displayName=`TimelineHorizontalItem`;var Te=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`div`,{ref:n,className:a(`relative w-full border rounded-lg overflow-hidden`,e),...t}));Te.displayName=`TimelineGantt`;var Ee=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`div`,{ref:n,className:a(`flex border-b bg-gray-50`,e),...t}));Ee.displayName=`TimelineGanttHeader`;var Z=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`div`,{ref:n,className:a(`w-48 border-r bg-white`,e),...t}));Z.displayName=`TimelineGanttRowLabels`;var Q=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`div`,{ref:n,className:a(`flex-1 overflow-x-auto`,e),...t}));Q.displayName=`TimelineGanttGrid`;var $=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`div`,{ref:n,className:a(`flex items-center border-b min-h-12`,e),...t}));$.displayName=`TimelineGanttRow`;var De=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`div`,{ref:n,className:a(`px-4 py-2 font-medium text-sm truncate`,e),...t}));De.displayName=`TimelineGanttLabel`;var Oe=E.forwardRef(({className:e,start:t=0,width:n=100,variant:r=`default`,...i},o)=>(0,D.jsx)(`div`,{ref:o,className:a(`absolute h-8 rounded-md transition-colors cursor-pointer`,{default:`bg-blue-500 hover:bg-blue-600`,success:`bg-green-500 hover:bg-green-600`,warning:`bg-yellow-500 hover:bg-yellow-600`,danger:`bg-red-500 hover:bg-red-600`,info:`bg-purple-500 hover:bg-purple-600`}[r],e),style:{left:`${t}%`,width:`${n}%`},...i}));Oe.displayName=`TimelineGanttBar`;var ke=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(`div`,{ref:n,className:a(`px-2 py-1 text-white text-xs font-medium truncate`,e),...t}));ke.displayName=`TimelineGanttBarContent`;var Ae={filter:!0,sort:!0,limit:`limit`},je=p(({schema:e,...t})=>{let{dataSource:n}=c()||{};return(0,D.jsx)(v,{schema:e,mapping:Ae,dataSource:n,testId:`object-timeline`,errorTitle:`This timeline’s data source could not be resolved`,children:e=>(0,D.jsx)(be,{schema:e,dataSource:n,...t})})});f.register(`object-timeline`,je,{namespace:`plugin-timeline`,label:`Object Timeline`,category:`view`,inputs:[{name:`objectName`,type:`string`,required:!0},{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`]}]}),f.register(`timeline`,je,{namespace:`view`,label:`Timeline View`,category:`view`,inputs:[{name:`objectName`,type:`string`,required:!0},{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`]}]});export{xe as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{t as n,v as r}from"./vendor-react-BggL7APJ.js";import{$ as i,bi as a,bt as o,pt as s,vt as c,xt as l,yt as u}from"./ui-components-BTB1NkUW.js";import{Ai as d,At as f,Di as p,Lt as m,Pr as h,Rt as ee,Ti as g,Ui as _,ct as v,ft as y,g as te,ir as ne,ki as b,n as re,ut as ie,v as x,wi as S,zt as C}from"./framework-DcWkeiND.js";import{h as w,p as ae}from"./i18n-runtime-CTgAQF4N.js";import{t as oe}from"./vendor-icon-chevron-down-BEf_jTEE.js";import{t as se}from"./vendor-icon-chevron-right-DbnKwHYQ.js";import{c as T}from"./plugin-grid-C9h7mRVv.js";var E=e(r(),1),D=n(),ce=w({"detail.recordDetail":`Record Detail`,"grid.refreshing":`Refreshing…`},`detail.recordDetail`),le=[];function O(e){return p(e)||(e&&typeof e==`object`?e.key:void 0)||void 0}function ue(e){let t=e.tree||{},n=Array.isArray(e.fields)?e.fields:Array.isArray(t.fields)?t.fields:[];return{parentField:O(e.parentField??t.parentField),labelField:O(e.labelField??t.labelField)??`name`,fields:n.map(O).filter(e=>!!e),defaultExpandedDepth:e.defaultExpandedDepth??t.defaultExpandedDepth}}function de(e,t){let n=e?.fields;if(!n||typeof n!=`object`)return;let r;for(let[e,i]of Object.entries(n)){let n=i?.reference;if(i?.type===`tree`&&(n===void 0||t&&n===t))return e;!r&&(i?.type===`lookup`||i?.type===`master_detail`)&&n&&t&&n===t&&(r=e)}return r}function k(e){let t=e?.id??e?._id;return t==null?void 0:String(t)}function A(e,t){if(!t)return;let n=e?.[t];if(n!=null){if(typeof n==`object`){let e=n.id??n._id;return e==null?void 0:String(e)}return String(n)}}function fe(e,t){let n=new Map,r=[];for(let t of e){let e=k(t);e!=null&&(n.set(e,{id:e,record:t,depth:0,children:[]}),r.push(e))}let i=[];for(let e of r){let r=n.get(e),a=A(r.record,t),o=a==null?void 0:n.get(a);o&&o!==r?o.children.push(r):i.push(r)}let a=(e,t)=>{for(let n of e)n.depth=t,a(n.children,t+1)};return a(i,0),i}function pe(e,t){let n=[],r=e=>{for(let i of e)n.push(i),i.children.length>0&&t.has(i.id)&&r(i.children)};return r(e),n}function j(e,t){let n=new Set,r=e=>{for(let i of e)i.children.length!==0&&(t==null||i.depth<t)&&(n.add(i.id),r(i.children))};return r(e),n}function me(e,t,n){let r=j(e,t);if(n.size===0)return r;let i=e=>{for(let t of e){let e=n.get(t.id);e===!0?r.add(t.id):e===!1&&r.delete(t.id),i(t.children)}};return i(e),r}function M(e,t){if(e==null)return``;let n=Array.isArray(t?.fieldDef?.options)?t.fieldDef.options:null;if(n&&n.length>0){let r=t.objectName?t.translateOptions(t.objectName,t.fieldName,n):n,i=e=>{let t=r.find(t=>t?.value===e);if(t)return String(t.label??e);let n=String(e).toLowerCase(),i=r.find(e=>String(e?.value).toLowerCase()===n);return i?String(i.label??e):m(String(e))};return Array.isArray(e)?e.filter(e=>e!=null).map(i).join(`, `):i(e)}return typeof e==`object`&&g(t?.fieldDef)?h(void 0,e):String(typeof e==`object`?e.name??e.label??e.id??e._id??``:e)}var N=({schema:e,dataSource:t,className:n,onRowClick:r,...f})=>{let[p,m]=(0,E.useState)(null),[h,g]=(0,E.useState)(null),[_,w]=(0,E.useState)(!0),[O,k]=(0,E.useState)(null),A=(0,E.useMemo)(()=>ee(e,`undeclared`),[e]),j=C(e,A)??``,{ready:N,def:P}=x(j,t),F=A?.provider,I=A?.provider===`object`?A.object:void 0,L=A?.provider===`value`?A.items:void 0,R=i(),he=y(),z=ie(e.filter,he),ge=te(t?I:void 0);(0,E.useEffect)(()=>{let n=!1;return(async()=>{try{if(w(!0),k(null),F===`object`&&t&&typeof t.find==`function`){if(!N)return;let e=S(P?.fields),r=R?.isLoaded?e.filter(e=>R.checkField(I,e,`read`)):e,i=await t.find(I,{$filter:z,...d(),...r.length>0?{$expand:r}:{}}),a=b(i);n||(m({provider:F,object:I,rows:a.rows}),g(a),w(!1));return}let r=f.data??e.data;if(Array.isArray(r)){n||(m({provider:F,object:I,rows:r}),g(null),w(!1));return}if(F===`value`){let e=await new ne({items:L??[]}).find(``,{$filter:z,...d()}),t=b(e);n||(m({provider:F,object:I,rows:t.rows}),g(t),w(!1));return}n||(m({provider:F,object:I,rows:[]}),w(!1))}catch(e){n||(k(e),w(!1))}})(),()=>{n=!0}},[F,I,L,t,z,P,N,f.data,R,ge]);let B=(0,E.useMemo)(()=>ue(e),[e]),V=(0,E.useMemo)(()=>B.parentField??de(P,e.objectName),[B.parentField,P,e.objectName]),H=p&&p.provider===F&&p.object===I?p.rows:null,U=(0,E.useMemo)(()=>fe(H??le,V),[H,V]),[W,_e]=(0,E.useState)(()=>new Map),G=(0,E.useMemo)(()=>me(U,B.defaultExpandedDepth,W),[U,B.defaultExpandedDepth,W]),ve=(e,t)=>_e(n=>{let r=new Map(n);return r.set(e,!t),r}),ye=(0,E.useMemo)(()=>pe(U,G),[U,G]),K=ae(),q=C(e,A)??e.objectName,J=e=>{let t=P?.fields?.[e]?.label||e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase());return q?K.fieldLabel(q,e,t):t},Y=e=>({fieldDef:P?.fields?.[e],fieldName:e,objectName:q,translateOptions:K.translateOptions}),X=v({navigation:e.navigation,objectName:C(e,A)??e.objectName,onRowClick:r}),{anchorRef:be,captureAnchor:xe}=l(),{t:Z}=ce();if(O)return(0,D.jsx)(`div`,{className:a(`flex items-center justify-center h-40 text-destructive`,n),children:(0,D.jsxs)(`p`,{children:[`Failed to load tree: `,O.message]})});if(H===null||_&&H.length===0)return(0,D.jsx)(`div`,{className:a(`flex items-center justify-center h-40 text-muted-foreground`,n),children:(0,D.jsx)(`p`,{children:`Loading…`})});if(H.length===0)return(0,D.jsx)(`div`,{className:a(`flex items-center justify-center h-40 text-muted-foreground`,n),children:(0,D.jsx)(`p`,{children:`No records`})});let Q=n=>{if(!X.isOverlay)return null;let r=C(e,A)??e.objectName;return(0,D.jsx)(c,{...X,title:Z(`detail.recordDetail`),mainContent:n,popoverAnchorRef:be,storageKey:r?o(r):void 0,legacyStorageKey:r?u(r):void 0,width:X.width??`min(960px, 60vw)`,children:e=>{let n=e,i=n.id??n._id,a=!!P?.fields&&Object.keys(P.fields).length>0;return!r||i==null||!a?(0,D.jsx)(`div`,{className:`space-y-3 p-4`,children:Object.entries(n).map(([e,t])=>(0,D.jsxs)(`div`,{className:`flex flex-col`,children:[(0,D.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,D.jsx)(`span`,{className:`text-sm`,children:M(t,Y(e))||`—`})]},e))}):(0,D.jsx)(`div`,{className:`px-6 pt-6 pb-6`,children:(0,D.jsx)(T,{record:n,objectName:r,recordId:i,dataSource:t,objectSchema:P,onClose:X.close})})}})},$=(0,D.jsxs)(`div`,{className:a(`w-full overflow-auto`,n),"data-testid":`object-tree`,children:[(0,D.jsx)(s,{active:_&&H.length>0,ariaLabel:Z(`grid.refreshing`),className:`sticky -mb-0.5`}),(0,D.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,D.jsx)(`thead`,{children:(0,D.jsxs)(`tr`,{className:`border-b text-left text-muted-foreground`,children:[(0,D.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:J(B.labelField)}),B.fields.filter(e=>e!==B.labelField).map(e=>(0,D.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:J(e)},e))]})}),(0,D.jsx)(`tbody`,{children:ye.map(e=>{let t=e.children.length>0,n=G.has(e.id);return(0,D.jsxs)(`tr`,{className:`border-b hover:bg-accent/50 cursor-pointer`,"data-testid":`object-tree-row`,"data-depth":e.depth,onClick:t=>{xe(t),X.handleClick(e.record,t)},children:[(0,D.jsx)(`td`,{className:`px-3 py-2`,children:(0,D.jsxs)(`div`,{className:`flex items-center gap-1`,style:{paddingLeft:`${e.depth*20}px`},children:[t?(0,D.jsx)(`button`,{type:`button`,"aria-label":n?`Collapse`:`Expand`,className:`flex h-5 w-5 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted`,onClick:t=>{t.stopPropagation(),ve(e.id,n)},children:n?(0,D.jsx)(oe,{className:`h-4 w-4`}):(0,D.jsx)(se,{className:`h-4 w-4`})}):(0,D.jsx)(`span`,{className:`inline-block h-5 w-5`}),(0,D.jsx)(`span`,{className:`truncate`,children:M(e.record[B.labelField],Y(B.labelField))||`—`})]})}),B.fields.filter(e=>e!==B.labelField).map(t=>(0,D.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:M(e.record[t],Y(t))},t))]},e.id)})})]}),h&&(0,D.jsx)(re,{result:h})]});if(X.isOverlay&&X.mode===`split`&&X.isOpen&&X.selectedRecord){let e=Q($);if(e)return(0,D.jsx)(D.Fragment,{children:e})}return(0,D.jsxs)(D.Fragment,{children:[$,Q()]})},P=t({ObjectTree:()=>N,ObjectTreeRenderer:()=>F}),F=({schema:e,...t})=>{let{dataSource:n}=f()||{};return(0,D.jsx)(N,{schema:e,dataSource:n,...t})},I=[{name:`objectName`,type:`string`,required:!0},{name:`tree`,type:`object`,description:`parentField, labelField, fields, defaultExpandedDepth`}];_.register(`object-tree`,F,{namespace:`plugin-tree`,label:`Object Tree`,category:`view`,inputs:I}),_.register(`tree`,F,{namespace:`view`,label:`Tree View`,category:`view`,inputs:I});export{P as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t,v as n}from"./vendor-react-BggL7APJ.js";import{Nr as r,Zt as i,dr as a,fr as o,rn as s,tn as c}from"./vendor-objectstack-XuWC71M9.js";import{$ as l,$n as u,$t as d,Ar as f,Cn as p,En as m,Fn as h,Gn as g,In as _,Kn as v,Kt as y,Ln as b,Mr as x,Nr as S,On as C,Pr as w,Qn as ee,Qt as T,Rn as E,Rr as D,Tn as O,Wn as k,Xt as te,Zn as A,_r as j,ar as M,bi as N,br as ne,cr as re,di as ie,dr as P,fi as ae,fr as F,gi as oe,gr as se,hi as ce,hr as I,ir as le,jr as ue,jt as de,kr as fe,li as pe,lr as me,mi as L,mr as he,ni as R,or as ge,pi as z,pr as _e,qn as B,rr as V,sr as H,tr as U,ui as ve,ur as ye,vi as W,vr as be,vt as xe,wn as G,yr as Se,zn as Ce}from"./ui-components-BTB1NkUW.js";import{Di as K,Dr as we,Dt as q,Si as J,Ui as Y,Ut as Te,Xi as Ee,Yn as De,ft as Oe,g as ke,ht as Ae,m as je,pt as Me,sr as Ne,v as Pe,wi as Fe,xi as Ie}from"./framework-DcWkeiND.js";import{h as Le,t as Re,w as ze}from"./i18n-runtime-CTgAQF4N.js";import{i as Be,r as Ve}from"./vendor-ui-utils-DIUdEYii.js";import{t as He}from"./vendor-icon-activity-CkniytwY.js";import{t as Ue}from"./vendor-icon-arrow-up-down-DdDqplfV.js";import{t as We}from"./vendor-icon-arrow-up-CzdjEQwQ.js";import{t as X}from"./vendor-icon-calendar-BsoUBIef.js";import{t as Ge}from"./vendor-icon-chart-column-DicJIApF.js";import{t as Ke}from"./vendor-icon-chart-gantt-DT-shh3t.js";import{t as qe}from"./vendor-icon-check-vpu9Zukp.js";import{t as Je}from"./vendor-icon-chevron-down-BEf_jTEE.js";import{t as Ye}from"./vendor-icon-copy-B5M-KdZo.js";import{t as Xe}from"./vendor-icon-ellipsis-BjiiCS3N.js";import{t as Ze}from"./vendor-icon-file-text-7BKAVNof.js";import{t as Qe}from"./vendor-icon-funnel-CtmEg9FH.js";import{t as $e}from"./vendor-icon-globe-BaOanPH5.js";import{t as et}from"./vendor-icon-grid-3x3-Dyc1xp4z.js";import{t as tt}from"./vendor-icon-grip-vertical-B01-ovq0.js";import{t as nt}from"./vendor-icon-images-qaVnL5yL.js";import{t as rt}from"./vendor-icon-layout-grid-B3quJ1GF.js";import{t as it}from"./vendor-icon-layout-template-BSsyv3fX.js";import{t as at}from"./vendor-icon-list-ordered-DaaRBYov.js";import{t as ot}from"./vendor-icon-list-tree-Br55vyL9.js";import{t as st}from"./vendor-icon-list-TLz-7vfa.js";import{t as ct}from"./vendor-icon-lock-B_psRnly.js";import{t as lt}from"./vendor-icon-map-DsFP3Vmp.js";import{t as ut}from"./vendor-icon-pencil-CMubUBjW.js";import{t as dt}from"./vendor-icon-pin-off-C5gX5GZ0.js";import{t as Z}from"./vendor-icon-pin-BWwVcO2t.js";import{t as ft}from"./vendor-icon-plus-BlfcDDsa.js";import{t as pt}from"./vendor-icon-save-CuavGNuU.js";import{t as mt}from"./vendor-icon-search-B2Uqtp_W.js";import{t as ht}from"./vendor-icon-settings-2-BHIWdy1J.js";import{t as gt}from"./vendor-icon-settings-CYQ7xc_F.js";import{t as _t}from"./vendor-icon-share-2-D3bdPyHy.js";import{t as vt}from"./vendor-icon-sliders-horizontal-BsnKXU0c.js";import{t as yt}from"./vendor-icon-star-DfusowFE.js";import{t as bt}from"./vendor-icon-table-CeQhi8NL.js";import{t as xt}from"./vendor-icon-trash-BLsWkwB9.js";import{t as St}from"./vendor-icon-x-CcLtgRNL.js";import{t as Ct}from"./plugin-form-CV8ZY04-.js";import{_ as wt,a as Tt,c as Et,d as Dt,n as Ot,o as kt,p as At,r as jt,s as Mt,t as Nt,u as Pt,v as Ft,y as It}from"./vendor-dndkit-CqQIoA27.js";import{r as Lt}from"./plugin-grid-C9h7mRVv.js";var Q=e(n(),1);function Rt(e,t,n,r){typeof e==`function`&&e(n),t&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(t,{detail:r}))}var $=t(),zt={list:`List`,detail:`Detail`,grid:`Grid`,kanban:`Kanban`,calendar:`Calendar`,timeline:`Timeline`,map:`Map`,gallery:`Gallery`,gantt:`Gantt`,chart:`Chart`,tree:`Tree`,page:`Page`},Bt={list:st,detail:Ze,grid:et,kanban:rt,calendar:X,timeline:He,map:lt,gallery:nt,gantt:Ke,chart:Ge,tree:ot,page:it},Vt=Be(`flex gap-4`,{variants:{position:{top:`flex-col`,bottom:`flex-col-reverse`,left:`flex-row`,right:`flex-row-reverse`}},defaultVariants:{position:`top`}}),Ht=Be(`w-full`,{variants:{orientation:{horizontal:`w-full`,vertical:`w-48`}},defaultVariants:{orientation:`horizontal`}}),Ut=Be(`flex gap-2`,{variants:{orientation:{horizontal:`flex-row flex-wrap`,vertical:`flex-col`}},defaultVariants:{orientation:`horizontal`}}),Wt=Be(``,{variants:{orientation:{horizontal:``,vertical:`flex h-auto flex-col items-stretch`}},defaultVariants:{orientation:`horizontal`}});function Gt(e){return e.label?e.label:zt[e.type]||e.type}function Kt(e){return e.icon?y(e.icon):Bt[e.type]||null}function qt(e){return e.activeView?e.activeView:e.defaultView?e.defaultView:e.views?.[0]?.type}var Jt={share:_t,settings:gt,duplicate:Ye,delete:xt},Yt={share:`Share`,settings:`Settings`,duplicate:`Duplicate`,delete:`Delete`},Xt=({schema:e,className:t,onViewChange:n,onCreateView:r,onViewAction:i,createViewLabel:a=`Create view`,...o})=>{let s=Q.useMemo(()=>e.storageKey?e.storageKey:`view-switcher${e.id?`-${e.id}`:``}`,[e.id,e.storageKey]),[c,l]=Q.useState(()=>qt(e));Q.useEffect(()=>{if(e.activeView){l(e.activeView);return}if(e.persistPreference)try{let t=localStorage.getItem(s);if(t){let n=e.views.find(e=>e.type===t)?.type;n&&l(n)}}catch{}},[e.activeView,e.persistPreference,e.views,s]),Q.useEffect(()=>{if(e.persistPreference&&c&&!e.activeView)try{localStorage.setItem(s,c)}catch{}},[c,e.activeView,e.persistPreference,s]);let u=Q.useCallback(t=>{Rt(n,e.onViewChange,t,{view:t})},[n,e.onViewChange]),f=Q.useCallback(e=>{l(e),u(e)},[u]),p=c||e.views?.[0]?.type,m=p||``,g=e.views.find(e=>e.type===p)||e.views?.[0],v=e.variant||`tabs`,x=e.position||`top`,S=x===`left`||x===`right`,C=S?`vertical`:`horizontal`,w=e.viewActions&&e.viewActions.length>0?(0,$.jsx)(`div`,{className:`flex items-center gap-1`,children:e.viewActions.map((e,t)=>{let n=e.icon&&y(e.icon)||Jt[e.type];return(0,$.jsx)(W,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>i?.(e.type,p),title:Yt[e.type]||e.type,children:n?(0,$.jsx)(n,{className:`h-3.5 w-3.5`}):null},`action-${e.type}-${t}`)})}):null,ee=e.allowCreateView?(0,$.jsx)(W,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>r?.(),title:a,children:(0,$.jsx)(ft,{className:`h-3.5 w-3.5`})}):null,D=(0,$.jsxs)(`div`,{className:N(Ht({orientation:C}),`flex items-center gap-1`),children:[v===`dropdown`&&(0,$.jsxs)(h,{value:m,onValueChange:e=>f(e),children:[(0,$.jsx)(E,{className:N(`w-full`,S?`h-10`:`h-9`),children:(0,$.jsx)(Ce,{placeholder:`Select view`})}),(0,$.jsx)(_,{children:e.views.map((e,t)=>(0,$.jsx)(b,{value:e.type,children:Gt(e)},`${e.type}-${t}`))})]}),v===`buttons`&&(0,$.jsx)(`div`,{className:N(Ut({orientation:C})),children:e.views.map((e,t)=>{let n=e.type===p,r=Kt(e);return(0,$.jsxs)(W,{type:`button`,size:`sm`,variant:n?`secondary`:`ghost`,className:N(`justify-start gap-2`,S?`w-full`:``),onClick:()=>f(e.type),children:[r?(0,$.jsx)(r,{className:`h-4 w-4`}):null,(0,$.jsx)(`span`,{children:Gt(e)})]},`${e.type}-${t}`)})}),v===`tabs`&&(0,$.jsx)(te,{value:m,onValueChange:e=>f(e),children:(0,$.jsx)(T,{className:N(Wt({orientation:C})),children:e.views.map((e,t)=>{let n=Kt(e);return(0,$.jsxs)(d,{value:e.type,className:N(`gap-2`,S?`justify-start`:``),children:[n?(0,$.jsx)(n,{className:`h-4 w-4`}):null,(0,$.jsx)(`span`,{children:Gt(e)})]},`${e.type}-${t}`)})})}),w,ee]}),O=g?.schema?Array.isArray(g.schema)?(0,$.jsx)(`div`,{className:`space-y-4`,children:g.schema.map((e,t)=>(0,$.jsx)(Ae,{schema:e,...o},`${g.type}-${t}`))}):(0,$.jsx)(Ae,{schema:Me(g.schema),...o}):null;return(0,$.jsxs)(`div`,{className:N(Vt({position:x}),t),children:[(0,$.jsx)(`div`,{className:N(`shrink-0`,S?`flex flex-col`:`flex`),children:D}),(0,$.jsx)(`div`,{className:`flex-1 min-w-0`,children:O})]})};s();var Zt={sm:480,md:720,lg:960,xl:1200,full:1600};function Qt(e){let t=i(e);return t<=3?`sm`:t<=8?`md`:t<=15?`lg`:`xl`}function $t(e,t){return`min(92vw, ${Zt[!e||e===`auto`?Qt(t):e]}px)`}var en=12;function tn(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function nn(e,t,n=0){if(Object.is(e,t))return!0;if(n>=en)return!1;if(e instanceof Date||t instanceof Date)return e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime();if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!nn(e[r],t[r],n+1))return!1;return!0}if(tn(e)&&tn(t)){let r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let i of r)if(!Object.prototype.hasOwnProperty.call(t,i)||!nn(e[i],t[i],n+1))return!1;return!0}return!1}function rn(e){let t=(0,Q.useRef)(e),n=nn(t.current,e)?t.current:e;return t.current=n,n}var an=Ae,on={latitudeField:`latitudeField`,longitudeField:`longitudeField`,locationField:`locationField`,titleField:`titleField`,descriptionField:`descriptionField`,zoom:`zoom`,center:`center`,style:`mapStyle`};function sn(e){if(!e||typeof e!=`object`)return{};let t=e;return Object.fromEntries(Object.entries(on).filter(([e])=>e in t).map(([e,n])=>[n,t[e]]))}function cn(e){if(!Array.isArray(e)||e.length===0)return;let t=e.map(K).filter(e=>!!e);return t.length>0?t:void 0}function ln(e){if(Array.isArray(e))return e.map(K).filter(e=>!!e)}function un(e,t){let[n,r]=(0,Q.useState)(()=>dn(e,t));if(n.currentUserId!==t.currentUserId||n.currentOrgId!==t.currentOrgId||n.onUnresolved!==t.onUnresolved||!nn(n.segments,e)){let n=dn(e,t);return r(n),n.resolved}return n.resolved}function dn(e,t){return{segments:e,currentUserId:t.currentUserId,currentOrgId:t.currentOrgId,onUnresolved:t.onUnresolved,resolved:De(e,t)}}function fn(){let{t:e}=ze(),t=e(`console.objectView.new`);return t===`console.objectView.new`?`New`:t}var pn=Le({"detail.recordDetailWithLabel":`{{label}} Detail`,"form.createTitle":`Create {{object}}`,"form.editTitle":`Edit {{object}}`,"form.viewTitle":`View {{object}}`,"actionConfirm.title":`Confirm Action`,"actionConfirm.confirm":`Continue`,"actionConfirm.cancel":`Cancel`,"objectActions.deleteConfirm":`Are you sure you want to delete this record?`,"console.objectView.bulkDeleteConfirm":`Delete {{count}} selected records? This cannot be undone.`,"objectActions.deleteSuccess":`{{label}} deleted successfully`,"objectActions.deleteFailed":`Failed to delete {{label}}`,"objectActions.bulkDeleteSuccess":`Deleted {{count}} {{label}} records`,"objectActions.bulkDeletePartial":`{{succeeded}} deleted, {{failed}} failed`},`detail.recordDetailWithLabel`),mn=({schema:e,dataSource:t,className:n,views:i,activeViewId:a,onViewChange:o,onRowClick:s,onEdit:u,renderListView:p,hideNamedViewTabs:m,toolbarAddon:h,onCreateView:g,onViewAction:_})=>{let v=fn(),{t:y}=pn(),b=Re(),x=e.objectName??``,{ready:ee,def:E}=Pe(x,t),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(`create`),[j,M]=(0,Q.useState)(null),[ne,se]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{if(t?.onMutation&&e.objectName&&!p)return t.onMutation(t=>{t.resource===e.objectName&&(se(e=>e+1),je({objectName:t.resource,recordId:t.id==null?void 0:String(t.id)}))})},[t,e.objectName,p]);let[I,le]=(0,Q.useState)([]),[de,he]=(0,Q.useState)(!1),R=e.listViews,ge=R!=null&&Object.keys(R).length>0,[_e,B]=(0,Q.useState)(()=>e.defaultListView&&R?.[e.defaultListView]?e.defaultListView:R&&Object.keys(R)[0]||``),V=(0,Q.useMemo)(()=>!ge||!_e?null:R[_e]||null,[ge,_e,R]),H=(0,Q.useMemo)(()=>i&&i.length>0?i:null,[i]),U=H!=null&&H.length>0,be=a||H?.[0]?.id,G=H?.find(e=>e.id===be)||H?.[0],Se=rn(G?{id:G.id,filter:G.filter,sort:G.sort}:void 0),Ce=Oe(),K=un({view:V?.filter||Se?.filter,table:e.table?.filter,tableDefaults:e.table?.defaultFilters},Ce),q=(0,Q.useMemo)(()=>V?.type?V.type:G?.type?G.type:e.defaultViewType||`grid`,[V,G,e.defaultViewType]),J=e.navigation,Y=l(),De=JSON.stringify(e.table?.sort??null),Ae=ke(!p&&q!==`grid`&&q!==`tree`&&q!==`chart`&&t&&e.objectName||void 0);(0,Q.useEffect)(()=>{let n=!0;return(async()=>{if(!p&&q!==`grid`&&t&&e.objectName&&ee){he(!0);try{let r=Ee(K.view||K.table||K.tableDefaults),i=V?.sort||Se?.sort||e.table?.sort,a=Fe(E?.fields),o=Y?.isLoaded?a.filter(t=>Y.checkField(e.objectName,t,`read`)):a,s=await t.find(e.objectName,{$filter:r,$orderby:we(i),$top:100,...o.length>0?{$expand:o}:{}}),c=[];Array.isArray(s)?c=s:s&&typeof s==`object`&&Array.isArray(s.data)&&(c=s.data),n&&le(c)}catch(e){console.error(`ObjectView data fetch error:`,e)}finally{n&&he(!1)}}})(),()=>{n=!1}},[e.objectName,t,q,ne,V,Se,p,ee,E,Y,K,De,Ae]);let Me=C(),Ie=e.layout||c(E,{viewport:Me?`mobile`:`desktop`}),Le=e.operations||e.table?.operations||{create:!0,read:!0,update:!0,delete:!0},ze=(0,Q.useCallback)(()=>{Ie===`page`&&e.onNavigate?e.onNavigate(`new`,`edit`):(A(`create`),M(null),O(!0))},[Ie,e]),Be=(0,Q.useCallback)(t=>{if(u){u(t);return}if(Ie===`page`&&e.onNavigate){let n=t.id||t._id;e.onNavigate(n,`edit`)}else A(`edit`),M(t),O(!0)},[Ie,e,u]),He=(0,Q.useCallback)(t=>{if(Ie===`page`&&e.onNavigate){let n=t.id||t._id;e.onNavigate(n,`view`)}else A(`view`),M(t),O(!0)},[Ie,e]),Ue=(0,Q.useCallback)(t=>{let n=t.id||t._id,r=`/${e.objectName}/${encodeURIComponent(String(n))}`;window.open(r,`_blank`)},[e.objectName]),We=(0,Q.useCallback)((t,n)=>{if(s){s(t,n);return}let r=n,i=!!(r&&(r.metaKey||r.ctrlKey||r.button===1))&&(t.id||t._id)!=null;if(J){if(J.mode===`none`||J.preventNavigation)return;if(J.mode===`new_window`||J.openNewTab||i){Ue(t);return}if(J.mode===`drawer`){A(`view`),M(t),O(!0);return}if(J.mode===`modal`){A(`view`),M(t),O(!0);return}if(J.mode===`page`){let n=t.id||t._id;e.onNavigate&&e.onNavigate(n,`view`);return}if(J.mode===`split`||J.mode===`popover`){A(`view`),M(t),O(!0);return}}if(Le.read!==!1){if(i){Ue(t);return}He(t)}},[s,J,Le.read,He,Ue,e]),[X,Ge]=(0,Q.useState)(null),Ke=(0,Q.useCallback)(e=>{e?.id!=null&&Ge({open:!0,records:[e],bulk:!1})},[]),qe=(0,Q.useCallback)(e=>{let t=e.filter(e=>e?.id!=null);t.length!==0&&Ge({open:!0,records:t,bulk:!0})},[]),Je=(0,Q.useCallback)(()=>{se(e=>e+1),e.objectName&&je({objectName:e.objectName})},[e.objectName]),Ye=(0,Q.useCallback)(()=>{O(!1),M(null),Je()},[Je]),Xe=(0,Q.useCallback)(()=>{O(!1),M(null)},[]),Ze=(0,Q.useMemo)(()=>!U||!H||H.length<=1?null:{type:`view-switcher`,variant:`tabs`,position:`top`,persistPreference:!0,storageKey:`view-pref-${e.objectName}`,defaultView:G?.type||`grid`,activeView:G?.type||`grid`,views:H.map(e=>({type:e.type,label:e.label,icon:{kanban:`kanban`,calendar:`calendar`,map:`map`,gallery:`layout-grid`,timeline:`activity`,gantt:`chart-gantt`,grid:`table`,list:`list`,detail:`file-text`,chart:`chart-column`,tree:`list-tree`,page:`layout-template`}[e.type]||`table`})),allowCreateView:e.allowCreateView,viewActions:e.viewActions},[U,H,G,e.objectName,e.allowCreateView,e.viewActions]),Qe=(0,Q.useCallback)(e=>{if(!H)return;let t=H.find(t=>t.type===e);t&&o&&o(t.id)},[H,o]),$e=(0,Q.useCallback)(e=>{B(e)},[]),et=(0,Q.useCallback)(t=>{let n={objectName:e.objectName,fields:ln(V?.columns)||G?.columns||cn(e.table?.columns)||e.table?.fields,className:`h-full w-full`,showSearch:G?.showSearch??e.showSearch??!1,showSort:G?.showSort??e.showSort??!1,showFilters:G?.showFilters??e.showFilters??!1,color:G?.color},r=G||{},i={kanban:V?.kanban,calendar:V?.calendar,gallery:V?.gallery,timeline:V?.timeline,gantt:V?.gantt,map:V?.map,chart:V?.chart,tree:V?.tree},a=Object.keys(i).filter(e=>i[e]!=null),o=a.length===0?r:a.reduce((e,t)=>({...e,[t]:{...r[t]??{},...i[t]}}),{...r});switch(t){case`kanban`:{let e=o.kanban||{},t=e.groupByField||e.groupField||`status`,r=(Array.isArray(e.columns)&&e.columns.length>0?e.columns:n.fields)||[],{columns:i,groupByField:a,groupField:s,titleField:c,conditionalFormatting:l,groupBy:u,...d}=e,f=e.conditionalFormatting??G?.conditionalFormatting;return{type:`object-kanban`,...n,groupBy:t,titleField:e.titleField||`name`,cardFields:r,...d,...f?{conditionalFormatting:f}:{}}}case`calendar`:{let{dateField:e,endField:t,...r}=o.calendar||{};return{type:`object-calendar`,...n,...o.calendar?.startDateField?{startDateField:o.calendar.startDateField}:{},...o.calendar?.endDateField?{endDateField:o.calendar.endDateField}:{},...o.calendar?.titleField?{titleField:o.calendar.titleField}:{},...r}}case`gallery`:return{type:`object-gallery`,...n,imageField:o.gallery?.coverField||o.gallery?.imageField,titleField:o.gallery?.titleField||`name`,...o.gallery||{}};case`timeline`:{let e=o.timeline?.startDateField||o.timeline?.dateField;return{type:`object-timeline`,...n,...e?{startDateField:e}:{},titleField:o.timeline?.titleField||`name`,...o.timeline||{}}}case`gantt`:return{type:`object-gantt`,...n,...o.gantt?.startDateField?{startDateField:o.gantt.startDateField}:{},...o.gantt?.endDateField?{endDateField:o.gantt.endDateField}:{},...o.gantt||{}};case`map`:return{type:`object-map`,...n,...sn(o.map)};case`tree`:return{type:`object-tree`,...n,parentField:o.tree?.parentField,labelField:o.tree?.labelField||o.tree?.titleField||`name`,fields:o.tree?.fields||n.fields,defaultExpandedDepth:o.tree?.defaultExpandedDepth,...o.tree||{}};case`chart`:{let t=o.chart||{};if(t.dataset){let e=Array.isArray(t.dimensions)?t.dimensions:[],n=Array.isArray(t.values)?t.values:[];return{type:`object-chart`,dataset:t.dataset,dimensions:e,values:n,chartType:t.chartType||`bar`,xAxisKey:e[0],series:n.map(e=>({dataKey:e,label:e})),className:`h-[400px] w-full`}}let n=Array.isArray(t.yAxisFields)&&t.yAxisFields[0]||t.valueField||`value`,r=t.xAxisField||t.categoryField||`name`;return{type:`object-chart`,objectName:e.objectName,chartType:t.chartType||`bar`,aggregate:{field:n,function:t.aggregation||`count`,groupBy:r},xAxisKey:r,series:[{dataKey:n,label:n}],className:`h-[400px] w-full`}}default:return null}},[e.objectName,e.table?.columns,e.table?.fields,V,G]),tt=(0,Q.useMemo)(()=>{let t=K.view,n=V?.sort||G?.sort;return{type:`object-grid`,objectName:e.objectName,title:e.table?.title,description:e.table?.description,fields:ln(V?.columns)||G?.columns||e.table?.fields,columns:V?.columns||G?.columns||e.table?.columns,operations:{...Le,create:!1},defaultFilters:t||K.tableDefaults,filter:t?void 0:K.table,sort:n||e.table?.sort,pagination:e.table?.pagination,selection:e.table?.selection,grouping:V?.grouping,rowColor:V?.rowColor,pageSize:e.table?.pageSize,selectable:e.table?.selectable,className:e.table?.className}},[e,Le,V,G,K]),nt=()=>{let t=j?j.id||j._id:void 0;return{type:`object-form`,objectName:e.objectName,mode:k,recordId:t,title:e.form?.title,description:e.form?.description,fields:e.form?.fields,customFields:e.form?.customFields,sections:e.form?.sections,groups:e.form?.groups,layout:e.form?.layout,columns:e.form?.columns,showSubmit:e.form?.showSubmit,submitText:e.form?.submitText,showCancel:e.form?.showCancel,cancelText:e.form?.cancelText,showReset:e.form?.showReset,initialValues:e.form?.initialValues,buttons:e.form?.buttons,defaults:e.form?.defaults,readOnly:e.form?.readOnly||k===`view`,className:e.form?.className,subforms:e.form?.subforms,onSuccess:Ye,onCancel:Xe}},rt=()=>{if(e.form?.title)return e.form.title;let t=E?.label||e.objectName;switch(k){case`create`:return y(`form.createTitle`,{object:t});case`edit`:return y(`form.editTitle`,{object:t});case`view`:return y(`form.viewTitle`,{object:t});default:return t}},it=(0,Q.useMemo)(()=>{let e=J?.width;return e?typeof e==`number`?`max-w-[${e}px]`:`max-w-[${e}]`:``},[J]),at=()=>(0,$.jsx)(re,{open:D,onOpenChange:O,direction:`right`,children:(0,$.jsxs)(me,{className:N(`w-full sm:max-w-2xl`,it),children:[(0,$.jsxs)(P,{children:[(0,$.jsx)(F,{children:rt()}),e.form?.description&&(0,$.jsx)(ye,{children:e.form.description})]}),(0,$.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 pb-4`,children:(0,$.jsx)(Ct,{schema:nt(),dataSource:t})})]})}),ot=()=>(0,$.jsx)(fe,{open:D,onOpenChange:O,children:(0,$.jsxs)(f,{className:N(`max-w-2xl max-h-[90vh] overflow-y-auto`,it),children:[(0,$.jsxs)(S,{children:[(0,$.jsx)(w,{children:rt()}),e.form?.description&&(0,$.jsx)(ue,{children:e.form.description})]}),(0,$.jsx)(Ct,{schema:nt(),dataSource:t})]})}),st=K.view||K.table||K.tableDefaults,ct=V?.sort||G?.sort||e.table?.sort,lt=()=>{let n=`${e.objectName}-${_e||G?.id||`default`}-${q}`;if(p)return p({schema:{type:`list-view`,objectName:e.objectName,viewType:q,label:V?.label??G?.label,description:V?.description??G?.description,columns:V?.columns||G?.columns||e.table?.columns||e.table?.fields,filter:st,sort:ct,rowHeight:V?.rowHeight??Te(G??{}).rowHeight,groupBy:G?.groupBy,groupBy2:G?.groupBy2,grouping:V?.grouping??G?.grouping,options:G,userActions:{...Te(e??{}).userActions,...Te(G??{}).userActions,...V?.userActions},compactToolbar:V?.compactToolbar??G?.compactToolbar??e.compactToolbar,allowExport:G?.allowExport??e.allowExport,exportOptions:V?.exportOptions??G?.exportOptions,color:G?.color??e.color,rowColor:V?.rowColor??G?.rowColor,inlineEdit:V?.inlineEdit??G?.inlineEdit??e.inlineEdit,wrapHeaders:G?.wrapHeaders??e.wrapHeaders,clickIntoRecordDetails:G?.clickIntoRecordDetails??e.clickIntoRecordDetails,addRecordViaForm:G?.addRecordViaForm??e.addRecordViaForm,addDeleteRecordsInline:G?.addDeleteRecordsInline??e.addDeleteRecordsInline,collapseAllByDefault:G?.collapseAllByDefault??e.collapseAllByDefault,fieldTextColor:G?.fieldTextColor??e.fieldTextColor,prefixField:G?.prefixField??e.prefixField,showDescription:G?.showDescription??e.showDescription,data:V?.data??G?.data??e.data,navigation:V?.navigation??G?.navigation??e.navigation,selection:V?.selection??G?.selection??e.selection,pagination:V?.pagination??G?.pagination??e.pagination,searchableFields:V?.searchableFields??G?.searchableFields??e.searchableFields,filterableFields:V?.filterableFields??G?.filterableFields??e.filterableFields,resizable:V?.resizable??G?.resizable??e.resizable,hiddenFields:V?.hiddenFields??G?.hiddenFields??e.hiddenFields,fieldOrder:V?.fieldOrder,appearance:V?.appearance??G?.appearance,rowActions:V?.rowActions??G?.rowActions??e.rowActions,rowActionDefs:G?.rowActionDefs??e.rowActionDefs,bulkActions:V?.bulkActions??G?.bulkActions??e.bulkActions,bulkActionDefs:V?.bulkActionDefs??G?.bulkActionDefs,sharing:V?.sharing??G?.sharing??e.sharing,addRecord:V?.addRecord??G?.addRecord??e.addRecord,conditionalFormatting:V?.conditionalFormatting??G?.conditionalFormatting??e.conditionalFormatting,userFilters:V?.userFilters??G?.userFilters??e.userFilters,showRecordCount:V?.showRecordCount??G?.showRecordCount??e.showRecordCount,allowPrinting:V?.allowPrinting??G?.allowPrinting??e.allowPrinting,emptyState:V?.emptyState??G?.emptyState??e.emptyState,aria:V?.aria??G?.aria??e.aria,refreshTrigger:ne},dataSource:t,onEdit:Be,onRowClick:We,className:`h-full`,refreshKey:ne,onAddRecord:ze});if(q!==`grid`){let e=et(q);if(e&&an)return(0,$.jsx)(an,{schema:e,dataSource:t,data:I,loading:de},n);if(!an)return(0,$.jsx)(`div`,{className:`flex items-center justify-center h-40 text-muted-foreground`,children:(0,$.jsxs)(`p`,{children:[`SchemaRenderer not available. Install @object-ui/react to render `,q,` views.`]})})}return(0,$.jsx)(Lt,{schema:tt,dataSource:t,onRowClick:We,onEdit:Le.update===!1?void 0:Be,onDelete:Le.delete===!1?void 0:Ke,onBulkDelete:Le.delete===!1?void 0:qe},n)},ut=()=>{if(m||!ge)return null;let e=Object.entries(R);return e.length<=1?null:(0,$.jsx)(te,{value:_e,onValueChange:$e,className:`w-full`,children:(0,$.jsx)(T,{className:`w-auto`,children:e.map(([e,t])=>(0,$.jsx)(d,{value:e,className:`text-sm`,children:r(t.label,b)||t.name||e},e))})})},dt=()=>{let t=e.showCreate!==!1&&Le.create!==!1,n=e.showViewSwitcher===!0,r=ut();return!r&&!n&&!t&&!h?null:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[r,(n||t||h)&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:n&&Ze&&(0,$.jsx)(Xt,{schema:Ze,onViewChange:Qe,onCreateView:g,onViewAction:_,className:`overflow-x-auto`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[h,t&&(0,$.jsxs)(W,{size:`sm`,onClick:ze,children:[(0,$.jsx)(ft,{className:`h-4 w-4`}),v]})]})]})]})},Z=J?.mode===`modal`?`modal`:J?.mode===`drawer`?`drawer`:J?.mode===`split`?`split`:J?.mode===`popover`?`popover`:Ie,pt=e=>(0,$.jsx)(`div`,{className:`space-y-3`,children:(0,$.jsx)(Ct,{schema:nt(),dataSource:t})}),mt=(0,Q.useCallback)(e=>{e||Xe()},[Xe]),ht=dt(),gt=(0,$.jsx)(pe,{open:X?.open??!1,onOpenChange:e=>{e||Ge(e=>e&&{...e,open:!1})},children:(0,$.jsxs)(ae,{children:[(0,$.jsxs)(ce,{children:[(0,$.jsx)(oe,{children:y(`actionConfirm.title`)}),(0,$.jsx)(z,{children:X?.bulk?y(`console.objectView.bulkDeleteConfirm`,{count:X.records.length}):Ne.confirmText({objectName:e.objectName,t:y},X?.records[0])})]}),(0,$.jsxs)(L,{children:[(0,$.jsx)(ie,{children:y(`actionConfirm.cancel`)}),(0,$.jsx)(ve,{onClick:()=>{if(!X?.open)return;let{records:n,bulk:r}=X;Ge({...X,open:!1}),Ne.run({objectName:e.objectName,label:E?.label||e.objectName,dataSource:t,t:y,toast:Ve,onRefresh:Je},r?{params:{records:n}}:{params:{recordId:String(n[0].id),record:n[0]}})},children:y(`actionConfirm.confirm`)})]})]})});if(Z===`split`){let t=E?.label||e.objectName;return(0,$.jsxs)(`div`,{className:N(`flex flex-col h-full min-w-0 overflow-hidden`,n),children:[(e.title||e.description)&&(0,$.jsxs)(`div`,{className:`mb-4 shrink-0`,children:[e.title&&(0,$.jsx)(`h2`,{className:`text-2xl font-bold tracking-tight`,children:e.title}),e.description&&(0,$.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:e.description})]}),ht&&(0,$.jsx)(`div`,{className:`mb-4 shrink-0`,children:ht}),(0,$.jsx)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-hidden`,children:D&&j?(0,$.jsx)(xe,{isOpen:D,selectedRecord:j,mode:`split`,close:Xe,setIsOpen:mt,width:J?.width,isOverlay:!0,title:y(`detail.recordDetailWithLabel`,{label:t}),mainContent:(0,$.jsx)(`div`,{className:`h-full overflow-auto`,children:lt()}),children:pt}):lt()}),gt]})}return(0,$.jsxs)(`div`,{className:N(`flex flex-col h-full min-w-0 overflow-hidden`,n),children:[(e.title||e.description)&&(0,$.jsxs)(`div`,{className:`mb-4 shrink-0`,children:[e.title&&(0,$.jsx)(`h2`,{className:`text-2xl font-bold tracking-tight`,children:e.title}),e.description&&(0,$.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:e.description})]}),ht&&(0,$.jsx)(`div`,{className:`mb-4 shrink-0`,children:ht}),(0,$.jsx)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-hidden`,children:lt()}),Z===`drawer`&&at(),Z===`modal`&&ot(),Z===`popover`&&D&&j&&(0,$.jsx)(xe,{isOpen:D,selectedRecord:j,mode:`popover`,close:Xe,setIsOpen:mt,width:J?.width,isOverlay:!0,title:rt(),children:pt}),gt]})},hn=Be(`flex`,{variants:{layout:{inline:`flex-col space-y-4`,popover:`items-center`,drawer:`items-center`}},defaultVariants:{layout:`inline`}}),gn=e=>e==null||e===``?!0:Array.isArray(e)?e.length===0:typeof e==`object`&&Object.values(e).every(e=>e==null||e===``),_n=e=>Array.isArray(e)?{start:e[0]||``,end:e[1]||``}:e&&typeof e==`object`?{start:e.start||``,end:e.end||``}:{start:``,end:``},vn=({schema:e,className:t,onChange:n})=>{let[r,i]=Q.useState(e.values||{}),[a,o]=Q.useState(!1);Q.useEffect(()=>{e.values&&i(e.values)},[e.values]);let s=Q.useCallback(t=>{Rt(n,e.onChange,t,{values:t})},[n,e.onChange]),c=Q.useCallback((t,n)=>{let a={...r,[t]:n};i(a),e.showApply||s(a)},[s,e.showApply,r]),l=Q.useCallback(()=>{let t={};if(i(t),e.showApply){s(t);return}s(t)},[s,e.showApply]),u=Q.useCallback(()=>{s(r),o(!1)},[s,r]),d=Q.useMemo(()=>Object.values(r).filter(e=>!gn(e)).length,[r]),f=e=>{let t=e.label||e.field,n=e.placeholder||`Filter by ${t}`;switch(e.type){case`number`:return(0,$.jsx)(B,{type:`number`,value:r[e.field]??``,placeholder:n,onChange:t=>{let n=t.target.value,r=n===``?``:Number(n);c(e.field,r)}});case`select`:return(0,$.jsxs)(h,{value:r[e.field]===void 0?``:String(r[e.field]),onValueChange:t=>{let n=e.options?.find(e=>String(e.value)===t);c(e.field,n?n.value:t)},children:[(0,$.jsx)(E,{children:(0,$.jsx)(Ce,{placeholder:n})}),(0,$.jsx)(_,{children:e.options?.map(e=>(0,$.jsx)(b,{value:String(e.value),children:e.label},String(e.value)))})]});case`multi-select`:{let t=r[e.field],n=Array.isArray(t)?t:t?[t]:[];return(0,$.jsx)(`div`,{className:`max-h-40 overflow-y-auto space-y-0.5 border rounded-md p-2`,children:e.options?.map(t=>{let r=n.map(String).includes(String(t.value));return(0,$.jsxs)(`label`,{className:N(`flex items-center gap-2 text-sm py-1 px-1.5 rounded cursor-pointer`,r?`bg-primary/5 text-primary`:`hover:bg-muted`),children:[(0,$.jsx)(D,{checked:r,onCheckedChange:r=>{let i=r?[...n,t.value]:n.filter(e=>String(e)!==String(t.value));c(e.field,i)}}),(0,$.jsx)(`span`,{className:`truncate`,children:t.label})]},String(t.value))})})}case`date`:return(0,$.jsx)(B,{type:`date`,value:r[e.field]??``,onChange:t=>c(e.field,t.target.value)});case`date-range`:{let t=_n(r[e.field]);return(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(B,{type:`date`,value:t.start??``,onChange:n=>{c(e.field,{...t,start:n.target.value})}}),(0,$.jsx)(B,{type:`date`,value:t.end??``,onChange:n=>{c(e.field,{...t,end:n.target.value})}})]})}case`boolean`:return(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(D,{checked:!!r[e.field],onCheckedChange:t=>c(e.field,!!t)}),(0,$.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Enabled`})]});default:return(0,$.jsx)(B,{value:r[e.field]??``,placeholder:n,onChange:t=>c(e.field,t.target.value)})}},p=(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:e.filters.map(e=>(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(A,{className:`text-xs text-muted-foreground`,children:e.label||e.field}),f(e)]},e.field))}),(e.showApply||e.showClear)&&(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t pt-3`,children:[e.showClear&&(0,$.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,onClick:l,children:`Clear`}),e.showApply&&(0,$.jsx)(W,{type:`button`,size:`sm`,onClick:u,children:`Apply`})]})]}),m=e.layout||`inline`;return m===`popover`?(0,$.jsx)(`div`,{className:N(hn({layout:m}),t),children:(0,$.jsxs)(k,{open:a,onOpenChange:o,children:[(0,$.jsx)(v,{asChild:!0,children:(0,$.jsxs)(W,{type:`button`,variant:d>0?`secondary`:`outline`,size:`sm`,className:`gap-2`,children:[(0,$.jsx)(vt,{className:`h-4 w-4`}),`Filters`,d>0&&(0,$.jsx)(`span`,{className:`inline-flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary/10 px-1 text-xs font-medium text-primary`,children:d})]})}),(0,$.jsx)(g,{align:`start`,className:`w-[520px] p-4`,children:p})]})}):m===`drawer`?(0,$.jsxs)(`div`,{className:N(hn({layout:m}),t),children:[(0,$.jsxs)(W,{type:`button`,variant:d>0?`secondary`:`outline`,size:`sm`,className:`gap-2`,onClick:()=>o(!0),children:[(0,$.jsx)(vt,{className:`h-4 w-4`}),`Filters`,d>0&&(0,$.jsx)(`span`,{className:`inline-flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary/10 px-1 text-xs font-medium text-primary`,children:d})]}),(0,$.jsx)(re,{open:a,onOpenChange:o,children:(0,$.jsxs)(me,{children:[(0,$.jsxs)(P,{children:[(0,$.jsx)(F,{children:`Filters`}),(0,$.jsx)(ye,{children:`Refine the data with advanced filters.`})]}),(0,$.jsx)(`div`,{className:`px-4 pb-6`,children:p})]})})]}):(0,$.jsxs)(`div`,{className:N(hn({layout:m}),t),children:[p,!e.showApply&&e.showClear&&(0,$.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,className:`gap-2`,onClick:l,children:[(0,$.jsx)(St,{className:`h-3.5 w-3.5`}),`Clear filters`]})]})},yn=Be(``,{variants:{variant:{buttons:`flex flex-wrap gap-2`,dropdown:`flex flex-wrap items-center gap-3`,builder:`space-y-3`}},defaultVariants:{variant:`dropdown`}}),bn=e=>e?e.map(e=>({field:e.field,direction:e.direction})):[],xn=e=>e.map(e=>({id:`${e.field}-${e.direction}`,field:e.field,order:e.direction})),Sn=e=>e.filter(e=>e.field).map(e=>({field:e.field,direction:e.order})),Cn=({schema:e,className:t,onChange:n})=>{let[r,i]=Q.useState(()=>bn(e.sort)),[a,o]=Q.useState(()=>xn(bn(e.sort)));Q.useEffect(()=>{let t=bn(e.sort);i(t),o(xn(t))},[e.sort]);let s=Q.useCallback(t=>{i(t),Rt(n,e.onChange,t,{sort:t})},[n,e.onChange]),c=Q.useCallback(t=>{let n=r.find(e=>e.field===t),i=!!e.multiple;if(!n){let e=i?[...r,{field:t,direction:`asc`}]:[{field:t,direction:`asc`}];s(e);return}if(n.direction===`asc`){let e=r.map(e=>e.field===t?{...e,direction:`desc`}:e);s(e);return}let a=r.filter(e=>e.field!==t);s(a)},[s,e.multiple,r]);if((e.variant||`dropdown`)===`buttons`)return(0,$.jsx)(`div`,{className:N(yn({variant:`buttons`}),t),children:e.fields.map(e=>{let t=r.find(t=>t.field===e.field);return(0,$.jsxs)(W,{type:`button`,variant:t?`secondary`:`outline`,size:`sm`,onClick:()=>c(e.field),className:`gap-2`,children:[(0,$.jsx)(`span`,{children:e.label||e.field}),t&&(0,$.jsx)(We,{className:N(`h-3.5 w-3.5 motion-safe:transition-transform motion-safe:duration-200`,t.direction===`desc`&&`rotate-180`),"aria-label":t.direction===`asc`?`ascending`:`descending`})]},e.field)})});if(e.multiple)return(0,$.jsx)(`div`,{className:N(yn({variant:`builder`}),t),children:(0,$.jsx)(de,{fields:e.fields.map(e=>({value:e.field,label:e.label||e.field})),value:a,onChange:e=>{o(e),s(Sn(e))}})});let l=r[0];return(0,$.jsxs)(`div`,{className:N(yn({variant:`dropdown`}),t),children:[(0,$.jsxs)(h,{value:l?.field||``,onValueChange:e=>{if(!e){s([]);return}s([{field:e,direction:l?.direction||`asc`}])},children:[(0,$.jsx)(E,{className:`w-56`,children:(0,$.jsx)(Ce,{placeholder:`Select field`})}),(0,$.jsx)(_,{children:e.fields.map(e=>(0,$.jsx)(b,{value:e.field,children:e.label||e.field},e.field))})]}),(0,$.jsxs)(h,{value:l?.direction||`asc`,onValueChange:e=>{l?.field&&s([{field:l.field,direction:e}])},children:[(0,$.jsx)(E,{className:`w-36`,children:(0,$.jsx)(Ce,{})}),(0,$.jsxs)(_,{children:[(0,$.jsx)(b,{value:`asc`,children:`Ascending`}),(0,$.jsx)(b,{value:`desc`,children:`Descending`})]})]})]})};function wn(){if(typeof crypto<`u`&&typeof crypto.randomUUID==`function`)return crypto.randomUUID();if(typeof crypto<`u`&&typeof crypto.getRandomValues==`function`){let e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)}function Tn(e,t,n,r){return`${e}/share/${t}/${n}?mode=readonly&token=${r}`}var En=({objectName:e,viewId:t=`default`,baseUrl:n,onShare:r,className:i})=>{let[a,o]=Q.useState(null),[s,c]=Q.useState(!1),[l,u]=Q.useState(!1),[d,f]=Q.useState(``),[p,m]=Q.useState(``),h=n??(typeof window<`u`?window.location.origin:``),_=Q.useCallback(()=>{let n=wn(),i=Tn(h,e,t,n);o(i),c(!1);let a=p?new Date(Date.now()+parseInt(p,10)*864e5).toISOString():void 0;r?.(i,{password:d||void 0,expiresAt:a})},[h,e,t,r,d,p]),y=Q.useCallback(async()=>{if(a)try{await navigator.clipboard.writeText(a),c(!0),setTimeout(()=>c(!1),2e3)}catch{let e=document.createElement(`textarea`);e.value=a,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e),c(!0),setTimeout(()=>c(!1),2e3)}},[a]);return(0,$.jsxs)(k,{open:l,onOpenChange:u,children:[(0,$.jsx)(v,{asChild:!0,children:(0,$.jsxs)(W,{variant:`outline`,size:`sm`,className:N(`gap-2`,i),children:[(0,$.jsx)(_t,{className:`h-4 w-4`}),`Share`]})}),(0,$.jsxs)(g,{className:`w-96 space-y-4`,align:`end`,children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h4`,{className:`text-sm font-medium`,children:`Share View`}),(0,$.jsx)(R,{variant:`secondary`,className:`text-xs`,children:`Read-only`})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Generate a public link to share this view. Recipients can view data without logging in.`})]}),a?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(B,{value:a,readOnly:!0,className:`h-8 text-xs`,onClick:e=>e.target.select()}),(0,$.jsx)(W,{variant:`outline`,size:`sm`,onClick:y,className:`shrink-0 gap-1`,children:s?(0,$.jsx)(qe,{className:`h-4 w-4 text-green-500`}):(0,$.jsx)(Ye,{className:`h-4 w-4`})})]}),(d||p)&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[d&&(0,$.jsxs)(R,{variant:`outline`,className:`text-xs gap-1`,children:[(0,$.jsx)(ct,{className:`h-3 w-3`}),`Password protected`]}),p&&(0,$.jsxs)(R,{variant:`outline`,className:`text-xs gap-1`,children:[(0,$.jsx)(X,{className:`h-3 w-3`}),`Expires in `,p,` day`,p===`1`?``:`s`]})]})]}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[(0,$.jsx)(ct,{className:`h-3.5 w-3.5`}),`Password protection (optional)`]}),(0,$.jsx)(B,{type:`password`,value:d,onChange:e=>f(e.target.value),placeholder:`Enter password...`,className:`h-8 text-xs`})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[(0,$.jsx)(X,{className:`h-3.5 w-3.5`}),`Expires after (optional)`]}),(0,$.jsxs)(`select`,{value:p,onChange:e=>m(e.target.value),className:`w-full h-8 text-xs rounded-md border border-input bg-background px-3`,children:[(0,$.jsx)(`option`,{value:``,children:`Never`}),(0,$.jsx)(`option`,{value:`1`,children:`1 day`}),(0,$.jsx)(`option`,{value:`7`,children:`7 days`}),(0,$.jsx)(`option`,{value:`30`,children:`30 days`}),(0,$.jsx)(`option`,{value:`90`,children:`90 days`})]})]}),(0,$.jsxs)(W,{onClick:_,className:`w-full gap-2`,size:`sm`,children:[(0,$.jsx)(_t,{className:`h-4 w-4`}),`Generate Link`]})]})]})]})};function Dn(){let{t:e}=ze();return(t,n,r)=>{let i=e(t,r);return!i||i===t?n:String(i)}}var On={private:0,team:1,organization:2,public:3},kn=8,An=({id:e,disabled:t,children:n})=>{let{attributes:r,listeners:i,setNodeRef:a,transform:o,transition:s,isDragging:c}=kt({id:e,disabled:t,attributes:{role:`tab`,roleDescription:`view tab`,tabIndex:0}}),l={transform:It.Transform.toString(o),transition:s,zIndex:c?10:void 0,opacity:c?.5:void 0};return(0,$.jsx)($.Fragment,{children:n({setNodeRef:a,style:l,listeners:i,attributes:r,isDragging:c})})},jn=({views:e,activeViewId:t,onViewChange:n,viewTypeIcons:r={},config:i={},onAddView:a,onRenameView:o,onDuplicateView:s,onDeleteView:c,onSetDefaultView:l,onShareView:d,onSaveAsView:f,onPinView:h,onReorderViews:g,onChangeViewType:_,onConfigView:v,onManageViews:y,availableViewTypes:b,hasUnsavedChanges:x=!1,onResetChanges:S,className:C})=>{let{showAddButton:w=!0,inlineRename:T=!0,contextMenu:E=!0,reorderable:D=!1,maxVisibleTabs:k=4,showIndicators:te=!0,showSaveAsView:A=!0,showPinnedSection:re=!0,showVisibilityGroups:ie=!1}=i,P=Dn(),[ae,F]=(0,Q.useState)(null),[oe,ce]=(0,Q.useState)(``),ue=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{ae&&ue.current&&(ue.current.focus(),ue.current.select())},[ae]);let de=(0,Q.useCallback)(t=>{if(!T||!o)return;let n=e.find(e=>e.id===t);n&&(n.readonly||(F(t),ce(n.label)))},[T,o,e]),fe=(0,Q.useCallback)(()=>{ae&&oe.trim()&&o&&o(ae,oe.trim()),F(null),ce(``)},[ae,oe,o]),pe=(0,Q.useCallback)(()=>{F(null),ce(``)},[]),me=(0,Q.useMemo)(()=>e.length>0&&e.every(e=>!!e.readonly),[e]),L=(0,Q.useMemo)(()=>{let t=[...e];return t.sort((e,t)=>{if(re){let n=+!!e.isPinned,r=+!!t.isPinned;if(n!==r)return r-n}if(ie){let n=On[e.visibility||`public`]??On.public,r=On[t.visibility||`public`]??On.public;if(n!==r)return n-r}return 0}),t},[e,re,ie]),{visibleViews:R,overflowViews:z}=(0,Q.useMemo)(()=>{let e=L.slice(0,k),n=L.slice(k),r=n.findIndex(e=>e.id===t);if(r===-1)return{visibleViews:e,overflowViews:n};let i=n[r],a=e.length>0?[...e.slice(0,-1),i]:[i],o=e.length>0?e[e.length-1]:null,s=n.filter((e,t)=>t!==r);return o&&s.unshift(o),{visibleViews:a,overflowViews:s}},[L,k,t]),ve=Ft(wt(Dt,{activationConstraint:{distance:kn}}),wt(Pt)),ye=(0,Q.useCallback)(e=>{let{active:t,over:n}=e;if(!n||t.id===n.id||!g)return;let r=L.findIndex(e=>e.id===t.id),i=L.findIndex(e=>e.id===n.id);r!==-1&&i!==-1&&g(Ot(L,r,i).map(e=>e.id))},[L,g]),xe=bt,Ce=(0,Q.useCallback)(e=>{if(!ie||e===0)return!1;let t=R[e-1],n=R[e],r=e=>e.visibility===`private`;return r(t)&&!r(n)},[ie,R]),K=(e,i)=>{let a=e.id===t,f=r[e.type]||xe,x=ae===e.id,S=te&&(e.hasActiveFilters||e.hasActiveSort),C=Ce(i),w=!!e.readonly,T=w?void 0:v,O=o&&!w?de:void 0,k=s,A=d,F=w?void 0:l,L=w?void 0:h,R=!w&&_&&b&&b.length>0?{run:_,types:b}:void 0,z=w?void 0:c,ve=y,ye=!!(O||k||A||F||L),W=!!T||ye||!!R,K=W||!!z,we=K||!!ve,q=ye||!!R,J=q||!!z,Y=J||!!ve,Te=(e=>ie?e.visibility===`private`?(0,$.jsx)(ct,{"data-testid":`view-tab-visibility-${e.id}`,className:`h-3 w-3 text-muted-foreground shrink-0`}):e.visibility?(0,$.jsx)($e,{"data-testid":`view-tab-visibility-${e.id}`,className:`h-3 w-3 text-muted-foreground shrink-0`}):null:null)(e),Ee=t=>(0,$.jsxs)(`div`,{"data-testid":`view-tab-${e.id}`,role:`tab`,tabIndex:0,"aria-selected":a,onClick:()=>!x&&n(e.id),onDoubleClick:()=>de(e.id),onKeyDown:t=>{!x&&(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e.id))},...t?.listeners??{},...t?.attributes??{},className:N(`group/tab inline-flex items-center gap-1.5 px-3 py-2 text-sm font-medium border-b-2 transition-colors whitespace-nowrap relative outline-none focus-visible:ring-2 focus-visible:ring-ring`,t?.isDragging?`cursor-grabbing`:`cursor-pointer`,a?`border-primary text-primary`:`border-transparent text-muted-foreground hover:text-foreground hover:border-border`),children:[D&&g&&(0,$.jsx)(`span`,{"data-testid":`view-tab-drag-handle-${e.id}`,"aria-hidden":`true`,className:N(`text-muted-foreground transition-opacity pointer-events-none`,`opacity-0 group-hover/tab:opacity-100`,t?.isDragging&&`opacity-100`),children:(0,$.jsx)(tt,{className:`h-3 w-3`})}),re&&e.isPinned&&(0,$.jsx)(Z,{"data-testid":`view-tab-pin-indicator-${e.id}`,className:`h-3 w-3 text-primary shrink-0`}),Te,(0,$.jsx)(f,{className:`h-3.5 w-3.5`}),x?(0,$.jsx)(B,{ref:ue,"data-testid":`view-tab-rename-input-${e.id}`,value:oe,onChange:e=>ce(e.target.value),onBlur:fe,onKeyDown:e=>{e.key===`Enter`&&fe(),e.key===`Escape`&&pe()},className:`h-5 w-24 px-1 py-0 text-sm border-none focus-visible:ring-1`,onClick:e=>e.stopPropagation()}):(0,$.jsx)(`span`,{children:e.label}),w&&!me&&(0,$.jsxs)(p,{children:[(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(ct,{"data-testid":`view-tab-readonly-${e.id}`,"aria-label":P(`view.readonlyAriaLabel`,`Read-only view`),className:`h-3 w-3 text-muted-foreground shrink-0`})}),(0,$.jsx)(G,{side:`bottom`,className:`text-xs`,children:e.readonlyReason||P(`view.readonlyTooltip`,`System view — defined in code, read-only.`)})]}),S&&(0,$.jsxs)(p,{children:[(0,$.jsx)(m,{asChild:!0,children:(0,$.jsxs)(`span`,{"data-testid":`view-tab-indicator-${e.id}`,className:`ml-1 inline-flex items-center gap-0.5 h-4 px-1 rounded-full bg-primary/10 text-primary shrink-0`,children:[e.hasActiveFilters&&(0,$.jsx)(Qe,{className:`h-2.5 w-2.5`}),e.hasActiveSort&&(0,$.jsx)(Ue,{className:`h-2.5 w-2.5`})]})}),(0,$.jsx)(G,{side:`bottom`,className:`text-xs`,children:[e.hasActiveFilters&&`Active filters`,e.hasActiveSort&&`Active sort`].filter(Boolean).join(`, `)})]}),e.isDefault&&(0,$.jsx)(yt,{className:`h-3 w-3 text-amber-500 fill-amber-500 shrink-0`}),a&&we&&(0,$.jsxs)(ee,{children:[(0,$.jsx)(H,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"data-testid":`view-tab-actions-${e.id}`,className:`ml-0.5 h-4 w-4 flex items-center justify-center rounded hover:bg-accent shrink-0 opacity-70 hover:opacity-100 transition-opacity`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),"aria-label":P(`view.tabActionsFor`,`View actions for ${e.label}`,{name:e.label}),children:(0,$.jsx)(Je,{className:`h-3 w-3`})})}),(0,$.jsxs)(u,{align:`start`,className:`min-w-[180px]`,onClick:e=>e.stopPropagation(),children:[T&&(0,$.jsxs)(U,{"data-testid":`view-tab-menu-config-${e.id}`,onClick:()=>T(e.id),children:[(0,$.jsx)(ht,{className:`h-4 w-4 mr-2`}),` `,P(`view.editViewConfig`,`Edit view config`)]}),O&&(0,$.jsxs)(U,{"data-testid":`view-tab-menu-rename-${e.id}`,onClick:()=>O(e.id),children:[(0,$.jsx)(ut,{className:`h-4 w-4 mr-2`}),` `,P(`view.rename`,`Rename`)]}),k&&(0,$.jsxs)(U,{"data-testid":`view-tab-menu-duplicate-${e.id}`,onClick:()=>k(e.id),children:[(0,$.jsx)(Ye,{className:`h-4 w-4 mr-2`}),` `,P(`view.duplicateView`,`Duplicate view`)]}),A&&(0,$.jsxs)(U,{"data-testid":`view-tab-menu-share-${e.id}`,onClick:()=>A(e.id),children:[(0,$.jsx)(_t,{className:`h-4 w-4 mr-2`}),` `,P(`view.shareView`,`Share view`)]}),F&&(0,$.jsxs)(U,{"data-testid":`view-tab-menu-default-${e.id}`,onClick:()=>F(e.id),children:[(0,$.jsx)(yt,{className:`h-4 w-4 mr-2`}),` `,P(`view.setAsDefault`,`Set as default`)]}),L&&(0,$.jsx)(U,{"data-testid":`view-tab-menu-pin-${e.id}`,onClick:()=>L(e.id,!e.isPinned),children:e.isPinned?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(dt,{className:`h-4 w-4 mr-2`}),` `,P(`view.unpinView`,`Unpin view`)]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{className:`h-4 w-4 mr-2`}),` `,P(`view.pinView`,`Pin view`)]})}),R&&(0,$.jsxs)(le,{children:[(0,$.jsxs)(ge,{"data-testid":`view-tab-menu-change-type-${e.id}`,children:[(0,$.jsx)(rt,{className:`h-4 w-4 mr-2`}),` `,P(`view.changeViewType`,`Change view type`)]}),(0,$.jsx)(M,{children:R.types.map(t=>{let n=r[t.type]||xe;return(0,$.jsxs)(U,{"data-testid":`view-tab-menu-type-${e.id}-${t.type}`,disabled:t.type===e.type,onClick:()=>R.run(e.id,t.type),children:[(0,$.jsx)(n,{className:`h-4 w-4 mr-2`}),(0,$.jsx)(`span`,{children:t.label})]},t.type)})})]}),z&&(0,$.jsxs)($.Fragment,{children:[W&&(0,$.jsx)(V,{}),(0,$.jsxs)(U,{"data-testid":`view-tab-menu-delete-${e.id}`,onClick:()=>z(e.id),className:`text-destructive focus:text-destructive`,children:[(0,$.jsx)(xt,{className:`h-4 w-4 mr-2`}),` `,P(`view.deleteView`,`Delete view`)]})]}),ve&&(0,$.jsxs)($.Fragment,{children:[K&&(0,$.jsx)(V,{}),(0,$.jsxs)(U,{"data-testid":`view-tab-menu-manage-${e.id}`,onClick:ve,children:[(0,$.jsx)(at,{className:`h-4 w-4 mr-2`}),` `,P(`view.manageAllViews`,`Manage all views…`)]})]})]})]})]}),De=t=>!E||x||!Y?t:(0,$.jsxs)(_e,{children:[(0,$.jsx)(ne,{asChild:!0,children:t}),(0,$.jsxs)(he,{children:[O&&(0,$.jsxs)(I,{"data-testid":`context-menu-rename-${e.id}`,onClick:()=>O(e.id),children:[(0,$.jsx)(ut,{className:`h-4 w-4 mr-2`}),` `,P(`view.rename`,`Rename`)]}),k&&(0,$.jsxs)(I,{"data-testid":`context-menu-duplicate-${e.id}`,onClick:()=>k(e.id),children:[(0,$.jsx)(Ye,{className:`h-4 w-4 mr-2`}),` `,P(`view.duplicateView`,`Duplicate view`)]}),A&&(0,$.jsxs)(I,{"data-testid":`context-menu-share-${e.id}`,onClick:()=>A(e.id),children:[(0,$.jsx)(_t,{className:`h-4 w-4 mr-2`}),` `,P(`view.shareView`,`Share view`)]}),F&&(0,$.jsxs)(I,{"data-testid":`context-menu-default-${e.id}`,onClick:()=>F(e.id),children:[(0,$.jsx)(yt,{className:`h-4 w-4 mr-2`}),` `,P(`view.setAsDefault`,`Set as default`)]}),L&&(0,$.jsx)(I,{"data-testid":`context-menu-pin-${e.id}`,onClick:()=>L(e.id,!e.isPinned),children:e.isPinned?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(dt,{className:`h-4 w-4 mr-2`}),` `,P(`view.unpinView`,`Unpin view`)]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{className:`h-4 w-4 mr-2`}),` `,P(`view.pinView`,`Pin view`)]})}),R&&(0,$.jsxs)($.Fragment,{children:[ye&&(0,$.jsx)(se,{}),(0,$.jsxs)(j,{children:[(0,$.jsxs)(Se,{"data-testid":`context-menu-change-type-${e.id}`,children:[(0,$.jsx)(rt,{className:`h-4 w-4 mr-2`}),` `,P(`view.changeViewType`,`Change view type`)]}),(0,$.jsx)(be,{"data-testid":`context-menu-type-submenu-${e.id}`,children:R.types.map(t=>{let n=r[t.type]||xe;return(0,$.jsxs)(I,{"data-testid":`context-menu-type-${e.id}-${t.type}`,disabled:t.type===e.type,onClick:()=>R.run(e.id,t.type),children:[(0,$.jsx)(n,{className:`h-4 w-4 mr-2`}),(0,$.jsxs)(`div`,{className:`flex flex-col`,children:[(0,$.jsx)(`span`,{children:t.label}),t.description&&(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.description})]})]},t.type)})})]})]}),z&&(0,$.jsxs)($.Fragment,{children:[q&&(0,$.jsx)(se,{}),(0,$.jsxs)(I,{"data-testid":`context-menu-delete-${e.id}`,onClick:()=>z(e.id),className:`text-destructive focus:text-destructive`,children:[(0,$.jsx)(xt,{className:`h-4 w-4 mr-2`}),` `,P(`view.deleteView`,`Delete view`)]})]}),ve&&(0,$.jsxs)($.Fragment,{children:[J&&(0,$.jsx)(se,{}),(0,$.jsxs)(I,{"data-testid":`context-menu-manage-${e.id}`,onClick:ve,children:[(0,$.jsx)(at,{className:`h-4 w-4 mr-2`}),` `,P(`view.manageAllViews`,`Manage all views…`)]})]})]})]});return D&&g?(0,$.jsxs)(Q.Fragment,{children:[C&&(0,$.jsx)(`div`,{"data-testid":`view-tab-visibility-separator`,className:`w-px h-5 bg-border mx-1 self-center shrink-0`}),(0,$.jsx)(An,{id:e.id,children:({setNodeRef:e,style:t,listeners:n,attributes:r,isDragging:i})=>(0,$.jsx)(`div`,{ref:e,style:t,className:N(`flex`,i&&`z-10`),children:De(Ee({listeners:n,attributes:r,isDragging:i}))})})]},e.id):(0,$.jsxs)(Q.Fragment,{children:[C&&(0,$.jsx)(`div`,{"data-testid":`view-tab-visibility-separator`,className:`w-px h-5 bg-border mx-1 self-center shrink-0`}),De(Ee())]},e.id)},we=(0,$.jsx)($.Fragment,{children:R.map((e,t)=>K(e,t))});return(0,$.jsx)(O,{children:(0,$.jsxs)(`div`,{"data-testid":`view-tab-bar`,className:N(`flex items-center gap-0.5 -mb-px`,C),children:[D&&g?(0,$.jsx)(Et,{sensors:ve,collisionDetection:At,onDragEnd:ye,children:(0,$.jsx)(Nt,{items:R.map(e=>e.id),strategy:jt,children:(0,$.jsx)(`div`,{"data-testid":`view-tab-sortable-container`,className:`flex items-center gap-0.5`,children:we})})}):we,z.length>0&&(0,$.jsxs)(ee,{children:[(0,$.jsx)(H,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-testid":`view-tab-overflow`,className:`inline-flex items-center gap-1 px-2 py-2 text-sm text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(Xe,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`text-xs`,children:P(`view.moreViews`,`${z.length} more`,{count:z.length})})]})}),(0,$.jsxs)(u,{align:`end`,children:[y&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(U,{"data-testid":`view-tab-overflow-manage`,onClick:y,className:`font-medium`,children:[(0,$.jsx)(at,{className:`h-4 w-4 mr-2`}),` `,P(`view.manageAllViews`,`Manage all views…`)]}),(0,$.jsx)(V,{})]}),z.map(e=>{let t=r[e.type]||xe;return(0,$.jsxs)(U,{"data-testid":`view-tab-overflow-${e.id}`,onClick:()=>n(e.id),children:[e.isPinned&&(0,$.jsx)(Z,{className:`h-3 w-3 mr-1 text-primary shrink-0`}),(0,$.jsx)(t,{className:`h-4 w-4 mr-2`}),e.label,te&&(e.hasActiveFilters||e.hasActiveSort)&&(0,$.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-0.5 h-4 px-1 rounded-full bg-primary/10 text-primary`,children:[e.hasActiveFilters&&(0,$.jsx)(Qe,{className:`h-2.5 w-2.5`}),e.hasActiveSort&&(0,$.jsx)(Ue,{className:`h-2.5 w-2.5`})]})]},e.id)})]})]}),w&&a&&(0,$.jsxs)(p,{children:[(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"data-testid":`view-tab-add`,onClick:a,className:`inline-flex items-center px-2 py-2 text-muted-foreground hover:text-foreground transition-colors`,children:(0,$.jsx)(ft,{className:`h-4 w-4`})})}),(0,$.jsx)(G,{children:`Add View`})]}),A&&x&&(0,$.jsxs)(`div`,{"data-testid":`view-tab-save-as`,className:`flex items-center gap-1 ml-2 text-xs text-amber-600 dark:text-amber-400`,children:[(0,$.jsx)(pt,{className:`h-3.5 w-3.5`}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:`Unsaved changes`}),f&&(0,$.jsx)(W,{variant:`ghost`,size:`sm`,"data-testid":`view-tab-save-as-btn`,className:`h-6 px-2 text-xs`,onClick:f,children:`Save as View`}),S&&(0,$.jsx)(W,{variant:`ghost`,size:`sm`,"data-testid":`view-tab-reset-btn`,className:`h-6 px-2 text-xs`,onClick:S,children:`Reset`})]})]})})};function Mn(){let{t:e}=ze();return(t,n,r)=>{let i=e(t,r);return!i||i===t?n:String(i)}}var Nn=bt,Pn=({view:e,isActive:t,Icon:n,isRenaming:r,onStartRename:i,onCommitRename:a,onCancelRename:o,onRowClick:s,onDelete:c,onDuplicate:l,onSetDefault:d,onSetPinned:f,onConfigView:h})=>{let g=Mn(),{attributes:_,listeners:v,setNodeRef:y,transform:b,transition:x,isDragging:S}=kt({id:e.id}),C={transform:It.Transform.toString(b),transition:x,opacity:S?.5:1},w=(0,Q.useRef)(null),[T,E]=(0,Q.useState)(e.label),D=!!e.readonly,k=D?void 0:i,te=l,A=D?void 0:h,j=D||e.isDefault?void 0:d,M=D?void 0:f,ne=D?void 0:c,re=!!(k||te||A||j||M),ie=re||!!ne;(0,Q.useEffect)(()=>{r&&(E(e.label),requestAnimationFrame(()=>{w.current?.focus(),w.current?.select()}))},[r,e.label]);let P=(0,Q.useCallback)(()=>{let t=T.trim();t&&t!==e.label?a(e.id,t):o()},[T,e.id,e.label,a,o]);return(0,$.jsxs)(`li`,{ref:y,style:C,"data-testid":`manage-views-row-${e.id}`,className:N(`group/row flex items-center gap-2 px-2 py-2 rounded-md border border-transparent`,`hover:bg-accent/50 transition-colors`,t&&`bg-accent/40 border-border`,S&&`shadow-md bg-background border-border z-10`),children:[(0,$.jsx)(`button`,{type:`button`,..._,...v,"aria-label":g(`view.dragToReorder`,`Drag to reorder`),"data-testid":`manage-views-drag-${e.id}`,className:`shrink-0 h-6 w-5 flex items-center justify-center text-muted-foreground/40 hover:text-muted-foreground cursor-grab active:cursor-grabbing rounded hover:bg-accent`,onClick:e=>e.stopPropagation(),children:(0,$.jsx)(tt,{className:`h-4 w-4`})}),(0,$.jsx)(n,{className:`shrink-0 h-4 w-4 text-muted-foreground`}),(0,$.jsx)(`div`,{className:`flex-1 min-w-0`,onClick:()=>{r||s?.(e.id)},children:r?(0,$.jsx)(B,{ref:w,value:T,onChange:e=>E(e.target.value),onBlur:P,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),P()):e.key===`Escape`&&(e.preventDefault(),o())},onClick:e=>e.stopPropagation(),className:`h-7 text-sm`,"data-testid":`manage-views-rename-input-${e.id}`}):(0,$.jsxs)(`button`,{type:`button`,className:`w-full text-left text-sm font-medium truncate cursor-pointer flex items-center gap-1.5`,onDoubleClick:t=>{t.stopPropagation(),k?.(e.id)},title:e.label,children:[(0,$.jsx)(`span`,{className:`truncate`,children:e.label}),D&&(0,$.jsx)(ct,{"aria-label":g(`view.readonlyAriaLabel`,`Read-only view`),"data-testid":`manage-views-readonly-${e.id}`,className:`h-3 w-3 text-muted-foreground shrink-0`}),e.isDefault&&(0,$.jsxs)(`span`,{className:`ml-1 inline-flex items-center text-[10px] uppercase tracking-wide text-muted-foreground`,title:g(`view.defaultView`,`Default view`),children:[(0,$.jsx)(yt,{className:`h-3 w-3 mr-0.5 fill-current`}),` `,g(`view.defaultBadge`,`default`)]})]})}),f&&!r&&!D&&(0,$.jsx)(O,{delayDuration:300,children:(0,$.jsxs)(p,{children:[(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":e.isPinned?g(`view.unpinView`,`Unpin View`):g(`view.pinView`,`Pin View`),"data-testid":`manage-views-pin-${e.id}`,onClick:t=>{t.stopPropagation(),f(e.id,!e.isPinned)},className:N(`shrink-0 h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent transition-colors`,e.isPinned?`text-amber-500`:`text-muted-foreground/40 opacity-0 group-hover/row:opacity-100`),children:e.isPinned?(0,$.jsx)(Z,{className:`h-4 w-4 fill-current`}):(0,$.jsx)(Z,{className:`h-4 w-4`})})}),(0,$.jsx)(G,{side:`top`,children:e.isPinned?g(`view.unpinView`,`Unpin View`):g(`view.pinView`,`Pin View`)})]})}),d&&!r&&!e.isDefault&&!D&&(0,$.jsx)(O,{delayDuration:300,children:(0,$.jsxs)(p,{children:[(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":g(`view.setAsDefault`,`Set as Default`),"data-testid":`manage-views-default-${e.id}`,onClick:t=>{t.stopPropagation(),d(e.id)},className:`shrink-0 h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent text-muted-foreground/40 hover:text-foreground opacity-0 group-hover/row:opacity-100 transition-colors`,children:(0,$.jsx)(yt,{className:`h-4 w-4`})})}),(0,$.jsx)(G,{side:`top`,children:g(`view.setAsDefault`,`Set as Default`)})]})}),!r&&ie&&(0,$.jsxs)(ee,{children:[(0,$.jsx)(H,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":g(`view.tabActionsFor`,`View actions for ${e.label}`,{name:e.label}),"data-testid":`manage-views-actions-${e.id}`,onClick:e=>e.stopPropagation(),className:`shrink-0 h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent text-muted-foreground opacity-60 group-hover/row:opacity-100 transition-opacity`,children:(0,$.jsx)(Xe,{className:`h-4 w-4`})})}),(0,$.jsxs)(u,{align:`end`,className:`min-w-[180px]`,children:[k&&(0,$.jsxs)(U,{"data-testid":`manage-views-action-rename-${e.id}`,onClick:()=>k(e.id),children:[(0,$.jsx)(ut,{className:`h-4 w-4 mr-2`}),` `,g(`view.rename`,`Rename`)]}),te&&(0,$.jsxs)(U,{"data-testid":`manage-views-action-duplicate-${e.id}`,onClick:()=>te(e.id),children:[(0,$.jsx)(Ye,{className:`h-4 w-4 mr-2`}),` `,g(`view.duplicateView`,`Duplicate View`)]}),A&&(0,$.jsxs)(U,{"data-testid":`manage-views-action-config-${e.id}`,onClick:()=>A(e.id),children:[(0,$.jsx)(ut,{className:`h-4 w-4 mr-2`}),` `,g(`view.editViewConfig`,`Edit view config`)]}),j&&(0,$.jsxs)(U,{"data-testid":`manage-views-action-default-${e.id}`,onClick:()=>j(e.id),children:[(0,$.jsx)(yt,{className:`h-4 w-4 mr-2`}),` `,g(`view.setAsDefault`,`Set as Default`)]}),M&&(0,$.jsx)(U,{"data-testid":`manage-views-action-pin-${e.id}`,onClick:()=>M(e.id,!e.isPinned),children:e.isPinned?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(dt,{className:`h-4 w-4 mr-2`}),` `,g(`view.unpinView`,`Unpin View`)]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{className:`h-4 w-4 mr-2`}),` `,g(`view.pinView`,`Pin View`)]})}),ne&&(0,$.jsxs)($.Fragment,{children:[re&&(0,$.jsx)(V,{}),(0,$.jsxs)(U,{"data-testid":`manage-views-action-delete-${e.id}`,onClick:()=>ne(e.id),className:`text-destructive focus:text-destructive`,children:[(0,$.jsx)(xt,{className:`h-4 w-4 mr-2`}),` `,g(`view.deleteView`,`Delete View`)]})]})]})]}),r&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":g(`common.save`,`Save`),onMouseDown:e=>e.preventDefault(),onClick:P,className:`h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent text-emerald-600`,children:(0,$.jsx)(qe,{className:`h-4 w-4`})}),(0,$.jsx)(`button`,{type:`button`,"aria-label":g(`common.cancel`,`Cancel`),onMouseDown:e=>e.preventDefault(),onClick:o,className:`h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent text-muted-foreground`,children:(0,$.jsx)(St,{className:`h-4 w-4`})})]})]})},Fn=({open:e,onOpenChange:t,views:n,activeViewId:r,viewTypeIcons:i={},onRename:a,onDelete:o,onDuplicate:s,onSetDefault:c,onSetPinned:l,onReorder:u,onAddView:d,onConfigView:p})=>{let m=Mn(),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(()=>n.map(e=>e.id));(0,Q.useEffect)(()=>{b(n.map(e=>e.id))},[n]),(0,Q.useEffect)(()=>{e||(v(null),g(``))},[e]);let C=(0,Q.useMemo)(()=>{let e=new Map(n.map(e=>[e.id,e]));return y.map(t=>e.get(t)).filter(Boolean)},[y,n]),ee=(0,Q.useMemo)(()=>{if(!h.trim())return C;let e=h.toLowerCase();return C.filter(t=>t.label.toLowerCase().includes(e))},[C,h]),T=Ft(wt(Dt,{activationConstraint:{distance:5}}),wt(Pt,{coordinateGetter:Tt})),E=e=>{let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=y.indexOf(String(t.id)),i=y.indexOf(String(n.id));if(r<0||i<0)return;let a=Ot(y,r,i);b(a),u?.(a)},D=e=>{t(!1),requestAnimationFrame(()=>p?.(e))};return(0,$.jsx)(fe,{open:e,onOpenChange:t,children:(0,$.jsxs)(f,{className:`sm:max-w-[560px] p-0 gap-0 overflow-hidden`,"data-testid":`manage-views-dialog`,children:[(0,$.jsxs)(S,{className:`px-5 pt-5 pb-3`,children:[(0,$.jsx)(w,{className:`text-base`,children:m(`view.manageViews`,`Manage views`)}),(0,$.jsx)(ue,{className:`text-xs`,children:m(`view.manageViewsDescription`,`Reorder, rename, pin, or delete every view in this object.`)})]}),(0,$.jsx)(`div`,{className:`px-5 pb-3`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(mt,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),(0,$.jsx)(B,{value:h,onChange:e=>g(e.target.value),placeholder:m(`view.searchViews`,`Search views`),className:`pl-8 h-9`,"data-testid":`manage-views-search`})]})}),(0,$.jsx)(`div`,{className:`px-3 pb-3 max-h-[55vh] overflow-y-auto`,"data-testid":`manage-views-list`,children:ee.length===0?(0,$.jsx)(`div`,{className:`text-center text-sm text-muted-foreground py-10`,children:m(`view.noViewsFound`,`No views match your search.`)}):(0,$.jsx)(Et,{sensors:T,collisionDetection:At,onDragEnd:E,children:(0,$.jsx)(Nt,{items:ee.map(e=>e.id),strategy:Mt,children:(0,$.jsx)(`ul`,{className:`space-y-0.5`,children:ee.map(e=>{let t=i[e.type]||Nn;return(0,$.jsx)(Pn,{view:e,Icon:t,isActive:e.id===r,isRenaming:_===e.id,onStartRename:a?e=>v(e):void 0,onCancelRename:()=>v(null),onCommitRename:(e,t)=>{v(null),a?.(e,t)},onDelete:o,onDuplicate:s,onSetDefault:c,onSetPinned:l,onConfigView:p?D:void 0},e.id)})})})})}),(0,$.jsxs)(x,{className:`border-t bg-muted/30 px-5 py-3 flex sm:justify-between gap-2`,children:[d?(0,$.jsxs)(W,{variant:`ghost`,size:`sm`,onClick:()=>{t(!1),requestAnimationFrame(()=>d())},"data-testid":`manage-views-add`,className:`text-sm`,children:[(0,$.jsx)(ft,{className:`h-4 w-4 mr-1.5`}),` `,m(`view.addNewView`,`Add new view`)]}):(0,$.jsx)(`span`,{}),(0,$.jsx)(W,{size:`sm`,onClick:()=>t(!1),"data-testid":`manage-views-done`,children:m(`view.done`,`Done`)})]})]})})},In=e=>e.toLowerCase().replace(/[\s_-]+/g,``);new Map([...a.map(e=>[In(e),e]),...Object.entries(o).map(([e,t])=>[In(e),t])]);function Ln(e){let t=(e||``).toLowerCase();return Ie(t)?(J(t),`text`):[`integer`,`int`,`float`,`double`,`number`,`currency`,`money`,`percent`,`rating`].includes(t)?`number`:[`date`,`datetime`,`datetime_tz`,`timestamp`,`time`].includes(t)?`date`:[`boolean`,`bool`,`checkbox`,`switch`].includes(t)?`boolean`:[`select`,`picklist`,`single_select`,`multi_select`,`enum`,`status`,`lookup`,`master_detail`,`user`].includes(t)?`select`:`text`}function Rn(e){return e.fields?Object.entries(e.fields).filter(([e,t])=>!(e.startsWith(`_`)||t?.hidden)).map(([e,t])=>({value:e,label:t.label||e,type:Ln(t.type),options:t.options,rawType:t.type,rawName:e})):[]}var zn=new Set([`image`,`image_url`,`photo`,`picture`,`avatar`,`file`,`attachment`,`attachments`,`media`,`url`,`link`]),Bn=[`image`,`photo`,`picture`,`avatar`,`thumbnail`,`thumb`,`logo`,`cover`,`banner`,`icon`,`attachment`];function Vn(e){if(!e)return!1;let t=(e.rawType||e.type||``).toLowerCase();if(zn.has(t))return!0;let n=(e.rawName||e.name||e.key||e.value||``).toLowerCase();return n?Bn.some(e=>n.includes(e)):!1}var Hn=new Set([`geolocation`,`geo`,`geo_point`,`geopoint`,`location`,`latlng`,`lnglat`]);function Un(e,t){if(!e)return!1;let n=(e.rawType||e.type||``).toLowerCase();if(Hn.has(n))return!0;let r=(e.rawName||e.name||e.key||e.value||``).toLowerCase();return r?t===`latitude`?/(^|[_-])lat([^a-z]|itude)?($|[_-])/.test(r)||r===`lat`:/(^|[_-])(lng|lon|long)([^a-z]|gitude)?($|[_-])/.test(r)||r===`lng`||r===`lon`:!1}function Wn(e,t){if(e.length!==0){for(let n of t){let t=e.find(e=>e.value.toLowerCase().includes(n));if(t)return t.value}return e[0]?.value}}var Gn=[`status`,`stage`,`state`,`priority`,`category`,`type`],Kn=[`start_date`,`startdate`,`due_date`,`duedate`,`event_date`,`date`,`created_at`,`createdat`,`created`],qn=[`end_date`,`enddate`,`finish_date`,`completion_date`,`closed_at`],Jn=({schema:e})=>{let t=(0,Q.useContext)(q)?.dataSource??null;return(0,$.jsx)(mn,{schema:e,dataSource:t})};Y.register(`object-view`,Jn,{namespace:`plugin-view`,label:`Object View`,category:`view`,icon:`LayoutDashboard`,inputs:[{name:`objectName`,type:`string`,required:!0},{name:`title`,type:`string`},{name:`description`,type:`string`},{name:`layout`,type:`enum`,enum:[`drawer`,`modal`,`page`]},{name:`defaultViewType`,type:`enum`,enum:[`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]},{name:`defaultListView`,type:`string`},{name:`showSearch`,type:`boolean`},{name:`showFilters`,type:`boolean`},{name:`showCreate`,type:`boolean`},{name:`showViewSwitcher`,type:`boolean`},{name:`listViews`,type:`object`},{name:`navigation`,type:`object`},{name:`searchableFields`,type:`array`},{name:`filterableFields`,type:`array`}],defaultProps:{layout:`drawer`,defaultViewType:`grid`,showSearch:!0,showFilters:!0,showCreate:!0,showViewSwitcher:!0}}),Y.register(`view`,Jn,{namespace:`plugin-view`,label:`View`,category:`view`}),Y.register(`view-switcher`,Xt,{namespace:`view`,label:`View Switcher`,category:`view`,icon:`LayoutGrid`,inputs:[{name:`views`,type:`array`,required:!0},{name:`defaultView`,type:`string`},{name:`activeView`,type:`string`},{name:`variant`,type:`enum`,enum:[`tabs`,`buttons`,`dropdown`]},{name:`position`,type:`enum`,enum:[`top`,`bottom`,`left`,`right`]},{name:`persistPreference`,type:`boolean`},{name:`storageKey`,type:`string`},{name:`onViewChange`,type:`string`}],defaultProps:{variant:`tabs`,position:`top`,defaultView:`grid`,views:[{type:`grid`,label:`Grid`,schema:{type:`text`,content:`Grid view`}},{type:`list`,label:`List`,schema:{type:`text`,content:`List view`}}]}}),Y.register(`filter-ui`,vn,{namespace:`view`,label:`Filter UI`,category:`view`,icon:`SlidersHorizontal`,inputs:[{name:`filters`,type:`array`,required:!0},{name:`values`,type:`object`},{name:`onChange`,type:`string`},{name:`showClear`,type:`boolean`},{name:`showApply`,type:`boolean`},{name:`layout`,type:`enum`,enum:[`inline`,`popover`,`drawer`]}],defaultProps:{layout:`inline`,showApply:!1,showClear:!0,filters:[{field:`name`,label:`Name`,type:`text`,placeholder:`Search name`},{field:`status`,label:`Status`,type:`select`,options:[{label:`Open`,value:`open`},{label:`Closed`,value:`closed`}]},{field:`created_at`,label:`Created`,type:`date`}]}}),Y.register(`sort-ui`,Cn,{namespace:`view`,label:`Sort UI`,category:`view`,icon:`ArrowUpDown`,inputs:[{name:`fields`,type:`array`,required:!0},{name:`sort`,type:`array`},{name:`onChange`,type:`string`},{name:`multiple`,type:`boolean`},{name:`variant`,type:`enum`,enum:[`dropdown`,`buttons`]}],defaultProps:{variant:`dropdown`,multiple:!0,fields:[{field:`name`,label:`Name`},{field:`created_at`,label:`Created At`}],sort:[{field:`name`,direction:`asc`}]}}),Y.register(`shared-view-link`,En,{namespace:`view`,label:`Shared View Link`,category:`view`,icon:`Share2`,inputs:[{name:`objectName`,type:`string`,required:!0},{name:`viewId`,type:`string`},{name:`baseUrl`,type:`string`}],defaultProps:{objectName:`objects`,viewId:`default`}}),Y.register(`view:simple`,({schema:e,className:t,children:n,dataSource:r,...i})=>{let a=e.props?.columns?{display:`grid`,gridTemplateColumns:`repeat(${e.props.columns}, 1fr)`,gap:`1rem`}:void 0;return(0,$.jsx)(`div`,{className:t,style:a,...i,children:n})},{namespace:`plugin-view`,label:`Simple View`,category:`view`});export{Un as a,Fn as c,$t as d,Rn as i,jn as l,Gn as n,Vn as o,Kn as r,Wn as s,qn as t,mn as u};
|