@objectstack/console 17.6.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.
Files changed (277) hide show
  1. package/CHANGELOG.md +428 -0
  2. package/dist/.objectstack-injection.json +2 -2
  3. package/dist/.objectui-sha +1 -1
  4. package/dist/assets/{ActionResultDialog-4kHDGnT3.js → ActionResultDialog-ChYnuROr.js} +3 -3
  5. package/dist/assets/{AiPendingActionsPage-JjOddm0h.js → AiPendingActionsPage-Dh3-i4BB.js} +1 -1
  6. package/dist/assets/{ApiConsolePage-BgS26lbp.js → ApiConsolePage-CKYEqlMs.js} +1 -1
  7. package/dist/assets/{AppDocsIndex-BDoH5ECM.js → AppDocsIndex-B5Tky2xg.js} +1 -1
  8. package/dist/assets/{AppManagementPage-CCgKmNTj.js → AppManagementPage-ZwyvnHpM.js} +1 -1
  9. package/dist/assets/ApprovalsInboxPage-DD4fe0Em.js +1 -0
  10. package/dist/assets/AuditLogPage-Sed6iMqP.js +1 -0
  11. package/dist/assets/BookPage-DYjUsQIc.js +1 -0
  12. package/dist/assets/{ComponentNavView-B5g9c6fx.js → ComponentNavView-DrlxM4SY.js} +1 -1
  13. package/dist/assets/CreateViewDialog-Cp72x_O7.js +1 -0
  14. package/dist/assets/{DashboardView-BOcovpPd.js → DashboardView-juicRxcP.js} +1 -1
  15. package/dist/assets/DocPage-CxJaQ-pC.js +1 -0
  16. package/dist/assets/{DocsIndex-DwW2QsYY.js → DocsIndex-LALVtIVR.js} +1 -1
  17. package/dist/assets/{DocsLayout-D63StSgd.js → DocsLayout-BAwlJQQf.js} +1 -1
  18. package/dist/assets/{DocsSlug-CP9fcabi.js → DocsSlug-CkF1E-Zs.js} +1 -1
  19. package/dist/assets/ExpressionProvider-Dr0e99r1.js +1 -0
  20. package/dist/assets/FlowRunsPage-R3W3t2s4.js +1 -0
  21. package/dist/assets/{IntegrationsPage-DvG0x0Nb.js → IntegrationsPage-DIuFLEbF.js} +2 -2
  22. package/dist/assets/InterfaceListPage-BfoCldGu.js +1 -0
  23. package/dist/assets/{MarketplaceInstalledPage-B7KETQG2.js → MarketplaceInstalledPage-DyjhcUNB.js} +1 -1
  24. package/dist/assets/MarketplacePackagePage-BbO27Pgs.js +4 -0
  25. package/dist/assets/MarketplacePage-DO2_b64U.js +1 -0
  26. package/dist/assets/{MetadataInspector-EP0I3-Kq.js → MetadataInspector-BQyu9pOE.js} +1 -1
  27. package/dist/assets/ObjectDataPage-DIY-yefK.js +1 -0
  28. package/dist/assets/PageView-C-qWu3Jw.js +1 -0
  29. package/dist/assets/ProfilePage-Qp8DL8CF.js +1 -0
  30. package/dist/assets/{PublicFormsPage-D3uCTR-8.js → PublicFormsPage-D3AT2EH9.js} +1 -1
  31. package/dist/assets/RecordDetailView-B3XBEgk2.js +3 -0
  32. package/dist/assets/{RecordFormPage-kiJI-ieF.js → RecordFormPage-CcoZfUJ3.js} +1 -1
  33. package/dist/assets/ReportDefaultInspector-DVcWM6sh.js +1 -0
  34. package/dist/assets/ReportView-pJCFptzp.js +2 -0
  35. package/dist/assets/RuntimeDraftBar-DObTyFu2.js +1 -0
  36. package/dist/assets/SchemaForm-BWSWYMLE.js +3 -0
  37. package/dist/assets/SearchResultsPage-ChVIzFob.js +1 -0
  38. package/dist/assets/{SettingsHub-DP1mrzEN.js → SettingsHub-CPP9FDe8.js} +1 -1
  39. package/dist/assets/{SettingsView-u7mc6pcc.js → SettingsView-CrHAROu9.js} +1 -1
  40. package/dist/assets/{SkeletonDetail-DIwlbHTr.js → SkeletonDetail-CP-35B8x.js} +1 -1
  41. package/dist/assets/{af-DPUgkQl0.js → af-Bhbso4Pg.js} +1 -1
  42. package/dist/assets/ai-BAPiCsNk.js +3 -0
  43. package/dist/assets/app-shell-eager-leaves-D9tgfJOe.js +1 -0
  44. package/dist/assets/{ar-B-6GTIRU.js → ar-DG8TAFtm.js} +1 -1
  45. package/dist/assets/{ar-DZ-wEl298ti.js → ar-DZ-BtSien-d.js} +1 -1
  46. package/dist/assets/{ar-EG-YBT90_S0.js → ar-EG-DpXC0zoY.js} +1 -1
  47. package/dist/assets/{ar-MA-3uT-EYh6.js → ar-MA-D1qVJLyE.js} +1 -1
  48. package/dist/assets/{ar-SA-SiQsjhhc.js → ar-SA-BIYKNgv8.js} +1 -1
  49. package/dist/assets/{ar-TN-CfzXjKzS.js → ar-TN-mUR5Mq3s.js} +1 -1
  50. package/dist/assets/{az-BqAfcNza.js → az-B7IqwHGK.js} +1 -1
  51. package/dist/assets/{be-CQgWXa9_.js → be-CnZyPaSX.js} +1 -1
  52. package/dist/assets/{be-tarask-BmNg0Sir.js → be-tarask--uMMCC7l.js} +1 -1
  53. package/dist/assets/{bg-D3evgRuS.js → bg-CZwuirtY.js} +1 -1
  54. package/dist/assets/{bn-uItkARwm.js → bn-BbOX0r-z.js} +1 -1
  55. package/dist/assets/{bs-DueReOpO.js → bs-B5W75cYR.js} +1 -1
  56. package/dist/assets/{ca-Cr3AHktR.js → ca-Be69LdIM.js} +1 -1
  57. package/dist/assets/{ckb-CTi5BET7.js → ckb-B-nKM1Vn.js} +1 -1
  58. package/dist/assets/{createDerive-CjN1i5vn.js → createDerive-CynsXU-B.js} +1 -1
  59. package/dist/assets/{cs-43mFX9jr.js → cs-qHngxH7l.js} +1 -1
  60. package/dist/assets/{cy-BBSkg3F8.js → cy-DscO2Pgf.js} +1 -1
  61. package/dist/assets/{da-C5oA5qcs.js → da-vibkaLMF.js} +1 -1
  62. package/dist/assets/data-adapter-BDsrq0TX.js +2 -0
  63. package/dist/assets/{de-AT-CApxwJzu.js → de-AT--JneEuBw.js} +1 -1
  64. package/dist/assets/{de-CPtbLlAf.js → de-BCT78XYW.js} +1 -1
  65. package/dist/assets/default-inspector-registry-Dktr6x_q.js +1 -0
  66. package/dist/assets/dist-yh3dYtHt.js +14 -0
  67. package/dist/assets/drillUrlFilters-N0RngQg6.js +1 -0
  68. package/dist/assets/{el-Dto2xBQU.js → el-Cl0y9T2b.js} +1 -1
  69. package/dist/assets/en-AU-By42tTB7.js +1 -0
  70. package/dist/assets/{en-CA-DKuJPN1U.js → en-CA-BqEEoj-Y.js} +1 -1
  71. package/dist/assets/en-GB-Cx8B9nkB.js +1 -0
  72. package/dist/assets/en-IE-CX9nv6uO.js +1 -0
  73. package/dist/assets/en-IN-ByGSBHa4.js +1 -0
  74. package/dist/assets/en-NZ-BPMwa2ZN.js +1 -0
  75. package/dist/assets/en-ZA-lj_N4R6c.js +1 -0
  76. package/dist/assets/{eo-BL8JXIWd.js → eo-oOXROuhF.js} +1 -1
  77. package/dist/assets/{es-BnoaNxsu.js → es-EudscwjH.js} +1 -1
  78. package/dist/assets/{et-tPYLNenO.js → et-CB-5LLh6.js} +1 -1
  79. package/dist/assets/{eu-CUBG6bT0.js → eu-B4-hcseX.js} +1 -1
  80. package/dist/assets/{fa-IR-Rr2d9xSs.js → fa-IR-CogavcMJ.js} +1 -1
  81. package/dist/assets/{fi-B0NVIZsV.js → fi-CIBE0mYa.js} +1 -1
  82. package/dist/assets/{formatLong-1-gt9bpo.js → formatLong-qqgm7lV1.js} +1 -1
  83. package/dist/assets/{fr-CA-CBDvLXFg.js → fr-CA-BugXMutW.js} +1 -1
  84. package/dist/assets/{fr-BbhHek8e.js → fr-CDReXYWW.js} +1 -1
  85. package/dist/assets/{fr-CH-WPNmwPn7.js → fr-CH-fiTiB6X1.js} +1 -1
  86. package/dist/assets/framework-CAuH4h0L.js +35 -0
  87. package/dist/assets/{fy-DvOBbvEF.js → fy-t_GzIAg_.js} +1 -1
  88. package/dist/assets/{gd-BQPiTPX5.js → gd-CSncIxtN.js} +1 -1
  89. package/dist/assets/getIcon-BDkBRQFw.js +1 -0
  90. package/dist/assets/{gl-BJCXK8uO.js → gl-_138Mj2S.js} +1 -1
  91. package/dist/assets/{gu-CctPRz3V.js → gu-COfH-YUT.js} +1 -1
  92. package/dist/assets/{he-CVFMk6p2.js → he-BXL4lOKY.js} +1 -1
  93. package/dist/assets/{hi-Ba30-RwS.js → hi-kXuYI0TJ.js} +1 -1
  94. package/dist/assets/{highlighted-body-OFNGDK62-BQ57IrBV.js → highlighted-body-OFNGDK62-CK7x7Gzm.js} +1 -1
  95. package/dist/assets/{hr-BZUqTbZs.js → hr-DAOsQWzI.js} +1 -1
  96. package/dist/assets/{ht-BLe05tPx.js → ht-Ch8SKz8p.js} +1 -1
  97. package/dist/assets/{hu-2CQ_Mkww.js → hu-q6W_rWPT.js} +1 -1
  98. package/dist/assets/{hy-CclcPG4H.js → hy-0M8OmwnM.js} +1 -1
  99. package/dist/assets/{i18n-BnUsCaSC.js → i18n-DTfZonAM.js} +3 -3
  100. package/dist/assets/i18n-locale-ar-O6rs-Cir.js +4 -0
  101. package/dist/assets/i18n-locale-de-CMc1jk4a.js +4 -0
  102. package/dist/assets/i18n-locale-en-CbRQO81h.js +4 -0
  103. package/dist/assets/i18n-locale-es-t47nyoCX.js +4 -0
  104. package/dist/assets/i18n-locale-fr-E425EqJM.js +4 -0
  105. package/dist/assets/i18n-locale-ja-y_fk77fz.js +4 -0
  106. package/dist/assets/i18n-locale-ko-CdnY2uCg.js +4 -0
  107. package/dist/assets/i18n-locale-pt-BaUOXS6y.js +4 -0
  108. package/dist/assets/i18n-locale-ru-pFlhX9wg.js +4 -0
  109. package/dist/assets/i18n-locale-zh-Dkj4ROTN.js +4 -0
  110. package/dist/assets/i18n-runtime-CdWyaiOD.js +1 -0
  111. package/dist/assets/{id-6JLB8s-f.js → id-BM_H1_jv.js} +1 -1
  112. package/dist/assets/index-ocmkyCt6.js +19 -0
  113. package/dist/assets/index-v2Ijn9Gr.css +2 -0
  114. package/dist/assets/{infrastructure-Cc34lEqb.js → infrastructure-CSnL6ntj.js} +2 -2
  115. package/dist/assets/integration-7NqwVHuJ.js +1 -0
  116. package/dist/assets/{is-to0CWzm1.js → is-B_7jXZfS.js} +1 -1
  117. package/dist/assets/isSameWeek-D90tBsli.js +1 -0
  118. package/dist/assets/{it-ea0B8Ujp.js → it-CBM0J9cD.js} +1 -1
  119. package/dist/assets/{it-CH-DhdfjP5Z.js → it-CH-BQltCNsR.js} +1 -1
  120. package/dist/assets/{ja-B1bzkgDW.js → ja-DBjnsx21.js} +1 -1
  121. package/dist/assets/{ja-Hira-CMrY5hXO.js → ja-Hira-BZfSmj1i.js} +1 -1
  122. package/dist/assets/{ka-DKSXLnXP.js → ka-HwpuKgUY.js} +1 -1
  123. package/dist/assets/{kk-DHwMv8Dn.js → kk-DLKA9paj.js} +1 -1
  124. package/dist/assets/{km-tpLG1xNr.js → km-BU5kermq.js} +1 -1
  125. package/dist/assets/{kn-MLreVnHA.js → kn-BNFqbCoi.js} +1 -1
  126. package/dist/assets/{ko-CI0DBazn.js → ko-D8n4uMqQ.js} +1 -1
  127. package/dist/assets/{lb-CmL572Xe.js → lb-B1empQ7m.js} +1 -1
  128. package/dist/assets/{lt-DRtUOLdw.js → lt-gMukpK3G.js} +1 -1
  129. package/dist/assets/{lv-COSHgkOP.js → lv-D2O5AnsZ.js} +1 -1
  130. package/dist/assets/{match-BQoOW8Cj.js → match-BTF6WqJh.js} +1 -1
  131. package/dist/assets/{match-B-ergJQb.js → match-Cyum2eeW.js} +1 -1
  132. package/dist/assets/{match-dfBS0YSQ.js → match-ScHH8kYk.js} +1 -1
  133. package/dist/assets/mermaid-GHXKKRXX-D4H6EVJQ.js +1 -0
  134. package/dist/assets/metadata-admin-CEhVmXFv.js +9 -0
  135. package/dist/assets/{mk-B0IH_YL_.js → mk-D-Zl0xVN.js} +1 -1
  136. package/dist/assets/{mn-P-QdQ2n3.js → mn-jJbTslgD.js} +1 -1
  137. package/dist/assets/{ms-CtyEOINy.js → ms-CUuJHLA4.js} +1 -1
  138. package/dist/assets/{mt-DfuZ2HRm.js → mt-yIcbfxKY.js} +1 -1
  139. package/dist/assets/{nb-2Hp-5Tnt.js → nb-D9WNypoj.js} +1 -1
  140. package/dist/assets/{nl-BE-mmxbfNoR.js → nl-BE-B1vKiw2h.js} +1 -1
  141. package/dist/assets/{nl-CZ_nLREz.js → nl-DC7b5e90.js} +1 -1
  142. package/dist/assets/{nn-ccWhYsNa.js → nn-uP4yJ9s0.js} +1 -1
  143. package/dist/assets/{oc-z504BFRV.js → oc-DHTqadJI.js} +1 -1
  144. package/dist/assets/{pl-DeQ7ASt-.js → pl-Bxnnizf5.js} +1 -1
  145. package/dist/assets/plugin-calendar-b7C35ANT.js +1 -0
  146. package/dist/assets/plugin-charts-b-yVtmdI.js +7 -0
  147. package/dist/assets/{plugin-chatbot-Ck47EhDX.js → plugin-chatbot-D1KW_oIO.js} +8 -8
  148. package/dist/assets/plugin-dashboard-DTkPoPEb.js +6 -0
  149. package/dist/assets/plugin-form-UIRm-FpQ.js +1 -0
  150. package/dist/assets/plugin-gantt-9dtc8zzX.js +63 -0
  151. package/dist/assets/plugin-grid-Cp4RKtMJ.js +10 -0
  152. package/dist/assets/plugin-kanban-B2JOPZIJ.js +1 -0
  153. package/dist/assets/plugin-map-CBJcVJYk.js +1 -0
  154. package/dist/assets/{plugin-markdown-BOkHcir_.js → plugin-markdown-CNlDzqP-.js} +1 -1
  155. package/dist/assets/plugin-report-IZzgQb-Q.js +59 -0
  156. package/dist/assets/plugin-timeline-DsmtjcJ3.js +1 -0
  157. package/dist/assets/plugin-tree-DTRPBdhe.js +1 -0
  158. package/dist/assets/plugin-view-D9ixsNDG.js +1 -0
  159. package/dist/assets/plugins-views-CnvkdSJK.js +3 -0
  160. package/dist/assets/{pt-BR-D80_lPYF.js → pt-BR-D416seHT.js} +1 -1
  161. package/dist/assets/{pt-CJJ1RmXd.js → pt-DwHBy9_c.js} +1 -1
  162. package/dist/assets/{ro-EuFb2TCj.js → ro-DDf1X3Np.js} +1 -1
  163. package/dist/assets/{ru-CMaVQScp.js → ru-8eM3mcgK.js} +1 -1
  164. package/dist/assets/{runtime-metadata-persistence-ClOTznqa.js → runtime-metadata-persistence-DX29lQ62.js} +1 -1
  165. package/dist/assets/{se-DsfdKLdF.js → se-D4JvQeRX.js} +1 -1
  166. package/dist/assets/{sk-BNV9omI8.js → sk-DvpgttGI.js} +1 -1
  167. package/dist/assets/{sl-DJS_nINU.js → sl-B3gCZ-_a.js} +1 -1
  168. package/dist/assets/{sq-HEgjcbHe.js → sq-CVaTmL0V.js} +1 -1
  169. package/dist/assets/{sr-CO0CFu4X.js → sr-CnH5Ffyz.js} +1 -1
  170. package/dist/assets/{sr-Latn-eE1Idzey.js → sr-Latn-Dw9w61q6.js} +1 -1
  171. package/dist/assets/src-BUry7633.js +2 -0
  172. package/dist/assets/{src-BU7L2v4J.js → src-DMDT5a27.js} +1 -1
  173. package/dist/assets/src-ZxH3AOCu.js +16 -0
  174. package/dist/assets/{studioEntry-WeMfaSGn.js → studioEntry-DAqcBFtr.js} +1 -1
  175. package/dist/assets/{submitRedirect-C2lfZSHt.js → submitRedirect-iy0oOi7I.js} +1 -1
  176. package/dist/assets/{sv-5uTzgQT3.js → sv-CU7wdxyK.js} +1 -1
  177. package/dist/assets/{ta-BzgdkBZG.js → ta-DPH6q0HR.js} +1 -1
  178. package/dist/assets/{te-Ct_pl7ZJ.js → te-BSaThkGV.js} +1 -1
  179. package/dist/assets/{th-DouAlk0-.js → th-NXP8_Qb8.js} +1 -1
  180. package/dist/assets/{tr-3XNBsI40.js → tr-DDXoH663.js} +1 -1
  181. package/dist/assets/types-zod-ChJ30y25.js +1 -0
  182. package/dist/assets/{ug-B9n24h9G.js → ug-Guus6pPe.js} +1 -1
  183. package/dist/assets/ui-components-D8wcRNrt.js +37 -0
  184. package/dist/assets/ui-layout-BYO3rRIl.js +1 -0
  185. package/dist/assets/{uk-DCAenByf.js → uk-uiy4vsp8.js} +1 -1
  186. package/dist/assets/use-book-data-DFTswcKm.js +1 -0
  187. package/dist/assets/{useActionModal-Blp4rhOk.js → useActionModal-h52Z5Pkl.js} +1 -1
  188. package/dist/assets/useCanAuthorMetadata-TDrVrYGB.js +1 -0
  189. package/dist/assets/useDatasetCatalog-BOd0Ybr1.js +1 -0
  190. package/dist/assets/{useNavTargetLabel-BOJncjIb.js → useNavTargetLabel-D8lRdb6O.js} +1 -1
  191. package/dist/assets/useOpenRecordList-C7oqUD3F.js +1 -0
  192. package/dist/assets/{usePackageL10n-Ci9uVkRZ.js → usePackageL10n-Jl2XiF2F.js} +1 -1
  193. package/dist/assets/{useSettingsLabel-CeMnMWsh.js → useSettingsLabel-CSpBDTdy.js} +1 -1
  194. package/dist/assets/{uz-Cyrl-JSeHEqu-.js → uz-Cyrl-Cmb5bvbf.js} +1 -1
  195. package/dist/assets/{uz-DT3s9bZS.js → uz-DJWxoTz4.js} +1 -1
  196. package/dist/assets/vendor-objectstack-C4eD5dbT.js +139 -0
  197. package/dist/assets/{vi-D2p-h6bY.js → vi-Bb3QoIJC.js} +1 -1
  198. package/dist/assets/{zh-CN-DHOKqAit.js → zh-CN-C-Hts1ZR.js} +1 -1
  199. package/dist/assets/{zh-HK-D4iIPY7I.js → zh-HK-CtBAZ_ZS.js} +1 -1
  200. package/dist/assets/{zh-TW-gORQ_tZh.js → zh-TW-B7DDahD-.js} +1 -1
  201. package/dist/chunk-membership.json +28 -26
  202. package/dist/eager-closure.json +107 -101
  203. package/dist/index.html +4 -4
  204. package/dist/sdui.manifest.json +486 -63
  205. package/package.json +1 -1
  206. package/dist/assets/ApprovalsInboxPage-C6S1vk0X.js +0 -1
  207. package/dist/assets/AuditLogPage-v2dKXMuk.js +0 -1
  208. package/dist/assets/BookPage-DwFMcTSN.js +0 -1
  209. package/dist/assets/CreateViewDialog-D3l-tYHM.js +0 -1
  210. package/dist/assets/DocPage-B6AkH5WI.js +0 -1
  211. package/dist/assets/ExpressionProvider-CrL6jhVq.js +0 -1
  212. package/dist/assets/FlowRunsPage-CxdaiUyk.js +0 -1
  213. package/dist/assets/InterfaceListPage-C4wPYohR.js +0 -1
  214. package/dist/assets/MarketplacePackagePage-CfgKDpNH.js +0 -4
  215. package/dist/assets/MarketplacePage-DNEyU5AE.js +0 -1
  216. package/dist/assets/ObjectDataPage-CykEm9MD.js +0 -1
  217. package/dist/assets/PageView-C6u86tni.js +0 -1
  218. package/dist/assets/ProfilePage-C3SjXMzi.js +0 -1
  219. package/dist/assets/RecordDetailView-DgR_zhP4.js +0 -3
  220. package/dist/assets/ReportDefaultInspector-BIinF0EQ.js +0 -1
  221. package/dist/assets/ReportView-BREO-ADE.js +0 -2
  222. package/dist/assets/RuntimeDraftBar-BCWfd2yS.js +0 -1
  223. package/dist/assets/SchemaForm-C4uMMZ13.js +0 -3
  224. package/dist/assets/SearchResultsPage-C6Hw_Lpn.js +0 -1
  225. package/dist/assets/ai-DPBykF2N.js +0 -3
  226. package/dist/assets/app-shell-eager-leaves-Cf2bM6uT.js +0 -1
  227. package/dist/assets/data-adapter-Cymvlczj.js +0 -1
  228. package/dist/assets/default-inspector-registry-Bs6GBn00.js +0 -1
  229. package/dist/assets/dist-BF-ssUpn.js +0 -14
  230. package/dist/assets/drillUrlFilters-hi-2d3DW.js +0 -1
  231. package/dist/assets/en-AU-FVwCiDJO.js +0 -1
  232. package/dist/assets/en-GB-DQ_y5VbJ.js +0 -1
  233. package/dist/assets/en-IE-DaXOhsZW.js +0 -1
  234. package/dist/assets/en-IN-CnRZnAom.js +0 -1
  235. package/dist/assets/en-NZ-CBZLEToK.js +0 -1
  236. package/dist/assets/en-ZA-BE59v0wZ.js +0 -1
  237. package/dist/assets/framework-DFR4HNtj.js +0 -35
  238. package/dist/assets/getIcon-Cfwf-Egt.js +0 -1
  239. package/dist/assets/i18n-locale-ar-92O_xtDZ.js +0 -4
  240. package/dist/assets/i18n-locale-de-T5ic3yH9.js +0 -4
  241. package/dist/assets/i18n-locale-en-rxr7WJYl.js +0 -4
  242. package/dist/assets/i18n-locale-es-D_WOifJ_.js +0 -4
  243. package/dist/assets/i18n-locale-fr-3cvyjMkp.js +0 -4
  244. package/dist/assets/i18n-locale-ja-DXlIkB8I.js +0 -4
  245. package/dist/assets/i18n-locale-ko-DngRpS45.js +0 -4
  246. package/dist/assets/i18n-locale-pt-BkPaFCqZ.js +0 -4
  247. package/dist/assets/i18n-locale-ru-E5wLh-y6.js +0 -4
  248. package/dist/assets/i18n-locale-zh-BL4_Yand.js +0 -4
  249. package/dist/assets/i18n-runtime-97_bDVjP.js +0 -1
  250. package/dist/assets/index-Cadlh4t_.css +0 -2
  251. package/dist/assets/index-D98sa5GF.js +0 -20
  252. package/dist/assets/integration-CeAF4JFT.js +0 -1
  253. package/dist/assets/isSameWeek-DBXaA1Gd.js +0 -1
  254. package/dist/assets/mermaid-GHXKKRXX-Bb17TtNP.js +0 -1
  255. package/dist/assets/metadata-admin-CABUxbJl.js +0 -9
  256. package/dist/assets/plugin-calendar-Cn5HaZU8.js +0 -1
  257. package/dist/assets/plugin-charts-B6RcFWbo.js +0 -7
  258. package/dist/assets/plugin-dashboard-DjEx8e5Y.js +0 -6
  259. package/dist/assets/plugin-form-CLDvL0up.js +0 -1
  260. package/dist/assets/plugin-gantt-CrVrxVdi.js +0 -63
  261. package/dist/assets/plugin-grid-D2rmQEW_.js +0 -11
  262. package/dist/assets/plugin-kanban-BUNHFfIC.js +0 -1
  263. package/dist/assets/plugin-map-y-7RQQC5.js +0 -1
  264. package/dist/assets/plugin-report-mT3jpna0.js +0 -59
  265. package/dist/assets/plugin-timeline-B1EF83D3.js +0 -1
  266. package/dist/assets/plugin-tree-MTHUt3_S.js +0 -1
  267. package/dist/assets/plugin-view-DHJI-ahf.js +0 -1
  268. package/dist/assets/plugins-views-CfkgqD30.js +0 -3
  269. package/dist/assets/src-BUtIBFDA.js +0 -1
  270. package/dist/assets/src-C0eXlKtx.js +0 -16
  271. package/dist/assets/types-zod-DXpXw10W.js +0 -1
  272. package/dist/assets/ui-components-D6cEVg0T.js +0 -37
  273. package/dist/assets/ui-layout-DgVDuPEM.js +0 -1
  274. package/dist/assets/use-book-data-CwRldFxP.js +0 -1
  275. package/dist/assets/useCanAuthorMetadata-BxCMgFRf.js +0 -1
  276. package/dist/assets/useOpenRecordList-BrwJFojQ.js +0 -1
  277. package/dist/assets/vendor-objectstack-DFqu45yM.js +0 -138
@@ -1,3 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t,v as n}from"./vendor-react-BggL7APJ.js";import{Ri as r,Vi as i,qr as a}from"./vendor-objectstack-DFqu45yM.js";import{$ as o,Br as s,Ft as c,Gn as l,It as u,Jn as d,Kn as f,Mt as p,Nt as m,Pt as h,Vr as g,X as _,_t as v,ft as y,mt as b,p as x,pt as S,qn as C,qt as ee,v as w,xi as T,yi as E,yt as te}from"./ui-components-D6cEVg0T.js";import{$i as ne,A as re,Ai as ie,At as ae,Ci as D,Ei as oe,Fi as se,Ft as O,Gt as ce,Ir as le,Jt as k,Kt as ue,Ot as de,Pi as fe,Ti as pe,Ut as me,Wt as he,Xi as A,Xt as ge,Yi as _e,Zi as ve,_ as ye,_i as be,_r as xe,bi as Se,c as Ce,dt as we,fi as Te,gt as Ee,ki as j,lt as De,na as Oe,nn as ke,pt as Ae,qt as je,r as Me,u as Ne,vi as Pe,wi as Fe,y as M,yi as Ie}from"./framework-DFR4HNtj.js";import{f as Le,h as N,o as Re,p as ze,t as Be,w as P}from"./i18n-runtime-97_bDVjP.js";import{t as Ve}from"./vendor-icon-activity-CkniytwY.js";import{t as He}from"./vendor-icon-arrow-up-down-DdDqplfV.js";import{t as F}from"./vendor-icon-calendar-BsoUBIef.js";import{t as Ue}from"./vendor-icon-chart-column-DicJIApF.js";import{t as We}from"./vendor-icon-chart-gantt-DT-shh3t.js";import{t as Ge}from"./vendor-icon-check-vpu9Zukp.js";import{t as I}from"./vendor-icon-chevron-down-BEf_jTEE.js";import{t as Ke}from"./vendor-icon-chevron-right-DbnKwHYQ.js";import{t as qe}from"./vendor-icon-download-C3csYSaD.js";import{t as Je}from"./vendor-icon-eye-off-Dy3GIcvl.js";import{t as Ye}from"./vendor-icon-grid-3x3-Dyc1xp4z.js";import{t as Xe}from"./vendor-icon-group-Dq8ETKd5.js";import{t as L}from"./vendor-icon-images-qaVnL5yL.js";import{t as Ze}from"./vendor-icon-inbox-ByVQ4l4S.js";import{t as Qe}from"./vendor-icon-layout-grid-B3quJ1GF.js";import{t as $e}from"./vendor-icon-list-tree-Br55vyL9.js";import{t as et}from"./vendor-icon-loader-circle-D3PsuVaD.js";import{t as tt}from"./vendor-icon-map-DsFP3Vmp.js";import{t as nt}from"./vendor-icon-paintbrush-BDpkFJjT.js";import{t as rt}from"./vendor-icon-pencil-CMubUBjW.js";import{t as it}from"./vendor-icon-plus-BlfcDDsa.js";import{t as at}from"./vendor-icon-printer-VcYhF59P.js";import{t as ot}from"./vendor-icon-rotate-cw-piooiFbz.js";import{t as st}from"./vendor-icon-rows-2-CyEMxks5.js";import{t as ct}from"./vendor-icon-rows-3-Bl0iGPg_.js";import{t as lt}from"./vendor-icon-rows-4-DVXDgm1n.js";import{t as ut}from"./vendor-icon-search-B2Uqtp_W.js";import{t as dt}from"./vendor-icon-settings-2-BHIWdy1J.js";import{t as ft}from"./vendor-icon-share-2-D3bdPyHy.js";import{t as pt}from"./vendor-icon-shield-alert-CJYtPI9w.js";import{t as mt}from"./vendor-icon-sliders-horizontal-BsnKXU0c.js";import{t as ht}from"./vendor-icon-square-check-big-B4UVzWzR.js";import{t as gt}from"./vendor-icon-trash-BLsWkwB9.js";import{t as _t}from"./vendor-icon-triangle-alert-D5n0T3q_.js";import{t as vt}from"./vendor-icon-x-CcLtgRNL.js";import{v as yt}from"./plugin-grid-D2rmQEW_.js";var R=e(n(),1),z=t(),B={grid:(0,z.jsx)(Ye,{className:`h-4 w-4`}),kanban:(0,z.jsx)(Qe,{className:`h-4 w-4`}),gallery:(0,z.jsx)(L,{className:`h-4 w-4`}),calendar:(0,z.jsx)(F,{className:`h-4 w-4`}),timeline:(0,z.jsx)(Ve,{className:`h-4 w-4`}),gantt:(0,z.jsx)(We,{className:`h-4 w-4`}),map:(0,z.jsx)(tt,{className:`h-4 w-4`}),chart:(0,z.jsx)(Ue,{className:`h-4 w-4`}),tree:(0,z.jsx)($e,{className:`h-4 w-4`})},bt={grid:`console.objectView.viewTypeGrid`,kanban:`console.objectView.viewTypeKanban`,gallery:`console.objectView.viewTypeGallery`,calendar:`console.objectView.viewTypeCalendar`,timeline:`console.objectView.viewTypeTimeline`,gantt:`console.objectView.viewTypeGantt`,map:`console.objectView.viewTypeMap`,chart:`console.objectView.viewTypeChart`,tree:`console.objectView.viewTypeTree`},xt=N({"console.objectView.viewTypeGrid":`Grid`,"console.objectView.viewTypeKanban":`Kanban`,"console.objectView.viewTypeGallery":`Gallery`,"console.objectView.viewTypeCalendar":`Calendar`,"console.objectView.viewTypeTimeline":`Timeline`,"console.objectView.viewTypeGantt":`Gantt`,"console.objectView.viewTypeMap":`Map`,"console.objectView.viewTypeChart":`Chart`,"console.objectView.viewTypeTree":`Tree`},`console.objectView.viewTypeGrid`);function St(){let{t:e}=xt();return R.useMemo(()=>{let t={};for(let[n,r]of Object.entries(bt))t[n]=e(r);return t},[e])}var Ct=({currentView:e,availableViews:t=[`grid`,`kanban`],onViewChange:n,className:r,animated:i=!0})=>{let[a,o]=R.useState(!1),s=St(),c=R.useCallback(t=>{o(!1),t!==e&&(i&&typeof document<`u`&&`startViewTransition`in document?document.startViewTransition(()=>n(t)):n(t))},[i,e,n]);return t.length>=2&&t.length<=4?(0,z.jsx)(`div`,{role:`tablist`,"data-testid":`view-switcher-segmented`,className:T(`inline-flex items-center gap-0.5 rounded-lg bg-muted p-0.5 oui-view-switcher`,r),children:t.map(t=>{let n=t===e;return(0,z.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n,"aria-label":s[t],title:s[t],"data-state":n?`on`:`off`,onClick:()=>c(t),className:T(`inline-flex items-center gap-1.5 h-7 px-2.5 rounded-[7px] text-xs font-medium transition-all duration-150`,n?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[B[t],(0,z.jsx)(`span`,{className:`hidden sm:inline-block`,children:s[t]})]},t)})}):(0,z.jsxs)(l,{open:a,onOpenChange:o,children:[(0,z.jsx)(C,{asChild:!0,children:(0,z.jsxs)(`button`,{type:`button`,"data-testid":`view-switcher-dropdown`,"aria-label":s[e],className:T(`inline-flex items-center gap-1.5 h-7 px-2 rounded-md text-xs font-medium transition-colors oui-view-switcher`,a?`text-foreground bg-muted`:`text-muted-foreground hover:text-foreground`,r),children:[B[e],(0,z.jsx)(`span`,{className:`hidden sm:inline-block`,children:s[e]}),(0,z.jsx)(I,{className:`h-3 w-3 opacity-60`})]})}),(0,z.jsx)(f,{align:`end`,className:`w-44 p-1`,children:t.map(t=>(0,z.jsxs)(`button`,{type:`button`,onClick:()=>c(t),"data-state":t===e?`on`:`off`,className:T(`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs transition-colors hover:bg-muted`,t===e?`text-foreground font-medium`:`text-muted-foreground`),children:[B[t],(0,z.jsx)(`span`,{className:`flex-1 text-left`,children:s[t]}),t===e&&(0,z.jsx)(Ge,{className:`h-3.5 w-3.5`})]},t))})]})};function wt({title:e,badge:t,onClear:n,clearLabel:r,defaultOpen:i=!0,children:a}){let[o,s]=R.useState(i);return(0,z.jsxs)(`div`,{className:`border-b last:border-b-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`flex items-center gap-1.5 text-xs font-medium text-foreground/80 hover:text-foreground`,children:[(0,z.jsx)(I,{className:T(`h-3.5 w-3.5 transition-transform`,!o&&`-rotate-90`)}),e,typeof t==`number`&&t>0&&(0,z.jsx)(`span`,{className:`ml-1 inline-flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary/10 px-1 text-[10px] text-primary tabular-nums`,children:t})]}),n&&(0,z.jsx)(`button`,{type:`button`,onClick:n,className:`text-[11px] text-muted-foreground hover:text-foreground`,children:r})]}),o&&(0,z.jsx)(`div`,{className:`px-3 pb-3`,children:a})]})}function Tt(e){let{t,allFields:n,showGroup:r,groupingConfig:i,setGroupingConfig:a,showColor:o,rowColorConfig:s,setRowColorConfig:c,showDensity:u,density:d,showHideFields:p,hiddenFields:m,updateHiddenFields:h,showInlineEdit:g,inlineEdit:_,setInlineEdit:y}=e,[b,x]=R.useState(!1),S=[!!i?.fields?.length,!!s?.field,d&&d.mode!==`compact`,(m?.size??0)>0,!!_].filter(Boolean).length,ee=d?.mode===`compact`?lt:d?.mode===`comfortable`?ct:st,w=t(`list.viewSettings`,{defaultValue:`View settings`});return(0,z.jsxs)(l,{open:b,onOpenChange:x,children:[(0,z.jsx)(C,{asChild:!0,children:(0,z.jsxs)(E,{variant:`ghost`,size:`sm`,"aria-label":w,title:w,className:T(`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,S>0&&`text-foreground font-medium`),"data-testid":`view-settings-trigger`,children:[(0,z.jsx)(dt,{className:`h-3.5 w-3.5 sm:mr-1.5`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:w}),S>0&&(0,z.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:S})]})}),(0,z.jsxs)(f,{align:`end`,className:`w-80 p-0`,"data-testid":`view-settings-content`,children:[(0,z.jsxs)(`div`,{className:`px-3 py-2 border-b`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold`,children:w}),(0,z.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:t(`list.viewSettingsHint`,{defaultValue:`Grouping, color, density, and visible fields. Applies to everyone who uses this view.`})})]}),r&&a&&(0,z.jsx)(wt,{title:t(`list.group`,{defaultValue:`Group`}),badge:i?.fields?.length||0,onClear:i?()=>a(void 0):void 0,clearLabel:t(`list.clear`,{defaultValue:`Clear`}),children:(0,z.jsx)(v,{value:i,fieldOptions:n.map(e=>({value:e.name,label:e.label||e.name})),maxLevels:3,labels:{addGroup:t(`list.addGroup`,`Add group field`),collapseTitle:t(`list.collapsedByDefault`,`Collapsed by default`),removeTitle:t(`list.removeGroup`,`Remove`)},onChange:e=>a(e)})}),o&&c&&(0,z.jsxs)(wt,{title:t(`list.rowColor`,{defaultValue:`Row Color`}),onClear:s?()=>c(void 0):void 0,clearLabel:t(`list.clear`,{defaultValue:`Clear`}),defaultOpen:!!s,children:[(0,z.jsx)(`label`,{className:`block text-[11px] text-muted-foreground mb-1`,children:t(`list.colorByField`,{defaultValue:`Color by field`})}),(0,z.jsxs)(`select`,{className:`w-full h-8 rounded border border-input bg-background px-2 text-xs`,value:s?.field||``,onChange:e=>{let t=e.target.value;c(t?{field:t,colors:s?.colors||{}}:void 0)},"data-testid":`color-field-select`,children:[(0,z.jsx)(`option`,{value:``,children:t(`list.none`,{defaultValue:`None`})}),n.map(e=>(0,z.jsx)(`option`,{value:e.name,children:e.label||e.name},e.name))]})]}),u&&d&&(0,z.jsx)(wt,{title:t(`grid.toolbar.densityMode`,{defaultValue:`Density`}),defaultOpen:d.mode!==`compact`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsxs)(E,{variant:`outline`,size:`sm`,className:`h-7 gap-1.5`,onClick:d.cycle,"data-testid":`view-settings-density-cycle`,children:[(0,z.jsx)(ee,{className:`h-3.5 w-3.5`}),(0,z.jsx)(`span`,{className:`text-xs`,children:d.mode===`compact`?t(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):d.mode===`comfortable`?t(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):t(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`})})]}),(0,z.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t(`grid.toolbar.densityCycleShortHint`,{defaultValue:`Click to cycle`})})]})}),g&&y&&(0,z.jsx)(wt,{title:t(`list.recordEditingTitle`,{defaultValue:`Record editing`}),defaultOpen:!!_,children:(0,z.jsxs)(`label`,{className:`flex items-center gap-2 text-xs py-1 px-1 rounded hover:bg-muted cursor-pointer`,children:[(0,z.jsx)(`input`,{type:`checkbox`,checked:!!_,onChange:()=>y(!_),className:`rounded border-input`,"data-testid":`view-settings-inline-edit`}),(0,z.jsx)(`span`,{children:t(`list.inlineEditLabel`,{defaultValue:`Edit records inline (click a cell to edit)`})})]})}),p&&m&&h&&(0,z.jsx)(wt,{title:t(`list.hideFieldsTitle`,{defaultValue:`Hide Fields`}),badge:m.size,onClear:m.size>0?()=>h(new Set):void 0,clearLabel:t(`list.showAll`,{defaultValue:`Show all`}),defaultOpen:m.size>0,children:(0,z.jsx)(`div`,{className:`max-h-48 overflow-y-auto space-y-0.5`,children:n.map(e=>(0,z.jsxs)(`label`,{className:`flex items-center gap-2 text-xs py-1 px-1 rounded hover:bg-muted cursor-pointer`,children:[(0,z.jsx)(`input`,{type:`checkbox`,checked:!m.has(e.name),onChange:()=>{let t=new Set(m);t.has(e.name)?t.delete(e.name):t.add(e.name),h(t)},className:`rounded border-input`}),(0,z.jsx)(`span`,{className:`truncate`,children:e.label||e.name})]},e.name))})})]})]})}function Et(){let{t:e}=P(),t=e(`common.more`);return!t||t===`common.more`?`More`:t}var Dt=new Set([`lookup`,`master_detail`,`user`]),Ot={select:`single-choice`,"multi-select":`multi-choice`,boolean:`multi-choice`,"date-range":`range`,text:`text`};function kt(e){return(e||[]).filter(e=>e&&(e.id||e.name)).map(e=>({id:e.id??e.name,label:typeof e.label==`string`?e.label:e.label?.toString?.()??e.id??e.name,filters:Array.isArray(e.filters)?e.filters:Array.isArray(e.filter)?e.filter.filter(e=>e&&typeof e.field==`string`).map(e=>[e.field,r(e.operator),e.value]):[],default:e.default??e.isDefault}))}function At({config:e,objectDef:t,data:n=[],onFilterChange:r,maxVisible:i,className:a,initialSelections:o,onSelectionsChange:s}){switch(e.element){case`dropdown`:return(0,z.jsx)(H,{fields:e.fields||[],objectDef:t,data:n,onFilterChange:r,maxVisible:i,className:a,initialSelections:o,onSelectionsChange:s});case`tabs`:return(0,z.jsx)(jt,{tabs:kt(e.tabs||[]),showAllRecords:e.showAllRecords!==!1,allowAddTab:e.allowAddTab,onFilterChange:r,className:a,initialTab:typeof o?._tab?.[0]==`string`?o._tab[0]:void 0,onSelectionsChange:s});case`toggle`:return(0,z.jsx)(Mt,{fields:e.fields||[],onFilterChange:r,className:a});default:return null}}function V(e,t,n,r){return e.map(e=>{let i=e.options?[...e.options]:[],a=e.type,o,s,c;if(t?.fields){let n=Array.isArray(t.fields)?t.fields.find(t=>t.name===e.field):t.fields[e.field];n&&(a||=n.type,c=n.label,o=n.reference,s=n.displayField,i.length===0&&n.options&&(i=Array.isArray(n.options)?n.options.map(e=>({label:e.label??String(e.value??e),value:e.value??e,color:e.color})):Object.entries(n.options).map(([e,t])=>({label:t?.label||e,value:e,color:t?.color}))))}i.length===0&&a===`boolean`&&(i=[{label:`True`,value:!0},{label:`False`,value:!1}]),e.showCount&&n.length>0&&(i=i.map(t=>({...t,count:n.filter(n=>n[e.field]===t.value).length})));let l=e.label??c;if(r?.objectName){i=r.translateOptions(r.objectName,e.field,i);let t=e.label||c,n=r.fieldLabel(r.objectName,e.field,t||e.field);l=n===e.field&&t?t:n}return{...e,label:l,type:a,options:i,referenceTo:o,displayField:s}})}function H({fields:e,objectDef:t,data:n,onFilterChange:r,maxVisible:i,className:a,initialSelections:o,onSelectionsChange:s}){let{fieldLabel:c,translateOptions:u}=ze(),d=Et(),p=t?.name,m=R.useMemo(()=>new Map(e.map(e=>[e.field,Ot[e.type??``]])),[e]),[g,_]=R.useState(()=>{let t={};return e.forEach(e=>{e.defaultValues&&e.defaultValues.length>0&&(t[e.field]=e.defaultValues);let n=o?.[e.field];n&&n.length>0&&(t[e.field]=n),m.get(e.field)===`single-choice`&&(t[e.field]?.length??0)>1&&(t[e.field]=t[e.field].slice(0,1))}),t}),v=R.useRef({}),y=R.useMemo(()=>V(e,t,n,{objectName:p,fieldLabel:c,translateOptions:u}).map(e=>{if(!e.showCount)return e;if((g[e.field]||[]).length===0)return v.current[e.field]=new Map(e.options.map(e=>[String(e.value),e.count??0])),e;let t=v.current[e.field];return t?{...e,options:e.options.map(e=>({...e,count:t.get(String(e.value))??e.count}))}:e}),[e,t,n,p,c,u,g]),b=R.useCallback(e=>{r(Object.entries(e).flatMap(([e,t])=>{if(t.length===0)return[];switch(m.get(e)){case`range`:{let[n,r]=t,i=[];return n!==void 0&&n!==``&&i.push([e,`>=`,n]),r!==void 0&&r!==``&&i.push([e,`<=`,r]),i}case`text`:{let n=String(t[0]??``).trim();return n?[[e,`contains`,n]]:[]}default:return[[e,`in`,t]]}}))},[r,m]),x=(e,t)=>{let n={...g,[e]:t};_(n),b(n),s?.(n)};R.useEffect(()=>{let e=g,t={},n=!1;for(let[r,i]of Object.entries(e)){let e=y.find(e=>e.field===r),a=i.map(t=>{if(!e||typeof t!=`string`)return t;let n=e.options.find(e=>String(e.value)===t);return n&&n.value!==t?n.value:e.type===`boolean`&&(t===`true`||t===`false`)?t===`true`:t});t[r]=a,a.some((e,t)=>e!==i[t])&&(n=!0)}n&&(_(t),e=t),Object.values(e).some(e=>e.length>0)&&b(e)},[]);let S=i!==void 0&&i<y.length?y.slice(0,i):y,ee=i!==void 0&&i<y.length?y.slice(i):[],w=e=>{let t=g[e.field]||[],n=m.get(e.field),r=t.filter(e=>e!==``&&e!=null).length,i=r>0,a=n===`single-choice`,o=D(e.type);o&&Fe(e.type);let s=!o&&Dt.has(e.type||``)&&e.options.length===0&&(e.referenceTo||e.type===`user`),c=s?`w-72`:`w-56`;return(0,z.jsxs)(l,{children:[(0,z.jsx)(C,{asChild:!0,children:(0,z.jsxs)(`button`,{type:`button`,"data-testid":`filter-badge-${e.field}`,className:T(`inline-flex items-center gap-1 h-7 px-2 text-xs transition-colors shrink-0 rounded-md`,i?`text-foreground font-medium`:`text-muted-foreground hover:text-foreground`),children:[(0,z.jsx)(`span`,{className:`truncate max-w-[100px]`,children:e.label||e.field}),i&&(0,z.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80 tabular-nums`,children:r}),i?(0,z.jsx)(vt,{className:`h-3 w-3 opacity-60 hover:opacity-100`,"data-testid":`filter-clear-${e.field}`,onClick:t=>{t.stopPropagation(),x(e.field,[])}}):(0,z.jsx)(I,{className:`h-3 w-3 opacity-60`})]})}),(0,z.jsx)(f,{align:`start`,className:T(c,`p-2`),children:s?(0,z.jsx)(`div`,{"data-testid":`filter-lookup-${e.field}`,children:(0,z.jsx)(h,{field:{value:e.field,label:e.label||e.field,type:e.type,referenceTo:e.referenceTo,displayField:e.displayField},value:t,multiple:!0,onChange:t=>{let n=Array.isArray(t)?t:t==null||t===``?[]:[t];x(e.field,n)}})}):n===`range`?(0,z.jsx)(`div`,{className:`space-y-2 p-1`,"data-testid":`filter-range-${e.field}`,children:[0,1].map(n=>(0,z.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,z.jsx)(`span`,{className:`w-8 shrink-0`,children:n===0?`From`:`To`}),(0,z.jsx)(`input`,{type:`date`,"data-testid":`filter-range-${e.field}-${n===0?`from`:`to`}`,value:String(t[n]??``),onChange:r=>{let i=[String(t[0]??``),String(t[1]??``)];i[n]=r.target.value,x(e.field,i[0]===``&&i[1]===``?[]:i)},className:`h-7 flex-1 rounded border border-input bg-background px-2 text-xs text-foreground`})]},n))}):n===`text`?(0,z.jsx)(`input`,{type:`search`,"data-testid":`filter-text-${e.field}`,defaultValue:String(t[0]??``),placeholder:e.label||e.field,onBlur:t=>{let n=t.target.value.trim();x(e.field,n?[n]:[])},onKeyDown:t=>{if(t.key===`Enter`){let n=t.target.value.trim();x(e.field,n?[n]:[])}},className:`h-8 w-full rounded border border-input bg-background px-2 text-xs text-foreground`}):(0,z.jsx)(`div`,{className:`max-h-60 overflow-y-auto space-y-0.5`,"data-testid":`filter-options-${e.field}`,children:e.options.length===0?(0,z.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-muted-foreground`,children:`No options`}):e.options.map(n=>(0,z.jsxs)(`label`,{className:T(`flex items-center gap-2 text-sm py-1.5 px-2 rounded cursor-pointer`,t.includes(n.value)?`bg-primary/5 text-primary`:`hover:bg-muted`),children:[(0,z.jsx)(`input`,{type:a?`radio`:`checkbox`,name:a?`user-filter-${e.field}`:void 0,checked:t.includes(n.value),onChange:()=>{let r=a?[n.value]:t.includes(n.value)?t.filter(e=>e!==n.value):[...t,n.value];x(e.field,r)},className:a?`border-input`:`rounded border-input`}),n.color&&(0,z.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full shrink-0`,style:{backgroundColor:n.color}}),(0,z.jsx)(`span`,{className:`truncate flex-1`,children:n.label}),n.count!==void 0&&(0,z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.count})]},String(n.value)))})})]},e.field)};return(0,z.jsx)(`div`,{className:T(`flex items-center gap-0.5 overflow-x-auto`,a),"data-testid":`user-filters-dropdown`,children:y.length===0?(0,z.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`user-filters-empty`,children:`No filter fields`}):(0,z.jsxs)(z.Fragment,{children:[S.map(w),ee.length>0&&(0,z.jsxs)(l,{children:[(0,z.jsx)(C,{asChild:!0,children:(0,z.jsxs)(`button`,{type:`button`,"data-testid":`user-filters-more`,className:`inline-flex items-center gap-1 h-7 px-2 text-xs text-muted-foreground hover:text-foreground transition-colors shrink-0 rounded-md`,children:[(0,z.jsx)(`span`,{children:d}),(0,z.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80 tabular-nums`,children:ee.length}),(0,z.jsx)(I,{className:`h-3 w-3 opacity-60`})]})}),(0,z.jsx)(f,{align:`start`,className:`w-64 p-2`,"data-testid":`user-filters-more-content`,children:(0,z.jsx)(`div`,{className:`space-y-1`,children:ee.map(w)})})]})]})})}function jt({tabs:e,showAllRecords:t,allowAddTab:n,onFilterChange:r,className:i,initialTab:a,onSelectionsChange:o}){let[s,c]=R.useState(()=>a&&(a===`__all__`||e.some(e=>e.id===a))?a:e.find(e=>e.default)?.id||(t?`__all__`:e[0]?.id||``)),[u,p]=R.useState([]),[m,h]=R.useState(!1),[g,_]=R.useState(``),v=R.useCallback(t=>{if(t===`__all__`)return[];let n=e.find(e=>e.id===t);return n?n.filters||[]:u.find(e=>e.id===t)?.filters||[]},[e,u]),y=R.useCallback(e=>{c(e),r(v(e)),o?.({_tab:[e]})},[v,r,o]),b=R.useMemo(()=>{let n=[...e];return t&&n.push({id:`__all__`,label:`All records`,filters:[]}),n},[e,t]),x=R.useCallback(()=>{let t=g.trim();if(!t)return;let n=new Set([...e.map(e=>e.id??e.name??``),...u.map(e=>e.id)]),i=u.length+1;for(;n.has(`__session_${i}__`);)i+=1;let a=`__session_${i}__`,l=v(s).map(e=>Array.isArray(e)?[...e]:e);p(e=>[...e,{id:a,label:t,filters:l}]),c(a),_(``),h(!1),r(l),o?.({_tab:[a]})},[g,e,u,v,s,r,o]),S=R.useCallback(n=>{if(p(e=>e.filter(e=>e.id!==n)),s!==n)return;let r=e.find(e=>e.default);y(r?.id||(t?`__all__`:e[0]?.id||``))},[s,e,t,y]);return R.useEffect(()=>{if(s&&s!==`__all__`){let t=e.find(e=>e.id===s);t&&r(t.filters||[])}},[]),(0,z.jsxs)(`div`,{className:T(`flex items-center gap-0.5 overflow-x-auto`,i),"data-testid":`user-filters-tabs`,children:[b.map(e=>{let t=e.id??e.name??``;return(0,z.jsx)(`button`,{type:`button`,"data-testid":`filter-tab-${t}`,onClick:()=>y(t),className:T(`inline-flex items-center h-7 px-3 text-xs font-medium rounded-md transition-colors shrink-0`,s===t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:text-foreground hover:bg-muted`),children:e.label},t)}),u.map(e=>{let t=s===e.id;return(0,z.jsxs)(`span`,{className:T(`inline-flex items-center h-7 rounded-md transition-colors shrink-0`,t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),children:[(0,z.jsx)(`button`,{type:`button`,"data-testid":`filter-tab-${e.id}`,onClick:()=>y(e.id),className:`inline-flex items-center h-7 pl-3 pr-1 text-xs font-medium rounded-l-md`,children:e.label}),(0,z.jsx)(`button`,{type:`button`,"data-testid":`filter-tab-remove-${e.id}`,onClick:()=>S(e.id),title:`Remove tab`,"aria-label":`Remove tab ${e.label}`,className:`inline-flex items-center h-7 pl-0.5 pr-2 rounded-r-md opacity-60 hover:opacity-100`,children:(0,z.jsx)(vt,{className:`h-3 w-3`})})]},e.id)}),n&&(0,z.jsxs)(l,{open:m,onOpenChange:e=>{h(e),e||_(``)},children:[(0,z.jsx)(C,{asChild:!0,children:(0,z.jsx)(`button`,{type:`button`,className:`inline-flex items-center justify-center h-7 w-7 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted shrink-0`,"data-testid":`filter-tab-add`,title:`Add filter tab`,children:(0,z.jsx)(it,{className:`h-3.5 w-3.5`})})}),(0,z.jsxs)(f,{align:`start`,className:`w-64 p-2 space-y-2`,"data-testid":`filter-tab-add-content`,children:[(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Name this tab. It keeps the filters applied right now, and lives in this session only.`}),(0,z.jsx)(d,{autoFocus:!0,value:g,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),x())},placeholder:`Tab name`,className:`h-7 text-xs`,"data-testid":`filter-tab-add-input`}),(0,z.jsx)(`div`,{className:`flex justify-end`,children:(0,z.jsx)(E,{size:`sm`,className:`h-7 px-2 text-xs`,disabled:!g.trim(),"data-testid":`filter-tab-add-confirm`,onClick:x,children:`Add tab`})})]})]})]})}function Mt({fields:e,onFilterChange:t,className:n}){let[r,i]=R.useState(()=>{let t=new Set;return e.forEach(e=>{e.defaultValues&&e.defaultValues.length>0&&t.add(e.field)}),t}),a=R.useCallback(n=>{t(Array.from(n).map(t=>{let n=e.find(e=>e.field===t);return n?.defaultValues?[t,`in`,n.defaultValues]:[t,`!=`,null]}))},[e,t]),o=e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),a(n),n})};return R.useEffect(()=>{r.size>0&&a(r)},[]),(0,z.jsx)(`div`,{className:T(`flex items-center gap-1 overflow-x-auto`,n),"data-testid":`user-filters-toggle`,children:e.map(e=>{let t=r.has(e.field);return(0,z.jsx)(E,{variant:t?`default`:`outline`,size:`sm`,className:`h-7 px-3 text-xs shrink-0`,"data-testid":`filter-toggle-${e.field}`,onClick:()=>o(e.field),children:e.label||e.field},e.field)})})}var Nt={latitudeField:`latitudeField`,longitudeField:`longitudeField`,locationField:`locationField`,titleField:`titleField`,descriptionField:`descriptionField`,zoom:`zoom`,center:`center`,style:`mapStyle`};function U(e){if(!e||typeof e!=`object`)return{};let t=e;return Object.fromEntries(Object.entries(Nt).filter(([e])=>e in t).map(([e,n])=>[n,t[e]]))}function Pt(e){return{...U(e.options?.map),...U(e.map)}}function Ft(e){let t=e.chart||e.options?.chart||{};if(t.dataset){let e=Array.isArray(t.dimensions)?t.dimensions:[],n=Array.isArray(t.values)?t.values:[];return{config:t,shape:`dataset`,resolves:n.length>0,dataset:t.dataset,dimensions:e,values:n}}let n=Array.isArray(t.yAxisFields)&&t.yAxisFields[0]||t.valueField||void 0,r=t.xAxisField||t.categoryField||void 0;return{config:t,shape:`legacy`,resolves:!!(r&&n),dimensions:[],values:[],categoryField:r,valueField:n}}var It=new Set([...c].map(e=>String(r(e))));function W(e){return It.has(String(r(e)))}function G(e){switch(e.toLowerCase().replace(/[_\s]/g,``)){case`equals`:case`eq`:return`=`;case`notequals`:case`ne`:case`neq`:return`!=`;case`contains`:return`contains`;case`icontains`:return`icontains`;case`notcontains`:return`notcontains`;case`startswith`:return`startswith`;case`endswith`:return`endswith`;case`greaterthan`:case`gt`:return`>`;case`greaterorequal`:case`greaterthanorequal`:case`gte`:return`>=`;case`lessthan`:case`lt`:return`<`;case`lessorequal`:case`lessthanorequal`:case`lte`:return`<=`;case`in`:return`in`;case`notin`:case`nin`:return`nin`;case`before`:return`<`;case`after`:return`>`;case`between`:return`between`;case`isnull`:return`isnull`;case`isnotnull`:return`isnotnull`;default:return e}}var Lt=[],K=new Set([`nin`,`not_in`,`notIn`,`notin`,`not in`]);function Rt(e){if(!Array.isArray(e)||e.length<3)return e;let[t,n,r]=e;return typeof t==`string`&&(t===`and`||t===`or`)?[t,...e.slice(1).map(e=>Array.isArray(e)?Rt(e):e)]:n===`in`&&Array.isArray(r)?r.length===0?[]:r.length===1?[t,`=`,r[0]]:[`or`,...r.map(e=>[t,`=`,e])]:K.has(n)&&Array.isArray(r)?r.length===0?[]:r.length===1?[t,`!=`,r[0]]:[`and`,...r.map(e=>[t,`!=`,e])]:e}function zt(e){let t=typeof e==`string`?[e]:Array.isArray(e)?e:[],n=[];for(let e of t)if(typeof e==`string`){let t=e.trim().split(/\s+/);if(!t[0])continue;n.push({id:crypto.randomUUID(),field:t[0],order:t[1]?.toLowerCase()===`desc`?`desc`:`asc`})}else e&&typeof e==`object`&&typeof e.field==`string`&&n.push({id:crypto.randomUUID(),field:e.field,order:e.order||`asc`});return n}function Bt(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Vt(e){switch(e){case`bottom`:return{top:!1,bottom:!0};case`both`:return{top:!0,bottom:!0};default:return{top:!0,bottom:!1}}}function Ht(e){let t=[e?.timeline,e?.options?.timeline,e?.calendar,e?.options?.calendar],n=e=>{for(let n of t){if(!n)continue;let t=e(n);if(typeof t==`string`&&t)return t}};return{startDateField:n(e=>e.startDateField??e.dateField),endDateField:n(e=>e.endDateField),titleField:n(e=>e.titleField)}}function Ut(e){return!Array.isArray(e)||e.length===0?[]:e.map(e=>Array.isArray(e)?Rt(e):e).filter(e=>Array.isArray(e)&&e.length>0)}function Wt(e,t,n){let r=qt(t);return Oe(e,r.length>0?r:void 0,...Ut(n))}var Gt={id:`root`,logic:`and`,conditions:[]},Kt=[];function qt(e){if(!e||!e.conditions||e.conditions.length===0)return[];let t=Ut(e.conditions.filter(e=>W(e.operator)?!0:u(e.operator,e.value)).map(e=>{let t=String(r(e.operator));return t===`is_empty`?[e.field,`=`,null]:t===`is_not_empty`?[e.field,`!=`,null]:W(e.operator)?[e.field,G(e.operator),null]:[e.field,G(e.operator),e.value]}));return t.length===0?[]:t.length===1?t[0]:[e.logic,...t]}var Jt=N({"list.recordCount":`{{count}} records`,"list.recordCountOne":`{{count}} record`,"list.noItems":`No items found`,"list.noItemsMessage":`There are no records to display. Try adjusting your filters or adding new data.`,"list.firstRunTitle":`Nothing here yet`,"list.firstRunMessage":`Create your first record to get started.`,"list.noMatches":`No matching records`,"list.noMatchesMessage":`No records match your current filters or search. Try adjusting or clearing them.`,"list.loading":`Loading records…`,"list.loadErrorTitle":`Couldn’t load records`,"list.loadErrorMessage":`Something went wrong while loading this data. Check your connection and try again.`,"list.loadErrorForbiddenTitle":`You don’t have access`,"list.loadErrorForbiddenMessage":`You don’t have permission to view these records. Contact your administrator if you think you should have access.`,"list.loadErrorUnauthorizedTitle":`Sign in required`,"list.loadErrorUnauthorizedMessage":`Your session has expired or you are signed out. Sign in again to view these records.`,"list.loadErrorRejectedTitle":`This view’s query was rejected`,"list.loadErrorRejectedMessage":`The server could not process this view’s filter or query options. Clearing the filters usually fixes it; if the view is saved this way, an administrator needs to correct it.`,"list.loadErrorApiDisabledTitle":`This object isn’t available through the API`,"list.loadErrorApiDisabledMessage":`This page can’t load its records because the object is not exposed through the API. That is a setting on the object itself, not a permission — an administrator has to enable API access for it before this page can work.`,"list.retry":`Retry`,"grid.grouping.needsHeaderQuery":`This view is grouped, but its data source does not implement queryGroupHeaders, so the groups cannot be counted. Remove the grouping to show the records.`,"list.search":`Search`,"table.search":`Search…`,"list.filter":`Filter`,"list.filterRecords":`Filter Records`,"list.sort":`Sort`,"list.sortRecords":`Sort Records`,"list.sortByIdSuffix":`(by ID)`,"list.sortRelationalHint":`Columns that link to another record are not listed: they can only be sorted by the stored ID, not by the name shown in the cell. To sort by that name, denormalize it onto this object as a stored field, written when the source changes, and sort by that. Not a formula field: it is virtual, so no column is stored for it and the server refuses to sort by one.`,"list.resetSortToDefault":`Reset to view default`,"list.group":`Group`,"list.groupBy":`Group By`,"list.export":`Export`,"list.exportAs":`Export as {{format}}`,"list.color":`Color`,"list.rowColor":`Row Color`,"list.colorByField":`Color by field`,"list.clear":`Clear`,"list.none":`None`,"list.hideFields":`Hide fields`,"list.showAll":`Show all`,"list.pullToRefresh":`Pull to refresh`,"list.refresh":`Refresh`,"list.refreshing":`Refreshing…`,"list.dataLimitReached":`Showing first {{limit}} records. More data may be available.`,"list.addRecord":`Add record`,"list.tabs":`Tabs`,"list.allRecords":`All Records`,"list.share":`Share`,"list.print":`Print`,"common.printDialogHint":`Opens your browser’s print dialog (not a PDF export)`,"list.hideFieldsTitle":`Hide Fields`,"table.rowsPerPage":`Rows per page`,"grid.toolbar.densityMode":`Density`,"grid.toolbar.densityCompact":`Compact`,"grid.toolbar.densityComfortable":`Comfortable`,"grid.toolbar.densitySpacious":`Spacious`,"grid.toolbar.densityCycleHint":`{{label}} (click to cycle)`,"grid.toolbar.densityCycleShortHint":`Click to cycle`,"list.viewSettings":`View settings`,"list.viewSettingsHint":`Grouping, color, density, and visible fields. Applies to everyone who uses this view.`,"detail.recordDetail":`Record Detail`,"detail.recordDetailWithLabel":`{{label}} Detail`},`list.recordCount`);function Yt(){let{fieldLabel:e,actionLabel:t,objectLabel:n}=Le();return{fieldLabel:e,actionLabel:t,objectLabel:n}}function Xt(){let e=a.parse({}).pageSize;if(typeof e!=`number`||!Number.isInteger(e)||e<=0)throw Error(`[ObjectUI] ListView: @objectstack/spec no longer declares a positive default for pagination.pageSize (read ${String(e)}); a paged list has no display page size to fall back to.`);return e}var Zt=Xt();function Qt(e){return typeof e==`number`&&Number.isInteger(e)&&e>0}function $t(e,t,n){let r=e??t;return Qt(r)?r:n}function en(e,t,n,r){let i=e??t;if(i==null||Qt(i))return null;let a=typeof n==`string`&&n?`list-view on ${n}`:`list-view`,o=r?`its default page size (${Zt})`:`its default fetch batch (100), since this view does not page`;return`[ObjectUI] ListView pagination: ${a} declared pageSize: ${String(i)}, which is not a positive integer. A page size must be a positive integer (the spec refuses zero and negative values), so it was ignored and this list fell back to ${o}.`}var tn=R.forwardRef(({schema:e,className:t,onViewChange:n,onFilterChange:r,onSortChange:a,onSearchChange:s,onHiddenFieldsChange:c,onInlineEditChange:u,onColumnStateChange:h,onRowClick:g,showViewSwitcher:_,userFilterSelections:x,onUserFilterSelectionsChange:w,initialFilters:ie,initialSearchTerm:ae,...D},le)=>{let de=_??e?.showViewSwitcher??!1,{t:A}=Jt(),{fieldLabel:_e,actionLabel:ve,objectLabel:Oe}=Yt(),{translateOptions:Ne}=ze(),Fe=Be(),M=R.useMemo(()=>he(e),[e]),Le=Ae(),N=we(M.filter,Le),P=R.useCallback((e,t)=>M.objectName?_e(M.objectName,e,t):t,[M.objectName,_e]),Ve=R.useCallback(e=>{let t=Bt(e);return M.objectName&&typeof ve==`function`?ve(M.objectName,e,t):t},[M.objectName,ve]),[F,Ue]=R.useState(M.viewType),We=F===`chart`&&Ft(M).shape===`dataset`,Ge=F===`tree`||F===`chart`,I=R.useMemo(()=>{let e=M.userActions,t=M.addRecord?.enabled===!0&&e?.addRecordForm!==!1,n=Vt(M.addRecord?.position);return{showSearch:e?.search!==!1&&!Ge,showSort:e?.sort!==!1,showFilters:e?.filter!==!1&&!We,showUserFilters:!We,showRefresh:e?.refresh!==!1,showDensity:e?.rowHeight!==!1,showGroup:e?.group!==!1,showHideFields:e?.hideFields===!0,showColor:e?.rowColor===!0,compactToolbar:M.compactToolbar===!0,showAddRecord:t,showAddRecordTop:t&&n.top,showAddRecordBottom:t&&n.bottom}},[M.userActions,M.compactToolbar,M.addRecord,We,Ge]),[Ke,Ye]=R.useState(()=>ae??``),L=Ge?``:Ke,[Qe,$e]=R.useState(!1),[tt,dt]=R.useState(!1),[B,bt]=R.useState(()=>zt(M.sort)),xt=R.useMemo(()=>JSON.stringify(M.sort||[]),[M.sort]);R.useEffect(()=>{bt(zt(M.sort))},[xt]);let St=R.useMemo(()=>zt(M.sort),[xt]),wt=R.useMemo(()=>B.length!==St.length||B.some((e,t)=>e.field!==St[t].field||e.order!==St[t].order),[B,St]),[Et,Dt]=R.useState(!1),[Ot,kt]=R.useState(()=>ie&&Array.isArray(ie.conditions)?ie:{id:`root`,logic:`and`,conditions:[]}),V=D.dataSource,[H,jt]=R.useState([]),[Mt,Nt]=R.useState(null),[U,It]=R.useState(`network`),[W,G]=R.useState(()=>!(Array.isArray(M.data)||M.data&&typeof M.data==`object`&&M.data.provider===`value`&&Array.isArray(M.data.items)||M.viewType===`gantt`&&M.data&&typeof M.data==`object`&&!Array.isArray(M.data)&&M.data.provider===`api`)),[K,Rt]=R.useState(null),[Ut,qt]=R.useState(!1),[Xt,Qt]=R.useState(0),[tn,nn]=R.useState(!1);R.useImperativeHandle(le,()=>({refresh:()=>Qt(e=>e+1)}),[]),R.useEffect(()=>{if(V?.onMutation&&M.objectName)return V.onMutation(e=>{e.resource===M.objectName&&Qt(e=>e+1)})},[V,M.objectName]);let[rn,an]=R.useState(void 0),on=M.pagination?.pageSize,[sn,cn]=R.useState(1),[ln,un]=R.useState(null),[dn,fn]=R.useState(null),pn=R.useMemo(()=>{if(M.grouping?.fields?.length)return M.grouping;let e=typeof M.groupBy==`string`?M.groupBy.trim():``,t=typeof M.groupBy2==`string`?M.groupBy2.trim():``,n=[];return e&&n.push({field:e,order:`asc`,collapsed:!1}),t&&t!==e&&n.push({field:t,order:`asc`,collapsed:!1}),n.length>0?{fields:n}:void 0},[M.grouping,M.groupBy,M.groupBy2]),[q,mn]=R.useState(pn),[hn,gn]=R.useState(!1),_n=R.useRef(pn);R.useEffect(()=>{_n.current!==pn&&(_n.current=pn,mn(pn))},[pn]);let vn=F===`grid`&&!q?.fields?.length,J=$t(rn,on,vn?Zt:100);R.useEffect(()=>{let e=en(rn,on,M.objectName,vn);e&&console.warn(e)},[rn,on,M.objectName,vn]);let yn=vn?(sn-1)*J:0,bn=vn?ln:null,[xn,Sn]=R.useState(M.rowColor),[Cn,wn]=R.useState(!1),[Tn,En]=R.useState([]),Dn=R.useRef(0),[On,kn]=R.useState([]),An=We&&Ot.conditions&&Ot.conditions.length>0?Gt:Ot,jn=We&&On.length>0?Kt:On,Mn=R.useMemo(()=>{let e=M.userFilters;if(!e)return;if(e.element===`tabs`||e.fields&&e.fields.length>0||!K?.fields)return e;let t=new Set([`select`,`multi-select`,`boolean`]),n=[],r=Array.isArray(K.fields)?K.fields.map(e=>[e.name,e]):Object.entries(K.fields);for(let[e,i]of r)(t.has(i.type)||i.options&&!i.type)&&n.push({field:e,label:P(e,i.label||e),type:i.type===`boolean`?`boolean`:i.type===`multi-select`?`multi-select`:`select`});return n.length===0?e:{...e,fields:n}},[M.userFilters,K,P]),[Y,Nn]=R.useState(()=>new Set(M.hiddenFields||[])),Pn=R.useMemo(()=>JSON.stringify(M.hiddenFields||[]),[M.hiddenFields]);R.useEffect(()=>{Nn(new Set(M.hiddenFields||[]))},[Pn]);let Fn=R.useCallback(e=>{Nn(e),c?.(Array.from(e))},[c]),[In,Ln]=R.useState(!1),[Rn,zn]=R.useState(()=>!!M.inlineEdit);R.useEffect(()=>{zn(!!M.inlineEdit)},[M.inlineEdit]);let Bn=R.useCallback(e=>{zn(e),u?.(e)},[u]),[Vn,Hn]=R.useState(!1),[Un,Wn]=R.useState(!1),[Gn,Kn]=R.useState(null),{getObjectApiOperations:qn,can:Jn}=o(),X=M.objectName?qn(M.objectName):void 0,Yn=M.allowExport!==!1&&M.operations?.export!==!1&&(!X||X.includes(`export`)),Xn=R.useMemo(()=>{let e=M.bulkActions;return!e||e.length===0||se(K,X).delete&&(!M.objectName||Jn(M.objectName,`delete`))?e:e.filter(e=>String(e).toLowerCase()!==`delete`)},[M.bulkActions,M.objectName,K,X,Jn]),Zn=R.useMemo(()=>se(K,X).deletePredicates?.visibleWhen,[K,X]),Qn=O(),$n=R.useMemo(()=>xe(Zn,Tn,{scope:Qn,fields:K?.fields,label:`delete`}),[Zn,Tn,Qn,K]),er=R.useMemo(()=>M.userActions?.editInline!==!1&&fe(K,X)&&(!M.objectName||Jn(M.objectName,`update`)),[M.userActions,M.objectName,K,X,Jn]),Z=R.useMemo(()=>{if(M.exportOptions)return Array.isArray(M.exportOptions)?{formats:M.exportOptions}:M.exportOptions},[M.exportOptions]),tr=R.useMemo(()=>{let e=Z?.formats||[`csv`,`json`],t=typeof V?.exportDownload==`function`&&M.objectName&&Z?.streaming!==!1?[`csv`,`xlsx`,`json`]:[`csv`,`json`];return e.filter(e=>t.includes(e))},[Z,V,M.objectName]);R.useEffect(()=>{let e=Z?.formats;if(!e)return;let t=e.filter(e=>!tr.includes(e));t.length>0&&console.warn(`[ObjectUI] ListView export: unsupported format(s) hidden from the menu: ${t.join(`, `)}`)},[Z,tr]);let nr=R.useMemo(()=>ce(M.rowHeight)??`compact`,[M.rowHeight]),Q=re(nr,{onChange:M.onDensityChange}),rr=R.useMemo(()=>`objectui:gallery:density:${M.objectName??`default`}`,[M.objectName]),[ir,ar]=R.useState(()=>{if(typeof window>`u`)return M.gallery?.cardSize??`medium`;try{let e=window.localStorage.getItem(rr);if(e===`small`||e===`medium`||e===`large`)return e}catch{}return M.gallery?.cardSize??`medium`}),or=R.useCallback(()=>{ar(e=>{let t=e===`large`?`medium`:e===`medium`?`small`:`large`;try{window.localStorage.setItem(rr,t)}catch{}return t})},[rr]),sr=R.useCallback(async()=>{Qt(e=>e+1)},[]),{ref:cr,isRefreshing:lr,pullDistance:ur}=yt({onRefresh:sr,enabled:!!V&&!!M.objectName}),dr=R.useMemo(()=>M.id?`listview-${M.objectName}-${M.id}-view`:`listview-${M.objectName}-view`,[M.objectName,M.id]);R.useEffect(()=>{let e=!0;return qt(!1),Rt(null),(async()=>{if(!V||!M.objectName){qt(!0);return}if(typeof V.getObjectSchema!=`function`){qt(!0);return}try{let t=await V.getObjectSchema(M.objectName);e&&Rt(t)}catch(e){console.warn(`Failed to fetch object schema for ListView:`,e)}finally{e&&qt(!0)}})(),()=>{e=!1}},[M.objectName,V]);let $=o(),fr=R.useMemo(()=>{let e=Array.isArray(M.columns)?M.columns.map(e=>j(e)).filter(e=>typeof e==`string`&&e.length>0):[],t=new Set(e),n=e=>{if(!e)return;let n=[e.groupByField,e.groupField,e.groupBy,e.summarizeField,e.titleField,e.cardTitle,e.startDateField,e.endDateField,e.dateField,e.endField,e.colorField,e.allDayField,e.coverField,e.imageField,e.swimlaneField,e.valueField,e.locationField,e.latitudeField,e.longitudeField,...Array.isArray(e.columns)?e.columns:[],...Array.isArray(e.cardFields)?e.cardFields:[],...Array.isArray(e.visibleFields)?e.visibleFields:[]];for(let e of n)typeof e==`string`&&e&&t.add(e)};n(M.kanban),n(M.options?.kanban),n(M.calendar),n(M.options?.calendar),n(M.gallery),n(M.options?.gallery),n(M.timeline),n(M.options?.timeline),n(M.gantt),n(M.options?.gantt),n(Pt(M));for(let e of ue(q))t.add(e);let r=t.size>0?Array.from(t):void 0,i=oe(K?.fields,r);return!$?.isLoaded||!M.objectName?i:i.filter(e=>$.checkField(M.objectName,e,`read`))},[K?.fields,q,M.columns,M.kanban,M.calendar,M.gallery,M.timeline,M.gantt,M.map,M.options,$,M.objectName]),pr=F===`gantt`&&!!M.data&&typeof M.data==`object`&&!Array.isArray(M.data)&&M.data.provider===`api`,mr=F===`grid`&&(q?.fields?.length??0)>0&&!Array.isArray(M.data)&&M.data?.provider!==`value`&&!!M.objectName&&typeof V?.queryGroupHeaders==`function`,hr=F===`grid`&&ue(q).length>0&&!Array.isArray(M.data)&&M.data?.provider!==`value`&&!!M.objectName&&!!V&&typeof V.queryGroupHeaders!=`function`,gr=F!==`gantt`&&!mr&&!hr,_r=!Array.isArray(M.data)&&M.data?.provider!==`value`&&!pr,vr=ye(_r&&M.objectName||void 0),yr=M.conditionalFormatting,br=M.rowActionDefs,xr=M.bulkActionDefs,Sr=R.useMemo(()=>JSON.stringify(k(ge({conditionalFormatting:yr,rowActionDefs:br,bulkActionDefs:xr}))),[yr,br,xr]);R.useEffect(()=>{let e=!0,t=++Dn.current;if(M.data&&typeof M.data==`object`&&!Array.isArray(M.data)){let e=M.data;if(e.provider===`value`&&Array.isArray(e.items)){let t=e.items;if(L){let e=L.toLowerCase();t=t.filter(t=>Object.values(t).some(t=>t!=null&&String(t).toLowerCase().includes(e)))}jt(t),G(!1),nn(!1);return}}if(Array.isArray(M.data)){let e=M.data;if(L){let t=L.toLowerCase();e=e.filter(e=>Object.values(e).some(e=>e!=null&&String(e).toLowerCase().includes(t)))}jt(e),G(!1),nn(!1);return}if(pr){G(!1),nn(!1);return}if(hr){jt([]),G(!1),nn(!1);return}return Ut?((async()=>{if(!V||!M.objectName){G(!1);return}G(!0),Nt(null);let n=null;try{let r=Wt(N,An,jn),i=B.length>0?B.filter(e=>e.field).map(e=>({field:e.field,order:e.order})):void 0,a=(()=>{let e=Array.isArray(M.columns)?M.columns.map(e=>j(e)).filter(e=>typeof e==`string`&&e.length>0):[];if(e.length===0)return;let t=$?.isLoaded&&M.objectName?e.filter(e=>$.checkField(M.objectName,e,`read`)):e,n=new Set([`id`]);for(let e of t)n.add(e);for(let e of fr)n.add(e);let r=(()=>{let e=K?.fields;if(!e)return null;let t=Array.isArray(e)?e.map(e=>e?.name).filter(e=>typeof e==`string`):Object.keys(e),n=new Set(t);return n.add(`id`),n.add(`created_at`),n.add(`updated_at`),n})(),i=e=>{typeof e==`string`&&e&&(!r||r.has(e))&&($?.isLoaded&&M.objectName&&r?.has(e)&&!je.has(e)&&!$.checkField(M.objectName,e,`read`)||n.add(e))},a=e=>{je.has(e)?n.add(e):i(e)},o=e=>{if(!e)return;let t=[e.groupByField,e.groupField,e.groupBy,e.summarizeField,e.titleField,e.cardTitle,e.startDateField,e.endDateField,e.dateField,e.endField,e.colorField,e.allDayField,e.coverField,e.imageField,e.swimlaneField,e.valueField,e.locationField,e.latitudeField,e.longitudeField,e.descriptionField,...Array.isArray(e.columns)?e.columns:[],...Array.isArray(e.cardFields)?e.cardFields:[],...Array.isArray(e.visibleFields)?e.visibleFields:[]];for(let e of t)i(e)};o(M.kanban),o(M.options?.kanban),o(M.calendar),o(M.options?.calendar),o(M.gallery),o(M.options?.gallery),o(M.timeline),o(M.options?.timeline),(M.timeline??M.options?.timeline)&&(i(`status`),i(`priority`)),o(M.gantt),o(M.options?.gantt),o(Pt(M));for(let e of ue(q))i(e);for(let e of k(ge({conditionalFormatting:M.conditionalFormatting,rowActionDefs:M.rowActionDefs,bulkActionDefs:M.bulkActionDefs,objectActions:K?.actions,userActions:K?.userActions})))a(e);return Array.from(n)})(),o=r!==void 0,s=yn,c={...o?{$filter:r}:{},$orderby:i,$top:J,...s>0?{$skip:s}:{},...a?{$select:a}:{},...fr.length>0?{$expand:fr}:{},...L?{$search:L,...M.searchableFields&&M.searchableFields.length>0?{$searchFields:M.searchableFields}:{}}:{}},l=await V.find(M.objectName,c);if(!e||t!==Dn.current)return;let u=[];Array.isArray(l)?u=l:l&&typeof l==`object`&&(Array.isArray(l.data)?u=l.data:Array.isArray(l.records)?u=l.records:Array.isArray(l.value)&&(u=l.value)),jt(u);let d=l&&typeof l==`object`?l.total:void 0,f=typeof d==`number`?d:null;if(un(f),s>0&&u.length===0&&f!==null){let e=Math.max(1,Math.ceil(f/J));e<Math.floor(s/J)+1&&(n=e,cn(e))}fn(c),nn(u.length>=J)}catch(e){t===Dn.current&&(console.error(`ListView data fetch error:`,e),jt([]),Nt(e?.message?String(e.message):String(e??`Unknown error`)),It(Me(e)))}finally{e&&t===Dn.current&&n===null&&G(!1)}})(),()=>{e=!1}):void 0},[M.objectName,M.data,V,N,J,B,An,jn,Xt,L,M.searchableFields,M.columns,M.kanban,M.calendar,M.gallery,M.timeline,M.gantt,M.map,M.options,K?.fields,Ut,M.refreshTrigger,$,yn,q,Sr,pr,vr,hr]);let Cr=JSON.stringify([M.objectName,N,J,B,An,jn,L,F,q]),wr=R.useRef(Cr);R.useEffect(()=>{wr.current!==Cr&&(wr.current=Cr,cn(1))},[Cr]);let Tr=R.useMemo(()=>{let e=[`grid`];(M.kanban?.groupByField||M.kanban?.groupField||M.options?.kanban?.groupByField||M.options?.kanban?.groupField)&&e.push(`kanban`),(M.gallery?.coverField||M.gallery?.imageField||M.options?.gallery?.imageField)&&e.push(`gallery`),(M.calendar?.startDateField||M.options?.calendar?.startDateField)&&e.push(`calendar`),Ht(M).startDateField&&e.push(`timeline`),(M.gantt?.startDateField||M.options?.gantt?.startDateField)&&e.push(`gantt`);let t=Pt(M);(t.locationField||t.latitudeField&&t.longitudeField)&&e.push(`map`),(M.tree?.parentField||M.options?.tree?.parentField||M.viewType===`tree`)&&e.push(`tree`),Ft(M).resolves&&e.push(`chart`),M.viewType&&!e.includes(M.viewType)&&me(M.viewType)&&e.push(M.viewType);let n=M.appearance?.allowedVisualizations;if(Array.isArray(n)&&n.length>0){let t=n.filter(t=>e.includes(t));return t.length>0?t:[`grid`]}return e},[M.options,M.viewType,M.kanban,M.calendar,M.gantt,M.gallery,M.timeline,M.map,M.tree,M.chart,M.appearance?.allowedVisualizations]),Er=de&&Tr.length>1;R.useEffect(()=>{M.viewType&&Ue(M.viewType)},[M.viewType]);let Dr=R.useCallback(e=>{Ue(e);try{localStorage.setItem(dr,e)}catch(e){console.warn(`Failed to save view preference to localStorage:`,e)}n?.(e)},[dr,n]),Or=R.useCallback(e=>{Ye(e),s?.(e)},[s]),kr=De({navigation:M.navigation,objectName:M.objectName,onNavigate:M.onNavigate,onRowClick:g}),Ar=i(M.label,Fe),jr=Ar?A(`detail.recordDetailWithLabel`,{label:Ar}):M.objectName?A(`detail.recordDetailWithLabel`,{label:M.objectName.charAt(0).toUpperCase()+M.objectName.slice(1)}):A(`detail.recordDetail`),Mr=R.useMemo(()=>{let e=Array.isArray(M.columns)?M.columns:[];if($?.isLoaded&&M.objectName&&(e=e.filter(e=>{let t=j(e);return!t||$.checkField(M.objectName,t,`read`)})),Y.size>0&&(e=e.filter(e=>{let t=j(e);return t!=null&&!Y.has(t)})),M.fieldOrder&&M.fieldOrder.length>0){let t=new Map(M.fieldOrder.map((e,t)=>[e,t]));e=[...e].sort((e,n)=>(t.get(j(e))??1/0)-(t.get(j(n))??1/0))}return e},[M.columns,M.objectName,Y,M.fieldOrder,$]),Nr=R.useMemo(()=>Array.isArray(M.columns)&&M.columns.length>0,[M.columns]),Pr=R.useRef(null),Fr=N;if(F===`gantt`||F===`tree`||F===`chart`||mr)try{let e=Wt(N,An,jn),t=JSON.stringify(e??null),n=Pr.current;n&&n.key===t?Fr=n.value:(Pr.current={key:t,value:e},Fr=e)}catch(e){if(!(e instanceof ne))throw e;Fr=Pr.current?Pr.current.value:N}let Ir=F===`gantt`?L:``,Lr=R.useMemo(()=>{let e=Q.mode===`compact`?`compact`:Q.mode===`spacious`?`tall`:`medium`,t={objectName:M.objectName,fields:Mr,filter:N,sort:B,className:`h-full w-full`,showSearch:!1,onRowClick:kr.handleClick,rowHeight:e,hideRowHeightToggle:!0,...h?{onColumnStateChange:h}:{},...M.columnState?{columnState:M.columnState}:{}};switch(F){default:case`grid`:return{type:`object-grid`,...t,...Nr?{columns:Mr}:{fields:void 0,columns:void 0},...M.conditionalFormatting?{conditionalFormatting:M.conditionalFormatting}:{},editable:Rn&&er,...M.wrapHeaders==null?{}:{wrapHeaders:M.wrapHeaders},...M.resizable==null?{}:{resizable:M.resizable},...M.selection?{selection:M.selection}:{},...M.pagination?{pagination:M.pagination}:{},...q?{grouping:q}:{},...mr?{filter:Fr,...M.searchableFields&&M.searchableFields.length>0?{searchableFields:M.searchableFields}:{}}:{},...xn?{rowColor:xn}:{},...M.rowActions?{rowActions:M.rowActions}:{},...M.rowActionDefs?{rowActionDefs:M.rowActionDefs}:{},...M.bulkActions?{batchActions:M.bulkActions}:{},...M.bulkActionDefs?{bulkActionDefs:M.bulkActionDefs}:{},...M.options?.grid||{}};case`kanban`:{let{columns:e,groupByField:n,groupField:r,cardFields:i,titleField:a,groupBy:o,...s}={...M.options?.kanban||{},...M.kanban||{}},c=n||r||Te(K)||void 0;return{type:`object-kanban`,...t,groupBy:c,...a?{titleField:a}:{},cardFields:i||e||Mr||[],...q?{grouping:q}:{},...s}}case`calendar`:{let e=M.calendar?.startDateField||M.options?.calendar?.startDateField,n=M.calendar?.endDateField||M.options?.calendar?.endDateField,r=M.calendar?.titleField||M.options?.calendar?.titleField,{dateField:i,endField:a,...o}={...M.options?.calendar||{},...M.calendar||{}};return{type:`object-calendar`,...t,...e?{startDateField:e}:{},...n?{endDateField:n}:{},...r?{titleField:r}:{},...M.calendar?.defaultView?{defaultView:M.calendar.defaultView}:{},...o}}case`gallery`:{let e={...M.options?.gallery||{},...M.gallery||{},cardSize:ir};return{type:`object-gallery`,...t,gallery:Object.keys(e).length>0?e:void 0,imageField:M.gallery?.coverField||M.gallery?.imageField||M.options?.gallery?.imageField,titleField:M.gallery?.titleField||M.options?.gallery?.titleField||`name`,...q?{grouping:q}:{}}}case`timeline`:{let e={...M.options?.timeline||{},...M.timeline||{}},n=Ht(M),r={...e,...n.startDateField?{startDateField:n.startDateField}:{},...n.endDateField?{endDateField:n.endDateField}:{}};return{type:`object-timeline`,...t,timeline:Object.keys(r).length>0?r:void 0,...n.startDateField?{startDateField:n.startDateField}:{},titleField:n.titleField||`name`,...n.endDateField?{endDateField:n.endDateField}:{},...M.timeline?.groupByField?{groupByField:M.timeline.groupByField}:{},...M.timeline?.colorField?{colorField:M.timeline.colorField}:{},...M.timeline?.scale?{scale:M.timeline.scale}:{}}}case`gantt`:{let e=M.gantt?.startDateField||M.options?.gantt?.startDateField,n=M.gantt?.endDateField||M.options?.gantt?.endDateField;return{type:`object-gantt`,...t,filter:Fr,...Ir?{search:Ir,...M.searchableFields&&M.searchableFields.length>0?{searchableFields:M.searchableFields}:{}}:{},...M.navigation?{navigation:M.navigation}:{},...M.data?{data:M.data}:{},...e?{startDateField:e}:{},...n?{endDateField:n}:{},...M.gantt?.titleField?{titleField:M.gantt.titleField}:{},...M.options?.gantt||{},...M.gantt||{}}}case`map`:{let e=Pt(M);return{type:`object-map`,...t,...e}}case`tree`:{let e=M.tree||M.options?.tree||{};return{type:`object-tree`,...t,filter:Fr,parentField:e.parentField,labelField:e.labelField||e.titleField||`name`,fields:e.fields||Mr,defaultExpandedDepth:e.defaultExpandedDepth,...e}}case`chart`:{let e=Ft(M),t=e.config;if(e.shape===`dataset`){let n=e.dimensions,r=e.values;return{type:`object-chart`,dataset:e.dataset,dimensions:n,values:r,chartType:t.chartType||`bar`,xAxisKey:n[0],series:r.map(e=>({dataKey:e,label:e})),className:`h-[400px] w-full`}}let n=e.valueField||`value`,r=e.categoryField||`name`;return{type:`object-chart`,objectName:M.objectName,chartType:t.chartType||`bar`,filter:Fr,aggregate:{field:n,function:t.aggregation||`count`,groupBy:r},xAxisKey:r,series:[{dataKey:n,label:n}],className:`h-[400px] w-full`}}}},[F,M,N,B,Mr,Nr,q,xn,kr.handleClick,Q.mode,ir,Rn,er,K,Fr,Ir,mr]),Rr=Ot.conditions&&Ot.conditions.length>0,zr=R.useMemo(()=>{let e,t=(e,t)=>{if(!t)return;let n=Array.isArray(t)?t.map(e=>({value:e?.value??e,label:e?.label??String(e?.value??e),...e&&typeof e==`object`?e:{}})):Object.entries(t).map(([e,t])=>({value:e,label:t?.label||e,...t}));return M.objectName?Ne(M.objectName,e,n):n};return e=K?.fields?Object.entries(K.fields).map(([e,n])=>({value:e,label:P(e,n.label||e),type:n.type||`text`,options:t(e,n.options),referenceTo:n.reference,displayField:n.displayField})):(Array.isArray(M.columns)?M.columns:[]).flatMap(e=>{if(typeof e==`string`)return[{value:e,label:e,type:`text`}];let t=j(e);return t?[{value:t,label:P(t,e.label||t),type:e.type||`text`}]:[]}),e},[K,M.columns,M.objectName,P,Ne]),Br=R.useMemo(()=>{if(!M.filterableFields||M.filterableFields.length===0)return zr;let e=new Set(M.filterableFields);return zr.filter(t=>e.has(t.value))},[zr,M.filterableFields]),Vr=R.useMemo(()=>Ie(K),[K]),{sortFields:Hr,sortHasRelationalField:Ur}=R.useMemo(()=>{let e=new Set(B.map(e=>e.field).filter(Boolean)),t=!1,n=[];for(let r of zr){let i=pe.has(r.type),a=Vr?Pe(Vr,r.value):!Se.has(r.type);if(!i&&a){n.push({value:r.value,label:r.label});continue}if(e.has(r.value)){n.push({value:r.value,label:i?`${r.label} ${A(`list.sortByIdSuffix`)}`:r.label});continue}i&&(t=!0)}return{sortFields:n,sortHasRelationalField:t}},[zr,B,A,Vr]),Wr=R.useCallback(e=>{a&&a(Vr?be(e,Vr):e)},[a,Vr]),Gr=R.useCallback(e=>{let t=e.map(e=>({id:crypto.randomUUID(),field:e.field,order:e.order}));bt(t),cn(1),Wr(t)},[Wr]),Kr=R.useCallback(()=>{let e=zt(M.sort);bt(e),cn(1),Wr(e)},[xt,Wr]),qr=R.useCallback(e=>{if(!Yn)return;let t=Z,n=t?.maxRecords||0,r=t?.includeHeaders!==!1,a=K?.label&&K?.name&&typeof Oe==`function`?Oe(K):K?.label,o=e=>ke(e,{prefix:t?.fileNamePrefix,label:a,objectName:M.objectName,viewLabel:i(M.label,Fe)});if((e===`csv`||e===`xlsx`||e===`json`)&&typeof V?.exportDownload==`function`&&M.objectName&&t?.streaming!==!1){let t=Mr.map(e=>j(e)).filter(Boolean),i=B.length>0?B.filter(e=>e.field).map(e=>({field:e.field,direction:e.order})):void 0;Kn(null),Wn(!0),(async()=>{try{let a=Wt(N,An,jn),s=await V.exportDownload(M.objectName,{format:e,fields:t.length?t:void 0,filter:a,...L?{search:L,...M.searchableFields&&M.searchableFields.length>0?{searchFields:M.searchableFields}:{}}:{},sort:i,includeHeaders:r,limit:n>0?n:void 0}),c=URL.createObjectURL(s),l=document.createElement(`a`);l.href=c,l.download=o(e),l.rel=`noopener`,document.body.appendChild(l),l.click(),l.remove(),URL.revokeObjectURL(c),Hn(!1)}catch(e){console.error(`ListView export failed:`,e),Kn(e instanceof Error?e.message:String(e))}finally{Wn(!1)}})();return}let s=n>0?H.slice(0,n):H;if(e===`csv`){let e=Mr.map(e=>j(e)).filter(Boolean),t=[];r&&t.push(e.join(`,`)),s.forEach(n=>{t.push(e.map(e=>{let t=n[e],r;return r=t==null?``:Array.isArray(t)?t.map(e=>typeof e==`object`&&e?JSON.stringify(e):String(e??``)).join(`; `):typeof t==`object`?JSON.stringify(t):String(t),r.includes(`,`)||r.includes(`"`)||r.includes(`
2
- `)||r.includes(`\r`)?`"${r.replace(/"/g,`""`)}"`:r}).join(`,`))});let n=new Blob([t.join(`
3
- `)],{type:`text/csv;charset=utf-8;`}),i=URL.createObjectURL(n),a=document.createElement(`a`);a.href=i,a.download=o(`csv`),a.click(),URL.revokeObjectURL(i)}else if(e===`json`){let e=new Blob([JSON.stringify(s,null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=o(`json`),n.click(),URL.revokeObjectURL(t)}Hn(!1)},[H,Mr,Z,M.objectName,N,M.searchableFields,Yn,V,An,jn,B,L,K,Oe]),Jr=R.useMemo(()=>(Array.isArray(M.columns)?M.columns:[]).flatMap(e=>{if(typeof e==`string`)return[{name:e,label:P(e,e)}];let t=j(e);return t?[{name:t,label:P(t,e.label||t)}]:[]}),[M.columns,P]),Yr=Ce(M.aria,Fe),Xr=Re(M.description,Fe);return(0,z.jsxs)(`div`,{ref:cr,className:T(`flex flex-col h-full bg-background relative min-w-0 overflow-hidden`,t),...Yr,role:Yr.role??`region`,...M.aria?.live?{"aria-live":M.aria.live}:{},"aria-busy":W||void 0,"data-state":W?`loading`:`idle`,children:[ur>0&&(0,z.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:ur},children:A(lr?`list.refreshing`:`list.pullToRefresh`)}),Xr&&M.appearance?.showDescription!==!1&&(0,z.jsx)(`div`,{className:`px-4 pt-1.5 text-xs text-muted-foreground bg-background`,"data-testid":`view-description`,children:Xr}),(0,z.jsxs)(`div`,{className:`border-b px-2 sm:px-4 py-1.5 flex items-center justify-between gap-1 sm:gap-2 bg-background`,children:[(0,z.jsx)(`div`,{className:`flex items-center gap-2 overflow-x-auto min-w-0`,children:Mn&&I.showUserFilters&&(0,z.jsx)(`div`,{className:`shrink-0 min-w-0 overflow-x-auto`,"data-testid":`user-filters`,children:(0,z.jsx)(At,{config:Mn,objectDef:K,data:H,onFilterChange:kn,maxVisible:3,initialSelections:x,onSelectionsChange:w})})}),(0,z.jsxs)(`div`,{className:`flex items-center gap-0 shrink-0 rounded-lg border border-border bg-muted/40 p-0.5 shadow-sm`,"data-print-hide":!0,children:[Er&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Ct,{currentView:F,availableViews:Tr,onViewChange:Dr}),(0,z.jsx)(`div`,{className:`h-4 w-px bg-border/60 mx-0.5`})]}),F===`grid`&&u&&!I.compactToolbar&&er&&(0,z.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:()=>Bn(!Rn),className:T(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,Rn&&`text-primary`),title:A(`list.inlineEditLabel`,{defaultValue:`Edit records inline (click a cell to edit)`}),"data-testid":`toolbar-inline-edit-toggle`,children:[(0,z.jsx)(rt,{className:`h-3.5 w-3.5 mr-1.5`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:A(`list.inlineEditShort`,{defaultValue:`Edit inline`})})]}),I.showHideFields&&!I.compactToolbar&&(0,z.jsxs)(l,{open:In,onOpenChange:Ln,children:[(0,z.jsx)(C,{asChild:!0,children:(0,z.jsxs)(E,{variant:`ghost`,size:`sm`,className:T(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,Y.size>0&&`text-primary`),children:[(0,z.jsx)(Je,{className:`h-3.5 w-3.5 mr-1.5`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:A(`list.hideFields`)}),Y.size>0&&(0,z.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:Y.size})]})}),(0,z.jsx)(f,{align:`start`,className:`w-64 p-3`,children:(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,z.jsx)(`h4`,{className:`font-medium text-sm`,children:A(`list.hideFieldsTitle`)}),Y.size>0&&(0,z.jsx)(E,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>Fn(new Set),children:A(`list.showAll`)})]}),(0,z.jsx)(`div`,{className:`max-h-60 overflow-y-auto space-y-1`,children:Jr.map(e=>(0,z.jsxs)(`label`,{className:`flex items-center gap-2 text-sm py-1 px-1 rounded hover:bg-muted cursor-pointer`,children:[(0,z.jsx)(`input`,{type:`checkbox`,checked:!Y.has(e.name),onChange:()=>{let t=new Set(Y);t.has(e.name)?t.delete(e.name):t.add(e.name),Fn(t)},className:`rounded border-input`}),(0,z.jsx)(`span`,{className:`truncate`,children:e.label})]},e.name))})]})})]}),I.showHideFields&&!I.compactToolbar&&(I.showFilters||I.showSort||I.showGroup)&&(0,z.jsx)(`div`,{className:`hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0`}),I.showFilters&&(0,z.jsxs)(l,{open:Et,onOpenChange:Dt,children:[(0,z.jsx)(C,{asChild:!0,children:(0,z.jsxs)(E,{variant:`ghost`,size:`sm`,className:T(`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,Rr&&`text-foreground font-medium`),children:[(0,z.jsx)(mt,{className:`h-3.5 w-3.5 mr-1.5`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:A(`list.filter`)}),Rr&&(0,z.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:Ot.conditions?.length||0})]})}),(0,z.jsx)(f,{align:`start`,className:`w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4`,children:(0,z.jsxs)(`div`,{className:`space-y-4`,children:[(0,z.jsx)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:(0,z.jsx)(`h4`,{className:`font-medium text-sm`,children:A(`list.filterRecords`)})}),(0,z.jsx)(m,{fields:Br,value:Ot,extraOperators:Lt,onChange:e=>{kt(e),r&&r(e)}})]})})]}),I.showGroup&&!I.compactToolbar&&(0,z.jsxs)(l,{open:hn,onOpenChange:gn,children:[(0,z.jsx)(C,{asChild:!0,children:(0,z.jsxs)(E,{variant:`ghost`,size:`sm`,className:T(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,q&&`text-foreground font-medium`),children:[(0,z.jsx)(Xe,{className:`h-3.5 w-3.5 mr-1.5`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:A(`list.group`)}),q&&q.fields?.length>0&&(0,z.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:q.fields.length})]})}),(0,z.jsx)(f,{align:`start`,className:`w-72 p-3`,children:(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,z.jsx)(`h4`,{className:`font-medium text-sm`,children:A(`list.groupBy`)}),q&&(0,z.jsx)(E,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>mn(void 0),"data-testid":`clear-grouping`,children:A(`list.clear`)})]}),(0,z.jsx)(`div`,{"data-testid":`group-field-list`,children:(0,z.jsx)(v,{value:q,fieldOptions:Jr.map(e=>({value:e.name,label:e.label||e.name})),maxLevels:3,labels:{addGroup:A(`list.addGroup`,{defaultValue:`Add group field`}),collapseTitle:A(`list.collapsedByDefault`,{defaultValue:`Collapsed by default`}),removeTitle:A(`list.removeGroup`,{defaultValue:`Remove`})},onChange:e=>mn(e)})})]})})]}),I.showSort&&(0,z.jsxs)(l,{open:tt,onOpenChange:dt,children:[(0,z.jsx)(C,{asChild:!0,children:(0,z.jsxs)(E,{variant:`ghost`,size:`sm`,className:T(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,B.length>0&&`text-foreground font-medium`),children:[(0,z.jsx)(He,{className:`h-3.5 w-3.5 mr-1.5`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:A(`list.sort`)}),B.length>0&&(0,z.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:B.length})]})}),(0,z.jsx)(f,{align:`start`,className:`w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4`,children:(0,z.jsxs)(`div`,{className:`space-y-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,z.jsx)(`h4`,{className:`font-medium text-sm`,children:A(`list.sortRecords`)}),St.length>0&&(0,z.jsx)(E,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-muted-foreground hover:text-primary`,disabled:!wt,onClick:Kr,"data-testid":`sort-reset-default`,children:A(`list.resetSortToDefault`)})]}),(0,z.jsx)(p,{fields:Hr,value:B,onChange:e=>{bt(e),Wr(e)}}),Ur&&(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`sort-relational-hint`,children:A(`list.sortRelationalHint`)})]})})]}),!I.compactToolbar&&(I.showFilters||I.showSort||I.showGroup)&&(I.showColor||I.showDensity)&&(0,z.jsx)(`div`,{className:`hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0`}),I.showColor&&!I.compactToolbar&&(0,z.jsxs)(l,{open:Cn,onOpenChange:wn,children:[(0,z.jsx)(C,{asChild:!0,children:(0,z.jsxs)(E,{variant:`ghost`,size:`sm`,className:T(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,xn&&`text-foreground font-medium`),children:[(0,z.jsx)(nt,{className:`h-3.5 w-3.5 mr-1.5`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:A(`list.color`)})]})}),(0,z.jsx)(f,{align:`start`,className:`w-64 p-3`,children:(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,z.jsx)(`h4`,{className:`font-medium text-sm`,children:A(`list.rowColor`)}),xn&&(0,z.jsx)(E,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>Sn(void 0),"data-testid":`clear-row-color`,children:A(`list.clear`)})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,"data-testid":`color-field-list`,children:[(0,z.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:A(`list.colorByField`)}),(0,z.jsxs)(`select`,{className:`w-full h-8 rounded border border-input bg-background px-2 text-xs`,value:xn?.field||``,onChange:e=>{let t=e.target.value;Sn(t?{field:t,colors:xn?.colors||{}}:void 0)},"data-testid":`color-field-select`,children:[(0,z.jsx)(`option`,{value:``,children:A(`list.none`)}),Jr.map(e=>(0,z.jsx)(`option`,{value:e.name,children:e.label},e.name))]})]})]})})]}),I.showDensity&&!I.compactToolbar&&F!==`gallery`&&(()=>{let e=Q.mode===`compact`?lt:Q.mode===`comfortable`?ct:st,t=Q.mode===`compact`?A(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):Q.mode===`comfortable`?A(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):A(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`}),n=`${A(`grid.toolbar.densityMode`,{defaultValue:`Density`})}: ${t}`,r=A(`grid.toolbar.densityCycleHint`,{defaultValue:`{{label}} (click to cycle)`,label:n});return(0,z.jsx)(E,{variant:`ghost`,size:`sm`,"aria-label":n,className:T(`hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150`,Q.mode!==`compact`&&`text-foreground font-medium`),onClick:Q.cycle,title:r,children:(0,z.jsx)(e,{className:`h-3.5 w-3.5`})})})(),I.showDensity&&!I.compactToolbar&&F===`gallery`&&(()=>{let e=ir===`small`?lt:ir===`medium`?ct:st,t=ir===`small`?A(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):ir===`medium`?A(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):A(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`}),n=`${A(`grid.toolbar.densityMode`,{defaultValue:`Density`})}: ${t}`,r=A(`grid.toolbar.densityCycleHint`,{defaultValue:`{{label}} (click to cycle)`,label:n});return(0,z.jsx)(E,{variant:`ghost`,size:`sm`,"aria-label":n,className:T(`hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150`,ir!==`small`&&`text-foreground font-medium`),onClick:or,title:r,children:(0,z.jsx)(e,{className:`h-3.5 w-3.5`})})})(),I.compactToolbar&&(I.showGroup||I.showColor||I.showDensity||I.showHideFields)&&(0,z.jsx)(Tt,{t:A,allFields:Jr,showGroup:I.showGroup,groupingConfig:q,setGroupingConfig:mn,showColor:I.showColor,rowColorConfig:xn,setRowColorConfig:Sn,showDensity:I.showDensity,density:Q,showHideFields:I.showHideFields,hiddenFields:Y,updateHiddenFields:Fn,showInlineEdit:F===`grid`&&er,inlineEdit:Rn,setInlineEdit:Bn}),(I.showColor||I.showDensity||I.compactToolbar)&&Z&&Yn&&tr.length>0&&(0,z.jsx)(`div`,{className:`h-5 w-px bg-border/50 mx-1 shrink-0`}),I.showRefresh&&(0,z.jsx)(E,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150`,onClick:()=>Qt(e=>e+1),disabled:W,title:A(`list.refresh`),"aria-label":A(`list.refresh`),"data-testid":`refresh-button`,children:(0,z.jsx)(ot,{className:T(`h-3.5 w-3.5`,W&&`animate-spin`)})}),Z&&Yn&&tr.length>0&&(0,z.jsxs)(l,{open:Vn,onOpenChange:Hn,children:[(0,z.jsx)(C,{asChild:!0,children:(0,z.jsxs)(E,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,children:[(0,z.jsx)(qe,{className:`h-3.5 w-3.5 mr-1.5`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:A(`list.export`)})]})}),(0,z.jsx)(f,{align:`start`,className:`w-48 p-2`,children:(0,z.jsxs)(`div`,{className:`space-y-1`,children:[tr.map(e=>(0,z.jsxs)(E,{variant:`ghost`,size:`sm`,className:`w-full justify-start h-8 text-xs`,disabled:Un,onClick:()=>qr(e),children:[Un?(0,z.jsx)(et,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,z.jsx)(qe,{className:`h-3.5 w-3.5 mr-2`}),A(`list.exportAs`,{format:e.toUpperCase()})]},e)),Gn&&(0,z.jsx)(`div`,{className:`px-2 py-1 text-xs`,style:{color:`var(--destructive, #ef4444)`},role:`alert`,children:Gn})]})})]}),M.sharing?.type&&(0,z.jsxs)(E,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,title:`Sharing: ${M.sharing.type}`,"data-testid":`share-button`,children:[(0,z.jsx)(ft,{className:`h-3.5 w-3.5 mr-1.5`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:A(`list.share`)})]}),M.allowPrinting&&(()=>{let e=A(`common.printDialogHint`);return(0,z.jsxs)(E,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,onClick:()=>window.print(),"aria-label":`${A(`list.print`)}: ${e}`,title:e,"data-testid":`print-button`,children:[(0,z.jsx)(at,{className:`h-3.5 w-3.5 mr-1.5`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:A(`list.print`)})]})})(),(()=>{let e=M.allowPrinting||!!M.sharing?.type||Z&&Yn&&tr.length>0;return I.showSearch&&e?(0,z.jsx)(`div`,{className:`h-5 w-px bg-border/50 mx-1 shrink-0`}):null})(),I.showSearch&&(0,z.jsxs)(l,{open:Qe,onOpenChange:$e,children:[(0,z.jsx)(C,{asChild:!0,children:(0,z.jsxs)(E,{variant:`ghost`,size:`sm`,className:T(`hidden sm:inline-flex h-7 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,L?`px-2 text-foreground font-medium`:`w-7 p-0`),"data-testid":`search-icon-button`,title:L?`${A(`list.search`)}: ${L}`:A(`list.search`),children:[(0,z.jsx)(ut,{className:`h-3.5 w-3.5`}),L&&(0,z.jsx)(`span`,{className:`ml-1.5 max-w-[8rem] truncate text-[11px]`,"data-testid":`search-active-keyword`,children:L})]})}),(0,z.jsx)(f,{align:`end`,className:`w-[calc(100vw-2rem)] sm:w-64 p-2`,"data-testid":`search-popover`,children:(0,z.jsxs)(`div`,{className:`relative`,children:[(0,z.jsx)(ut,{className:`absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,z.jsx)(d,{placeholder:A(`table.search`),value:L,onChange:e=>Or(e.target.value),className:`pl-7 h-8 text-xs`,autoFocus:!0}),L&&(0,z.jsx)(E,{variant:`ghost`,size:`sm`,className:`absolute right-0.5 top-1/2 -translate-y-1/2 h-5 w-5 p-0 hover:bg-muted-foreground/20`,onClick:()=>Or(``),children:(0,z.jsx)(vt,{className:`h-3 w-3`})})]})})]}),I.showAddRecordTop&&(0,z.jsxs)(E,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,"data-testid":`add-record-button`,onClick:()=>D.onAddRecord?.(),children:[(0,z.jsx)(it,{className:`h-3.5 w-3.5 mr-1.5`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:A(`list.addRecord`)})]})]})]}),(0,z.jsxs)(`div`,{className:`flex-1 min-h-0 bg-background relative overflow-hidden animate-in fade-in-0 duration-200`,children:[(0,z.jsx)(b,{active:W&&H.length>0,ariaLabel:A(`list.refreshing`)}),hr?(0,z.jsx)(S,{role:`alert`,"data-testid":`list-grouping-needs-header-query`,className:`h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md`,icon:(0,z.jsx)(_t,{className:`h-12 w-12 text-destructive/60`}),iconWrapperClassName:`mb-3`,title:A(`list.loadErrorTitle`),message:A(`grid.grouping.needsHeaderQuery`)}):Mt&&H.length===0?(0,z.jsx)(S,{role:`alert`,"data-testid":`list-error-state`,"data-error-kind":U,className:`h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md`,icon:U===`network`?(0,z.jsx)(_t,{className:`h-12 w-12 text-destructive/60`}):(0,z.jsx)(pt,{className:`h-12 w-12 text-destructive/60`}),iconWrapperClassName:`mb-3`,title:A(U===`api-disabled`?`list.loadErrorApiDisabledTitle`:U===`forbidden`?`list.loadErrorForbiddenTitle`:U===`unauthorized`?`list.loadErrorUnauthorizedTitle`:U===`rejected`?`list.loadErrorRejectedTitle`:`list.loadErrorTitle`),message:A(U===`api-disabled`?`list.loadErrorApiDisabledMessage`:U===`forbidden`?`list.loadErrorForbiddenMessage`:U===`unauthorized`?`list.loadErrorUnauthorizedMessage`:U===`rejected`?`list.loadErrorRejectedMessage`:`list.loadErrorMessage`),children:U===`api-disabled`?null:(0,z.jsxs)(E,{variant:`outline`,size:`sm`,"data-testid":`list-error-retry`,onClick:()=>Qt(e=>e+1),children:[(0,z.jsx)(ot,{className:`h-4 w-4 mr-1.5`}),A(`list.retry`)]})}):W&&H.length===0?(0,z.jsxs)(`div`,{className:`flex flex-col h-full min-h-[200px] p-4 gap-2`,"data-testid":`list-loading`,role:`status`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,z.jsx)(`span`,{className:`sr-only`,children:A(`list.loading`)}),[0,1,2,3,4,5].map(e=>(0,z.jsx)(`div`,{className:`h-9 rounded bg-muted/60 animate-pulse`,style:{opacity:Math.max(.25,1-e*.12)}},e))]}):!W&&H.length===0&&F===`grid`?(()=>{let e=M.emptyState?.icon,t=ee(e)??Ze,n=Array.isArray(N)?N.length>0:N&&typeof N==`object`?Object.keys(N).length>0:!1,r=!!(L&&L.trim())||n||Array.isArray(jn)&&jn.length>0||Array.isArray(An?.conditions)&&An.conditions.length>0,i=(typeof M.emptyState?.title==`string`?M.emptyState.title:void 0)??A(r?`list.noMatches`:`list.firstRunTitle`),a=(typeof M.emptyState?.message==`string`?M.emptyState.message:void 0)??A(r?`list.noMatchesMessage`:`list.firstRunMessage`);return(0,z.jsx)(y,{"data-testid":`empty-state`,className:`h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md`,icon:(0,z.jsx)(t,{className:`h-12 w-12 text-muted-foreground/50`}),iconWrapperClassName:`mb-3`,title:i,description:a,action:I.showAddRecord?(0,z.jsxs)(E,{variant:`default`,size:`sm`,"data-testid":`empty-state-add-record`,onClick:()=>D.onAddRecord?.(),children:[(0,z.jsx)(it,{className:`h-4 w-4 mr-1.5`}),A(`list.addRecord`)]}):void 0})})():(0,z.jsx)(Ee,{schema:Lr,...D,...pr||mr?{}:{data:H},...mr?{search:L}:{},...Lr.type===`object-grid`&&K?.fields?{objectFields:K.fields}:{},loading:W,onRowSelect:En,...vn&&bn!=null?{manualPagination:!0,rowCount:bn,page:sn,pageSize:J,onPageChange:e=>cn(e),onPageSizeChange:e=>{an(e),cn(1)},sort:B,onSortChange:Gr,findParams:dn}:{}})]},F),I.showAddRecordBottom&&(0,z.jsx)(`div`,{className:`border-t px-2 sm:px-4 py-1 bg-background shrink-0`,children:(0,z.jsxs)(E,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,"data-testid":`add-record-button`,onClick:()=>D.onAddRecord?.(),children:[(0,z.jsx)(it,{className:`h-3.5 w-3.5 mr-1.5`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:A(`list.addRecord`)})]})}),Xn&&Xn.length>0&&Tn.length>0&&F!==`grid`&&(0,z.jsxs)(`div`,{className:`border-t border-primary/30 px-4 py-2 flex items-center gap-2 text-xs bg-primary/10 text-foreground shrink-0 shadow-sm`,role:`region`,"aria-label":`Bulk actions`,"data-testid":`bulk-actions-bar`,children:[(0,z.jsx)(ht,{className:`h-3.5 w-3.5 text-primary shrink-0`}),(0,z.jsxs)(`span`,{className:`font-medium`,children:[Tn.length,` `,Tn.length===1?`item`:`items`,` selected`]}),(0,z.jsx)(`div`,{className:`flex items-center gap-1.5 ml-3`,children:Xn.map(e=>{let t=String(e).toLowerCase(),n=t.includes(`delete`)||t.includes(`remove`)||t.includes(`destroy`),r=n?gt:null,i=t===`delete`?$n.eligible:Tn;return(0,z.jsxs)(E,{variant:n?`destructive`:`outline`,size:`sm`,className:`h-7 px-2.5 text-xs gap-1.5`,onClick:()=>D.onBulkAction?.(e,i),"data-testid":`bulk-action-${e}`,children:[r&&(0,z.jsx)(r,{className:`h-3 w-3`}),Ve(e)]},e)})}),$n.skipped>0&&Xn.some(e=>String(e).toLowerCase()===`delete`)&&(0,z.jsx)(`span`,{className:`text-muted-foreground ml-3`,"data-testid":`bulk-skipped-notice`,children:A(`grid.bulk.skippedIneligible`,{count:$n.skipped,defaultValue:`${$n.skipped} selected record(s) are not eligible for this action and will be skipped.`})}),(0,z.jsxs)(E,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs ml-auto gap-1`,onClick:()=>En([]),children:[(0,z.jsx)(vt,{className:`h-3 w-3`}),`Clear`]})]}),!W&&H.length>0&&gr&&M.showRecordCount!==!1&&(0,z.jsxs)(`div`,{className:`border-t px-4 py-2 flex items-center gap-3 text-xs text-muted-foreground bg-background shrink-0`,"data-testid":`record-count-bar`,children:[(0,z.jsx)(`span`,{className:`font-medium text-foreground/80`,children:(()=>{let e=bn??H.length;return A(e===1?`list.recordCountOne`:`list.recordCount`,{count:e})})()}),tn&&!(vn&&bn!=null)&&(0,z.jsx)(`span`,{className:`text-amber-600`,"data-testid":`data-limit-warning`,children:A(`list.dataLimitReached`,{limit:J})}),F!==`grid`&&M.pagination?.pageSizeOptions&&M.pagination.pageSizeOptions.length>0&&(0,z.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,z.jsx)(`span`,{children:A(`table.rowsPerPage`,{defaultValue:`Rows per page`})}),(0,z.jsx)(`select`,{"data-testid":`page-size-selector`,className:`h-7 w-[72px] px-2 py-1 text-xs rounded-md border border-input bg-background`,value:String(J),onChange:e=>{let t=Number(e.target.value);an(t),D.onPageSizeChange&&D.onPageSizeChange(t)},children:M.pagination.pageSizeOptions.map(e=>(0,z.jsx)(`option`,{value:String(e),children:e},e))})]})]}),kr.isOverlay&&(0,z.jsx)(te,{...kr,title:jr,children:e=>(0,z.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,z.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,z.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})});tn.displayName=`ListView`;var nn={columns:!0,filter:!0,sort:!0,limit:`pagination.pageSize`,viewType:!0},rn=A(R.forwardRef((e,t)=>{let n=(0,R.useContext)(de),r=(ve(e.dataSource)?void 0:e.dataSource)??n?.dataSource;return(0,z.jsx)(Ne,{schema:e.schema,mapping:nn,dataSource:r,testId:`list-view`,errorTitle:`This list view’s data source could not be resolved`,children:n=>(0,z.jsx)(tn,{ref:t,...e,schema:n,dataSource:r})})}));rn.displayName=`ListViewBlock`;var an={small:`grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6`,medium:`grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4`,large:`grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3`},on={small:`aspect-square`,medium:`aspect-[4/3]`,large:`aspect-[16/10]`},sn=new Set([`number`,`currency`,`percent`,`integer`,`decimal`]),cn=[{bg:`from-indigo-500/15 via-indigo-500/5 to-purple-500/10`,ring:`ring-indigo-500/15`,text:`text-indigo-600/70 dark:text-indigo-300/70`},{bg:`from-sky-500/15 via-sky-500/5 to-cyan-500/10`,ring:`ring-sky-500/15`,text:`text-sky-600/70 dark:text-sky-300/70`},{bg:`from-emerald-500/15 via-emerald-500/5 to-teal-500/10`,ring:`ring-emerald-500/15`,text:`text-emerald-600/70 dark:text-emerald-300/70`},{bg:`from-amber-500/15 via-amber-500/5 to-orange-500/10`,ring:`ring-amber-500/15`,text:`text-amber-600/70 dark:text-amber-300/70`},{bg:`from-rose-500/15 via-rose-500/5 to-pink-500/10`,ring:`ring-rose-500/15`,text:`text-rose-600/70 dark:text-rose-300/70`},{bg:`from-violet-500/15 via-violet-500/5 to-fuchsia-500/10`,ring:`ring-violet-500/15`,text:`text-violet-600/70 dark:text-violet-300/70`}];function ln(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return cn[Math.abs(t)%cn.length]}var un=({imageUrl:e,title:t,coverFit:n,aspectClass:r,placeholder:i,hidden:a})=>{let[o,s]=(0,R.useState)(!1),c=!!e&&!o;return(0,z.jsx)(`div`,{className:T(`w-full overflow-hidden relative`,r),hidden:a,children:c?n===`contain`?(0,z.jsx)(`div`,{className:T(`flex h-full w-full items-center justify-center bg-gradient-to-br`,i.bg),children:(0,z.jsx)(`img`,{src:e,alt:t,loading:`lazy`,onError:()=>s(!0),className:`h-1/2 w-1/2 max-h-24 max-w-24 object-contain transition-transform duration-300 ease-out group-hover:scale-[1.08]`})}):(0,z.jsx)(`img`,{src:e,alt:t,loading:`lazy`,onError:()=>s(!0),className:`h-full w-full object-cover transition-transform duration-300 ease-out group-hover:scale-[1.04]`}):(0,z.jsx)(`div`,{className:T(`flex h-full w-full items-center justify-center bg-gradient-to-br ring-1 ring-inset`,i.bg,i.ring),children:(0,z.jsx)(`span`,{className:T(`text-5xl font-semibold tracking-tight opacity-90`,i.text),children:t[0]?.toUpperCase()})})})},dn=({imageUrl:e,title:t,placeholder:n})=>{let[r,i]=(0,R.useState)(!1),a=!!e&&!r;return(0,z.jsx)(`div`,{className:T(`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br ring-1 ring-inset`,n.bg,n.ring),children:a?(0,z.jsx)(`img`,{src:e,alt:t,loading:`lazy`,onError:()=>i(!0),className:`h-6 w-6 object-contain transition-transform duration-300 ease-out group-hover:scale-110`}):(0,z.jsx)(`span`,{className:T(`text-base font-semibold`,n.text),children:t[0]?.toUpperCase()})})},fn=(e,t)=>{let n=e?.[t];if(!ie(n))return _(n)[0]?.url};_e.register(`object-gallery`,e=>{let{schema:t}=e,n=(0,R.useContext)(de),r=e.dataSource||n?.dataSource,i=ae(t.bind),[a,c]=(0,R.useState)([]),[l,u]=(0,R.useState)(!1),{ready:d,def:f}=M(t.objectName??``,r),p=o(),m=De({navigation:t.navigation,objectName:t.objectName,onRowClick:e.onRowClick??e.onCardClick}),h=t.gallery,_=h?.coverField??t.imageField??`image`,v=h?.coverFit??`cover`,y=h?.cardSize??`medium`,b=h?.titleField??t.titleField,S=h?.visibleFields,{fieldLabel:C,fieldOptionLabel:ee}=ze(),E=(0,R.useCallback)(e=>{let n=f?.fields?.[e],r={name:e};if(n){n.type&&(r.type=n.type),n.label&&(r.label=n.label),n.options&&(r.options=n.options),n.currency&&(r.currency=n.currency),n.precision!==void 0&&(r.precision=n.precision),n.scale!==void 0&&(r.scale=n.scale),n.useGrouping!==void 0&&(r.useGrouping=n.useGrouping),n.format&&(r.format=n.format);let e=n.reference;e&&(r.reference=e),n.reference_field&&(r.reference_field=n.reference_field)}if(t.objectName){let n=String(r.label??e);r.label=C(t.objectName,e,n)}return t.objectName&&Array.isArray(r.options)&&(r.options=r.options.map(n=>{let r=String(n?.value??n),i=String(n?.label??r);return{...n,value:r,label:ee(t.objectName,e,r,i)}})),r},[f,t.objectName,C,ee]),ne=!!t.objectName&&!i&&!t.data&&!e.data,re=ye(ne?t.objectName:void 0),D=Ae(),se=we(t.filter,D);(0,R.useEffect)(()=>{let n=!0;if(e.data&&Array.isArray(e.data)){c(e.data);return}let i=async()=>{if(r&&typeof r.find==`function`&&t.objectName){n&&u(!0);try{let e=oe(f?.fields),i=p?.isLoaded?e.filter(e=>p.checkField(t.objectName,e,`read`)):e,a=await r.find(t.objectName,{$filter:se,...i.length>0?{$expand:i}:{}}),o=[];if(Array.isArray(a))o=a;else if(a&&typeof a==`object`){let e=a;Array.isArray(e.records)?o=e.records:Array.isArray(e.data)&&(o=e.data)}n&&c(o)}catch(e){console.error(`[ObjectGallery] Fetch error:`,e)}finally{n&&u(!1)}}};if(ne){if(!d){n&&u(!0);return}i()}return()=>{n=!1}},[t.objectName,r,i,t.data,se,e.data,d,f,p,ne,re]);let O=e.data||i||t.data||a||[],ce=(0,R.useMemo)(()=>O.some(e=>!!fn(e,_)),[O,_]),k=t.grouping?.fields,ue=!!(k&&k.length>0),[fe,pe]=(0,R.useState)({}),me=(0,R.useMemo)(()=>k?k.some(e=>e.collapsed):!1,[k]),he=(0,R.useCallback)(e=>{pe(t=>({...t,[e]:t[e]===void 0?!me:!t[e]}))},[me]),A=(0,R.useMemo)(()=>{if(!ue||!k)return[];let e=new Map,t=[];for(let n of O){let r=k.map(e=>String(n[e.field]??``)).join(` / `);if(!e.has(r)){let i=k.map(e=>{let t=n[e.field];return t!=null&&t!==``?String(t):`(empty)`}).join(` / `);e.set(r,{label:i,items:[]}),t.push(r)}e.get(r).items.push(n)}let n=k[0]?.order??`asc`;return t.sort((e,t)=>{let r=e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`});return n===`desc`?-r:r}),t.map(t=>{let n=e.get(t),r=t in fe?fe[t]:me;return{key:t,label:n.label,items:n.items,collapsed:r}})},[O,k,ue,fe,me]);if(l&&!O.length)return(0,z.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading Gallery...`});if(!O.length)return(0,z.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`No items to display`});let ge=e=>!S||S.length===0?null:(0,z.jsx)(`div`,{className:`mt-1.5 space-y-1`,children:S.map(t=>{let n=e[t];if(ie(n))return null;let r=E(t),i=w(r)||r.type||`text`,a=x(i),o=r?.label&&String(r.label).trim()?String(r.label):void 0,s=o!=null&&sn.has(i);return(0,z.jsxs)(`div`,{className:T(`text-xs text-muted-foreground truncate [&_*]:!text-xs`,s&&`flex items-baseline gap-1.5`),onClick:e=>{e.target.closest(`a,button`)&&e.stopPropagation()},children:[s&&(0,z.jsx)(`span`,{className:`shrink-0 text-muted-foreground/70 tabular-nums`,children:o}),(0,z.jsx)(a,{value:n,field:r})]},t)})}),_e=(n,r)=>{let i=n.id??n._id??r,a=(b!=null&&n[b]!=null&&n[b]!==``?String(n[b]):void 0)??le(f,n),o=fn(n,_),c=ln(String(i)+`|`+a),l=T(`group relative overflow-hidden border-border/60 bg-card`,`transition-all duration-200 ease-out`,`hover:shadow-lg hover:border-border hover:-translate-y-0.5`,(e.onCardClick||e.onRowClick||t.navigation)&&`cursor-pointer`);return ce&&v===`contain`?(0,z.jsxs)(s,{role:`listitem`,className:l,onClick:e=>m.handleClick(n,e),children:[(0,z.jsx)(`div`,{"aria-hidden":!0,className:T(`absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r`,c.bg)}),(0,z.jsx)(g,{className:`p-4`,children:(0,z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,z.jsx)(dn,{imageUrl:o,title:a,placeholder:c}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`h3`,{className:`font-semibold tracking-tight truncate text-sm leading-tight text-foreground`,title:a,children:a}),ge(n)]})]})})]},i):(0,z.jsxs)(s,{role:`listitem`,className:l,onClick:e=>m.handleClick(n,e),children:[!ce&&(0,z.jsx)(`div`,{"aria-hidden":!0,className:T(`absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r`,c.bg)}),(0,z.jsx)(un,{imageUrl:o,title:a,coverFit:v,aspectClass:on[y],placeholder:c,hidden:!ce}),(0,z.jsxs)(g,{className:T(`p-3`,ce&&`border-t border-border/60`),children:[(0,z.jsx)(`h3`,{className:`font-semibold tracking-tight truncate text-sm leading-tight text-foreground`,title:a,children:a}),ge(n)]})]},i)},ve=e=>(0,z.jsx)(`div`,{className:T(`grid gap-4 p-4 auto-rows-min content-start`,an[y],t.className),role:`list`,children:e.map((e,t)=>_e(e,t))});return(0,z.jsxs)(z.Fragment,{children:[ue?(0,z.jsx)(`div`,{className:`space-y-2`,children:A.map(e=>(0,z.jsxs)(`div`,{className:`border rounded-md`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-3 py-2 text-sm font-medium text-left bg-muted/50 hover:bg-muted transition-colors`,onClick:()=>he(e.key),children:[e.collapsed?(0,z.jsx)(Ke,{className:`h-4 w-4 shrink-0`}):(0,z.jsx)(I,{className:`h-4 w-4 shrink-0`}),(0,z.jsx)(`span`,{children:e.label}),(0,z.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:e.items.length})]}),!e.collapsed&&ve(e.items)]},e.key))}):ve(O),m.isOverlay&&(0,z.jsx)(te,{...m,title:`Gallery Item`,children:e=>(0,z.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,z.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,z.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})},{namespace:`plugin-list`,label:`Gallery View`,category:`view`});var pn=Object.entries({grid:`Grid`,kanban:`Kanban`,gallery:`Gallery`,calendar:`Calendar`,timeline:`Timeline`,gantt:`Gantt`,map:`Map`,chart:`Chart`,tree:`Tree`}).map(([e,t])=>({label:t,value:e})),q=rn;_e.register(`list-view`,q,{namespace:`plugin-list`,label:`List View`,category:`Views`,icon:`LayoutList`,inputs:[{name:`objectName`,type:`string`,required:!0},{name:`viewType`,type:`enum`,enum:pn},{name:`columns`,type:`array`},{name:`filter`,type:`array`},{name:`sort`,type:`array`},{name:`options`,type:`object`}],defaultProps:{objectName:``,viewType:`grid`,columns:[],filter:[],sort:[],options:{}}}),_e.register(`list`,q,{namespace:`view`,skipFallback:!0,category:`view`,label:`List`,icon:`LayoutList`,inputs:[{name:`objectName`,type:`string`,required:!0},{name:`viewType`,type:`enum`,enum:pn},{name:`columns`,type:`array`},{name:`filter`,type:`array`},{name:`sort`,type:`array`},{name:`options`,type:`object`}]});export{tn as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{d as t,p as n,t as r,v as i}from"./vendor-react-BggL7APJ.js";import{nr as a,rr as o}from"./vendor-objectstack-DFqu45yM.js";import{$n as s,K as c,Yi as l,di as u,hi as d,ni as f,pi as p,q as m,t as h,yt as g}from"./framework-DFR4HNtj.js";import{h as _,o as v,s as y}from"./i18n-runtime-97_bDVjP.js";import{c as b}from"./data-adapter-Cymvlczj.js";import{a as x,o as S,r as C}from"./vendor-ui-utils-DIUdEYii.js";import{t as w}from"./vendor-icon-arrow-left-DmGEbpkA.js";import{t as T}from"./vendor-icon-at-sign-B71HJHhC.js";import{t as E}from"./vendor-icon-book-open-DKPXYwQK.js";import{t as D}from"./vendor-icon-calendar-BsoUBIef.js";import{t as O}from"./vendor-icon-chart-column-DicJIApF.js";import{t as k}from"./vendor-icon-chart-line-DOxarYni.js";import{t as A}from"./vendor-icon-chart-pie-OmZxepOF.js";import{t as j}from"./vendor-icon-check-vpu9Zukp.js";import{t as M}from"./vendor-icon-chevron-down-BEf_jTEE.js";import{t as N}from"./vendor-icon-chevron-left-KnDcuFH1.js";import{t as P}from"./vendor-icon-chevron-right-DbnKwHYQ.js";import{t as F}from"./vendor-icon-chevron-up-C-6o_0je.js";import{t as ee}from"./vendor-icon-clipboard-UqhWHclG.js";import{t as I}from"./vendor-icon-code-C7LFGCxG.js";import{t as L}from"./vendor-icon-columns-3-DsEBPpuZ.js";import{t as te}from"./vendor-icon-copy-B5M-KdZo.js";import{t as R}from"./vendor-icon-database-C8JGjSkn.js";import{t as ne}from"./vendor-icon-diamond-L7C1CJFo.js";import{t as z}from"./vendor-icon-download-C3csYSaD.js";import{t as re}from"./vendor-icon-eye-off-Dy3GIcvl.js";import{t as ie}from"./vendor-icon-eye-C3HaEGOo.js";import{t as B}from"./vendor-icon-file-text-7BKAVNof.js";import{t as V}from"./vendor-icon-folder-open-mGjBJ_Tq.js";import{t as ae}from"./vendor-icon-git-branch-CpQpJlYB.js";import{t as oe}from"./vendor-icon-globe-BaOanPH5.js";import{t as se}from"./vendor-icon-grid-3x3-Dyc1xp4z.js";import{t as ce}from"./vendor-icon-grip-vertical-B01-ovq0.js";import{t as le}from"./vendor-icon-hash-Lkwzb5Ny.js";import{t as H}from"./vendor-icon-image-D2YAsa8l.js";import{t as ue}from"./vendor-icon-layers-DXBEefR1.js";import{t as de}from"./vendor-icon-layout-dashboard-wba2hvZp.js";import{t as fe}from"./vendor-icon-link-2-EAo0juhN.js";import{t as U}from"./vendor-icon-link-RPcdxfUF.js";import{t as pe}from"./vendor-icon-list-ordered-DaaRBYov.js";import{t as me}from"./vendor-icon-lock-B_psRnly.js";import{t as he}from"./vendor-icon-map-pin-BS-hHv53.js";import{t as ge}from"./vendor-icon-map-DsFP3Vmp.js";import{t as _e}from"./vendor-icon-maximize-2-C215UtMO.js";import{t as ve}from"./vendor-icon-minus-CMTDFpmk.js";import{t as ye}from"./vendor-icon-moon-C1ZitaV0.js";import{t as be}from"./vendor-icon-mouse-pointer-click-WdN96Sza.js";import{t as xe}from"./vendor-icon-palette-CazWMHVl.js";import{t as Se}from"./vendor-icon-panel-left-close-CrofkR7D.js";import{t as Ce}from"./vendor-icon-panel-right-close-B1IgPiA5.js";import{t as we}from"./vendor-icon-panel-right-open-DRcsA0VE.js";import{t as Te}from"./vendor-icon-panels-top-left-BR5oKE-H.js";import{t as Ee}from"./vendor-icon-pencil-CMubUBjW.js";import{t as De}from"./vendor-icon-phone-H1S8HSi1.js";import{t as Oe}from"./vendor-icon-play-BfFoh-7G.js";import{t as ke}from"./vendor-icon-plus-BlfcDDsa.js";import{t as Ae}from"./vendor-icon-puzzle-D0_dPnVP.js";import{t as je}from"./vendor-icon-redo-2-BJ-uEK0D.js";import{t as Me}from"./vendor-icon-rotate-ccw-lr5YKsxC.js";import{t as Ne}from"./vendor-icon-search-B2Uqtp_W.js";import{t as Pe}from"./vendor-icon-sliders-horizontal-BsnKXU0c.js";import{t as Fe}from"./vendor-icon-square-D32ztiBM.js";import{t as Ie}from"./vendor-icon-star-DfusowFE.js";import{t as Le}from"./vendor-icon-sun-D1JMEG8e.js";import{t as Re}from"./vendor-icon-table-2-DMQ6UahM.js";import{t as ze}from"./vendor-icon-toggle-left-DJMejsN6.js";import{t as W}from"./vendor-icon-trash-BLsWkwB9.js";import{t as Be}from"./vendor-icon-trending-up-CBQiG1_M.js";import{t as Ve}from"./vendor-icon-triangle-alert-D5n0T3q_.js";import{t as He}from"./vendor-icon-type-DudTuHpS.js";import{t as Ue}from"./vendor-icon-undo-2-C9MbW2Vb.js";import{t as We}from"./vendor-icon-upload-BZ3rElxe.js";import{t as Ge}from"./vendor-icon-users-Db5uTXC8.js";import{t as Ke}from"./vendor-icon-x-CcLtgRNL.js";import{t as qe}from"./vendor-icon-zoom-out-IlqZRNIF.js";import{t as Je}from"./vendor-icon-zoom-in-ShI9ftXk.js";import{i as Ye,r as Xe}from"./plugin-form-CLDvL0up.js";import{s as Ze}from"./ui-layout-DgVDuPEM.js";import{r as Qe}from"./plugin-grid-D2rmQEW_.js";var G=e(i(),1);function $e(e){return e||(typeof window<`u`&&window.sessionStorage?window.sessionStorage:null)}function et(e,t={}){let{maxHistory:n=50,persistKey:r,storage:i}=t,a=$e(i),o=(()=>{if(!r||!a)return null;try{let e=a.getItem(r);if(!e)return null;let t=JSON.parse(e);if(t&&t.v===1&&Array.isArray(t.past)&&Array.isArray(t.future))return t}catch{}return null})(),[s,c]=(0,G.useState)(o?.current??e),l=(0,G.useRef)(o?.past??[]),u=(0,G.useRef)(o?.future??[]),[,d]=(0,G.useState)(0),f=(0,G.useCallback)(()=>d(e=>e+1),[]);(0,G.useEffect)(()=>{if(r&&a)try{let e={v:1,past:l.current,current:s,future:u.current};a.setItem(r,JSON.stringify(e))}catch{}},[s,r,a]);let p=(0,G.useCallback)(e=>{c(t=>(l.current=[...l.current.slice(-(n-1)),t],u.current=[],e)),f()},[n,f]),m=(0,G.useCallback)(()=>{l.current.length!==0&&(c(e=>{let t=[...l.current],n=t.pop();return l.current=t,u.current=[e,...u.current],n}),f())},[f]),h=(0,G.useCallback)(()=>{u.current.length!==0&&(c(e=>{let t=[...u.current],n=t.shift();return u.current=t,l.current=[...l.current,e],n}),f())},[f]),g=(0,G.useCallback)(e=>{l.current=[],u.current=[],c(e),f()},[f]),_=(0,G.useCallback)(()=>{if(r&&a)try{a.removeItem(r)}catch{}},[r,a]),v=(0,G.useCallback)(e=>{let t=l.current.length+1+u.current.length;e<0||e>=t||e!==l.current.length&&(c(t=>{let n=[...l.current,t,...u.current],r=n[e];return l.current=n.slice(0,e),u.current=n.slice(e+1),r}),f())},[f]);return{current:s,canUndo:l.current.length>0,canRedo:u.current.length>0,undoCount:l.current.length,redoCount:u.current.length,timeline:[...l.current,s,...u.current],currentIndex:l.current.length,push:p,undo:m,redo:h,reset:g,jumpTo:v,clearPersisted:_}}function K(){let[e,t]=(0,G.useState)(!1),[n,r]=(0,G.useState)(``),[i,a]=(0,G.useState)(``),o=(0,G.useRef)(null);return{isOpen:e,title:n,message:i,confirm:(0,G.useCallback)((e,n)=>(r(e),a(n),t(!0),new Promise(e=>{o.current=e})),[]),onConfirm:(0,G.useCallback)(()=>{t(!1),o.current?.(!0),o.current=null},[]),onCancel:(0,G.useCallback)(()=>{t(!1),o.current?.(!1),o.current=null},[])}}function tt(){let[e,t]=(0,G.useState)(new Set);return{selectedIds:e,toggle:(0,G.useCallback)((e,n=!1)=>{t(t=>{let r=new Set(n?t:[]);return t.has(e)&&n?r.delete(e):r.add(e),r})},[]),selectOne:(0,G.useCallback)(e=>{t(new Set([e]))},[]),selectMany:(0,G.useCallback)(e=>{t(new Set(e))},[]),clearSelection:(0,G.useCallback)(()=>{t(new Set)},[]),isSelected:(0,G.useCallback)(t=>e.has(t),[e]),count:e.size}}function nt(){let[e,t]=(0,G.useState)(null);return{clipboard:e,copy:(0,G.useCallback)(e=>{t(structuredClone(e))},[]),paste:(0,G.useCallback)(()=>e?structuredClone(e):null,[e]),hasContent:e!==null}}function rt(e={}){let{minZoom:t=.25,maxZoom:n=3,zoomStep:r=.1,initialZoom:i=1}=e,[a,o]=(0,G.useState)(i),[s,c]=(0,G.useState)({x:0,y:0}),l=(0,G.useRef)(!1),u=(0,G.useRef)({x:0,y:0}),d=(0,G.useCallback)(e=>Math.min(n,Math.max(t,+e.toFixed(2))),[t,n]);return{zoom:a,panOffset:s,zoomIn:(0,G.useCallback)(()=>o(e=>d(e+r)),[d,r]),zoomOut:(0,G.useCallback)(()=>o(e=>d(e-r)),[d,r]),resetZoom:(0,G.useCallback)(()=>{o(1),c({x:0,y:0})},[]),setZoom:(0,G.useCallback)(e=>o(d(e)),[d]),handleWheel:(0,G.useCallback)(e=>{if(e.ctrlKey||e.metaKey){e.preventDefault();let t=e.deltaY>0?-r:r;o(e=>d(e+t))}},[d,r]),startPan:(0,G.useCallback)(e=>{if(e.button===1||e.button===0&&e.altKey){e.preventDefault(),l.current=!0,u.current={x:e.clientX,y:e.clientY};let t=e=>{if(!l.current)return;let t=e.clientX-u.current.x,n=e.clientY-u.current.y;u.current={x:e.clientX,y:e.clientY},c(e=>({x:e.x+t,y:e.y+n}))},n=()=>{l.current=!1,document.removeEventListener(`mousemove`,t),document.removeEventListener(`mouseup`,n)};document.addEventListener(`mousemove`,t),document.addEventListener(`mouseup`,n)}},[]),transformStyle:{transform:`translate(${s.x}px, ${s.y}px) scale(${a})`,transformOrigin:`0 0`}}}var q=r();function it(...e){return x(S(e))}function at({isOpen:e,title:t,message:n,confirmLabel:r=`Delete`,cancelLabel:i=`Cancel`,destructive:a=!0,onConfirm:o,onCancel:s}){let c=(0,G.useRef)(null);return(0,G.useEffect)(()=>{let t=c.current;t&&(e&&!t.open?t.showModal():!e&&t.open&&t.close())},[e]),e?(0,q.jsx)(`dialog`,{ref:c,className:`fixed inset-0 z-50 m-auto rounded-lg border bg-background p-0 shadow-lg backdrop:bg-black/50`,onClose:s,"aria-labelledby":`confirm-title`,"aria-describedby":`confirm-message`,children:(0,q.jsxs)(`div`,{className:`w-80 p-6`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[a&&(0,q.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-full bg-destructive/10`,children:(0,q.jsx)(Ve,{className:`h-5 w-5 text-destructive`})}),(0,q.jsx)(`h2`,{id:`confirm-title`,className:`text-lg font-semibold`,children:t})]}),(0,q.jsx)(`p`,{id:`confirm-message`,className:`text-sm text-muted-foreground mb-6`,children:n}),(0,q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:s,className:`px-4 py-2 text-sm rounded-md border hover:bg-accent`,children:i}),(0,q.jsx)(`button`,{type:`button`,onClick:o,className:it(`px-4 py-2 text-sm rounded-md font-medium`,a?`bg-destructive text-destructive-foreground hover:bg-destructive/90`:`bg-primary text-primary-foreground hover:bg-primary/90`),autoFocus:!0,children:r})]})]})}):null}function ot(...e){return x(S(e))}function st({title:e=`Properties`,fields:t,onChange:n,className:r}){let[i,a]=(0,G.useState)(new Set),o=(0,G.useCallback)(e=>{a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),s=t.reduce((e,t)=>{let n=t.group??`General`;return e[n]||(e[n]=[]),e[n].push(t),e},{});return(0,q.jsxs)(`div`,{className:ot(`flex flex-col`,r),role:`region`,"aria-label":e,children:[(0,q.jsx)(`div`,{className:`p-3 border-b font-medium text-sm`,children:e}),(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[Object.entries(s).map(([e,t])=>(0,q.jsxs)(`div`,{className:`border-b last:border-b-0`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>o(e),className:`w-full flex items-center gap-1 px-3 py-2 text-xs font-medium text-muted-foreground hover:bg-accent/50`,children:[i.has(e)?(0,q.jsx)(P,{className:`h-3 w-3`}):(0,q.jsx)(M,{className:`h-3 w-3`}),e]}),!i.has(e)&&(0,q.jsx)(`div`,{className:`px-3 pb-2 space-y-2`,children:t.map(e=>(0,q.jsx)(ct,{field:e,onChange:n},e.name))})]},e)),t.length===0&&(0,q.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground text-center`,children:`Select an element to edit its properties`})]})]})}function ct({field:e,onChange:t}){let n=n=>{t(e.name,n)};return(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:e.label}),e.type===`text`&&(0,q.jsx)(`input`,{type:`text`,value:String(e.value??``),onChange:e=>n(e.target.value),className:`w-full px-2 py-1 text-xs border rounded bg-background`}),e.type===`number`&&(0,q.jsx)(`input`,{type:`number`,value:Number(e.value??0),onChange:e=>n(Number(e.target.value)),className:`w-full px-2 py-1 text-xs border rounded bg-background`}),e.type===`boolean`&&(0,q.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:!!e.value,onChange:e=>n(e.target.checked),className:`rounded`}),(0,q.jsx)(`span`,{className:`text-xs`,children:e.value?`Yes`:`No`})]}),e.type===`select`&&(0,q.jsx)(`select`,{value:String(e.value??``),onChange:e=>n(e.target.value),className:`w-full px-2 py-1 text-xs border rounded bg-background`,children:e.options?.map(e=>(0,q.jsx)(`option`,{value:e.value,children:e.label},e.value))}),e.type===`color`&&(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`input`,{type:`color`,value:String(e.value??`#000000`),onChange:e=>n(e.target.value),className:`h-6 w-6 rounded border cursor-pointer`}),(0,q.jsx)(`span`,{className:`text-xs font-mono`,children:String(e.value??`#000000`)})]}),e.type===`textarea`&&(0,q.jsx)(`textarea`,{value:String(e.value??``),onChange:e=>n(e.target.value),className:`w-full px-2 py-1 text-xs border rounded bg-background resize-y`,rows:3}),e.description&&(0,q.jsx)(`p`,{className:`text-[0.65rem] text-muted-foreground/70`,children:e.description})]})}function lt(...e){return x(S(e))}function ut({items:e,canvasWidth:t,canvasHeight:n,position:r=`bottom-right`,size:i=150,className:a}){let o=Math.min(i/t,i/n),s=t*o,c=n*o;return(0,q.jsx)(`div`,{className:lt(`absolute border rounded bg-background/90 shadow-sm overflow-hidden`,{"top-left":`top-2 left-2`,"top-right":`top-2 right-2`,"bottom-left":`bottom-2 left-2`,"bottom-right":`bottom-2 right-2`}[r],a),role:`img`,"aria-label":`Canvas minimap`,children:(0,q.jsxs)(`svg`,{width:s,height:c,viewBox:`0 0 ${t} ${n}`,children:[(0,q.jsx)(`rect`,{width:t,height:n,fill:`hsl(var(--muted))`,opacity:`0.3`}),e.map(e=>(0,q.jsx)(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,fill:e.selected?`hsl(var(--primary))`:e.color??`hsl(var(--foreground) / 0.3)`,rx:`2`},e.id))]})})}var dt=(0,G.createContext)(null);dt.displayName=`CollaborationContext`;function ft(){return(0,G.useContext)(dt)}function J(...e){return x(S(e))}function pt({canvas:e={width:1200,height:800,gridSize:8,showGrid:!0,snapToGrid:!0},components:t=[],palette:n=mt,showComponentTree:r=!0,undoRedo:i=!0,propertyEditor:a=!0,readOnly:o=!1,showMinimap:s=!1,onChange:c,className:l}){let u=et(t),d=u.current,f=(0,G.useCallback)(e=>{u.push(e),c?.(e)},[u,c]),p=rt({initialZoom:e.zoom??1}),{zoom:m}=p,h=tt(),g=(0,G.useMemo)(()=>{let e=Array.from(h.selectedIds);return e.length>0?e[0]:null},[h.selectedIds]),_=(0,G.useMemo)(()=>d.find(e=>e.id===g),[d,g]),v=nt(),y=K(),b=ft(),x=(0,G.useCallback)(e=>{b&&b.sendOperation({...e,userId:b.currentUserId??``})},[b]),[S,C]=(0,G.useState)(!0),[w,T]=(0,G.useState)(!0),[E,D]=(0,G.useState)(s),O=(0,G.useRef)(null),k=(0,G.useRef)(null),A=(0,G.useCallback)(t=>!e.snapToGrid||!e.gridSize?t:Math.round(t/e.gridSize)*e.gridSize,[e.snapToGrid,e.gridSize]),j=(0,G.useCallback)((e,t)=>{if(o)return;let r=n.flatMap(e=>e.items).find(t=>t.type===e),i=r?.defaultSize,a={id:`comp-${Date.now()}`,type:e,label:t,position:{x:100,y:100,width:i?.width??200,height:i?.height??100},props:r?.defaultProps??{}},s=[...d,a];f(s),h.selectOne(a.id),x({type:`insert`,elementId:a.id,data:{component:a}})},[d,o,n,f,h,x]),M=(0,G.useCallback)(e=>{if(o)return;let t=d.filter(t=>t.id!==e);f(t),h.isSelected(e)&&h.clearSelection(),x({type:`delete`,elementId:e,data:{}})},[d,o,f,h,x]),N=(0,G.useCallback)(async()=>{if(o||h.count===0||!await y.confirm(`Delete components`,`Are you sure you want to delete ${h.count} component${h.count>1?`s`:``}?`))return;let e=h.selectedIds,t=d.filter(t=>!e.has(t.id));f(t),h.clearSelection(),e.forEach(e=>{x({type:`delete`,elementId:e,data:{}})})},[o,h,y,d,f,x]),P=(0,G.useCallback)((e,t)=>{if(o||!g)return;let n=d.map(n=>n.id===g?e===`label`?{...n,label:String(t)}:e===`x`?{...n,position:{...n.position,x:Number(t)}}:e===`y`?{...n,position:{...n.position,y:Number(t)}}:e===`width`?{...n,position:{...n.position,width:Number(t)}}:e===`height`?{...n,position:{...n.position,height:Number(t)}}:{...n,props:{...n.props,[e]:t}}:n);f(n),x({type:`update`,elementId:g,data:{[e]:t}})},[o,g,d,f,x]),F=(0,G.useCallback)(()=>{let e=h.selectedIds;if(e.size===0)return;let t=d.filter(t=>e.has(t.id));v.copy(t)},[h,d,v]),I=(0,G.useCallback)(()=>{if(o)return;let e=v.paste();if(!e||e.length===0)return;let t=0,n=e.map(e=>({...e,id:`comp-${Date.now()}-${++t}-${Math.random().toString(36).slice(2,7)}`,position:{...e.position,x:e.position.x+20,y:e.position.y+20}})),r=[...d,...n];f(r),h.selectMany(n.map(e=>e.id)),n.forEach(e=>{x({type:`insert`,elementId:e.id,data:{component:e}})})},[o,v,d,f,h,x]),L=(0,G.useCallback)((e,t)=>{o||(O.current={id:t.id,startX:e.clientX,startY:e.clientY},e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t.id))},[o]),R=(0,G.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},[]),ne=(0,G.useCallback)(e=>{e.preventDefault();let t=O.current;if(!t||o)return;let n=(e.clientX-t.startX)/m,r=(e.clientY-t.startY)/m,i=d.map(e=>e.id===t.id?{...e,position:{...e.position,x:A(e.position.x+n),y:A(e.position.y+r)}}:e);f(i),x({type:`move`,elementId:t.id,data:{}}),O.current=null},[o,m,d,f,A,x]),z=(0,G.useMemo)(()=>_?[{name:`label`,label:`Label`,type:`text`,value:_.label??``,group:`General`},{name:`x`,label:`X`,type:`number`,value:_.position.x,group:`Position`},{name:`y`,label:`Y`,type:`number`,value:_.position.y,group:`Position`},{name:`width`,label:`Width`,type:`number`,value:_.position.width,group:`Size`},{name:`height`,label:`Height`,type:`number`,value:_.position.height,group:`Size`}]:[],[_]),re=(0,G.useMemo)(()=>d.map(e=>({id:e.id,x:e.position.x,y:e.position.y,width:typeof e.position.width==`number`?e.position.width:100,height:typeof e.position.height==`number`?e.position.height:50,selected:h.isSelected(e.id)})),[d,h]);return(0,G.useEffect)(()=>{let e=k.current;if(!e)return;let t=e=>{let t=[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.target.tagName),n=e.ctrlKey||e.metaKey;if((e.key===`Delete`||e.key===`Backspace`)&&h.count>0&&!t){e.preventDefault(),N();return}if(e.key===`Escape`){h.clearSelection();return}if(!t){if(n&&e.key===`z`&&!e.shiftKey&&i&&!o){e.preventDefault(),u.undo();return}if(n&&(e.key===`z`&&e.shiftKey||e.key===`y`)&&i&&!o){e.preventDefault(),u.redo();return}if(n&&e.key===`c`){e.preventDefault(),F();return}if(n&&e.key===`v`&&!o){e.preventDefault(),I();return}if(n&&e.key===`a`){e.preventDefault(),h.selectMany(d.map(e=>e.id));return}}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[h,N,i,o,u,F,I,d]),(0,q.jsxs)(`div`,{ref:k,tabIndex:0,className:J(`flex h-full w-full border rounded-lg overflow-hidden bg-background`,l),children:[!o&&(0,q.jsx)(`div`,{className:J(`border-r bg-muted/30 flex flex-col transition-[width] duration-200`,S?`w-60`:`w-0 overflow-hidden`),role:`region`,"aria-label":`Component palette`,children:S&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`p-3 border-b font-medium text-sm`,children:`Components`}),(0,q.jsx)(`div`,{className:`flex-1 overflow-y-auto p-2`,children:n.map(e=>(0,q.jsxs)(`div`,{className:`mb-3`,children:[(0,q.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground px-2 py-1 uppercase`,children:e.label}),e.items.map(e=>(0,q.jsxs)(`button`,{type:`button`,onClick:()=>j(e.type,e.label),className:`w-full flex items-center gap-2 px-2 py-1.5 text-sm rounded hover:bg-accent text-left`,children:[(0,q.jsx)(ke,{className:`h-3 w-3`}),e.label]},e.type))]},e.name))})]})}),(0,q.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 p-2 border-b bg-muted/20`,role:`toolbar`,"aria-label":`Designer toolbar`,children:[!o&&(0,q.jsx)(`button`,{type:`button`,className:`p-1.5 rounded hover:bg-accent`,title:S?`Collapse palette`:`Expand palette`,"aria-label":S?`Collapse palette`:`Expand palette`,onClick:()=>C(e=>!e),children:(0,q.jsx)(Se,{className:J(`h-4 w-4`,!S&&`rotate-180`)})}),i&&!o&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`w-px h-5 bg-border mx-1`}),(0,q.jsx)(`button`,{type:`button`,className:J(`p-1.5 rounded hover:bg-accent`,!u.canUndo&&`opacity-40 pointer-events-none`),title:`Undo (Ctrl+Z)`,"aria-label":`Undo`,disabled:!u.canUndo,onClick:()=>u.undo(),children:(0,q.jsx)(Ue,{className:`h-4 w-4`})}),(0,q.jsx)(`button`,{type:`button`,className:J(`p-1.5 rounded hover:bg-accent`,!u.canRedo&&`opacity-40 pointer-events-none`),title:`Redo (Ctrl+Shift+Z)`,"aria-label":`Redo`,disabled:!u.canRedo,onClick:()=>u.redo(),children:(0,q.jsx)(je,{className:`h-4 w-4`})}),(0,q.jsx)(`div`,{className:`w-px h-5 bg-border mx-1`})]}),!o&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`button`,{type:`button`,className:J(`p-1.5 rounded hover:bg-accent`,h.count===0&&`opacity-40 pointer-events-none`),title:`Copy (Ctrl+C)`,"aria-label":`Copy`,disabled:h.count===0,onClick:F,children:(0,q.jsx)(te,{className:`h-4 w-4`})}),(0,q.jsx)(`button`,{type:`button`,className:J(`p-1.5 rounded hover:bg-accent`,!v.hasContent&&`opacity-40 pointer-events-none`),title:`Paste (Ctrl+V)`,"aria-label":`Paste`,disabled:!v.hasContent,onClick:I,children:(0,q.jsx)(ee,{className:`h-4 w-4`})}),(0,q.jsx)(`div`,{className:`w-px h-5 bg-border mx-1`})]}),!o&&(0,q.jsx)(`button`,{type:`button`,className:J(`p-1.5 rounded hover:bg-accent`,h.count===0&&`opacity-40 pointer-events-none`),title:`Delete selected`,"aria-label":`Delete selected`,disabled:h.count===0,onClick:N,children:(0,q.jsx)(W,{className:`h-4 w-4`})}),(0,q.jsx)(`button`,{type:`button`,className:`p-1.5 rounded hover:bg-accent`,title:`Preview`,"aria-label":`Preview`,children:(0,q.jsx)(ie,{className:`h-4 w-4`})}),(0,q.jsx)(`button`,{type:`button`,className:J(`p-1.5 rounded hover:bg-accent`,E&&`bg-accent`),title:`Toggle minimap`,"aria-label":`Toggle minimap`,onClick:()=>D(e=>!e),children:(0,q.jsx)(ge,{className:`h-4 w-4`})}),(0,q.jsx)(`div`,{className:`flex-1`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(`button`,{type:`button`,className:`p-1 rounded hover:bg-accent text-xs`,"aria-label":`Zoom out`,onClick:p.zoomOut,children:(0,q.jsx)(ve,{className:`h-3 w-3`})}),(0,q.jsxs)(`span`,{className:`text-xs text-muted-foreground w-10 text-center`,children:[Math.round(m*100),`%`]}),(0,q.jsx)(`button`,{type:`button`,className:`p-1 rounded hover:bg-accent text-xs`,"aria-label":`Zoom in`,onClick:p.zoomIn,children:(0,q.jsx)(ke,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{type:`button`,className:`p-1 rounded hover:bg-accent text-xs`,"aria-label":`Reset zoom`,onClick:p.resetZoom,children:(0,q.jsx)(_e,{className:`h-3 w-3`})})]}),r&&(0,q.jsx)(`button`,{type:`button`,className:`p-1.5 rounded hover:bg-accent`,title:w?`Collapse panel`:`Expand panel`,"aria-label":w?`Collapse panel`:`Expand panel`,onClick:()=>T(e=>!e),children:(0,q.jsx)(Ce,{className:J(`h-4 w-4`,!w&&`rotate-180`)})})]}),(0,q.jsx)(`div`,{className:`flex-1 overflow-auto bg-muted/10 p-4 relative`,role:`region`,"aria-label":`Design canvas`,onWheel:p.handleWheel,onMouseDown:p.startPan,onDragOver:R,onDrop:ne,children:(0,q.jsxs)(`div`,{className:`relative bg-background border rounded shadow-sm mx-auto`,style:{width:e.width*m,height:e.height*m,transform:`translate(${p.panOffset.x}px, ${p.panOffset.y}px)`,backgroundImage:e.showGrid?`radial-gradient(circle, hsl(var(--border)) 1px, transparent 1px)`:void 0,backgroundSize:e.showGrid&&e.gridSize?`${e.gridSize*m}px ${e.gridSize*m}px`:void 0},children:[d.map(e=>{let t=h.isSelected(e.id);return(0,q.jsxs)(`div`,{draggable:!o,onDragStart:t=>L(t,e),className:J(`absolute border rounded cursor-move select-none transition-shadow`,t?`border-primary ring-2 ring-primary/20 shadow-md`:`border-border hover:border-primary/50`),style:{left:e.position.x*m,top:e.position.y*m,width:typeof e.position.width==`number`?e.position.width*m:e.position.width,height:typeof e.position.height==`number`?e.position.height*m:e.position.height},onClick:t=>h.toggle(e.id,t.shiftKey),children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1 bg-muted/50 text-xs border-b`,children:[(0,q.jsx)(ce,{className:`h-3 w-3 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`truncate`,children:e.label??e.type}),!o&&(0,q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),M(e.id)},className:`ml-auto p-0.5 rounded hover:bg-destructive/10`,"aria-label":`Delete ${e.label??e.type}`,children:(0,q.jsx)(W,{className:`h-3 w-3 text-destructive`})})]}),(0,q.jsx)(`div`,{className:`p-2 text-xs text-muted-foreground`,children:e.type})]},e.id)}),E&&(0,q.jsx)(ut,{items:re,canvasWidth:e.width,canvasHeight:e.height})]})})]}),r&&(0,q.jsx)(`div`,{className:J(`border-l bg-muted/30 flex flex-col transition-[width] duration-200`,w?`w-60`:`w-0 overflow-hidden`),role:`region`,"aria-label":`Component tree`,children:w&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`p-3 border-b font-medium text-sm flex items-center gap-2`,children:[(0,q.jsx)(ue,{className:`h-4 w-4`}),`Component Tree`]}),(0,q.jsx)(`div`,{className:`flex-1 overflow-y-auto p-2`,children:d.length===0?(0,q.jsx)(`div`,{className:`text-xs text-muted-foreground text-center py-4`,children:`No components added yet. Click a component in the palette to add it to the canvas.`}):d.map(e=>(0,q.jsx)(`button`,{type:`button`,onClick:t=>h.toggle(e.id,t.shiftKey),className:J(`w-full flex items-center gap-2 px-2 py-1.5 text-sm rounded text-left`,h.isSelected(e.id)?`bg-accent`:`hover:bg-accent/50`),children:(0,q.jsx)(`span`,{className:`truncate`,children:e.label??e.type})},e.id))}),a&&_?(0,q.jsx)(`div`,{className:`border-t`,children:(0,q.jsx)(st,{title:`Properties – ${_.label??_.type}`,fields:z,onChange:P})}):_&&(0,q.jsxs)(`div`,{className:`border-t p-3`,children:[(0,q.jsx)(`div`,{className:`text-xs font-medium mb-2`,children:`Properties`}),(0,q.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-1`,children:[(0,q.jsxs)(`div`,{children:[`Type: `,_.type]}),(0,q.jsxs)(`div`,{children:[`ID: `,_.id]}),(0,q.jsxs)(`div`,{children:[`Position: `,_.position.x,`,`,` `,_.position.y]}),(0,q.jsxs)(`div`,{children:[`Size: `,_.position.width,` ×`,` `,_.position.height]})]})]})]})}),(0,q.jsx)(at,{isOpen:y.isOpen,title:y.title,message:y.message,onConfirm:y.onConfirm,onCancel:y.onCancel})]})}var mt=[{name:`layout`,label:`Layout`,items:[{type:`container`,label:`Container`,defaultSize:{width:400,height:300}},{type:`flex`,label:`Flex`,defaultSize:{width:400,height:200}},{type:`grid`,label:`Grid`,defaultSize:{width:400,height:300}},{type:`card`,label:`Card`,defaultSize:{width:300,height:200}},{type:`tabs`,label:`Tabs`,defaultSize:{width:400,height:300}}]},{name:`form`,label:`Form`,items:[{type:`input`,label:`Input`,defaultSize:{width:300,height:60}},{type:`textarea`,label:`Textarea`,defaultSize:{width:300,height:120}},{type:`select`,label:`Select`,defaultSize:{width:300,height:60}},{type:`checkbox`,label:`Checkbox`,defaultSize:{width:200,height:40}},{type:`button`,label:`Button`,defaultSize:{width:120,height:40}}]},{name:`data`,label:`Data`,items:[{type:`table`,label:`Table`,defaultSize:{width:600,height:400}},{type:`chart`,label:`Chart`,defaultSize:{width:400,height:300}},{type:`list`,label:`List`,defaultSize:{width:300,height:400}},{type:`statistic`,label:`Statistic`,defaultSize:{width:200,height:100}}]}];function ht(e,t={}){return et(e,t)}function gt(...e){return x(S(e))}var _t=[`text`,`number`,`boolean`,`date`,`datetime`,`uuid`,`email`,`url`,`phone`,`json`,`integer`,`float`,`decimal`,`currency`,`percent`,`textarea`,`select`,`multiselect`,`lookup`,`attachment`,`formula`,`autonumber`];function vt(e,t=4,n=280,r=250,i=50,a=50){return e.map((e,o)=>({...e,position:{x:i+o%t*n,y:a+Math.floor(o/t)*r}}))}function yt({entities:e=[],relationships:t=[],canvas:n={width:1200,height:800,showGrid:!0},showRelationshipLabels:r=!0,readOnly:i=!1,onEntitiesChange:a,onRelationshipsChange:o,className:s}){let c=(0,G.useRef)(null),l=ht({entities:e,relationships:t},{maxHistory:50}),{entities:u,relationships:d}=l.current,f=(0,G.useCallback)(e=>{l.push(e),a?.(e.entities),o?.(e.relationships)},[l,a,o]),p=K(),m=tt(),h=m.count>0?Array.from(m.selectedIds)[0]:null,g=nt(),_=rt({minZoom:.25,maxZoom:3,zoomStep:.1}),v=ft(),[y,b]=(0,G.useState)(!0),[x,S]=(0,G.useState)(!0),[C,w]=(0,G.useState)(null),[T,E]=(0,G.useState)(``),[D,O]=(0,G.useState)(null),[k,A]=(0,G.useState)(``),j=(0,G.useRef)(null),N=(0,G.useCallback)(()=>{if(i)return;let e=l.current,t={id:`entity-${Date.now()}`,name:`new_entity_${e.entities.length+1}`,label:`New Entity ${e.entities.length+1}`,fields:[{name:`id`,type:`uuid`,primaryKey:!0,required:!0},{name:`created_at`,type:`datetime`,required:!0},{name:`updated_at`,type:`datetime`,required:!0}],position:{x:50+e.entities.length%4*280,y:50+Math.floor(e.entities.length/4)*250}},n={entities:[...e.entities,t],relationships:e.relationships};f(n),m.selectOne(t.id),v?.sendOperation({type:`insert`,userId:v?.currentUserId??``,elementId:t.id,data:{name:t.name,label:t.label}})},[i,l,f,m,v]),F=(0,G.useCallback)(async e=>{if(i)return;let t=u.find(t=>t.id===e);if(!await p.confirm(`Delete Entity`,`Are you sure you want to delete "${t?.label??e}"? This action cannot be undone.`))return;let n=l.current,r={entities:n.entities.filter(t=>t.id!==e),relationships:n.relationships.filter(t=>t.sourceEntity!==e&&t.targetEntity!==e)};f(r),m.isSelected(e)&&m.clearSelection(),v?.sendOperation({type:`delete`,userId:v?.currentUserId??``,elementId:e,data:{}})},[i,u,p,l,f,m,v]),I=(0,G.useCallback)(async()=>{if(i||m.count===0)return;let e=Array.from(m.selectedIds);if(!await p.confirm(`Delete Entities`,`Are you sure you want to delete ${e.length} selected entity(s)? This action cannot be undone.`))return;let t=l.current,n=new Set(e),r={entities:t.entities.filter(e=>!n.has(e.id)),relationships:t.relationships.filter(e=>!n.has(e.sourceEntity)&&!n.has(e.targetEntity))};f(r),m.clearSelection()},[i,m,p,l,f]),L=(0,G.useCallback)(()=>{if(i)return;let e=l.current,t={entities:vt(e.entities),relationships:e.relationships};f(t)},[i,l,f]),ne=(0,G.useCallback)(()=>{let e=u.filter(e=>m.isSelected(e.id));e.length>0&&g.copy(e)},[u,m,g]),z=(0,G.useCallback)(()=>{if(i)return;let e=g.paste();if(!e||e.length===0)return;let t=l.current,n=e.map((e,t)=>({...e,id:`entity-${Date.now()}-${t}`,name:`${e.name}_copy`,label:`${e.label} (Copy)`,position:{x:e.position.x+30,y:e.position.y+30}})),r={entities:[...t.entities,...n],relationships:t.relationships};f(r),m.selectMany(n.map(e=>e.id))},[i,g,l,f,m]),re=(0,G.useCallback)(e=>{if(i)return;let t=l.current,n={entities:t.entities.map(t=>{if(t.id!==e)return t;let n={name:`field_${t.fields.length+1}`,type:`text`,required:!1};return{...t,fields:[...t.fields,n]}}),relationships:t.relationships};f(n)},[i,l,f]),ie=(0,G.useCallback)((e,t,n)=>{i||(w({entityId:e,fieldIndex:t}),E(n))},[i]),B=(0,G.useCallback)(()=>{if(!C)return;let e=T.trim();if(e===``){w(null);return}let t=l.current,n={entities:t.entities.map(t=>{if(t.id!==C.entityId)return t;let n=t.fields.map((t,n)=>n===C.fieldIndex?{...t,name:e}:t);return{...t,fields:n}}),relationships:t.relationships};f(n),w(null)},[C,T,l,f]),V=(0,G.useCallback)(()=>{w(null)},[]),ae=(0,G.useCallback)((e,t)=>{i||(O(e),A(t))},[i]),oe=(0,G.useCallback)(()=>{if(!D)return;let e=k.trim();if(e===``){O(null);return}let t=l.current,n={entities:t.entities.map(t=>t.id===D?{...t,label:e}:t),relationships:t.relationships};f(n),O(null)},[D,k,l,f]),ce=(0,G.useCallback)(()=>{O(null)},[]),le=(0,G.useCallback)((e,t,n)=>{if(i)return;let r=l.current,a={entities:r.entities.map(r=>{if(r.id!==e)return r;let i=r.fields.map((e,r)=>r===t?{...e,type:n}:e);return{...r,fields:i}}),relationships:r.relationships};f(a)},[i,l,f]),H=(0,G.useCallback)((e,t)=>{if(i||!u.find(e=>e.id===t))return;let n=e.target.getBoundingClientRect();j.current={entityId:t,offsetX:e.clientX-n.left,offsetY:e.clientY-n.top},e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t)},[i,u]),ue=(0,G.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},[]),de=(0,G.useCallback)(e=>{if(e.preventDefault(),!j.current)return;let t=e.currentTarget.getBoundingClientRect(),n=_.zoom,r=(e.clientX-t.left-_.panOffset.x)/n-j.current.offsetX,i=(e.clientY-t.top-_.panOffset.y)/n-j.current.offsetY,a=l.current,o={entities:a.entities.map(e=>e.id===j.current.entityId?{...e,position:{x:Math.max(0,Math.round(r)),y:Math.max(0,Math.round(i))}}:e),relationships:a.relationships};f(o),j.current=null},[_.zoom,_.panOffset,l,f]),U=h?u.find(e=>e.id===h):null,pe=U?[{name:`name`,label:`Name`,type:`text`,value:U.name,group:`General`},{name:`label`,label:`Label`,type:`text`,value:U.label,group:`General`},{name:`description`,label:`Description`,type:`textarea`,value:U.description??``,group:`General`},{name:`color`,label:`Color`,type:`color`,value:U.color??`#3b82f6`,group:`Appearance`},{name:`position.x`,label:`X Position`,type:`number`,value:U.position.x,group:`Position`},{name:`position.y`,label:`Y Position`,type:`number`,value:U.position.y,group:`Position`}]:[],me=(0,G.useCallback)((e,t)=>{if(!h)return;let n=l.current,r={entities:n.entities.map(n=>n.id===h?e===`position.x`?{...n,position:{...n.position,x:Number(t)}}:e===`position.y`?{...n,position:{...n.position,y:Number(t)}}:{...n,[e]:t}:n),relationships:n.relationships};f(r)},[h,l,f]);(0,G.useEffect)(()=>{let e=c.current;if(!e)return;let t=e=>{let t=e.target.tagName;if(t===`INPUT`||t===`TEXTAREA`||t===`SELECT`)return;let n=e.ctrlKey||e.metaKey;n&&e.key===`z`?(e.preventDefault(),l.undo()):n&&(e.key===`y`||e.shiftKey&&e.key===`Z`)?(e.preventDefault(),l.redo()):n&&e.key===`c`?(e.preventDefault(),ne()):n&&e.key===`v`?(e.preventDefault(),z()):(e.key===`Delete`||e.key===`Backspace`)&&m.count>0?(e.preventDefault(),I()):e.key===`Escape`&&(m.clearSelection(),w(null),O(null))};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[l,ne,z,I,m]);let he=u.map(e=>({id:e.id,x:e.position.x,y:e.position.y,width:240,height:40+e.fields.length*24,color:e.color,selected:m.isSelected(e.id)}));return(0,q.jsxs)(`div`,{ref:c,tabIndex:0,className:gt(`flex h-full w-full border rounded-lg overflow-hidden bg-background`,s),children:[(0,q.jsxs)(`div`,{className:`flex flex-col flex-1 min-w-0`,children:[(0,q.jsxs)(`div`,{role:`toolbar`,"aria-label":`Designer toolbar`,className:`flex items-center gap-2 p-2 border-b bg-muted/20 flex-wrap`,children:[(0,q.jsx)(R,{className:`h-4 w-4`}),(0,q.jsx)(`span`,{className:`font-medium text-sm`,children:`Data Model Designer`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1 ml-2 border-l pl-2`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:()=>l.undo(),disabled:!l.canUndo,"aria-label":`Undo`,title:`Undo (Ctrl+Z)`,className:`p-1 rounded hover:bg-accent disabled:opacity-40`,children:(0,q.jsx)(Ue,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>l.redo(),disabled:!l.canRedo,"aria-label":`Redo`,title:`Redo (Ctrl+Y)`,className:`p-1 rounded hover:bg-accent disabled:opacity-40`,children:(0,q.jsx)(je,{className:`h-3.5 w-3.5`})})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1 border-l pl-2`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:_.zoomOut,"aria-label":`Zoom Out`,title:`Zoom Out`,className:`p-1 rounded hover:bg-accent`,children:(0,q.jsx)(qe,{className:`h-3.5 w-3.5`})}),(0,q.jsxs)(`span`,{className:`text-xs tabular-nums w-10 text-center`,children:[Math.round(_.zoom*100),`%`]}),(0,q.jsx)(`button`,{type:`button`,onClick:_.zoomIn,"aria-label":`Zoom In`,title:`Zoom In`,className:`p-1 rounded hover:bg-accent`,children:(0,q.jsx)(Je,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`button`,{type:`button`,onClick:_.resetZoom,"aria-label":`Reset Zoom`,title:`Reset Zoom`,className:`p-1 rounded hover:bg-accent`,children:(0,q.jsx)(Me,{className:`h-3 w-3`})})]}),!i&&(0,q.jsxs)(`div`,{className:`flex items-center gap-1 border-l pl-2`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:ne,disabled:m.count===0,"aria-label":`Copy`,title:`Copy (Ctrl+C)`,className:`p-1 rounded hover:bg-accent disabled:opacity-40`,children:(0,q.jsx)(te,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`button`,{type:`button`,onClick:z,disabled:!g.hasContent,"aria-label":`Paste`,title:`Paste (Ctrl+V)`,className:`p-1 rounded hover:bg-accent disabled:opacity-40`,children:(0,q.jsx)(ee,{className:`h-3.5 w-3.5`})})]}),!i&&(0,q.jsxs)(`button`,{type:`button`,onClick:L,"aria-label":`Auto Layout`,title:`Auto Layout`,className:`flex items-center gap-1 px-2 py-1 text-xs rounded border hover:bg-accent`,children:[(0,q.jsx)(se,{className:`h-3 w-3`}),` Auto Layout`]}),(0,q.jsx)(`div`,{className:`flex-1`}),v?.isConnected&&(0,q.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,role:`status`,"aria-label":`Collaboration active`,children:[(0,q.jsx)(Ge,{className:`h-3 w-3`}),(0,q.jsxs)(`span`,{children:[v.users.length,` user`,v.users.length===1?``:`s`]})]}),m.count>1&&(0,q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[m.count,` selected`]}),!i&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,onClick:N,"aria-label":`Add Entity`,className:`flex items-center gap-1 px-2 py-1 text-xs rounded bg-primary text-primary-foreground hover:bg-primary/90`,children:[(0,q.jsx)(ke,{className:`h-3 w-3`}),` Add Entity`]}),(0,q.jsxs)(`button`,{type:`button`,"aria-label":`Add Relationship`,title:`Add Relationship (coming soon)`,className:`flex items-center gap-1 px-2 py-1 text-xs rounded bg-secondary text-secondary-foreground hover:bg-secondary/80`,children:[(0,q.jsx)(fe,{className:`h-3 w-3`}),` Add Relationship`]})]})]}),(0,q.jsxs)(`div`,{role:`region`,"aria-label":`Canvas`,className:`flex-1 overflow-auto bg-muted/10 p-4 relative`,onWheel:_.handleWheel,onMouseDown:_.startPan,onDragOver:ue,onDrop:de,children:[(0,q.jsxs)(`div`,{className:`relative`,style:{width:n.width,minHeight:n.height,..._.transformStyle,backgroundImage:n.showGrid?`radial-gradient(circle, hsl(var(--border)) 1px, transparent 1px)`:void 0,backgroundSize:n.showGrid?`20px 20px`:void 0},children:[(0,q.jsx)(`svg`,{className:`absolute inset-0 pointer-events-none`,width:n.width,height:n.height,children:d.map(e=>{let t=u.find(t=>t.id===e.sourceEntity),n=u.find(t=>t.id===e.targetEntity);return!t||!n?null:(0,q.jsxs)(`g`,{children:[(0,q.jsx)(`line`,{x1:t.position.x+120,y1:t.position.y+50,x2:n.position.x+120,y2:n.position.y+50,stroke:`hsl(var(--primary))`,strokeWidth:`2`,strokeDasharray:e.type===`many-to-many`?`5,5`:void 0}),r&&e.label&&(0,q.jsx)(`text`,{x:(t.position.x+n.position.x)/2+120,y:(t.position.y+n.position.y)/2+50-8,textAnchor:`middle`,className:`text-xs fill-muted-foreground`,children:e.label})]},e.id)})}),u.length===0&&(0,q.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-muted-foreground text-sm`,children:`No entities in the model. Click 'Add Entity' to create your first entity.`}),u.map(e=>(0,q.jsxs)(`div`,{role:`group`,"aria-label":e.label,draggable:!i,onDragStart:t=>H(t,e.id),className:gt(`absolute rounded-lg border-2 bg-background shadow-sm w-60 select-none cursor-grab active:cursor-grabbing`,m.isSelected(e.id)?`border-primary ring-2 ring-primary/20`:`border-border hover:border-primary/50`),style:{left:e.position.x,top:e.position.y},onClick:t=>m.toggle(e.id,t.shiftKey),children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-t-lg font-medium text-sm`,style:{backgroundColor:e.color??`hsl(var(--primary) / 0.1)`},children:[(0,q.jsx)(R,{className:`h-3.5 w-3.5`}),D===e.id?(0,q.jsx)(`input`,{type:`text`,value:k,onChange:e=>A(e.target.value),onBlur:oe,onKeyDown:e=>{e.key===`Enter`&&oe(),e.key===`Escape`&&ce()},className:`text-sm font-medium px-1 py-0 border rounded bg-background w-32 focus:outline-none focus:ring-1 focus:ring-primary`,autoFocus:!0,onClick:e=>e.stopPropagation(),"data-testid":`entity-label-input-${e.id}`}):(0,q.jsx)(`span`,{className:`truncate cursor-text`,onDoubleClick:t=>{t.stopPropagation(),ae(e.id,e.label)},title:`Double-click to edit label`,"data-testid":`entity-label-${e.id}`,children:e.label}),!i&&(0,q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),F(e.id)},"aria-label":`Delete ${e.label}`,className:`ml-auto p-0.5 rounded hover:bg-destructive/20`,children:(0,q.jsx)(W,{className:`h-3 w-3 text-destructive`})})]}),(0,q.jsx)(`div`,{className:`px-3 py-1 divide-y`,children:e.fields.map((t,n)=>(0,q.jsxs)(`div`,{className:`flex items-center gap-2 py-1 text-xs`,children:[C&&C.entityId===e.id&&C.fieldIndex===n?(0,q.jsx)(`input`,{type:`text`,value:T,onChange:e=>E(e.target.value),onBlur:B,onKeyDown:e=>{e.key===`Enter`&&B(),e.key===`Escape`&&V()},className:`font-mono text-xs px-1 py-0 border rounded bg-background w-24 focus:outline-none focus:ring-1 focus:ring-primary`,autoFocus:!0,onClick:e=>e.stopPropagation()}):(0,q.jsxs)(`span`,{className:gt(`font-mono cursor-text`,t.primaryKey&&`font-bold text-primary`),onClick:r=>{r.stopPropagation(),ie(e.id,n,t.name)},title:`Click to edit field name`,children:[t.primaryKey&&(0,q.jsx)(`span`,{className:`text-[0.65rem] font-semibold text-primary mr-0.5`,children:`PK`}),t.name]}),i?(0,q.jsx)(`span`,{className:`text-muted-foreground ml-auto`,children:t.type}):(0,q.jsx)(`select`,{value:t.type,onChange:t=>{t.stopPropagation(),le(e.id,n,t.target.value)},onClick:e=>e.stopPropagation(),className:`text-xs text-muted-foreground ml-auto bg-transparent border-none focus:ring-1 focus:ring-primary rounded cursor-pointer p-0`,"data-testid":`field-type-${e.id}-${n}`,children:_t.map(e=>(0,q.jsx)(`option`,{value:e,children:e},e))}),t.required&&(0,q.jsx)(`span`,{className:`text-destructive`,children:`*`})]},`${t.name}-${n}`))}),!i&&(0,q.jsx)(`div`,{className:`px-3 py-1 border-t`,children:(0,q.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),re(e.id)},"aria-label":`Add field to ${e.label}`,className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground w-full py-0.5`,children:[(0,q.jsx)(ke,{className:`h-3 w-3`}),` Add Field`]})})]},e.id))]}),x&&u.length>0&&(0,q.jsx)(ut,{items:he,canvasWidth:n.width,canvasHeight:n.height,position:`bottom-right`,size:150})]})]}),(0,q.jsxs)(`div`,{className:`w-64 border-l flex flex-col bg-background shrink-0`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>b(e=>!e),className:`flex items-center gap-1 px-3 py-2 text-xs font-medium text-muted-foreground hover:bg-accent/50 border-b`,"aria-expanded":y,"aria-controls":`property-editor-panel`,children:[y?(0,q.jsx)(M,{className:`h-3 w-3`}):(0,q.jsx)(P,{className:`h-3 w-3`}),`Properties`]}),y&&(0,q.jsx)(`div`,{id:`property-editor-panel`,className:`flex-1 overflow-y-auto`,children:(0,q.jsx)(st,{title:U?U.label:`Properties`,fields:pe,onChange:me})})]}),(0,q.jsx)(`div`,{className:`border-t`,children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>S(e=>!e),className:`flex items-center gap-1 px-3 py-2 text-xs font-medium text-muted-foreground hover:bg-accent/50 w-full`,"aria-expanded":x,children:[x?(0,q.jsx)(M,{className:`h-3 w-3`}):(0,q.jsx)(P,{className:`h-3 w-3`}),`Minimap`]})})]}),(0,q.jsx)(at,{isOpen:p.isOpen,title:p.title,message:p.message,onConfirm:p.onConfirm,onCancel:p.onCancel,destructive:!0})]})}function bt(...e){return x(S(e))}var xt=120,St=50;function Ct(e,t){if(e.length===0)return e;let n=new Map,r=new Map;for(let t of e)n.set(t.id,0),r.set(t.id,[]);for(let e of t)n.set(e.target,(n.get(e.target)??0)+1),r.get(e.source)?.push(e.target);let i=[],a=new Set,o=e.filter(e=>(n.get(e.id)??0)===0).map(e=>e.id);for(o.length===0&&(o=[e[0].id]);o.length>0;){i.push(o);for(let e of o)a.add(e);let e=new Set;for(let t of o)for(let n of r.get(t)??[])a.has(n)||e.add(n);o=Array.from(e)}let s=e.filter(e=>!a.has(e.id)).map(e=>e.id);s.length>0&&i.push(s);let c=new Map;for(let e=0;e<i.length;e++){let t=i[e];for(let n=0;n<t.length;n++)c.set(t[n],{x:80+e*200,y:80+n*100})}return e.map(e=>({...e,position:c.get(e.id)??e.position}))}function wt({processName:e=`New Process`,nodes:t=[],edges:n=[],lanes:r,canvas:i={width:1400,height:800,showGrid:!0},showMinimap:a=!0,showToolbar:o=!0,readOnly:s=!1,onNodesChange:c,onEdgesChange:l,className:u}){let d=et({nodes:t,edges:n},{maxHistory:50}),f=d.current.nodes,p=d.current.edges,m=(0,G.useCallback)((e,t)=>{d.push({nodes:e,edges:t}),c?.(e),l?.(t)},[d,c,l]),h=K(),g=tt(),_=nt(),v=rt({initialZoom:1}),y=ft(),[b,x]=(0,G.useState)(null),[S,C]=(0,G.useState)(!1),[w,T]=(0,G.useState)(null),[E,D]=(0,G.useState)(null),[O,k]=(0,G.useState)(!0),[A,j]=(0,G.useState)(null),[M,N]=(0,G.useState)({x:0,y:0}),P=(0,G.useRef)(null),F=(0,G.useRef)(c),I=(0,G.useRef)(l);F.current=c,I.current=l,(0,G.useEffect)(()=>{F.current?.(f),I.current?.(p)},[d.current]);let L=(0,G.useCallback)((e,t)=>{if(s)return;let n={id:`node-${Date.now()}`,type:e,label:t,position:{x:200+f.length*160,y:200}},r=[...f,n];m(r,p),x(n.id),g.selectOne(n.id),y?.sendOperation({type:`insert`,elementId:n.id,data:{label:t},userId:y.currentUserId??``})},[f,p,s,m,g,y]),R=(0,G.useCallback)(async e=>{if(s)return;let t=f.find(t=>t.id===e);if(!await h.confirm(`Delete Node`,`Are you sure you want to delete "${t?.label??e}"? This will also remove all connected edges.`))return;let n=f.filter(t=>t.id!==e),r=p.filter(t=>t.source!==e&&t.target!==e);m(n,r),b===e&&x(null),g.clearSelection(),y?.sendOperation({type:`delete`,elementId:e,data:{},userId:y.currentUserId??``})},[f,p,b,s,m,h,g,y]),z=(0,G.useCallback)(async()=>{if(s||g.count===0||!await h.confirm(`Delete Selected Nodes`,`Are you sure you want to delete ${g.count} selected node(s) and their connected edges?`))return;let e=g.selectedIds,t=f.filter(t=>!e.has(t.id)),n=p.filter(t=>!e.has(t.source)&&!e.has(t.target));m(t,n),x(null),g.clearSelection()},[f,p,s,m,h,g]),re=(0,G.useCallback)(()=>{let e=g.count>0?g.selectedIds:b?new Set([b]):new Set;if(e.size===0)return;let t=f.filter(t=>e.has(t.id));_.copy(t)},[f,b,g,_]),ie=(0,G.useCallback)(()=>{if(s)return;let e=_.paste();if(!e||e.length===0)return;let t=e.map(e=>({...e,id:`node-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,position:{x:e.position.x+40,y:e.position.y+40}})),n=[...f,...t];m(n,p),g.selectMany(t.map(e=>e.id)),x(t[0].id)},[s,f,p,_,m,g]),B=(0,G.useCallback)(()=>{C(e=>!e||(T(null),!1))},[]),V=(0,G.useCallback)(e=>{if(!S)return!1;if(!w)return T(e),!0;if(w===e)return!0;let t={id:`edge-${Date.now()}`,source:w,target:e},n=[...p,t];return m(f,n),T(null),C(!1),y?.sendOperation({type:`insert`,elementId:t.id,data:{source:w,target:e},userId:y.currentUserId??``}),!0},[S,w,f,p,m,y]),oe=(0,G.useCallback)(()=>{if(s||f.length===0)return;let e=Ct(f,p);m(e,p)},[f,p,s,m]),se=(0,G.useCallback)((e,t)=>{if(s||!f.find(e=>e.id===t))return;j(t);let n=e.target.getBoundingClientRect();N({x:e.clientX-n.left,y:e.clientY-n.top}),e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t)},[s,f]),ce=(0,G.useCallback)(e=>{if(e.preventDefault(),s||!A)return;let t=e.currentTarget.getBoundingClientRect(),n=v.zoom,r=(e.clientX-t.left-v.panOffset.x)/n-M.x,i=(e.clientY-t.top-v.panOffset.y)/n-M.y,a=Math.max(0,Math.round(r/20)*20),o=Math.max(0,Math.round(i/20)*20),c=f.map(e=>e.id===A?{...e,position:{x:a,y:o}}:e);m(c,p),j(null)},[s,A,M,f,p,v.zoom,v.panOffset,m]),le=(0,G.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},[]),H=(0,G.useMemo)(()=>f.find(e=>e.id===b)??null,[f,b]),ue=(0,G.useMemo)(()=>H?[{name:`label`,label:`Name`,type:`text`,value:H.label,group:`General`},{name:`type`,label:`Type`,type:`select`,value:H.type,options:[{label:`Start Event`,value:`start-event`},{label:`End Event`,value:`end-event`},{label:`User Task`,value:`user-task`},{label:`Service Task`,value:`service-task`},{label:`Script Task`,value:`script-task`},{label:`Exclusive Gateway`,value:`exclusive-gateway`},{label:`Parallel Gateway`,value:`parallel-gateway`},{label:`Inclusive Gateway`,value:`inclusive-gateway`}],group:`General`},{name:`description`,label:`Description`,type:`textarea`,value:H.description??``,group:`General`}]:[],[H]),de=(0,G.useCallback)((e,t)=>{if(s||!b)return;let n=f.map(n=>n.id===b?{...n,[e]:t}:n);m(n,p)},[s,b,f,p,m]),fe=e=>{switch(e){case`start-event`:return`rounded-full bg-green-100 border-green-500 text-green-700`;case`end-event`:return`rounded-full bg-red-100 border-red-500 text-red-700`;case`exclusive-gateway`:case`parallel-gateway`:case`inclusive-gateway`:case`event-based-gateway`:return`rotate-45 bg-yellow-100 border-yellow-500 text-yellow-700`;case`user-task`:return`rounded bg-blue-100 border-blue-500 text-blue-700`;case`service-task`:case`script-task`:return`rounded bg-purple-100 border-purple-500 text-purple-700`;default:return`rounded bg-gray-100 border-gray-500 text-gray-700`}},pe=(0,G.useMemo)(()=>f.map(e=>({id:e.id,x:e.position.x,y:e.position.y,width:xt,height:St,selected:g.isSelected(e.id)||e.id===b})),[f,g,b]);(0,G.useEffect)(()=>{let e=P.current;if(!e)return;let t=e=>{let t=e.target?.tagName;if(t===`INPUT`||t===`TEXTAREA`||t===`SELECT`)return;let n=e.ctrlKey||e.metaKey;if(n&&e.key===`z`&&!e.shiftKey){e.preventDefault(),d.undo();return}if(n&&e.key===`y`||n&&e.key===`z`&&e.shiftKey){e.preventDefault(),d.redo();return}if(n&&e.key===`c`){e.preventDefault(),re();return}if(n&&e.key===`v`){e.preventDefault(),ie();return}if(e.key===`Delete`||e.key===`Backspace`){g.count>0?(e.preventDefault(),z()):b&&(e.preventDefault(),R(b));return}if(e.key===`Escape`){S?(C(!1),T(null)):(x(null),g.clearSelection());return}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[b,S,g,d,re,ie,R,z]);let me=(0,G.useCallback)(e=>{e.target===e.currentTarget&&(x(null),g.clearSelection(),S&&(C(!1),T(null)))},[S,g]);return(0,q.jsxs)(`div`,{ref:P,tabIndex:0,className:bt(`flex flex-col h-full w-full border rounded-lg overflow-hidden bg-background`,u),children:[(0,q.jsx)(at,{isOpen:h.isOpen,title:h.title,message:h.message,onConfirm:h.onConfirm,onCancel:h.onCancel,destructive:!0}),o&&(0,q.jsxs)(`div`,{className:`flex items-center gap-2 p-2 border-b bg-muted/20`,role:`toolbar`,"aria-label":`Process toolbar`,children:[(0,q.jsx)(ae,{className:`h-4 w-4`}),(0,q.jsx)(`span`,{className:`font-medium text-sm`,"aria-label":`Process name`,children:e}),y?.isConnected&&(0,q.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,role:`status`,"aria-label":`Collaboration active`,children:[(0,q.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full bg-green-500`}),y.users.length,` user`,y.users.length===1?``:`s`]}),(0,q.jsx)(`div`,{className:`flex-1`}),!s&&(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:()=>d.undo(),disabled:!d.canUndo,className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent disabled:opacity-40`,title:`Undo (Ctrl+Z)`,"aria-label":`Undo`,children:(0,q.jsx)(Ue,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>d.redo(),disabled:!d.canRedo,className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent disabled:opacity-40`,title:`Redo (Ctrl+Y)`,"aria-label":`Redo`,children:(0,q.jsx)(je,{className:`h-3 w-3`})}),(0,q.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`}),(0,q.jsx)(`button`,{type:`button`,onClick:re,disabled:g.count===0&&!b,className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent disabled:opacity-40`,title:`Copy (Ctrl+C)`,"aria-label":`Copy`,children:(0,q.jsx)(te,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{type:`button`,onClick:ie,disabled:!_.hasContent,className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent disabled:opacity-40`,title:`Paste (Ctrl+V)`,"aria-label":`Paste`,children:(0,q.jsx)(ee,{className:`h-3 w-3`})}),(0,q.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`}),(0,q.jsxs)(`button`,{type:`button`,onClick:B,className:bt(`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,S&&`bg-primary text-primary-foreground`),title:`Connect nodes`,"aria-label":`Connect nodes`,"aria-pressed":S,children:[(0,q.jsx)(U,{className:`h-3 w-3`}),` Connect`]}),(0,q.jsxs)(`button`,{type:`button`,onClick:oe,className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,title:`Auto layout`,"aria-label":`Auto layout`,children:[(0,q.jsx)(Te,{className:`h-3 w-3`}),` Layout`]}),(0,q.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`}),(0,q.jsx)(`button`,{type:`button`,onClick:v.zoomIn,className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,title:`Zoom in`,"aria-label":`Zoom in`,children:(0,q.jsx)(Je,{className:`h-3 w-3`})}),(0,q.jsxs)(`span`,{className:`text-xs tabular-nums min-w-[3ch] text-center`,"aria-label":`Zoom level`,children:[Math.round(v.zoom*100),`%`]}),(0,q.jsx)(`button`,{type:`button`,onClick:v.zoomOut,className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,title:`Zoom out`,"aria-label":`Zoom out`,children:(0,q.jsx)(qe,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{type:`button`,onClick:v.resetZoom,className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,title:`Reset zoom`,"aria-label":`Reset zoom`,children:(0,q.jsx)(Me,{className:`h-3 w-3`})}),(0,q.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`}),(0,q.jsxs)(`button`,{type:`button`,onClick:()=>L(`start-event`,`Start`),className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,title:`Add Start Event`,"aria-label":`Add Start Event`,children:[(0,q.jsx)(Oe,{className:`h-3 w-3 text-green-600`}),` Start`]}),(0,q.jsxs)(`button`,{type:`button`,onClick:()=>L(`user-task`,`User Task`),className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,title:`Add User Task`,"aria-label":`Add User Task`,children:[(0,q.jsx)(Fe,{className:`h-3 w-3 text-blue-600`}),` Task`]}),(0,q.jsxs)(`button`,{type:`button`,onClick:()=>L(`exclusive-gateway`,`Decision`),className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,title:`Add Gateway`,"aria-label":`Add Gateway`,children:[(0,q.jsx)(ne,{className:`h-3 w-3 text-yellow-600`}),` Gateway`]}),(0,q.jsxs)(`button`,{type:`button`,onClick:()=>L(`end-event`,`End`),className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,title:`Add End Event`,"aria-label":`Add End Event`,children:[(0,q.jsx)(Fe,{className:`h-3 w-3 text-red-600`}),` End`]}),(0,q.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>k(e=>!e),className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,title:O?`Hide properties`:`Show properties`,"aria-label":O?`Hide property panel`:`Show property panel`,"aria-expanded":O,children:O?(0,q.jsx)(Ce,{className:`h-3 w-3`}):(0,q.jsx)(we,{className:`h-3 w-3`})})]})]}),(0,q.jsxs)(`div`,{className:`flex flex-1 overflow-hidden`,children:[(0,q.jsx)(`div`,{className:`flex-1 overflow-auto bg-muted/10 p-4`,role:`region`,"aria-label":`Process canvas`,onWheel:v.handleWheel,onMouseDown:v.startPan,children:(0,q.jsxs)(`div`,{className:`relative`,style:{...v.transformStyle,width:i.width,minHeight:i.height,backgroundImage:i.showGrid?`radial-gradient(circle, hsl(var(--border)) 1px, transparent 1px)`:void 0,backgroundSize:i.showGrid?`20px 20px`:void 0},onClick:me,onDrop:ce,onDragOver:le,children:[(0,q.jsxs)(`svg`,{className:`absolute inset-0 pointer-events-none`,width:i.width,height:i.height,children:[(0,q.jsx)(`defs`,{children:(0,q.jsx)(`marker`,{id:`arrowhead`,markerWidth:`10`,markerHeight:`7`,refX:`10`,refY:`3.5`,orient:`auto`,children:(0,q.jsx)(`polygon`,{points:`0 0, 10 3.5, 0 7`,fill:`hsl(var(--foreground))`})})}),p.map(e=>{let t=f.find(t=>t.id===e.source),n=f.find(t=>t.id===e.target);if(!t||!n)return null;t.position.x+xt/2;let r=t.position.y+St/2;n.position.x+xt/2;let i=n.position.y+St/2,a=t.position.x+xt,o=r,s=n.position.x,c=i,l=`M ${a} ${o} Q ${(a+s)/2} ${o}, ${(a+s)/2} ${(o+c)/2} T ${s} ${c}`;return(0,q.jsxs)(`g`,{children:[(0,q.jsx)(`path`,{d:l,fill:`none`,stroke:`hsl(var(--foreground) / 0.5)`,strokeWidth:`2`,markerEnd:`url(#arrowhead)`}),e.label&&(0,q.jsx)(`text`,{x:(a+s)/2,y:(o+c)/2-8,textAnchor:`middle`,className:`text-[10px] fill-muted-foreground`,children:e.label})]},e.id)})]}),f.length===0&&(0,q.jsx)(`div`,{className:`flex items-center justify-center h-full min-h-[200px] text-muted-foreground text-sm`,children:`No nodes in the process. Use the toolbar buttons to add start events, tasks, gateways, and end events.`}),f.map(e=>{let t=g.isSelected(e.id)||b===e.id,n=w===e.id,r=E===e.id,i=S||r;return(0,q.jsxs)(`div`,{className:`absolute select-none`,style:{left:e.position.x,top:e.position.y},role:`group`,"aria-label":e.label,draggable:!s&&!S,onDragStart:t=>se(t,e.id),onMouseEnter:()=>D(e.id),onMouseLeave:()=>D(null),onClick:t=>{V(e.id)||(t.shiftKey?g.toggle(e.id,!0):(x(e.id),g.selectOne(e.id)))},children:[(0,q.jsx)(`div`,{className:bt(`flex items-center justify-center border-2 min-w-[120px] min-h-[50px] px-3 py-2 transition-shadow`,fe(e.type),t&&`ring-2 ring-primary shadow-md`,n&&`ring-2 ring-blue-400 shadow-lg`,S&&!n&&`cursor-crosshair`),children:(0,q.jsx)(`span`,{className:bt(`text-xs font-medium`,(e.type===`exclusive-gateway`||e.type===`parallel-gateway`||e.type===`inclusive-gateway`||e.type===`event-based-gateway`)&&`-rotate-45`),children:e.label})}),i&&!s&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`absolute w-3 h-3 rounded-full bg-blue-500 border-2 border-white shadow cursor-crosshair`,style:{left:-6,top:St/2-6},title:`Input port`,onClick:t=>{t.stopPropagation(),V(e.id)}}),(0,q.jsx)(`div`,{className:`absolute w-3 h-3 rounded-full bg-blue-500 border-2 border-white shadow cursor-crosshair`,style:{right:-6,top:St/2-6},title:`Output port`,onClick:t=>{t.stopPropagation(),S?V(e.id):(C(!0),T(e.id))}}),(0,q.jsx)(`div`,{className:`absolute w-3 h-3 rounded-full bg-blue-400 border-2 border-white shadow cursor-crosshair`,style:{left:xt/2-6,top:-6},title:`Port`,onClick:t=>{t.stopPropagation(),V(e.id)}}),(0,q.jsx)(`div`,{className:`absolute w-3 h-3 rounded-full bg-blue-400 border-2 border-white shadow cursor-crosshair`,style:{left:xt/2-6,bottom:-6},title:`Port`,onClick:t=>{t.stopPropagation(),V(e.id)}})]}),!s&&t&&!S&&(0,q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),R(e.id)},className:`absolute -top-2 -right-2 p-0.5 rounded-full bg-destructive text-destructive-foreground shadow`,"aria-label":`Delete node`,children:(0,q.jsx)(W,{className:`h-3 w-3`})})]},e.id)}),a&&f.length>0&&(0,q.jsx)(ut,{items:pe,canvasWidth:i.width??1400,canvasHeight:i.height??800,position:`bottom-right`})]})}),O&&!s&&(0,q.jsx)(`div`,{className:`w-64 border-l bg-background overflow-y-auto shrink-0`,role:`complementary`,"aria-label":`Property panel`,children:(0,q.jsx)(st,{title:H?`Properties: ${H.label}`:`Properties`,fields:ue,onChange:de})})]})]})}function Y(...e){return x(S(e))}var X={untitledReport:`Untitled Report`,reportCanvas:`Report canvas`,properties:`Properties`,propertiesPanel:`Properties panel`,designerToolbar:`Report designer toolbar`,selectElementPrompt:`Select an element to edit its properties`,addElementsPrompt:`Add elements using the buttons above`,addText:`Add Text`,addField:`Add Field`,addImage:`Add Image`,addChart:`Add Chart`,addTable:`Add Table`,undo:`Undo`,undoShortcut:`Undo (Ctrl+Z)`,redo:`Redo`,redoShortcut:`Redo (Ctrl+Shift+Z)`,copy:`Copy`,copyShortcut:`Copy (Ctrl+C)`,paste:`Paste`,pasteShortcut:`Paste (Ctrl+V)`,deleteSelected:`Delete selected`,deleteElement:`Delete element`,deleteElementsTitle:`Delete elements`,deleteElementMessage:e=>`Are you sure you want to delete ${e} element${e>1?`s`:``}?`,collapsePanel:`Collapse panel`,expandPanel:`Expand panel`,collaborationConnected:`Connected`,sectionHeader:`Report Header`,sectionPageHeader:`Page Header`,sectionGroupHeader:`Group Header`,sectionDetail:`Detail`,sectionGroupFooter:`Group Footer`,sectionPageFooter:`Page Footer`,sectionFooter:`Report Footer`,elementText:`Text`,elementImage:`🖼 Image`,elementChart:`📊 Chart`,elementTable:`📋 Table`,propLabel:`Label`,propX:`X`,propY:`Y`,propWidth:`Width`,propHeight:`Height`,propText:`Text`,propField:`Field`,groupPosition:`Position`,groupSize:`Size`,groupContent:`Content`,groupGeneral:`General`},Tt={A4:{width:595,height:842},A3:{width:842,height:1191},Letter:{width:612,height:792},Legal:{width:612,height:1008},Tabloid:{width:792,height:1224}},Et=[{type:`header`,height:80,elements:[]},{type:`detail`,height:400,elements:[],repeat:!0},{type:`footer`,height:60,elements:[]}];function Dt({reportName:e=X.untitledReport,objectName:t,pageSize:n=`A4`,orientation:r=`portrait`,margins:i={top:40,right:40,bottom:40,left:40},sections:a=[],showToolbar:o=!0,showPropertyPanel:s=!0,readOnly:c=!1,onSectionsChange:l,className:u}){let d=et(a.length>0?a:Et),f=d.current,p=(0,G.useCallback)(e=>{d.push(e),l?.(e)},[d,l]),m=tt(),h=(0,G.useMemo)(()=>{let e=Array.from(m.selectedIds);return e.length>0?e[0]:null},[m.selectedIds]),g=nt(),_=K(),v=ft(),y=(0,G.useCallback)(e=>{v&&v.sendOperation({...e,userId:v.currentUserId??``})},[v]),[b,x]=(0,G.useState)(!0),S=(0,G.useRef)(null),C=(0,G.useRef)(null),w=Tt[n],T=r===`landscape`?w.height:w.width,E=r===`landscape`?w.width:w.height,D=e=>{switch(e){case`header`:return X.sectionHeader;case`page-header`:return X.sectionPageHeader;case`group-header`:return X.sectionGroupHeader;case`detail`:return X.sectionDetail;case`group-footer`:return X.sectionGroupFooter;case`page-footer`:return X.sectionPageFooter;case`footer`:return X.sectionFooter;default:return e}},k=(0,G.useMemo)(()=>h?f.flatMap(e=>e.elements).find(e=>e.id===h):null,[h,f]),A=(0,G.useCallback)((e,t)=>{if(c)return;let n={id:`elem-${Date.now()}`,type:t,position:{x:i.left,y:10,width:200,height:30},properties:{text:t===`text`?`New Text`:void 0,field:t===`field`?`field_name`:void 0}},r=f.map((t,r)=>r===e?{...t,elements:[...t.elements,n]}:t);p(r),m.selectOne(n.id),y({type:`insert`,elementId:n.id,data:{element:n}})},[f,i.left,c,p,m,y]),j=(0,G.useCallback)(e=>{if(c)return;let t=f.map(t=>({...t,elements:t.elements.filter(t=>t.id!==e)}));p(t),m.isSelected(e)&&m.clearSelection(),y({type:`delete`,elementId:e,data:{}})},[f,c,p,m,y]),M=(0,G.useCallback)(async()=>{if(c||m.count===0||!await _.confirm(X.deleteElementsTitle,X.deleteElementMessage(m.count)))return;let e=m.selectedIds,t=f.map(t=>({...t,elements:t.elements.filter(t=>!e.has(t.id))}));p(t),m.clearSelection(),e.forEach(e=>{y({type:`delete`,elementId:e,data:{}})})},[c,m,_,f,p,y]),N=(0,G.useCallback)((e,t)=>{if(c||!h)return;let n=f.map(n=>({...n,elements:n.elements.map(n=>n.id===h?e===`x`?{...n,position:{...n.position,x:Number(t)}}:e===`y`?{...n,position:{...n.position,y:Number(t)}}:e===`width`?{...n,position:{...n.position,width:Number(t)}}:e===`height`?{...n,position:{...n.position,height:Number(t)}}:{...n,properties:{...n.properties,[e]:t}}:n)}));p(n),y({type:`update`,elementId:h,data:{[e]:t}})},[c,h,f,p,y]),P=(0,G.useCallback)(()=>{let e=m.selectedIds;if(e.size===0)return;let t=f.flatMap(e=>e.elements).filter(t=>e.has(t.id));g.copy(t)},[m,f,g]),F=(0,G.useCallback)(()=>{if(c)return;let e=g.paste();if(!e||e.length===0)return;let t=0,n=e.map(e=>({...e,id:`elem-${Date.now()}-${++t}-${Math.random().toString(36).slice(2,7)}`,position:{...e.position,x:e.position.x+20,y:e.position.y+20}})),r=f.findIndex(e=>e.type===`detail`),i=r>=0?r:0,a=f.map((e,t)=>t===i?{...e,elements:[...e.elements,...n]}:e);p(a),m.selectMany(n.map(e=>e.id)),n.forEach(e=>{y({type:`insert`,elementId:e.id,data:{element:e}})})},[c,g,f,p,m,y]),I=(0,G.useCallback)((e,t,n)=>{c||(S.current={id:t.id,sectionIndex:n,startX:e.clientX,startY:e.clientY},e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t.id))},[c]),L=(0,G.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},[]),R=(0,G.useCallback)((e,t)=>{e.preventDefault();let n=S.current;if(!n||c)return;let r=e.clientX-n.startX,i=e.clientY-n.startY;if(n.sectionIndex===t){let e=f.map((e,a)=>a===t?{...e,elements:e.elements.map(e=>e.id===n.id?{...e,position:{...e.position,x:Math.max(0,e.position.x+r),y:Math.max(0,(typeof e.position.y==`number`?e.position.y:0)+i)}}:e)}:e);p(e)}else{let e=null,i=f.map((t,i)=>{if(i!==n.sectionIndex)return t;let a=t.elements.find(e=>e.id===n.id);return a&&(e={...a,position:{...a.position,x:Math.max(0,a.position.x+r),y:10}}),{...t,elements:t.elements.filter(e=>e.id!==n.id)}});if(e){let n=i.map((n,r)=>r===t?{...n,elements:[...n.elements,e]}:n);p(n)}}y({type:`move`,elementId:n.id,data:{}}),S.current=null},[c,f,p,y]),ne=(0,G.useMemo)(()=>{if(!k)return[];let e=[{name:`x`,label:X.propX,type:`number`,value:k.position.x,group:X.groupPosition},{name:`y`,label:X.propY,type:`number`,value:k.position.y,group:X.groupPosition},{name:`width`,label:X.propWidth,type:`number`,value:k.position.width,group:X.groupSize},{name:`height`,label:X.propHeight,type:`number`,value:k.position.height,group:X.groupSize}];return k.type===`text`&&e.push({name:`text`,label:X.propText,type:`text`,value:k.properties.text??``,group:X.groupContent}),k.type===`field`&&e.push({name:`field`,label:X.propField,type:`text`,value:k.properties.field??``,group:X.groupContent}),e},[k]);return(0,G.useEffect)(()=>{let e=C.current;if(!e)return;let t=e=>{let t=[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.target.tagName),n=e.ctrlKey||e.metaKey;if((e.key===`Delete`||e.key===`Backspace`)&&m.count>0&&!t){e.preventDefault(),M();return}if(e.key===`Escape`){m.clearSelection();return}if(!t){if(n&&e.key===`z`&&!e.shiftKey&&!c){e.preventDefault(),d.undo();return}if(n&&(e.key===`z`&&e.shiftKey||e.key===`y`)&&!c){e.preventDefault(),d.redo();return}if(n&&e.key===`c`){e.preventDefault(),P();return}if(n&&e.key===`v`&&!c){e.preventDefault(),F();return}if(n&&e.key===`a`){e.preventDefault();let t=f.flatMap(e=>e.elements).map(e=>e.id);m.selectMany(t);return}}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[m,M,c,d,P,F,f]),(0,q.jsxs)(`div`,{ref:C,tabIndex:0,className:Y(`flex h-full w-full border rounded-lg overflow-hidden bg-background`,u),children:[(0,q.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0`,children:[o&&(0,q.jsxs)(`div`,{role:`toolbar`,"aria-label":X.designerToolbar,className:`flex items-center gap-2 p-2 border-b bg-muted/20`,children:[(0,q.jsx)(B,{className:`h-4 w-4`}),(0,q.jsx)(`span`,{className:`font-medium text-sm`,children:e}),t&&(0,q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,t,`)`]}),!c&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`w-px h-5 bg-border mx-1`}),(0,q.jsx)(`button`,{type:`button`,className:Y(`p-1.5 rounded hover:bg-accent`,!d.canUndo&&`opacity-40 pointer-events-none`),title:X.undoShortcut,"aria-label":X.undo,disabled:!d.canUndo,onClick:()=>d.undo(),children:(0,q.jsx)(Ue,{className:`h-4 w-4`})}),(0,q.jsx)(`button`,{type:`button`,className:Y(`p-1.5 rounded hover:bg-accent`,!d.canRedo&&`opacity-40 pointer-events-none`),title:X.redoShortcut,"aria-label":X.redo,disabled:!d.canRedo,onClick:()=>d.redo(),children:(0,q.jsx)(je,{className:`h-4 w-4`})}),(0,q.jsx)(`div`,{className:`w-px h-5 bg-border mx-1`})]}),!c&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`button`,{type:`button`,className:Y(`p-1.5 rounded hover:bg-accent`,m.count===0&&`opacity-40 pointer-events-none`),title:X.copyShortcut,"aria-label":X.copy,disabled:m.count===0,onClick:P,children:(0,q.jsx)(te,{className:`h-4 w-4`})}),(0,q.jsx)(`button`,{type:`button`,className:Y(`p-1.5 rounded hover:bg-accent`,!g.hasContent&&`opacity-40 pointer-events-none`),title:X.pasteShortcut,"aria-label":X.paste,disabled:!g.hasContent,onClick:F,children:(0,q.jsx)(ee,{className:`h-4 w-4`})}),(0,q.jsx)(`div`,{className:`w-px h-5 bg-border mx-1`})]}),!c&&(0,q.jsx)(`button`,{type:`button`,className:Y(`p-1.5 rounded hover:bg-accent`,m.count===0&&`opacity-40 pointer-events-none`),title:X.deleteSelected,"aria-label":X.deleteSelected,disabled:m.count===0,onClick:M,children:(0,q.jsx)(W,{className:`h-4 w-4`})}),(0,q.jsx)(`div`,{className:`flex-1`}),v?.isConnected&&(0,q.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,q.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full bg-green-500`}),X.collaborationConnected,v.users.length>1&&` (${v.users.length})`]}),(0,q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[n,` `,r]}),s&&(0,q.jsx)(`button`,{type:`button`,className:`p-1.5 rounded hover:bg-accent`,title:b?X.collapsePanel:X.expandPanel,"aria-label":b?X.collapsePanel:X.expandPanel,onClick:()=>x(e=>!e),children:(0,q.jsx)(Ce,{className:Y(`h-4 w-4`,!b&&`rotate-180`)})})]}),(0,q.jsx)(`div`,{role:`region`,"aria-label":X.reportCanvas,className:`flex-1 overflow-auto bg-muted/10 p-4 flex justify-center`,children:(0,q.jsx)(`div`,{className:`bg-white shadow-lg border`,style:{width:T,minHeight:E},children:f.map((e,t)=>(0,q.jsxs)(`div`,{className:`relative border-b border-dashed border-gray-300`,style:{minHeight:e.height},onDragOver:L,onDrop:e=>R(e,t),children:[(0,q.jsxs)(`div`,{className:`absolute left-0 top-0 px-2 py-0.5 bg-muted text-xs text-muted-foreground border-r border-b rounded-br`,children:[D(e.type),e.repeat&&` ↻`]}),!c&&(0,q.jsxs)(`div`,{className:`absolute right-1 top-0 flex items-center gap-0.5`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:()=>A(t,`text`),className:`p-0.5 rounded hover:bg-accent`,title:X.addText,"aria-label":X.addText,children:(0,q.jsx)(He,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>A(t,`field`),className:`p-0.5 rounded hover:bg-accent`,title:X.addField,"aria-label":X.addField,children:(0,q.jsx)(ke,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>A(t,`image`),className:`p-0.5 rounded hover:bg-accent`,title:X.addImage,"aria-label":X.addImage,children:(0,q.jsx)(H,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>A(t,`chart`),className:`p-0.5 rounded hover:bg-accent`,title:X.addChart,"aria-label":X.addChart,children:(0,q.jsx)(O,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>A(t,`table`),className:`p-0.5 rounded hover:bg-accent`,title:X.addTable,"aria-label":X.addTable,children:(0,q.jsx)(Re,{className:`h-3 w-3`})})]}),(0,q.jsxs)(`div`,{className:`relative`,style:{minHeight:e.height,paddingTop:24},children:[e.elements.length===0&&(0,q.jsx)(`div`,{className:`text-xs text-muted-foreground text-center pt-4`,children:X.addElementsPrompt}),e.elements.map(e=>{let n=m.isSelected(e.id);return(0,q.jsxs)(`div`,{draggable:!c,onDragStart:n=>I(n,e,t),className:Y(`absolute border rounded px-2 py-1 text-xs cursor-pointer`,n?`border-primary ring-1 ring-primary/30 bg-primary/5`:`border-dashed border-gray-400 hover:border-primary/50`),style:{left:e.position.x,top:(typeof e.position.y==`number`?e.position.y:0)+24,width:e.position.width,height:e.position.height},onClick:t=>m.toggle(e.id,t.shiftKey),children:[(0,q.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.type===`text`&&(e.properties.text??X.elementText),e.type===`field`&&`{${e.properties.field??`field`}}`,e.type===`image`&&X.elementImage,e.type===`chart`&&X.elementChart,e.type===`table`&&X.elementTable]}),!c&&n&&(0,q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),j(e.id)},className:`absolute -top-2 -right-2 p-0.5 rounded-full bg-destructive text-destructive-foreground shadow`,"aria-label":X.deleteElement,children:(0,q.jsx)(W,{className:`h-2.5 w-2.5`})})]},e.id)})]})]},`${e.type}-${t}`))})})]}),s&&(0,q.jsx)(`div`,{role:`region`,"aria-label":X.propertiesPanel,className:Y(`border-l bg-muted/30 flex flex-col transition-[width] duration-200`,b?`w-56`:`w-0 overflow-hidden`),children:b&&(h&&k?(0,q.jsx)(st,{title:`${X.properties} – ${k.type}`,fields:ne,onChange:N}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`p-3 border-b font-medium text-sm`,children:X.properties}),(0,q.jsx)(`div`,{className:`flex-1 overflow-y-auto p-3`,children:(0,q.jsx)(`div`,{className:`text-xs text-muted-foreground text-center py-4`,children:X.selectElementPrompt})})]}))}),(0,q.jsx)(at,{isOpen:_.isOpen,title:_.title,message:_.message,onConfirm:_.onConfirm,onCancel:_.onCancel})]})}var Z=_({"appDesigner.basicInfo":`Basic Info`,"appDesigner.objects":`Objects`,"appDesigner.navigation":`Navigation`,"appDesigner.branding":`Branding`,"appDesigner.stepBasicDesc":`Name, title, and icon`,"appDesigner.stepObjectsDesc":`Select business objects`,"appDesigner.stepNavigationDesc":`Build navigation tree`,"appDesigner.stepBrandingDesc":`Logo, colors, and favicon`,"appDesigner.appName":`App Name`,"appDesigner.appTitle":`Title`,"appDesigner.appDescription":`Description`,"appDesigner.appIcon":`Icon`,"appDesigner.template":`Template`,"appDesigner.snakeCaseHint":`Must be snake_case (e.g. my_app)`,"appDesigner.searchObjects":`Search objects…`,"appDesigner.selectAll":`Select All`,"appDesigner.deselectAll":`Deselect All`,"appDesigner.noObjectsFound":`No objects found.`,"appDesigner.addGroup":`Add Group`,"appDesigner.addUrl":`Add URL`,"appDesigner.addSeparator":`Add Separator`,"appDesigner.noNavItemsHint":`No navigation items yet. Select objects in the previous step or add items manually.`,"appDesigner.separatorLabel":`— Separator —`,"appDesigner.newGroup":`New Group`,"appDesigner.newLink":`New Link`,"appDesigner.logoUrl":`Logo URL`,"appDesigner.primaryColor":`Primary Color`,"appDesigner.faviconUrl":`Favicon URL`,"appDesigner.preview":`Preview`,"common.cancel":`Cancel`,"common.back":`Back`,"common.next":`Next`,"common.close":`Close`,"appDesigner.complete":`Complete`,"appDesigner.saveDraft":`Save Draft`,"appDesigner.cancelConfirmTitle":`Discard changes?`,"appDesigner.cancelConfirmMessage":`You have unsaved changes. Are you sure you want to cancel?`,"appDesigner.confirmDiscard":`Discard`,"appDesigner.keepEditing":`Keep Editing`,"appDesigner.navNoItems":`No navigation items. Click buttons above to add items.`,"appDesigner.navNoPreviewItems":`No items`,"appDesigner.navLivePreview":`Live Preview`,"appDesigner.navCollapseGroup":`Collapse group`,"appDesigner.navExpandGroup":`Expand group`,"appDesigner.navAddChild":`Add child`,"appDesigner.navMoveUp":`Move up`,"appDesigner.navMoveDown":`Move down`,"appDesigner.navRemove":`Remove`,"appDesigner.navObjectPage":`Object Page`,"appDesigner.navDashboard":`Dashboard`,"appDesigner.navPage":`Page`,"appDesigner.navReport":`Report`,"appDesigner.navGroup":`Group`,"appDesigner.navUrl":`URL`,"appDesigner.navSeparator":`Separator`,"appDesigner.navTypeObject":`Object`,"appDesigner.navTypeDashboard":`Dashboard`,"appDesigner.navTypePage":`Page`,"appDesigner.navTypeReport":`Report`,"appDesigner.navTypeUrl":`URL`,"appDesigner.navTypeGroup":`Group`,"appDesigner.navTypeSeparator":`Separator`,"appDesigner.navTypeAction":`Action`,"appDesigner.navTypeComponent":`Component`,"appDesigner.navTypeDoc":`Doc`,"appDesigner.navEditIcon":`Edit icon`,"appDesigner.navToggleVisible":`Toggle visibility`,"appDesigner.navHidden":`Hidden`,"appDesigner.navExportSchema":`Export JSON`,"appDesigner.navImportSchema":`Import JSON`,"appDesigner.navExportSuccess":`Navigation schema exported`,"appDesigner.navImportSuccess":`Navigation schema imported`,"appDesigner.navImportError":`Invalid navigation JSON`,"appDesigner.navIconPlaceholder":`Icon name (e.g. Users)`,"appDesigner.dashboardEditor":`Dashboard Editor`,"appDesigner.noWidgets":`No widgets. Click a button above to add one.`,"appDesigner.widgetLayoutSize":`Layout Size`,"appDesigner.widgetWidth":`Width`,"appDesigner.widgetHeight":`Height`,"appDesigner.dashboardPreview":`Dashboard Preview`,"appDesigner.noWidgetsPreview":`No widgets to preview`,"appDesigner.widgetProperties":`Widget Properties`,"appDesigner.addWidget":`Add Widget`,"appDesigner.modeEdit":`Edit`,"appDesigner.pageCanvasEditor":`Page Canvas Editor`,"appDesigner.emptyPage":`Empty page. Click a button above to add a component.`,"appDesigner.pagePreview":`Page Preview`,"appDesigner.noComponentsPreview":`No components to preview`,"appDesigner.modePage":`Page`,"appDesigner.modeDashboard":`Dashboard`,"appDesigner.undo":`Undo`,"appDesigner.redo":`Redo`,"appDesigner.brandingEditor":`Branding Editor`,"appDesigner.brandingExport":`Export JSON`,"appDesigner.brandingImport":`Import JSON`,"appDesigner.brandingPreview":`Preview`,"appDesigner.brandingSampleButton":`Sample Button`,"appDesigner.brandingSampleText":`This is how your brand theme will look.`,"appDesigner.colorPalette":`Color Palette`,"appDesigner.fontFamily":`Font Family`,"appDesigner.fontDefault":`Default (System)`,"appDesigner.modeLight":`Light`,"appDesigner.modeDark":`Dark`,"appDesigner.mobilePreview":`Mobile Preview`,"appDesigner.objectManager.title":`Object Manager`,"appDesigner.objectManager.addObject":`New Object`,"appDesigner.objectManager.searchPlaceholder":`Search objects…`,"appDesigner.objectManager.noObjects":`No objects found.`,"appDesigner.objectManager.objectName":`API Name`,"appDesigner.objectManager.objectLabel":`Label`,"appDesigner.objectManager.pluralLabel":`Plural Label`,"appDesigner.objectManager.icon":`Icon`,"appDesigner.objectManager.selectIcon":`Select icon…`,"appDesigner.objectManager.group":`Group`,"appDesigner.objectManager.noGroup":`No Group`,"appDesigner.objectManager.sortOrder":`Sort Order`,"appDesigner.objectManager.relationships":`Relationships`,"appDesigner.objectManager.systemBadge":`System`,"appDesigner.objectManager.fieldCount":`{{count}} fields`,"appDesigner.objectManager.ungrouped":`Ungrouped`,"appDesigner.objectManager.deleteConfirmTitle":`Delete Object?`,"appDesigner.objectManager.deleteConfirmMessage":`This will permanently delete the object and all its fields. This action cannot be undone.`,"appDesigner.fieldDesigner.title":`Field Designer`,"appDesigner.fieldDesigner.addField":`New Field`,"appDesigner.fieldDesigner.searchPlaceholder":`Search fields…`,"appDesigner.fieldDesigner.allTypes":`All Types`,"appDesigner.fieldDesigner.noFields":`No fields found.`,"appDesigner.fieldDesigner.fieldName":`API Name`,"appDesigner.fieldDesigner.fieldLabel":`Label`,"appDesigner.fieldDesigner.fieldType":`Type`,"appDesigner.fieldDesigner.fieldGroup":`Group`,"appDesigner.fieldDesigner.description":`Description`,"appDesigner.fieldDesigner.required":`Required`,"appDesigner.fieldDesigner.unique":`Unique`,"appDesigner.fieldDesigner.readOnly":`Read Only`,"appDesigner.fieldDesigner.hidden":`Hidden`,"appDesigner.fieldDesigner.externalId":`External ID`,"appDesigner.fieldDesigner.trackHistory":`Track History`,"appDesigner.fieldDesigner.defaultValue":`Default Value`,"appDesigner.fieldDesigner.placeholder":`Placeholder`,"appDesigner.fieldDesigner.referenceTo":`Reference To`,"appDesigner.fieldDesigner.options":`Options`,"appDesigner.fieldDesigner.addOption":`Add Option`,"appDesigner.fieldDesigner.validationRules":`Validation Rules`,"appDesigner.fieldDesigner.addRule":`Add Rule`,"appDesigner.fieldDesigner.systemBadge":`System`,"appDesigner.fieldDesigner.ungrouped":`General`,"appDesigner.fieldDesigner.deleteConfirmTitle":`Delete Field?`,"appDesigner.fieldDesigner.deleteConfirmMessage":`This will permanently delete the field. Existing data in this field will be lost.`,"appDesigner.fieldDesigner.basicSection":`Basic`,"appDesigner.fieldDesigner.typeSpecificSection":`Type Settings`,"appDesigner.fieldDesigner.advancedSection":`Advanced`,"appDesigner.fieldDesigner.typeCategory.text":`Text`,"appDesigner.fieldDesigner.typeCategory.number":`Number`,"appDesigner.fieldDesigner.typeCategory.date":`Date & Time`,"appDesigner.fieldDesigner.typeCategory.choice":`Choice`,"appDesigner.fieldDesigner.typeCategory.relation":`Relation`,"appDesigner.fieldDesigner.typeCategory.advanced":`Advanced`,"common.edit":`Edit`,"common.delete":`Delete`},`appDesigner.basicInfo`);function Q(...e){return x(S(e))}var Ot={name:``,title:``,description:``,icon:``,template:``,objects:[],navigation:[],branding:{logo:``,primaryColor:`#3b82f6`,favicon:``}};function kt(e){let t=e.pluralLabel?.trim().toLowerCase();if(!t)return;let n=e=>typeof e==`string`&&e.trim().toLowerCase()===t;return n(e.label)||n(e.name)?void 0:e.pluralLabel}function At(e){return e.filter(e=>e.selected).map(e=>{let t=kt(e);return{id:e.name,type:`object`,...t?{label:t}:{},icon:e.icon,objectName:e.name}})}function jt(e){let t=new Set,n=e=>{for(let r of e)r.type===`object`&&r.objectName?t.add(r.objectName):r.type===`group`&&r.children&&n(r.children)};return n(e),t}function Mt(e,t){let n=!1,r=[];for(let i of e){if(i.type===`object`&&i.objectName&&t.has(i.objectName)){n=!0;continue}if(i.type===`group`&&i.children){let e=Mt(i.children,t);if(e!==i.children){n=!0,r.push({...i,children:e});continue}}r.push(i)}return n?r:e}function Nt(e,t){let n=Mt(e,new Set(t.filter(e=>!e.selected).map(e=>e.name))),r=jt(n),i=At(t.filter(e=>!r.has(e.name)));return i.length===0?n:[...n,...i]}var Pt=0;function Ft(e){return Pt+=1,`${e}_${Date.now()}_${Pt}`}function It({steps:e,currentIndex:t,onStepClick:n}){return(0,q.jsx)(`nav`,{className:`flex items-center justify-center gap-0 px-4 py-6`,children:e.map((e,r)=>{let i=r<t,a=r===t;return(0,q.jsxs)(G.Fragment,{children:[r>0&&(0,q.jsx)(`div`,{className:Q(`h-0.5 w-12 sm:w-20`,i?`bg-blue-500`:`bg-gray-200`)}),(0,q.jsxs)(`button`,{type:`button`,"data-testid":`wizard-step-${e.id}`,onClick:()=>n(r),className:Q(`flex flex-col items-center gap-1 outline-none focus-visible:ring-2 focus-visible:ring-blue-400 rounded-lg px-2 py-1`,a&&`cursor-default`,!a&&`cursor-pointer`),children:[(0,q.jsx)(`div`,{className:Q(`flex h-8 w-8 items-center justify-center rounded-full text-sm font-semibold transition-colors`,i&&`bg-blue-500 text-white`,a&&`bg-blue-600 text-white ring-2 ring-blue-300`,!i&&!a&&`bg-gray-200 text-gray-500`),children:i?(0,q.jsx)(j,{className:`h-4 w-4`}):r+1}),(0,q.jsx)(`span`,{className:Q(`text-xs font-medium`,a?`text-blue-600`:`text-gray-500`),children:e.label})]})]},e.id)})})}function Lt({draft:e,templates:t,readOnly:n,onChange:r,t:i}){let a=e.name.length>0&&!p(e.name);return(0,q.jsxs)(`div`,{"data-testid":`wizard-step-basic-content`,className:`mx-auto max-w-lg space-y-5`,children:[(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsxs)(`label`,{htmlFor:`app-name`,className:`block text-sm font-medium text-gray-700`,children:[i(`appDesigner.appName`),(0,q.jsx)(`span`,{className:`text-red-500`,"aria-hidden":`true`,"data-required-marker":`true`,children:` *`})]}),(0,q.jsx)(`input`,{id:`app-name`,"data-testid":`app-name-input`,"aria-required":`true`,type:`text`,value:e.name,onChange:e=>r({name:e.target.value}),placeholder:`my_app`,disabled:n,className:Q(`block w-full rounded-md border px-3 py-2 text-sm shadow-sm outline-none transition-colors`,`focus:border-blue-500 focus:ring-1 focus:ring-blue-500`,`disabled:cursor-not-allowed disabled:bg-gray-50`,a?`border-red-400`:`border-gray-300`)}),a&&(0,q.jsx)(`p`,{className:`text-xs text-red-500`,children:i(`appDesigner.snakeCaseHint`)})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsxs)(`label`,{htmlFor:`app-title`,className:`block text-sm font-medium text-gray-700`,children:[i(`appDesigner.appTitle`),(0,q.jsx)(`span`,{className:`text-red-500`,"aria-hidden":`true`,"data-required-marker":`true`,children:` *`})]}),(0,q.jsx)(`input`,{id:`app-title`,"data-testid":`app-title-input`,"aria-required":`true`,type:`text`,value:e.title,onChange:e=>r({title:e.target.value}),placeholder:`My Application`,disabled:n,className:`block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50`})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{htmlFor:`app-description`,className:`block text-sm font-medium text-gray-700`,children:i(`appDesigner.appDescription`)}),(0,q.jsx)(`textarea`,{id:`app-description`,"data-testid":`app-description-input`,value:e.description??``,onChange:e=>r({description:e.target.value}),rows:3,disabled:n,className:`block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50 resize-none`})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{htmlFor:`app-icon`,className:`block text-sm font-medium text-gray-700`,children:i(`appDesigner.appIcon`)}),(0,q.jsx)(`input`,{id:`app-icon`,type:`text`,value:e.icon??``,onChange:e=>r({icon:e.target.value}),placeholder:`LayoutDashboard`,disabled:n,className:`block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50`})]}),t.length>0&&(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{htmlFor:`app-template`,className:`block text-sm font-medium text-gray-700`,children:i(`appDesigner.template`)}),(0,q.jsxs)(`select`,{id:`app-template`,value:e.template??``,onChange:e=>r({template:e.target.value}),disabled:n,className:`block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50`,children:[(0,q.jsx)(`option`,{value:``,children:`None`}),t.map(e=>(0,q.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]})]})}function Rt({objects:e,readOnly:t,onToggle:n,onToggleAll:r,search:i,onSearchChange:a,t:o}){let s=(0,G.useMemo)(()=>{if(!i)return e;let t=i.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(t)||e.label.toLowerCase().includes(t))},[e,i]),c=e.length>0&&e.every(e=>e.selected);return e.every(e=>!e.selected),(0,q.jsxs)(`div`,{"data-testid":`wizard-step-objects-content`,className:`mx-auto max-w-2xl space-y-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsxs)(`div`,{className:`relative flex-1`,children:[(0,q.jsx)(Ne,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-gray-400`}),(0,q.jsx)(`input`,{"data-testid":`object-search`,type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:o(`appDesigner.searchObjects`),className:`block w-full rounded-md border border-gray-300 py-2 pl-9 pr-3 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500`})]}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>r(!c),disabled:t,className:`rounded-md border border-gray-300 px-3 py-2 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,children:o(c?`appDesigner.deselectAll`:`appDesigner.selectAll`)})]}),s.length===0?(0,q.jsx)(`p`,{className:`py-8 text-center text-sm text-gray-400`,children:o(`appDesigner.noObjectsFound`)}):(0,q.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3`,children:s.map(e=>(0,q.jsxs)(`button`,{type:`button`,"data-testid":`object-card-${e.name}`,disabled:t,onClick:()=>n(e.name),className:Q(`flex flex-col items-start gap-1 rounded-lg border-2 p-3 text-left transition-colors`,e.selected?`border-blue-500 bg-blue-50`:`border-gray-200 hover:border-gray-300`,t&&`pointer-events-none opacity-60`),children:[(0,q.jsxs)(`div`,{className:`flex w-full items-center justify-between`,children:[(0,q.jsx)(`span`,{className:`text-sm font-medium text-gray-800`,children:e.label}),(0,q.jsx)(`div`,{className:Q(`flex h-5 w-5 items-center justify-center rounded border transition-colors`,e.selected?`border-blue-500 bg-blue-500 text-white`:`border-gray-300`),children:e.selected&&(0,q.jsx)(j,{className:`h-3 w-3`})})]}),(0,q.jsx)(`span`,{className:`text-xs text-gray-500`,children:e.name}),e.icon&&(0,q.jsx)(`span`,{className:`text-xs text-gray-400`,children:e.icon})]},e.name))})]})}var zt={object:`bg-green-100 text-green-700`,group:`bg-purple-100 text-purple-700`,url:`bg-sky-100 text-sky-700`,separator:`bg-gray-100 text-gray-600`,dashboard:`bg-amber-100 text-amber-700`,page:`bg-teal-100 text-teal-700`,report:`bg-rose-100 text-rose-700`,action:`bg-orange-100 text-orange-700`};function Bt({items:e,objects:t,readOnly:n,onAdd:r,onRemove:i,onReorder:a,t:o}){let s=new Map(t.map(e=>[e.name,e.label])),c=e=>e.kind===`object`?s.get(e.objectName):void 0;return(0,q.jsxs)(`div`,{"data-testid":`wizard-step-navigation-content`,className:`mx-auto max-w-lg space-y-4`,children:[(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsxs)(`button`,{type:`button`,"data-testid":`add-group-btn`,onClick:()=>r(`group`),disabled:n,className:`inline-flex items-center gap-1.5 rounded-md border border-gray-300 px-3 py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,q.jsx)(V,{className:`h-3.5 w-3.5`}),o(`appDesigner.addGroup`)]}),(0,q.jsxs)(`button`,{type:`button`,"data-testid":`add-url-btn`,onClick:()=>r(`url`),disabled:n,className:`inline-flex items-center gap-1.5 rounded-md border border-gray-300 px-3 py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,q.jsx)(U,{className:`h-3.5 w-3.5`}),o(`appDesigner.addUrl`)]}),(0,q.jsxs)(`button`,{type:`button`,"data-testid":`add-separator-btn`,onClick:()=>r(`separator`),disabled:n,className:`inline-flex items-center gap-1.5 rounded-md border border-gray-300 px-3 py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,q.jsx)(ve,{className:`h-3.5 w-3.5`}),o(`appDesigner.addSeparator`)]})]}),e.length===0?(0,q.jsx)(`p`,{className:`py-8 text-center text-sm text-gray-400`,children:o(`appDesigner.noNavItemsHint`)}):(0,q.jsx)(`ul`,{className:`space-y-1.5`,children:e.map((t,r)=>(0,q.jsxs)(`li`,{"data-testid":`nav-item-${t.id}`,className:`flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2`,children:[t.icon&&(0,q.jsx)(`span`,{className:`text-xs text-gray-400`,children:t.icon}),(0,q.jsx)(`span`,{className:`flex-1 truncate text-sm text-gray-800`,children:t.type===`separator`?o(`appDesigner.separatorLabel`):Ze(t,void 0,c)}),(0,q.jsx)(`span`,{className:Q(`rounded-full px-2 py-0.5 text-[10px] font-medium`,zt[t.type]??`bg-gray-100 text-gray-600`),children:t.type}),(0,q.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:()=>a(t.id,`up`),disabled:n||r===0,className:`rounded p-0.5 text-gray-400 transition-colors hover:text-gray-700 disabled:opacity-30`,"aria-label":`Move up`,children:(0,q.jsx)(F,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>a(t.id,`down`),disabled:n||r===e.length-1,className:`rounded p-0.5 text-gray-400 transition-colors hover:text-gray-700 disabled:opacity-30`,"aria-label":`Move down`,children:(0,q.jsx)(M,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>i(t.id),disabled:n,className:`rounded p-0.5 text-gray-400 transition-colors hover:text-red-500 disabled:opacity-30`,"aria-label":`Remove`,children:(0,q.jsx)(W,{className:`h-3.5 w-3.5`})})]})]},t.id))})]})}function Vt({branding:e,title:t,readOnly:n,onChange:r,t:i}){return(0,q.jsxs)(`div`,{"data-testid":`wizard-step-branding-content`,className:`mx-auto max-w-lg space-y-5`,children:[(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{htmlFor:`branding-logo`,className:`block text-sm font-medium text-gray-700`,children:i(`appDesigner.logoUrl`)}),(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(H,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-gray-400`}),(0,q.jsx)(`input`,{id:`branding-logo`,"data-testid":`branding-logo-input`,type:`text`,value:e.logo??``,onChange:e=>r({logo:e.target.value}),placeholder:`https://example.com/logo.svg`,disabled:n,className:`block w-full rounded-md border border-gray-300 py-2 pl-9 pr-3 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50`})]})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{htmlFor:`branding-color`,className:`block text-sm font-medium text-gray-700`,children:i(`appDesigner.primaryColor`)}),(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(xe,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-gray-400`}),(0,q.jsx)(`input`,{id:`branding-color`,"data-testid":`branding-color-input`,type:`text`,value:e.primaryColor??`#3b82f6`,onChange:e=>r({primaryColor:e.target.value}),placeholder:`#3b82f6`,disabled:n,className:`block w-full rounded-md border border-gray-300 py-2 pl-9 pr-3 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50`})]})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{htmlFor:`branding-favicon`,className:`block text-sm font-medium text-gray-700`,children:i(`appDesigner.faviconUrl`)}),(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(oe,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-gray-400`}),(0,q.jsx)(`input`,{id:`branding-favicon`,"data-testid":`branding-favicon-input`,type:`text`,value:e.favicon??``,onChange:e=>r({favicon:e.target.value}),placeholder:`https://example.com/favicon.ico`,disabled:n,className:`block w-full rounded-md border border-gray-300 py-2 pl-9 pr-3 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50`})]})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`span`,{className:`block text-sm font-medium text-gray-700`,children:i(`appDesigner.preview`)}),(0,q.jsxs)(`div`,{className:`rounded-lg border border-gray-200 bg-white p-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.logo?(0,q.jsx)(`img`,{src:e.logo,alt:`App logo`,className:`h-8 w-8 rounded object-contain`}):(0,q.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded bg-gray-100 text-xs text-gray-400`,children:`Logo`}),(0,q.jsx)(`span`,{className:`text-sm font-semibold text-gray-800`,children:t||i(`appDesigner.appTitle`)})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,q.jsx)(`div`,{className:`h-4 w-4 rounded-full border border-gray-200`,style:{backgroundColor:e.primaryColor||`#3b82f6`}}),(0,q.jsx)(`span`,{className:`text-xs text-gray-500`,children:e.primaryColor||`#3b82f6`})]}),e.favicon&&(0,q.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,q.jsx)(`img`,{src:e.favicon,alt:`Favicon`,className:`h-4 w-4 rounded object-contain`}),(0,q.jsx)(`span`,{className:`text-xs text-gray-500`,children:`Favicon`})]})]})]})]})}function Ht({availableObjects:e=[],templates:t=[],initialDraft:n,onComplete:r,onCancel:i,onSaveDraft:a,readOnly:o=!1,className:s}){let{t:c}=Z(),l=K(),[u,d]=(0,G.useState)(0),[f,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(()=>({...Ot,objects:e.map(e=>({...e})),...n})),_=(0,G.useMemo)(()=>[{id:`basic`,label:c(`appDesigner.basicInfo`),description:c(`appDesigner.stepBasicDesc`),icon:`Settings`},{id:`objects`,label:c(`appDesigner.objects`),description:c(`appDesigner.stepObjectsDesc`),icon:`Database`},{id:`navigation`,label:c(`appDesigner.navigation`),description:c(`appDesigner.stepNavigationDesc`),icon:`Menu`},{id:`branding`,label:c(`appDesigner.branding`),description:c(`appDesigner.stepBrandingDesc`),icon:`Palette`}],[c]),v=u===0,y=u===_.length-1,b=(0,G.useMemo)(()=>h.name.length>0&&p(h.name)&&h.title.trim().length>0,[h.name,h.title]),x=(0,G.useMemo)(()=>u!==0||b,[u,b]),S=(0,G.useCallback)(e=>{g(t=>({...t,...e}))},[]),C=(0,G.useCallback)(e=>{g(t=>({...t,branding:{...t.branding,...e}}))},[]),w=(0,G.useCallback)(e=>{g(t=>({...t,objects:t.objects.map(t=>t.name===e?{...t,selected:!t.selected}:t)}))},[]),T=(0,G.useCallback)(e=>{g(t=>({...t,objects:t.objects.map(t=>({...t,selected:e}))}))},[]),E=(0,G.useCallback)(e=>{let t=e===`separator`?{id:Ft(e),type:e}:e===`group`?{id:Ft(e),type:e,label:`New Group`,children:[]}:{id:Ft(e),type:e,label:`New Link`,url:``};g(e=>({...e,navigation:[...e.navigation,t]}))},[]),D=(0,G.useCallback)(e=>{g(t=>({...t,navigation:t.navigation.filter(t=>t.id!==e)}))},[]),O=(0,G.useCallback)((e,t)=>{g(n=>{let r=[...n.navigation],i=r.findIndex(t=>t.id===e);if(i<0)return n;let a=t===`up`?i-1:i+1;return a<0||a>=r.length?n:([r[i],r[a]]=[r[a],r[i]],{...n,navigation:r})})},[]),k=(0,G.useCallback)(()=>{y||(u===1&&g(e=>({...e,navigation:Nt(e.navigation,e.objects)})),d(e=>e+1))},[u,y]),A=(0,G.useCallback)(()=>{v||d(e=>e-1)},[v]),M=(0,G.useCallback)(()=>{r?.(h)},[h,r]),F=(0,G.useCallback)(async()=>{(h.name.length>0||h.title.length>0)&&i?await l.confirm(c(`appDesigner.cancelConfirmTitle`),c(`appDesigner.cancelConfirmMessage`))&&i():i?.()},[h.name,h.title,i,l,c]),ee=(0,G.useCallback)(()=>{a?.(h)},[h,a]),I=(0,G.useCallback)(e=>{e<=u?d(e):e===u+1&&x&&(u===1&&e===2&&g(e=>({...e,navigation:Nt(e.navigation,e.objects)})),d(e))},[u,x]);return(0,q.jsxs)(`div`,{className:Q(`flex h-full flex-col rounded-xl border border-gray-200 bg-white shadow-sm`,s),children:[l.isOpen&&(0,q.jsx)(`div`,{"data-testid":`cancel-confirm-dialog`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40`,role:`dialog`,"aria-modal":`true`,children:(0,q.jsxs)(`div`,{className:`mx-4 w-full max-w-sm rounded-lg bg-white p-6 shadow-xl`,children:[(0,q.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,q.jsx)(`h3`,{className:`text-base font-semibold text-gray-900`,children:l.title}),(0,q.jsx)(`button`,{type:`button`,onClick:l.onCancel,className:`rounded p-1 text-gray-400 hover:text-gray-600`,"aria-label":c(`common.close`),children:(0,q.jsx)(Ke,{className:`h-4 w-4`})})]}),(0,q.jsx)(`p`,{className:`mt-2 text-sm text-gray-600`,children:l.message}),(0,q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,q.jsx)(`button`,{type:`button`,"data-testid":`cancel-confirm-keep`,onClick:l.onCancel,className:`rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50`,children:c(`appDesigner.keepEditing`)}),(0,q.jsx)(`button`,{type:`button`,"data-testid":`cancel-confirm-discard`,onClick:l.onConfirm,className:`rounded-md bg-red-600 px-3 py-1.5 text-sm font-medium text-white transition-colors hover:bg-red-700`,children:c(`appDesigner.confirmDiscard`)})]})]})}),(0,q.jsx)(`div`,{className:`border-b border-gray-100`,children:(0,q.jsx)(It,{steps:_,currentIndex:u,onStepClick:I})}),(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6`,children:[u===0&&(0,q.jsx)(Lt,{draft:h,templates:t,readOnly:o,onChange:S,t:c}),u===1&&(0,q.jsx)(Rt,{objects:h.objects,readOnly:o,onToggle:w,onToggleAll:T,search:f,onSearchChange:m,t:c}),u===2&&(0,q.jsx)(Bt,{items:h.navigation,objects:h.objects,readOnly:o,onAdd:E,onRemove:D,onReorder:O,t:c}),u===3&&(0,q.jsx)(Vt,{branding:h.branding,title:h.title,readOnly:o,onChange:C,t:c})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between border-t border-gray-100 px-6 py-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`button`,{type:`button`,"data-testid":`wizard-cancel`,onClick:F,disabled:o,className:`rounded-md px-4 py-2 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50`,children:c(`common.cancel`)}),a&&(0,q.jsx)(`button`,{type:`button`,"data-testid":`wizard-save-draft`,onClick:ee,disabled:o,className:`rounded-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,children:c(`appDesigner.saveDraft`)})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!v&&(0,q.jsxs)(`button`,{type:`button`,"data-testid":`wizard-back`,onClick:A,disabled:o,className:`inline-flex items-center gap-1 rounded-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,q.jsx)(N,{className:`h-4 w-4`}),c(`common.back`)]}),y?(0,q.jsxs)(`button`,{type:`button`,"data-testid":`wizard-complete`,onClick:M,disabled:o||!x,className:`inline-flex items-center gap-1 rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,q.jsx)(j,{className:`h-4 w-4`}),c(`appDesigner.complete`)]}):(0,q.jsxs)(`button`,{type:`button`,"data-testid":`wizard-next`,onClick:k,disabled:o||!x,className:`inline-flex items-center gap-1 rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50`,children:[c(`common.next`),(0,q.jsx)(P,{className:`h-4 w-4`})]})]})]})]})}function Ut(...e){return x(S(e))}var Wt=0;function Gt(e){return Wt+=1,`${e}_${Date.now()}_${Wt}`}function Kt(e,t,n){return e===`separator`?{id:t,type:e}:{id:t,type:e,label:n(e),...e===`group`?{children:[]}:{},...e===`url`?{url:``}:{}}}var qt={object:{labelKey:`appDesigner.navTypeObject`,color:`bg-green-100 text-green-700`,Icon:R},dashboard:{labelKey:`appDesigner.navTypeDashboard`,color:`bg-amber-100 text-amber-700`,Icon:de},page:{labelKey:`appDesigner.navTypePage`,color:`bg-teal-100 text-teal-700`,Icon:B},report:{labelKey:`appDesigner.navTypeReport`,color:`bg-rose-100 text-rose-700`,Icon:O},url:{labelKey:`appDesigner.navTypeUrl`,color:`bg-sky-100 text-sky-700`,Icon:U},component:{labelKey:`appDesigner.navTypeComponent`,color:`bg-indigo-100 text-indigo-700`,Icon:Ae},group:{labelKey:`appDesigner.navTypeGroup`,color:`bg-purple-100 text-purple-700`,Icon:V},separator:{labelKey:`appDesigner.navTypeSeparator`,color:`bg-gray-100 text-gray-600`,Icon:ve},action:{labelKey:`appDesigner.navTypeAction`,color:`bg-orange-100 text-orange-700`,Icon:be},doc:{labelKey:`appDesigner.navTypeDoc`,color:`bg-blue-100 text-blue-700`,Icon:E}},Jt=[{type:`object`,labelKey:`appDesigner.navObjectPage`},{type:`dashboard`,labelKey:`appDesigner.navDashboard`},{type:`page`,labelKey:`appDesigner.navPage`},{type:`report`,labelKey:`appDesigner.navReport`},{type:`group`,labelKey:`appDesigner.navGroup`},{type:`url`,labelKey:`appDesigner.navUrl`},{type:`separator`,labelKey:`appDesigner.navSeparator`}];function Yt(e){return typeof e==`string`?e:typeof e==`object`&&e&&(`key`in e||`defaultValue`in e)?g(e)??``:``}function Xt({item:e,depth:t,index:n,total:r,readOnly:i,onRemove:a,onMoveUp:o,onMoveDown:s,onToggleExpand:c,onUpdateLabel:l,onUpdateIcon:u,onToggleVisible:d,onAddChild:f,expandedIds:p,t:m}){let[h,g]=(0,G.useState)(!1),[_,v]=(0,G.useState)(Yt(e.label)),[y,b]=(0,G.useState)(!1),[x,S]=(0,G.useState)(e.icon||``),C=qt[e.type];e.type===`group`&&e.children&&e.children.length;let w=p.has(e.id),T=e.visible===!1,E=()=>{_.trim()?l(e.id,_.trim()):v(Yt(e.label)),g(!1)},D=()=>{u(e.id,x.trim()),b(!1)};return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`li`,{"data-testid":`nav-designer-item-${e.id}`,className:Ut(`flex items-center gap-2 rounded-md border border-gray-200 bg-white px-2 py-1.5 transition-colors hover:bg-gray-50`,T&&`opacity-50`),style:{marginLeft:t*20},children:[(0,q.jsx)(ce,{className:`h-3.5 w-3.5 shrink-0 cursor-grab text-gray-300`}),e.type===`group`?(0,q.jsx)(`button`,{type:`button`,onClick:()=>c(e.id),className:`rounded p-0.5 text-gray-400 hover:text-gray-600`,"aria-label":m(w?`appDesigner.navCollapseGroup`:`appDesigner.navExpandGroup`),children:w?(0,q.jsx)(M,{className:`h-3.5 w-3.5`}):(0,q.jsx)(P,{className:`h-3.5 w-3.5`})}):(0,q.jsx)(`span`,{className:`w-5`}),y&&!i?(0,q.jsx)(`input`,{type:`text`,value:x,onChange:e=>S(e.target.value),onBlur:D,onKeyDown:t=>{t.key===`Enter`&&D(),t.key===`Escape`&&(S(e.icon||``),b(!1))},autoFocus:!0,placeholder:m(`appDesigner.navIconPlaceholder`),"data-testid":`nav-designer-icon-input-${e.id}`,className:`w-24 rounded border border-blue-300 px-1 py-0.5 text-xs outline-none focus:ring-1 focus:ring-blue-400`}):(0,q.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,q.jsx)(C.Icon,{className:`h-3.5 w-3.5 shrink-0 text-gray-500`}),!i&&e.type!==`separator`&&(0,q.jsx)(`button`,{type:`button`,onClick:()=>{S(e.icon||``),b(!0)},className:`rounded p-0.5 text-gray-300 hover:text-blue-500`,"aria-label":m(`appDesigner.navEditIcon`),"data-testid":`nav-designer-edit-icon-${e.id}`,children:(0,q.jsx)(Ee,{className:`h-2.5 w-2.5`})})]}),e.type===`separator`?(0,q.jsx)(`span`,{className:`flex-1 text-xs italic text-gray-400`,children:m(`appDesigner.separatorLabel`)}):h&&!i?(0,q.jsx)(`input`,{type:`text`,value:_,onChange:e=>v(e.target.value),onBlur:E,onKeyDown:t=>{t.key===`Enter`&&E(),t.key===`Escape`&&(v(Yt(e.label)),g(!1))},autoFocus:!0,placeholder:Ze(e),"data-testid":`nav-designer-label-input-${e.id}`,className:`flex-1 rounded border border-blue-300 px-1.5 py-0.5 text-sm outline-none focus:ring-1 focus:ring-blue-400`}):(0,q.jsx)(`span`,{className:Ut(`flex-1 truncate text-sm text-gray-800`,!i&&`cursor-text`),onDoubleClick:()=>{i||(v(Yt(e.label)),g(!0))},children:Ze(e)}),(0,q.jsx)(`span`,{className:Ut(`rounded-full px-2 py-0.5 text-[10px] font-medium`,C.color),children:m(C.labelKey)}),T&&(0,q.jsx)(`span`,{className:`rounded-full bg-gray-200 px-1.5 py-0.5 text-[10px] font-medium text-gray-500`,"data-testid":`nav-designer-hidden-badge-${e.id}`,children:m(`appDesigner.navHidden`)}),!i&&e.type!==`separator`&&(0,q.jsx)(`button`,{type:`button`,onClick:()=>d(e.id),className:`rounded p-0.5 text-gray-400 hover:text-gray-700`,"aria-label":m(`appDesigner.navToggleVisible`),"data-testid":`nav-designer-toggle-visible-${e.id}`,children:T?(0,q.jsx)(re,{className:`h-3.5 w-3.5`}):(0,q.jsx)(ie,{className:`h-3.5 w-3.5`})}),e.type===`group`&&!i&&(0,q.jsx)(`button`,{type:`button`,onClick:()=>f(e.id,`page`),className:`rounded p-0.5 text-gray-400 hover:text-blue-500`,"aria-label":m(`appDesigner.navAddChild`),"data-testid":`nav-designer-add-child-${e.id}`,children:(0,q.jsx)(ke,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>o(e.id),disabled:i||n===0,className:`rounded p-0.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":m(`appDesigner.navMoveUp`),children:(0,q.jsx)(F,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>s(e.id),disabled:i||n===r-1,className:`rounded p-0.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":m(`appDesigner.navMoveDown`),children:(0,q.jsx)(M,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>a(e.id),disabled:i,className:`rounded p-0.5 text-gray-400 hover:text-red-500 disabled:opacity-30`,"aria-label":m(`appDesigner.navRemove`),"data-testid":`nav-designer-remove-${e.id}`,children:(0,q.jsx)(W,{className:`h-3.5 w-3.5`})})]}),e.type===`group`&&w&&e.children&&(0,q.jsx)(q.Fragment,{children:e.children.map((n,r)=>(0,q.jsx)(Xt,{item:n,depth:t+1,index:r,total:e.children.length,readOnly:i,onRemove:a,onMoveUp:o,onMoveDown:s,onToggleExpand:c,onUpdateLabel:l,onUpdateIcon:u,onToggleVisible:d,onAddChild:f,expandedIds:p,t:m},n.id))})]})}function Zt({items:e,t}){return(0,q.jsxs)(`div`,{"data-testid":`nav-designer-preview`,className:`w-56 shrink-0 rounded-lg border border-gray-200 bg-gray-50 p-3`,children:[(0,q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase text-gray-500`,children:t(`appDesigner.navLivePreview`)}),e.length===0?(0,q.jsx)(`p`,{className:`text-xs text-gray-400`,children:t(`appDesigner.navNoPreviewItems`)}):(0,q.jsx)(`ul`,{className:`space-y-0.5`,children:e.map(e=>(0,q.jsx)(Qt,{item:e,depth:0},e.id))})]})}function Qt({item:e,depth:t}){let n=qt[e.type];return e.type===`separator`?(0,q.jsx)(`li`,{className:`my-1 border-t border-gray-200`,style:{marginLeft:t*12}}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`li`,{className:`flex items-center gap-1.5 rounded px-2 py-1 text-xs text-gray-700 hover:bg-gray-100`,style:{marginLeft:t*12},children:[(0,q.jsx)(n.Icon,{className:`h-3 w-3 text-gray-400`}),(0,q.jsx)(`span`,{className:`truncate`,children:Ze(e)})]}),e.type===`group`&&e.children?.map(e=>(0,q.jsx)(Qt,{item:e,depth:t+1},e.id))]})}function $t({items:e,onChange:t,readOnly:n=!1,showPreview:r=!0,className:i,onExport:a,onImport:o}){let{t:s}=Z(),c=(0,G.useRef)(null),[l,u]=(0,G.useState)(()=>new Set(e.filter(e=>e.type===`group`).map(e=>e.id))),d=(0,G.useCallback)(n=>{function r(e){return e.filter(e=>e.id!==n).map(e=>e.children?{...e,children:r(e.children)}:e)}t(r(e))},[e,t]),f=(0,G.useCallback)((n,r)=>{function i(e){let t=e.findIndex(e=>e.id===n);if(t>=0){let n=r===`up`?t-1:t+1;if(n>=0&&n<e.length){let r=[...e];return[r[t],r[n]]=[r[n],r[t]],r}return e}return e.map(e=>e.children?{...e,children:i(e.children)}:e)}t(i(e))},[e,t]),p=(0,G.useCallback)((n,r)=>{function i(e){return e.map(e=>e.id===n&&e.type!==`separator`?{...e,label:r}:e.children?{...e,children:i(e.children)}:e)}t(i(e))},[e,t]),m=(0,G.useCallback)((n,r)=>{function i(e){return e.map(e=>e.id===n&&e.type!==`separator`?{...e,icon:r||void 0}:e.children?{...e,children:i(e.children)}:e)}t(i(e))},[e,t]),h=(0,G.useCallback)(n=>{function r(e){return e.map(e=>e.id===n&&e.type!==`separator`?{...e,visible:e.visible===!1}:e.children?{...e,children:r(e.children)}:e)}t(r(e))},[e,t]),g=(0,G.useCallback)((n,r)=>{let i=Kt(r,Gt(r),e=>`New ${s(qt[e].labelKey)}`);function a(e){return e.map(e=>e.id===n&&e.type===`group`?{...e,children:[...e.children||[],i]}:e.children?{...e,children:a(e.children)}:e)}t(a(e)),u(e=>new Set(e).add(n))},[e,t]),_=(0,G.useCallback)(n=>{let r=Kt(n,Gt(n),e=>`New ${s(qt[e].labelKey)}`);t([...e,r])},[e,t,s]),v=(0,G.useCallback)(e=>{u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),y=(0,G.useCallback)(()=>{if(a)a(e);else{let t=JSON.stringify(e,null,2),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`navigation-schema.json`,i.click(),URL.revokeObjectURL(r)}},[e,a]),b=(0,G.useCallback)(e=>{let n=e.target.files?.[0];if(!n)return;let r=new FileReader;r.onload=e=>{try{let n=JSON.parse(e.target?.result);Array.isArray(n)&&(o?o(n):t(n))}catch{}},r.readAsText(n),c.current&&(c.current.value=``)},[t,o]);return(0,q.jsxs)(`div`,{"data-testid":`navigation-designer`,className:Ut(`flex flex-col gap-4 sm:flex-row`,i),children:[(0,q.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[Jt.map(({type:e,labelKey:t})=>{let{Icon:r,color:i}=qt[e];return(0,q.jsxs)(`button`,{type:`button`,"data-testid":`nav-designer-add-${e}`,onClick:()=>_(e),disabled:n,className:Ut(`inline-flex items-center gap-1 rounded-md border border-gray-200 px-2.5 py-1 text-xs font-medium transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,q.jsx)(ke,{className:`h-3 w-3`}),s(t)]},e)}),(0,q.jsx)(`span`,{className:`mx-1 hidden h-4 w-px bg-gray-200 sm:block`}),(0,q.jsxs)(`button`,{type:`button`,"data-testid":`nav-designer-export`,onClick:y,className:`inline-flex items-center gap-1 rounded-md border border-gray-200 px-2.5 py-1 text-xs font-medium transition-colors hover:bg-gray-50`,children:[(0,q.jsx)(z,{className:`h-3 w-3`}),s(`appDesigner.navExportSchema`)]}),(0,q.jsxs)(`label`,{"data-testid":`nav-designer-import`,className:Ut(`inline-flex cursor-pointer items-center gap-1 rounded-md border border-gray-200 px-2.5 py-1 text-xs font-medium transition-colors hover:bg-gray-50`,n&&`cursor-not-allowed opacity-50`),children:[(0,q.jsx)(We,{className:`h-3 w-3`}),s(`appDesigner.navImportSchema`),(0,q.jsx)(`input`,{ref:c,type:`file`,accept:`.json`,className:`hidden`,onChange:b,disabled:n,"data-testid":`nav-designer-import-input`})]})]}),e.length===0?(0,q.jsx)(`div`,{className:`py-8 text-center text-sm text-gray-400`,children:s(`appDesigner.navNoItems`)}):(0,q.jsx)(`ul`,{className:`space-y-1`,"data-testid":`nav-designer-tree`,children:e.map((t,r)=>(0,q.jsx)(Xt,{item:t,depth:0,index:r,total:e.length,readOnly:n,onRemove:d,onMoveUp:e=>f(e,`up`),onMoveDown:e=>f(e,`down`),onToggleExpand:v,onUpdateLabel:p,onUpdateIcon:m,onToggleVisible:h,onAddChild:g,expandedIds:l,t:s},t.id))})]}),r&&(0,q.jsx)(Zt,{items:e,t:s})]})}function en(...e){return x(S(e))}var tn=[{type:`metric`,label:`KPI Metric`,Icon:Be},{type:`bar`,label:`Bar Chart`,Icon:O},{type:`line`,label:`Line Chart`,Icon:k},{type:`pie`,label:`Pie Chart`,Icon:A},{type:`table`,label:`Table`,Icon:Re}],nn=0;function rn(){return nn+=1,`widget_${Date.now()}_${nn}`}function an(e,t){return v(e,t)}function on(e,t,n){return y(e,t,n)}function sn({widget:e,index:t,total:n,selected:r,readOnly:i,onSelect:a,onRemove:o,onMoveUp:s,onMoveDown:c}){let l=e.type||`metric`,u=tn.find(e=>e.type===l)||tn[0],{language:d}=Z(),f=an(e.title,d);return(0,q.jsxs)(`div`,{"data-testid":`dashboard-widget-${e.id}`,onClick:a,className:en(`group cursor-pointer rounded-lg border-2 p-3 transition-colors`,r?`border-blue-500 bg-blue-50`:`border-gray-200 hover:border-gray-300`),children:[(0,q.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(ce,{className:`h-4 w-4 text-gray-300`}),(0,q.jsx)(u.Icon,{className:`h-4 w-4 text-gray-500`}),(0,q.jsx)(`span`,{className:`text-sm font-medium text-gray-800`,children:f||`Widget ${t+1}`})]}),!i&&(0,q.jsxs)(`div`,{className:`flex items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s()},disabled:t===0,className:`rounded p-0.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":`Move up`,children:(0,q.jsx)(F,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:t===n-1,className:`rounded p-0.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":`Move down`,children:(0,q.jsx)(M,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),o()},className:`rounded p-0.5 text-gray-400 hover:text-red-500`,"aria-label":`Remove widget`,"data-testid":`dashboard-widget-remove-${e.id}`,children:(0,q.jsx)(W,{className:`h-3.5 w-3.5`})})]})]}),(0,q.jsx)(`div`,{className:`mt-1.5 flex items-center gap-2`,children:(0,q.jsx)(`span`,{className:`rounded-full bg-gray-100 px-2 py-0.5 text-[10px] font-medium text-gray-600`,children:u.label})})]})}function cn({widget:e,readOnly:t,onChange:n,onClose:r}){let{t:i,language:a}=Z(),o=an(e.title,a);return(0,q.jsxs)(`div`,{"data-testid":`widget-property-panel`,className:`shrink-0 space-y-4 rounded-lg border border-gray-200 bg-white p-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`h4`,{className:`text-sm font-semibold text-gray-800`,children:i(`appDesigner.widgetProperties`)}),(0,q.jsx)(`button`,{type:`button`,onClick:r,className:`rounded p-0.5 text-gray-400 hover:text-gray-600`,"aria-label":`Close`,children:(0,q.jsx)(Ke,{className:`h-4 w-4`})})]}),(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsx)(`label`,{htmlFor:`widget-title`,className:`text-xs font-medium text-gray-600`,children:`Title`}),(0,q.jsx)(`input`,{id:`widget-title`,"data-testid":`widget-prop-title`,type:`text`,value:o,onChange:t=>{n({title:on(e.title,a,t.target.value)})},disabled:t,className:`block w-full rounded-md border border-gray-300 px-2.5 py-1.5 text-sm outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:bg-gray-50`})]}),(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsx)(`label`,{htmlFor:`widget-type`,className:`text-xs font-medium text-gray-600`,children:`Type`}),(0,q.jsx)(`select`,{id:`widget-type`,"data-testid":`widget-prop-type`,value:e.type??`metric`,onChange:e=>{let t=tn.find(t=>t.type===e.target.value);t&&n({type:t.type})},disabled:t,className:`block w-full rounded-md border border-gray-300 px-2.5 py-1.5 text-sm outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:bg-gray-50`,children:tn.map(e=>(0,q.jsx)(`option`,{value:e.type,children:e.label},e.type))})]}),(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsx)(`label`,{htmlFor:`widget-color`,className:`text-xs font-medium text-gray-600`,children:`Color Variant`}),(0,q.jsxs)(`select`,{id:`widget-color`,"data-testid":`widget-prop-color`,value:e.colorVariant??`default`,onChange:e=>n({colorVariant:e.target.value}),disabled:t,className:`block w-full rounded-md border border-gray-300 px-2.5 py-1.5 text-sm outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:bg-gray-50`,children:[(0,q.jsx)(`option`,{value:`default`,children:`Default`}),(0,q.jsx)(`option`,{value:`blue`,children:`Blue`}),(0,q.jsx)(`option`,{value:`teal`,children:`Teal`}),(0,q.jsx)(`option`,{value:`orange`,children:`Orange`}),(0,q.jsx)(`option`,{value:`purple`,children:`Purple`}),(0,q.jsx)(`option`,{value:`success`,children:`Success`}),(0,q.jsx)(`option`,{value:`warning`,children:`Warning`}),(0,q.jsx)(`option`,{value:`danger`,children:`Danger`})]})]}),(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsx)(`label`,{className:`text-xs font-medium text-gray-600`,children:i(`appDesigner.widgetLayoutSize`)}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex-1`,children:[(0,q.jsx)(`label`,{htmlFor:`widget-width`,className:`text-[10px] text-gray-400`,children:i(`appDesigner.widgetWidth`)}),(0,q.jsx)(`input`,{id:`widget-width`,"data-testid":`widget-prop-width`,type:`number`,min:1,value:e.layout?.w??1,onChange:t=>n({layout:{...e.layout,w:Number(t.target.value)||1}}),disabled:t,className:`block w-full rounded-md border border-gray-300 px-2 py-1 text-sm outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:bg-gray-50`})]}),(0,q.jsxs)(`div`,{className:`flex-1`,children:[(0,q.jsx)(`label`,{htmlFor:`widget-height`,className:`text-[10px] text-gray-400`,children:i(`appDesigner.widgetHeight`)}),(0,q.jsx)(`input`,{id:`widget-height`,"data-testid":`widget-prop-height`,type:`number`,min:1,value:e.layout?.h??1,onChange:t=>n({layout:{...e.layout,h:Number(t.target.value)||1}}),disabled:t,className:`block w-full rounded-md border border-gray-300 px-2 py-1 text-sm outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:bg-gray-50`})]})]})]})]})}function ln({schema:e}){let{t,language:n}=Z(),r=e.widgets||[];return(0,q.jsxs)(`div`,{"data-testid":`dashboard-preview`,className:`rounded-lg border border-gray-200 bg-gray-50 p-4`,children:[(0,q.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-gray-700`,children:v(e.label,n)||t(`appDesigner.dashboardPreview`)}),r.length===0?(0,q.jsx)(`div`,{className:`text-xs text-gray-400`,children:t(`appDesigner.noWidgetsPreview`)}):(0,q.jsx)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(${e.columns??2}, 1fr)`},children:r.map(e=>{let t=tn.find(t=>t.type===(e.type||`metric`))||tn[0];return(0,q.jsxs)(`div`,{className:`rounded-md border border-gray-200 bg-white p-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(t.Icon,{className:`h-3 w-3 text-gray-400`}),(0,q.jsx)(`span`,{className:`text-xs font-medium text-gray-600`,children:an(e.title,n)||`Untitled`})]}),(0,q.jsx)(`div`,{className:`mt-1 text-[10px] text-gray-400`,children:t.label})]},e.id)})})]})}function un({schema:e,onChange:t,readOnly:n=!1,className:r,onExport:i,onImport:a,selectedWidgetId:o,onWidgetSelect:s}){let{t:c}=Z(),[l,u]=(0,G.useState)(null),[d,f]=(0,G.useState)(!1),p=(0,G.useRef)(null),m=(0,G.useRef)(null),h=o!==void 0,g=h?o:l,_=(0,G.useCallback)(e=>{s&&s(e),h||u(e)},[h,s,u]),{current:v,canUndo:y,canRedo:b,push:x,undo:S,redo:C}=et(e),w=(0,G.useCallback)(e=>{x(e),t(e)},[x,t]),T=v.widgets||[],E=T.find(e=>e.id===g),D=(0,G.useCallback)(e=>{let t=rn(),n={id:t,title:``,type:e,layout:{x:0,y:T.length,w:v.columns??2,h:1}};w({...v,widgets:[...T,n]}),_(t)},[v,T,w,_]),O=(0,G.useCallback)(e=>{w({...v,widgets:T.filter(t=>t.id!==e)}),g===e&&_(null)},[v,T,g,w,_]),k=(0,G.useCallback)((e,t)=>{let n=T.findIndex(t=>t.id===e);if(n<0)return;let r=t===`up`?n-1:n+1;if(r<0||r>=T.length)return;let i=[...T];[i[n],i[r]]=[i[r],i[n]],w({...v,widgets:i})},[v,T,w]),A=(0,G.useCallback)(e=>{g&&w({...v,widgets:T.map(t=>t.id===g?{...t,...e}:t)})},[v,T,g,w]);(0,G.useEffect)(()=>{let e=p.current;if(!e)return;let t=e=>{if(!n){if((e.ctrlKey||e.metaKey)&&e.key===`z`&&!e.shiftKey){e.preventDefault(),S();return}if((e.ctrlKey||e.metaKey)&&(e.key===`y`||e.key===`z`&&e.shiftKey)){e.preventDefault(),C();return}if((e.key===`Delete`||e.key===`Backspace`)&&g){let t=e.target;if(t.tagName===`INPUT`||t.tagName===`SELECT`||t.tagName===`TEXTAREA`)return;e.preventDefault(),O(g)}}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[n,S,C,g,O]);let j=(0,G.useCallback)(()=>{i&&i(v)},[v,i]),M=(0,G.useCallback)(()=>{m.current?.click()},[]),N=(0,G.useCallback)(e=>{let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=()=>{try{let e=JSON.parse(n.result);e&&e.type===`dashboard`&&(w(e),a?.(e))}catch{}},n.readAsText(t),e.target.value=``},[w,a]);return(0,q.jsxs)(`div`,{ref:p,tabIndex:0,"data-testid":`dashboard-editor`,className:en(`flex flex-col gap-4 outline-none`,r),children:[(0,q.jsx)(`input`,{ref:m,type:`file`,accept:`.json`,className:`hidden`,"data-testid":`dashboard-import-input`,onChange:N}),E&&!d&&(0,q.jsx)(cn,{widget:E,readOnly:n,onChange:A,onClose:()=>_(null)}),(0,q.jsxs)(`div`,{className:`flex-1 space-y-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsxs)(`span`,{className:`text-sm font-medium text-gray-700`,children:[c(`appDesigner.addWidget`),`:`]}),tn.map(({type:e,label:t,Icon:r})=>(0,q.jsxs)(`button`,{type:`button`,"data-testid":`dashboard-add-${e}`,onClick:()=>D(e),disabled:n||d,className:`inline-flex items-center gap-1.5 rounded-md border border-gray-200 px-2.5 py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,q.jsx)(r,{className:`h-3.5 w-3.5`}),t]},e))]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[!n&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`button`,{type:`button`,"data-testid":`dashboard-undo`,onClick:S,disabled:!y,className:`rounded p-1.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":c(`appDesigner.undo`),children:(0,q.jsx)(Ue,{className:`h-4 w-4`})}),(0,q.jsx)(`button`,{type:`button`,"data-testid":`dashboard-redo`,onClick:C,disabled:!b,className:`rounded p-1.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":c(`appDesigner.redo`),children:(0,q.jsx)(je,{className:`h-4 w-4`})})]}),(0,q.jsx)(`button`,{type:`button`,"data-testid":`dashboard-export`,onClick:j,className:`rounded p-1.5 text-gray-400 hover:text-gray-700`,"aria-label":c(`appDesigner.navExportSchema`),children:(0,q.jsx)(z,{className:`h-4 w-4`})}),!n&&(0,q.jsx)(`button`,{type:`button`,"data-testid":`dashboard-import`,onClick:M,className:`rounded p-1.5 text-gray-400 hover:text-gray-700`,"aria-label":c(`appDesigner.navImportSchema`),children:(0,q.jsx)(We,{className:`h-4 w-4`})}),(0,q.jsx)(`button`,{type:`button`,"data-testid":`dashboard-preview-toggle`,onClick:()=>f(e=>!e),className:en(`rounded p-1.5 transition-colors`,d?`bg-blue-100 text-blue-600`:`text-gray-400 hover:text-gray-700`),"aria-label":c(d?`appDesigner.modeEdit`:`appDesigner.preview`),children:d?(0,q.jsx)(re,{className:`h-4 w-4`}):(0,q.jsx)(ie,{className:`h-4 w-4`})})]})]}),d?(0,q.jsx)(ln,{schema:v}):T.length===0?(0,q.jsx)(`div`,{className:`flex h-48 items-center justify-center rounded-lg border-2 border-dashed border-gray-200 text-sm text-gray-400`,children:c(`appDesigner.noWidgets`)}):(0,q.jsx)(`div`,{className:`grid gap-3`,style:{gridTemplateColumns:`repeat(${v.columns??2}, 1fr)`},children:T.map((e,t)=>(0,q.jsx)(sn,{widget:e,index:t,total:T.length,selected:e.id===g,readOnly:n,onSelect:()=>_(e.id??null),onRemove:()=>O(e.id),onMoveUp:()=>k(e.id,`up`),onMoveDown:()=>k(e.id,`down`)},e.id))})]})]})}function $(...e){return x(S(e))}var dn=[{hex:`#3b82f6`,name:`Blue`},{hex:`#6366f1`,name:`Indigo`},{hex:`#8b5cf6`,name:`Violet`},{hex:`#a855f7`,name:`Purple`},{hex:`#ec4899`,name:`Pink`},{hex:`#ef4444`,name:`Red`},{hex:`#f97316`,name:`Orange`},{hex:`#f59e0b`,name:`Amber`},{hex:`#eab308`,name:`Yellow`},{hex:`#22c55e`,name:`Green`},{hex:`#14b8a6`,name:`Teal`},{hex:`#06b6d4`,name:`Cyan`},{hex:`#0ea5e9`,name:`Sky`},{hex:`#64748b`,name:`Slate`},{hex:`#1e293b`,name:`Dark`},{hex:`#0f172a`,name:`Navy`}],fn=[`Inter`,`Roboto`,`Open Sans`,`Lato`,`Montserrat`,`Poppins`,`Source Sans Pro`,`Noto Sans`,`system-ui`];function pn({branding:e,onChange:t,appTitle:n=`My App`,readOnly:r=!1,className:i,onExport:a,onImport:o}){let{t:s}=Z(),[c,l]=(0,G.useState)(`light`),{current:u,push:d,canUndo:f,canRedo:p,undo:m,redo:h}=et(e),g=(0,G.useRef)(!0);(0,G.useEffect)(()=>{if(g.current){g.current=!1;return}t(u)},[u]);let _=(0,G.useCallback)(e=>{let n={...u,...e};g.current=!0,d(n),t(n)},[u,d,t]),v=(0,G.useCallback)(()=>{if(a){a(u);return}let e=new Blob([JSON.stringify(u,null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`branding.json`,n.click(),URL.revokeObjectURL(t)},[u,a]),y=(0,G.useCallback)(()=>{if(o){o(u);return}let e=document.createElement(`input`);e.type=`file`,e.accept=`.json`,e.onchange=e=>{let n=e.target.files?.[0];if(!n)return;let r=new FileReader;r.onload=e=>{try{let n=JSON.parse(e.target?.result);if(typeof n==`object`&&n){let e={...u,...n};d(e),t(e)}}catch{}},r.readAsText(n)},e.click()},[u,d,t,o]),b=(0,G.useCallback)(e=>{r||((e.ctrlKey||e.metaKey)&&e.key===`z`&&(e.preventDefault(),e.shiftKey?h():m()),(e.ctrlKey||e.metaKey)&&e.key===`y`&&(e.preventDefault(),h()))},[r,m,h]),x=u.primaryColor||`#3b82f6`,S=c===`dark`;return(0,q.jsxs)(`div`,{"data-testid":`branding-editor`,className:$(`flex flex-col gap-4 sm:gap-6`,i),onKeyDown:b,tabIndex:0,children:[(0,q.jsxs)(`div`,{"data-testid":`branding-editor-toolbar`,className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h2`,{className:`text-lg font-semibold text-gray-800 mr-auto`,children:s(`appDesigner.brandingEditor`)}),(0,q.jsxs)(`button`,{"data-testid":`branding-undo`,type:`button`,onClick:m,disabled:!f||r,className:$(`inline-flex items-center gap-1 rounded-md border px-2.5 py-1.5 text-xs font-medium shadow-sm transition-colors`,f&&!r?`border-gray-300 bg-white text-gray-700 hover:bg-gray-50`:`border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed`),title:s(`appDesigner.undo`),children:[(0,q.jsx)(Ue,{className:`h-3.5 w-3.5`}),s(`appDesigner.undo`)]}),(0,q.jsxs)(`button`,{"data-testid":`branding-redo`,type:`button`,onClick:h,disabled:!p||r,className:$(`inline-flex items-center gap-1 rounded-md border px-2.5 py-1.5 text-xs font-medium shadow-sm transition-colors`,p&&!r?`border-gray-300 bg-white text-gray-700 hover:bg-gray-50`:`border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed`),title:s(`appDesigner.redo`),children:[(0,q.jsx)(je,{className:`h-3.5 w-3.5`}),s(`appDesigner.redo`)]}),(0,q.jsxs)(`button`,{"data-testid":`branding-export`,type:`button`,onClick:v,className:`inline-flex items-center gap-1 rounded-md border border-gray-300 bg-white px-2.5 py-1.5 text-xs font-medium text-gray-700 shadow-sm transition-colors hover:bg-gray-50`,title:s(`appDesigner.brandingExport`),children:[(0,q.jsx)(z,{className:`h-3.5 w-3.5`}),s(`appDesigner.brandingExport`)]}),(0,q.jsxs)(`button`,{"data-testid":`branding-import`,type:`button`,onClick:y,disabled:r,className:$(`inline-flex items-center gap-1 rounded-md border px-2.5 py-1.5 text-xs font-medium shadow-sm transition-colors`,r?`border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed`:`border-gray-300 bg-white text-gray-700 hover:bg-gray-50`),title:s(`appDesigner.brandingImport`),children:[(0,q.jsx)(We,{className:`h-3.5 w-3.5`}),s(`appDesigner.brandingImport`)]})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:gap-6`,children:[(0,q.jsxs)(`div`,{className:`flex-1 space-y-5`,children:[(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{htmlFor:`be-logo`,className:`block text-sm font-medium text-gray-700`,children:s(`appDesigner.logoUrl`)}),(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(H,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-gray-400`}),(0,q.jsx)(`input`,{id:`be-logo`,"data-testid":`branding-logo-input`,type:`text`,value:u.logo??``,onChange:e=>_({logo:e.target.value}),placeholder:`https://example.com/logo.svg`,disabled:r,className:`block w-full rounded-md border border-gray-300 py-2 pl-9 pr-3 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50`})]})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{htmlFor:`be-color`,className:`block text-sm font-medium text-gray-700`,children:s(`appDesigner.primaryColor`)}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsxs)(`div`,{className:`relative flex-1`,children:[(0,q.jsx)(xe,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-gray-400`}),(0,q.jsx)(`input`,{id:`be-color`,"data-testid":`branding-color-input`,type:`text`,value:u.primaryColor??`#3b82f6`,onChange:e=>_({primaryColor:e.target.value}),placeholder:`#3b82f6`,disabled:r,className:`block w-full rounded-md border border-gray-300 py-2 pl-9 pr-3 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50`})]}),(0,q.jsx)(`input`,{"data-testid":`branding-color-picker`,type:`color`,value:x,onChange:e=>_({primaryColor:e.target.value}),disabled:r,className:`h-9 w-9 cursor-pointer rounded-md border border-gray-300 p-0.5 disabled:cursor-not-allowed`})]}),(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsx)(`span`,{className:`text-xs text-gray-500`,children:s(`appDesigner.colorPalette`)}),(0,q.jsx)(`div`,{"data-testid":`branding-color-palette`,className:`flex flex-wrap gap-1.5`,children:dn.map(e=>(0,q.jsx)(`button`,{"data-testid":`branding-swatch-${e.hex.slice(1)}`,type:`button`,onClick:()=>!r&&_({primaryColor:e.hex}),disabled:r,className:$(`h-6 w-6 rounded-full border-2 transition-transform hover:scale-110 disabled:cursor-not-allowed`,x===e.hex?`border-gray-800 ring-2 ring-offset-1 ring-gray-400`:`border-transparent`),style:{backgroundColor:e.hex},title:e.name},e.hex))})]})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{htmlFor:`be-favicon`,className:`block text-sm font-medium text-gray-700`,children:s(`appDesigner.faviconUrl`)}),(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(oe,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-gray-400`}),(0,q.jsx)(`input`,{id:`be-favicon`,"data-testid":`branding-favicon-input`,type:`text`,value:u.favicon??``,onChange:e=>_({favicon:e.target.value}),placeholder:`https://example.com/favicon.ico`,disabled:r,className:`block w-full rounded-md border border-gray-300 py-2 pl-9 pr-3 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50`})]})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{htmlFor:`be-font`,className:`block text-sm font-medium text-gray-700`,children:s(`appDesigner.fontFamily`)}),(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(He,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-gray-400`}),(0,q.jsxs)(`select`,{id:`be-font`,"data-testid":`branding-font-select`,value:u.fontFamily??``,onChange:e=>_({fontFamily:e.target.value||void 0}),disabled:r,className:`block w-full rounded-md border border-gray-300 py-2 pl-9 pr-3 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50 appearance-none`,children:[(0,q.jsx)(`option`,{value:``,children:s(`appDesigner.fontDefault`)}),fn.map(e=>(0,q.jsx)(`option`,{value:e,children:e},e))]})]})]})]}),(0,q.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`span`,{className:`text-sm font-medium text-gray-700`,children:s(`appDesigner.brandingPreview`)}),(0,q.jsxs)(`div`,{"data-testid":`branding-mode-toggle`,className:`flex rounded-md border border-gray-300 overflow-hidden`,children:[(0,q.jsxs)(`button`,{"data-testid":`branding-mode-light`,type:`button`,onClick:()=>l(`light`),className:$(`inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium transition-colors`,c===`light`?`bg-blue-50 text-blue-700`:`bg-white text-gray-600 hover:bg-gray-50`),children:[(0,q.jsx)(Le,{className:`h-3.5 w-3.5`}),s(`appDesigner.modeLight`)]}),(0,q.jsxs)(`button`,{"data-testid":`branding-mode-dark`,type:`button`,onClick:()=>l(`dark`),className:$(`inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium transition-colors`,c===`dark`?`bg-gray-800 text-gray-100`:`bg-white text-gray-600 hover:bg-gray-50`),children:[(0,q.jsx)(ye,{className:`h-3.5 w-3.5`}),s(`appDesigner.modeDark`)]})]})]}),(0,q.jsxs)(`div`,{"data-testid":`branding-preview`,className:$(`rounded-lg border p-4 transition-colors`,S?`border-gray-700 bg-gray-900 text-gray-100`:`border-gray-200 bg-white text-gray-800`),style:{fontFamily:u.fontFamily||`inherit`},children:[(0,q.jsx)(`div`,{className:`rounded-md p-3 mb-3`,style:{backgroundColor:x},children:(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[u.logo?(0,q.jsx)(`img`,{src:u.logo,alt:`Logo`,className:`h-8 w-8 rounded object-contain bg-white/20`}):(0,q.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded bg-white/20 text-xs text-white`,children:`Logo`}),(0,q.jsx)(`span`,{className:`text-sm font-semibold text-white`,children:n})]})}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`div`,{className:`h-4 w-4 rounded-full border border-gray-200`,style:{backgroundColor:x}}),(0,q.jsx)(`span`,{className:$(`text-xs`,S?`text-gray-400`:`text-gray-500`),children:x})]}),(0,q.jsx)(`button`,{type:`button`,className:`rounded-md px-3 py-1.5 text-xs font-medium text-white transition-colors`,style:{backgroundColor:x},tabIndex:-1,children:s(`appDesigner.brandingSampleButton`)}),(0,q.jsx)(`p`,{className:$(`text-xs`,S?`text-gray-400`:`text-gray-500`),children:s(`appDesigner.brandingSampleText`)}),u.favicon&&(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`img`,{src:u.favicon,alt:`Favicon`,className:`h-4 w-4 rounded object-contain`}),(0,q.jsx)(`span`,{className:$(`text-xs`,S?`text-gray-400`:`text-gray-500`),children:`Favicon`})]}),u.fontFamily&&(0,q.jsxs)(`div`,{className:$(`text-xs`,S?`text-gray-400`:`text-gray-500`),children:[s(`appDesigner.fontFamily`),`: `,u.fontFamily]})]})]}),(0,q.jsxs)(`div`,{"data-testid":`branding-preview-mobile`,className:$(`mx-auto w-48 rounded-xl border-2 p-2 transition-colors`,S?`border-gray-700 bg-gray-900`:`border-gray-300 bg-white`),style:{fontFamily:u.fontFamily||`inherit`},children:[(0,q.jsx)(`div`,{className:`text-center text-[10px] font-medium text-gray-400 mb-1`,children:s(`appDesigner.mobilePreview`)}),(0,q.jsx)(`div`,{className:`rounded-md p-2 mb-1`,style:{backgroundColor:x},children:(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[u.logo?(0,q.jsx)(`img`,{src:u.logo,alt:`Logo`,className:`h-4 w-4 rounded object-contain bg-white/20`}):(0,q.jsx)(`div`,{className:`flex h-4 w-4 items-center justify-center rounded bg-white/20 text-[6px] text-white`,children:`L`}),(0,q.jsx)(`span`,{className:`text-[9px] font-semibold text-white truncate`,children:n})]})}),(0,q.jsxs)(`div`,{className:`space-y-1 px-1`,children:[(0,q.jsx)(`div`,{className:$(`h-2 w-3/4 rounded`,S?`bg-gray-700`:`bg-gray-200`)}),(0,q.jsx)(`div`,{className:$(`h-2 w-1/2 rounded`,S?`bg-gray-700`:`bg-gray-200`)}),(0,q.jsx)(`div`,{className:$(`h-2 w-2/3 rounded`,S?`bg-gray-700`:`bg-gray-200`)})]})]})]})]})]})}function mn(...e){return x(S(e))}var hn=[`Custom Objects`,`System Objects`,`Integration`,`Analytics`],gn=[`Box`,`Database`,`Users`,`FileText`,`Settings`,`ShoppingCart`,`Calendar`,`Mail`,`Briefcase`,`Building`,`Globe`,`Heart`,`Star`,`Tag`,`Bookmark`,`Folder`,`Archive`,`Package`,`Truck`,`CreditCard`];function _n({objects:e,onObjectsChange:t,onSelectObject:n,showSystemObjects:r=!0,readOnly:i=!1,className:a}){let{t:o}=Z(),c=K(),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(null),p=(0,G.useMemo)(()=>r?e:e.filter(e=>!e.isSystem),[e,r]),m=(0,G.useMemo)(()=>new s({items:p}),[p]),h=(0,G.useMemo)(()=>[{field:`name`,label:o(`appDesigner.objectManager.objectName`),width:160},{field:`label`,label:o(`appDesigner.objectManager.objectLabel`),width:160},{field:`group`,label:o(`appDesigner.objectManager.group`),width:130},{field:`fieldCount`,label:`Fields`,width:80}],[o]),g=(0,G.useMemo)(()=>({type:`object-grid`,objectName:`object_definition`,columns:h,searchableFields:[`name`,`label`,`description`],showSearch:!0,operations:i?void 0:{create:!0,update:!0,delete:!0}}),[h,i]),_=(0,G.useCallback)(t=>{let r=e.find(e=>e.name===t.name);r&&n?.(r)},[e,n]),v=(0,G.useCallback)(t=>{let n=e.find(e=>e.name===t.name);n&&(f(n),u(!0))},[e]),y=(0,G.useCallback)(t=>{let n=e.find(e=>e.name===t.name);return{delete:!!n&&!n.isSystem}},[e]),b=(0,G.useCallback)(async n=>{let r=e.find(e=>e.name===n.name);r&&!r.isSystem&&await c.confirm(o(`appDesigner.objectManager.deleteConfirmTitle`),o(`appDesigner.objectManager.deleteConfirmMessage`))&&t?.(e.filter(e=>e.id!==r.id))},[e,t,c,o]),x=(0,G.useCallback)(()=>{f(null),u(!0)},[]),S=(0,G.useCallback)(n=>{if(d){let r={...d,name:String(n.name||d.name),label:String(n.label||d.label),pluralLabel:n.pluralLabel?String(n.pluralLabel):void 0,description:n.description?String(n.description):void 0,icon:n.icon?String(n.icon):void 0,group:n.group?String(n.group):void 0,sortOrder:typeof n.sortOrder==`number`?n.sortOrder:void 0};t?.(e.map(e=>e.id===d.id?r:e))}else{let r={id:`obj_${Date.now()}`,name:String(n.name||`new_object_${e.length+1}`),label:String(n.label||`New Object ${e.length+1}`),pluralLabel:n.pluralLabel?String(n.pluralLabel):void 0,description:n.description?String(n.description):void 0,icon:n.icon?String(n.icon):void 0,group:n.group?String(n.group):void 0,sortOrder:typeof n.sortOrder==`number`?n.sortOrder:void 0,isSystem:!1,fieldCount:0};t?.([...e,r])}u(!1),f(null)},[d,e,t]),C=(0,G.useCallback)(e=>{e||(u(!1),f(null))},[]),w=(0,G.useMemo)(()=>({type:`object-form`,formType:`modal`,objectName:`object_definition`,mode:d?`edit`:`create`,title:d?`${o(`common.edit`)} — ${d.label}`:o(`appDesigner.objectManager.addObject`),open:l,onOpenChange:C,modalSize:`lg`,customFields:[{name:`name`,label:o(`appDesigner.objectManager.objectName`),type:`text`,required:!0,placeholder:`api_name`,disabled:i||(d?.isSystem??!1)},{name:`label`,label:o(`appDesigner.objectManager.objectLabel`),type:`text`,required:!0,placeholder:`Display Name`,disabled:i},{name:`pluralLabel`,label:o(`appDesigner.objectManager.pluralLabel`),type:`text`,placeholder:`Display Names`,disabled:i},{name:`description`,label:o(`appDesigner.appDescription`),type:`textarea`,disabled:i},{name:`icon`,label:o(`appDesigner.objectManager.icon`),type:`select`,options:gn.map(e=>({label:e,value:e})),disabled:i},{name:`group`,label:o(`appDesigner.objectManager.group`),type:`select`,options:hn.map(e=>({label:e,value:e})),disabled:i},{name:`sortOrder`,label:o(`appDesigner.objectManager.sortOrder`),type:`number`,disabled:i}],initialValues:d?{name:d.name,label:d.label,pluralLabel:d.pluralLabel||``,description:d.description||``,icon:d.icon||``,group:d.group||``,sortOrder:d.sortOrder??0}:{},onSuccess:S,onCancel:()=>C(!1),readOnly:i}),[d,l,C,S,i,o]);return(0,q.jsxs)(`div`,{"data-testid":`object-manager`,className:mn(`w-full space-y-3`,a),children:[(0,q.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(R,{className:`h-4 w-4 text-primary`}),(0,q.jsx)(`h2`,{className:`text-sm font-semibold`,children:o(`appDesigner.objectManager.title`)}),(0,q.jsx)(`span`,{className:`rounded-full bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:p.length})]})}),(0,q.jsx)(Qe,{schema:g,dataSource:m,onRowClick:_,onEdit:i?void 0:v,onDelete:i?void 0:b,rowOperations:y,onAddRecord:i?void 0:x}),l&&(0,q.jsx)(Xe,{schema:w}),(0,q.jsx)(at,{isOpen:c.isOpen,title:c.title,message:c.message,confirmLabel:o(`common.delete`),cancelLabel:o(`common.cancel`),onConfirm:c.onConfirm,onCancel:c.onCancel,destructive:!0})]})}function vn(...e){return x(S(e))}var yn={text:{label:`Text`,Icon:He},textarea:{label:`Text Area`,Icon:B},number:{label:`Number`,Icon:le},boolean:{label:`Checkbox`,Icon:ze},date:{label:`Date`,Icon:D},datetime:{label:`Date/Time`,Icon:D},time:{label:`Time`,Icon:D},select:{label:`Picklist`,Icon:pe},email:{label:`Email`,Icon:T},phone:{label:`Phone`,Icon:De},url:{label:`URL`,Icon:oe},password:{label:`Password`,Icon:me},currency:{label:`Currency`,Icon:le},percent:{label:`Percent`,Icon:le},lookup:{label:`Lookup`,Icon:fe},formula:{label:`Formula`,Icon:I},autonumber:{label:`Auto Number`,Icon:le},file:{label:`File`,Icon:B},image:{label:`Image`,Icon:H},markdown:{label:`Markdown`,Icon:B},html:{label:`Rich Text`,Icon:B},color:{label:`Color`,Icon:xe},code:{label:`Code`,Icon:I},location:{label:`Location`,Icon:he},address:{label:`Address`,Icon:he},rating:{label:`Rating`,Icon:Ie},slider:{label:`Slider`,Icon:Pe}},bn={text:[`text`,`textarea`,`email`,`phone`,`url`,`password`,`markdown`,`html`],number:[`number`,`currency`,`percent`,`autonumber`,`rating`,`slider`],date:[`date`,`datetime`,`time`],choice:[`boolean`,`select`],relation:[`lookup`],advanced:[`formula`,`file`,`image`,`color`,`code`,`location`,`address`]},xn=[`text`,`number`,`date`,`choice`,`relation`,`advanced`];function Sn(e,t){return!b.includes(e)||e===t}function Cn({objectName:e,fields:t,onFieldsChange:n,readOnly:r=!1,className:i}){let{t:a}=Z(),o=K(),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(null),[f,p]=(0,G.useState)(``),m=(0,G.useMemo)(()=>f?t.filter(e=>e.type===f):t,[t,f]),h=(0,G.useMemo)(()=>new s({items:m}),[m]),g=(0,G.useMemo)(()=>[{field:`name`,label:a(`appDesigner.fieldDesigner.fieldName`),width:140},{field:`label`,label:a(`appDesigner.fieldDesigner.fieldLabel`),width:160},{field:`type`,label:a(`appDesigner.fieldDesigner.fieldType`),width:100},{field:`required`,label:a(`appDesigner.fieldDesigner.required`),width:80},{field:`unique`,label:a(`appDesigner.fieldDesigner.unique`),width:80},{field:`group`,label:a(`appDesigner.fieldDesigner.fieldGroup`),width:120}],[a]),_=(0,G.useMemo)(()=>({type:`object-grid`,objectName:`field_definition`,columns:g,searchableFields:[`name`,`label`,`description`],showSearch:!0,operations:r?void 0:{create:!0,update:!0,delete:!0}}),[g,r]),v=(0,G.useCallback)(e=>{let n=t.find(t=>t.name===e.name);n&&(d(n),l(!0))},[t]),y=(0,G.useCallback)(e=>{let n=t.find(t=>t.name===e.name);return{delete:!!n&&!n.isSystem}},[t]),b=(0,G.useCallback)(async e=>{let r=t.find(t=>t.name===e.name);r&&!r.isSystem&&await o.confirm(a(`appDesigner.fieldDesigner.deleteConfirmTitle`),a(`appDesigner.fieldDesigner.deleteConfirmMessage`))&&n?.(t.filter(e=>e.id!==r.id))},[t,n,o,a]),x=(0,G.useCallback)(()=>{d(null),l(!0)},[]),S=(0,G.useCallback)(e=>{if(u){let r={...u,name:String(e.name||u.name),label:String(e.label||u.label),type:e.type||u.type,group:e.group?String(e.group):void 0,description:e.description?String(e.description):void 0,required:e.required===!0,unique:e.unique===!0,readonly:e.readonly===!0,hidden:e.hidden===!0,externalId:e.externalId===!0,trackHistory:e.trackHistory===!0,defaultValue:e.defaultValue?String(e.defaultValue):void 0,placeholder:e.placeholder?String(e.placeholder):void 0,referenceTo:e.referenceTo?String(e.referenceTo):void 0};n?.(t.map(e=>e.id===u.id?r:e))}else{let r={id:`fld_${Date.now()}`,name:String(e.name||`new_field_${t.length+1}`),label:String(e.label||`New Field ${t.length+1}`),type:e.type||`text`,group:e.group?String(e.group):void 0,description:e.description?String(e.description):void 0,required:e.required===!0,unique:e.unique===!0,readonly:e.readonly===!0,hidden:e.hidden===!0,externalId:e.externalId===!0,trackHistory:e.trackHistory===!0,defaultValue:e.defaultValue?String(e.defaultValue):void 0,placeholder:e.placeholder?String(e.placeholder):void 0,referenceTo:e.referenceTo?String(e.referenceTo):void 0,isSystem:!1};n?.([...t,r])}l(!1),d(null)},[u,t,n]),C=(0,G.useCallback)(e=>{e||(l(!1),d(null))},[]),w=(0,G.useMemo)(()=>xn.map(e=>({category:e,label:a(`appDesigner.fieldDesigner.typeCategory.${e}`),options:bn[e].map(e=>({label:yn[e].label,value:e}))})),[a]),T=(0,G.useMemo)(()=>w.flatMap(e=>e.options).filter(e=>Sn(e.value,u?.type)),[w,u]),E=(0,G.useMemo)(()=>({type:`object-form`,formType:`drawer`,objectName:`field_definition`,mode:u?`edit`:`create`,title:u?`${a(`common.edit`)} — ${u.label}`:a(`appDesigner.fieldDesigner.addField`),open:c,onOpenChange:C,drawerSide:`right`,drawerWidth:`480px`,sections:[{name:`basic`,label:a(`appDesigner.fieldDesigner.basicSection`),fields:[{name:`name`,label:a(`appDesigner.fieldDesigner.fieldName`),type:`text`,required:!0,placeholder:`api_name`,disabled:r||(u?.isSystem??!1)},{name:`label`,label:a(`appDesigner.fieldDesigner.fieldLabel`),type:`text`,required:!0,placeholder:`Display Label`,disabled:r},{name:`type`,label:a(`appDesigner.fieldDesigner.fieldType`),type:`select`,required:!0,options:T,disabled:r||(u?.isSystem??!1)},{name:`required`,label:a(`appDesigner.fieldDesigner.required`),type:`boolean`,disabled:r},{name:`unique`,label:a(`appDesigner.fieldDesigner.unique`),type:`boolean`,disabled:r},{name:`description`,label:a(`appDesigner.fieldDesigner.description`),type:`textarea`,disabled:r}]},{name:`typeSpecific`,label:a(`appDesigner.fieldDesigner.typeSpecificSection`),fields:[{name:`referenceTo`,label:a(`appDesigner.fieldDesigner.referenceTo`),type:`text`,placeholder:`Referenced object`,disabled:r,visibleWhen:`record.type == 'lookup'`},{name:`defaultValue`,label:a(`appDesigner.fieldDesigner.defaultValue`),type:`text`,placeholder:`Default value`,disabled:r},{name:`placeholder`,label:a(`appDesigner.fieldDesigner.placeholder`),type:`text`,placeholder:`Placeholder text`,disabled:r},{name:`group`,label:a(`appDesigner.fieldDesigner.fieldGroup`),type:`text`,placeholder:`Field Group`,disabled:r}]},{name:`advanced`,label:a(`appDesigner.fieldDesigner.advancedSection`),collapsible:!0,collapsed:!0,fields:[{name:`externalId`,label:a(`appDesigner.fieldDesigner.externalId`),type:`boolean`,disabled:r},{name:`trackHistory`,label:a(`appDesigner.fieldDesigner.trackHistory`),type:`boolean`,disabled:r},{name:`readonly`,label:a(`appDesigner.fieldDesigner.readOnly`),type:`boolean`,disabled:r},{name:`hidden`,label:a(`appDesigner.fieldDesigner.hidden`),type:`boolean`,disabled:r}]}],initialValues:u?{name:u.name,label:u.label,type:u.type,group:u.group||``,description:u.description||``,required:u.required||!1,unique:u.unique||!1,readonly:u.readonly||!1,hidden:u.hidden||!1,externalId:u.externalId||!1,trackHistory:u.trackHistory||!1,defaultValue:u.defaultValue==null?``:String(u.defaultValue),placeholder:u.placeholder||``,referenceTo:u.referenceTo||``}:{type:`text`,required:!1,unique:!1},onSuccess:S,onCancel:()=>C(!1),readOnly:r}),[u,c,C,S,T,r,a]);return(0,q.jsxs)(`div`,{"data-testid":`field-designer`,className:vn(`w-full space-y-3`,i),children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(L,{className:`h-4 w-4 text-primary`}),(0,q.jsx)(`h2`,{className:`text-sm font-semibold`,children:a(`appDesigner.fieldDesigner.title`)}),e&&(0,q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`— `,e]}),(0,q.jsx)(`span`,{className:`rounded-full bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:m.length})]}),(0,q.jsxs)(`select`,{value:f,onChange:e=>p(e.target.value),"data-testid":`field-designer-type-filter`,className:`rounded-md border border-input bg-background px-2 py-1 text-xs outline-none transition-colors focus:border-primary focus:ring-1 focus:ring-primary`,children:[(0,q.jsx)(`option`,{value:``,children:a(`appDesigner.fieldDesigner.allTypes`)}),w.map(e=>(0,q.jsx)(`optgroup`,{label:e.label,children:e.options.map(e=>(0,q.jsx)(`option`,{value:e.value,children:e.label},e.value))},e.category))]})]}),(0,q.jsx)(Qe,{schema:_,dataSource:h,onEdit:r?void 0:v,onDelete:r?void 0:b,rowOperations:y,onAddRecord:r?void 0:x}),c&&(0,q.jsx)(Ye,{schema:E}),(0,q.jsx)(at,{isOpen:o.isOpen,title:o.title,message:o.message,confirmLabel:a(`common.delete`),cancelLabel:a(`common.cancel`),onConfirm:o.onConfirm,onCancel:o.onCancel,destructive:!0})]})}var wn=`objectui-app-wizard-draft`;function Tn(){let e=t(),{appName:r}=n(),{objects:i,refresh:a}=m(),o=c(),s=(i||[]).map(e=>({name:e.name,label:e.label||e.name,pluralLabel:e.pluralLabel,icon:e.icon,selected:!1})),l=(0,G.useCallback)(()=>{try{let e=localStorage.getItem(wn);if(e)return JSON.parse(e)}catch{}},[]),u=(0,G.useCallback)(async t=>{try{let n=d(t),r=o?.getClient();r&&await r.meta.saveItem(`app`,t.name,n),localStorage.removeItem(wn),C.success(`Application "${t.title}" created successfully`),await a?.(),e(`/apps/${t.name}`)}catch(e){C.error(e?.message||`Failed to create application`)}},[e,a,o]),f=(0,G.useCallback)(()=>{e(r?`/apps/${r}`:`/`)},[e,r]),p=(0,G.useCallback)(e=>{try{localStorage.setItem(wn,JSON.stringify(e)),C.info(`Draft saved`)}catch{}},[]);return(0,q.jsx)(`div`,{className:`mx-auto max-w-4xl py-8 px-4`,"data-testid":`create-app-page`,children:(0,q.jsx)(Ht,{availableObjects:s,initialDraft:l(),onComplete:u,onCancel:f,onSaveDraft:p})})}var En;function Dn(){return En??=new Set(Object.keys(o.shape)),En}var On;function kn(){return On??=new Set(Object.keys(a.shape)),On}function An(e,t){return!e||typeof e!=`object`?{}:Object.fromEntries(Object.entries(e).filter(([e])=>t.has(e)))}function jn(){let e=t(),{appName:r,editAppName:i}=n(),{apps:a,objects:o,refresh:s}=m(),l=c(),u=i||r,f=a.find(e=>e.name===u),p=jt(f?.navigation||[]),h=(o||[]).map(e=>({name:e.name,label:e.label||e.name,pluralLabel:e.pluralLabel,icon:e.icon,selected:p.has(e.name)})),g=(0,G.useMemo)(()=>{if(f)return{name:f.name,title:f.label||``,description:f.description||``,icon:f.icon||``,navigation:f.navigation||[],branding:{logo:f.branding?.logo||``,primaryColor:f.branding?.primaryColor||`#3b82f6`,favicon:f.branding?.favicon||``}}},[f]),_=(0,G.useCallback)(async t=>{try{let n=d(t),r=An(f,Dn()),i={...An(f?.branding,kn()),...n.branding},a={...r,...n,branding:i},o=l?.getClient();o&&await o.meta.saveItem(`app`,t.name,a),C.success(`Application "${t.title}" updated successfully`),await s?.(),e(`/apps/${t.name}`)}catch(e){C.error(e?.message||`Failed to update application`)}},[e,s,l,f]),v=(0,G.useCallback)(()=>{e(r?`/apps/${r}`:`/`)},[e,r]),y=(0,G.useCallback)(e=>{try{localStorage.setItem(`objectui-edit-draft-${u}`,JSON.stringify(e)),C.info(`Draft saved`)}catch{}},[u]);return f?(0,q.jsx)(`div`,{className:`mx-auto max-w-4xl py-8 px-4`,"data-testid":`edit-app-page`,children:(0,q.jsx)(Ht,{availableObjects:h,initialDraft:g,onComplete:_,onCancel:v,onSaveDraft:y})}):(0,q.jsx)(`div`,{className:`mx-auto max-w-4xl py-8 px-4 text-center`,"data-testid":`edit-app-not-found`,children:(0,q.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Application "`,u,`" not found.`]})})}function Mn(){let e=t(),{dashboardName:r}=n(),i=c(),{dashboards:a,refresh:o}=m(),s=a?.find(e=>e.name===r),[l,d]=(0,G.useState)(()=>u(s)||{type:`dashboard`,name:r??``,label:r??``,columns:2,widgets:[]}),f=(0,G.useRef)(l);f.current=l;let p=(0,G.useCallback)(async e=>{try{if(i)return await i.update(`sys_dashboard`,r,e),o().catch(()=>{}),!0}catch{}return!1},[i,r,o]),h=(0,G.useCallback)(async e=>{let t=u(e);d(t),await p(t)},[p]);(0,G.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),p(f.current).then(e=>{e&&C.success(`Dashboard saved`)}))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[p]);let g=(0,G.useCallback)(e=>{let t=new Blob([JSON.stringify(e,null,2)],{type:`application/json`}),n=URL.createObjectURL(t),i=document.createElement(`a`);i.href=n,i.download=`${r||`dashboard`}.json`,i.click(),URL.revokeObjectURL(n),C.success(`Dashboard schema exported`)},[r]),_=(0,G.useCallback)(e=>{C.success(`Dashboard schema imported`),h(e)},[h]);return s?(0,q.jsxs)(`div`,{className:`h-full flex flex-col`,"data-testid":`dashboard-design-page`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 sm:px-6`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:()=>e(-1),className:`rounded p-1.5 text-muted-foreground hover:text-foreground`,"aria-label":`Go back`,"data-testid":`dashboard-design-back`,children:(0,q.jsx)(w,{className:`h-4 w-4`})}),(0,q.jsxs)(`h1`,{className:`text-lg font-semibold tracking-tight truncate`,children:[`Edit Dashboard: `,s.label||r]})]}),(0,q.jsx)(`div`,{className:`flex-1 overflow-auto p-4 sm:p-6`,children:(0,q.jsx)(un,{schema:l,onChange:h,onExport:g,onImport:_})})]}):(0,q.jsxs)(`div`,{className:`h-full flex items-center justify-center text-muted-foreground`,children:[`Dashboard "`,r,`" not found`]})}new Set(f),h(`metadataFieldsPageCarryOver`),l.register(`page-designer`,pt,{namespace:`plugin-designer`,label:`Page Designer`,category:`Designer`,inputs:[{name:`canvas`,type:`code`},{name:`components`,type:`code`},{name:`showComponentTree`,type:`boolean`},{name:`undoRedo`,type:`boolean`},{name:`readOnly`,type:`boolean`}]}),l.register(`data-model-designer`,yt,{namespace:`plugin-designer`,label:`Data Model Designer`,category:`Designer`,inputs:[{name:`entities`,type:`code`},{name:`relationships`,type:`code`},{name:`autoLayout`,type:`boolean`},{name:`readOnly`,type:`boolean`}]}),l.register(`process-designer`,wt,{namespace:`plugin-designer`,label:`Process Designer (BPMN)`,category:`Designer`,inputs:[{name:`processName`,type:`string`},{name:`nodes`,type:`code`},{name:`edges`,type:`code`},{name:`showMinimap`,type:`boolean`},{name:`showToolbar`,type:`boolean`},{name:`readOnly`,type:`boolean`}]}),l.register(`report-designer`,Dt,{namespace:`plugin-designer`,label:`Report Designer`,category:`Designer`,inputs:[{name:`reportName`,type:`string`},{name:`objectName`,type:`string`},{name:`sections`,type:`code`},{name:`showToolbar`,type:`boolean`},{name:`showPropertyPanel`,type:`boolean`},{name:`readOnly`,type:`boolean`}]}),l.register(`app-creation-wizard`,Ht,{namespace:`plugin-designer`,label:`App Creation Wizard`,category:`Designer`,inputs:[{name:`availableObjects`,type:`code`},{name:`templates`,type:`code`},{name:`readOnly`,type:`boolean`}]}),l.register(`navigation-designer`,$t,{namespace:`plugin-designer`,label:`Navigation Designer`,category:`Designer`,inputs:[{name:`items`,type:`code`},{name:`showPreview`,type:`boolean`},{name:`readOnly`,type:`boolean`}]}),l.register(`dashboard-editor`,un,{namespace:`plugin-designer`,label:`Dashboard Editor`,category:`Designer`,inputs:[{name:`schema`,type:`code`},{name:`readOnly`,type:`boolean`}]}),l.register(`branding-editor`,pn,{namespace:`plugin-designer`,label:`Branding Editor`,category:`Designer`,inputs:[{name:`branding`,type:`code`},{name:`appTitle`,type:`string`},{name:`readOnly`,type:`boolean`}]}),l.register(`object-manager`,_n,{namespace:`plugin-designer`,label:`Object Manager`,category:`Designer`,inputs:[{name:`objects`,type:`code`},{name:`showSystemObjects`,type:`boolean`},{name:`readOnly`,type:`boolean`}]}),l.register(`field-designer`,Cn,{namespace:`plugin-designer`,label:`Field Designer`,category:`Designer`,inputs:[{name:`objectName`,type:`string`},{name:`fields`,type:`code`},{name:`readOnly`,type:`boolean`}]});export{Tn as CreateAppPage,Mn as DashboardDesignPage,jn as EditAppPage};