@object-ui/console 3.1.5 → 3.3.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 (178) hide show
  1. package/dist/assets/ActionParamDialog-FoHiwOv1.js +1 -0
  2. package/dist/assets/AdapterProvider-BMMNYOio.js +1 -0
  3. package/dist/assets/AddressField-cixYGlNB.js +1 -0
  4. package/dist/assets/AdvancedChartImpl-BWWiRBQV.js +7 -0
  5. package/dist/assets/AppManagementPage-bOyAnjhU.js +1 -0
  6. package/dist/assets/AuditLogPage-CYbk9eg-.js +1 -0
  7. package/dist/assets/AuthPageLayout-BxIX5ebE.js +1 -0
  8. package/dist/assets/AutoNumberField-ZhMKpjBg.js +1 -0
  9. package/dist/assets/AvatarField-CyFyTMU0.js +1 -0
  10. package/dist/assets/BooleanField-BfvYM6AV.js +1 -0
  11. package/dist/assets/ChartImpl-DC6hwSlw.js +1 -0
  12. package/dist/assets/CodeField-E_gkep6y.js +1 -0
  13. package/dist/assets/ColorField-Cx-A5Lt0.js +1 -0
  14. package/dist/assets/CreateAppPage-BWPsgJjt.js +1 -0
  15. package/dist/assets/CurrencyField-De8eUBZn.js +1 -0
  16. package/dist/assets/DashboardDesignPage-D5PK-DCt.js +1 -0
  17. package/dist/assets/DashboardView-DHicI3QF.js +1 -0
  18. package/dist/assets/DateField-DEX8P85a.js +1 -0
  19. package/dist/assets/DateTimeField-7-OLEv75.js +1 -0
  20. package/dist/assets/EditAppPage-D5zTwJlk.js +1 -0
  21. package/dist/assets/EmailField-PxbTAuYC.js +1 -0
  22. package/dist/assets/FileField-BgYkkxBp.js +1 -0
  23. package/dist/assets/ForgotPasswordPage-B-SC0EDQ.js +1 -0
  24. package/dist/assets/FormulaField-DtcAppqd.js +1 -0
  25. package/dist/assets/GeolocationField-C8Vv3Q9T.js +1 -0
  26. package/dist/assets/GridField-HGVRXmPw.js +1 -0
  27. package/dist/assets/HomeLayout-DiAhEUcQ.js +1 -0
  28. package/dist/assets/HomePage-D0mu1KhN.js +1 -0
  29. package/dist/assets/ImageField-DonGxYyR.js +1 -0
  30. package/dist/assets/KanbanEnhanced-dVJHM0Vq.js +1 -0
  31. package/dist/assets/KanbanImpl-Du7bmAIp.js +1 -0
  32. package/dist/assets/LocationField-y31Q9OYm.js +1 -0
  33. package/dist/assets/LoginPage-CK-e0NKb.js +1 -0
  34. package/dist/assets/LookupField-cs9NaWXw.js +1 -0
  35. package/dist/assets/MarkdownImpl-DLQW-V1y.js +1 -0
  36. package/dist/assets/MasterDetailField-BI3uiZgR.js +1 -0
  37. package/dist/assets/MetadataDetailPage-C7MBEpTZ.js +1 -0
  38. package/dist/assets/MetadataFormDialog-C6kZu-tl.js +1 -0
  39. package/dist/assets/MetadataInspector-DAb5pYOH.js +1 -0
  40. package/dist/assets/MetadataManagerPage-KqCTlrFw.js +1 -0
  41. package/dist/assets/MetadataProvider-B6Zo_H9g.js +1 -0
  42. package/dist/assets/NumberField-CAPsyF5_.js +1 -0
  43. package/dist/assets/ObjectField-BXs-P94B.js +1 -0
  44. package/dist/assets/OrgManagementPage-Bd5hFjFA.js +1 -0
  45. package/dist/assets/PageDesignPage-CQKuBMSG.js +1 -0
  46. package/dist/assets/PageView-DzAF-4xC.js +2 -0
  47. package/dist/assets/PasswordField-66M8i1cP.js +1 -0
  48. package/dist/assets/PercentField-B4-Z2cl-.js +1 -0
  49. package/dist/assets/PermissionManagementPage-BohlfBZM.js +1 -0
  50. package/dist/assets/PhoneField-CbEqbBrO.js +1 -0
  51. package/dist/assets/ProfilePage-B2B5Vwiv.js +1 -0
  52. package/dist/assets/QRCodeField-BMVgCKPB.js +1 -0
  53. package/dist/assets/RatingField-DT67gTVp.js +1 -0
  54. package/dist/assets/RecordDetailView-KuRefR4o.js +1 -0
  55. package/dist/assets/RegisterPage-BR28zo3Z.js +1 -0
  56. package/dist/assets/ReportView-Dud74EeY.js +1 -0
  57. package/dist/assets/RichTextField-BJ3qOJu3.js +1 -0
  58. package/dist/assets/RoleManagementPage-CSrM1CTg.js +1 -0
  59. package/dist/assets/SearchResultsPage-CziEvfRB.js +1 -0
  60. package/dist/assets/SelectField-BIh8RBU2.js +1 -0
  61. package/dist/assets/SignatureField-DeTRlABT.js +1 -0
  62. package/dist/assets/SliderField-DZ4Q6eTl.js +1 -0
  63. package/dist/assets/SummaryField-DIOlQfN3.js +1 -0
  64. package/dist/assets/SystemHubPage-CT0edisJ.js +1 -0
  65. package/dist/assets/SystemObjectViewPage-D2qKWQRW.js +1 -0
  66. package/dist/assets/TextAreaField-C4XjBoOs.js +1 -0
  67. package/dist/assets/TextField-BcXMv3xe.js +1 -0
  68. package/dist/assets/TimeField-CHh1ZLFD.js +1 -0
  69. package/dist/assets/UrlField-DiTncT6s.js +1 -0
  70. package/dist/assets/UserField-mFk7qkDu.js +1 -0
  71. package/dist/assets/UserManagementPage-CicLMv53.js +1 -0
  72. package/dist/assets/VectorField-BsaAAFSl.js +1 -0
  73. package/dist/assets/data-adapter-DPqgzJ64.js +39 -0
  74. package/dist/assets/framework-B0ex8RpF.js +2 -0
  75. package/dist/assets/getIcon-DUhh_MlU.js +1 -0
  76. package/dist/assets/index-KDzKK6UM.js +26 -0
  77. package/dist/assets/index-jP1vuxyn.css +2 -0
  78. package/dist/assets/infrastructure-88EEJ8ZY.js +3 -0
  79. package/dist/assets/lib-CQxQAzx9.js +29 -0
  80. package/dist/assets/maplibre-gl-tCaFQWyX.js +748 -0
  81. package/dist/assets/metadataTypeRegistry-D4RkPQA-.js +1 -0
  82. package/dist/assets/plugins-core-B8C8BUw8.js +135 -0
  83. package/dist/assets/plugins-core-Dpq2d-QS.css +2 -0
  84. package/dist/assets/plugins-views-Csz847hc.js +62 -0
  85. package/dist/assets/{skeletons-DcGqw3b1.js → skeletons-Dxs6Di3L.js} +1 -1
  86. package/dist/assets/src-BY3UmUTR.js +1 -0
  87. package/dist/assets/src-CZnjIqJM.js +1 -0
  88. package/dist/assets/src-ZtN-VRcF.js +1 -0
  89. package/dist/assets/ui-layout-CvxBdH1V.js +3 -0
  90. package/dist/assets/useFavorites--Hq-4pMF.js +1 -0
  91. package/dist/assets/useMetadataService-CC_uGGZw.js +1 -0
  92. package/dist/assets/useResponsiveSidebar-DB8TNfQv.js +1 -0
  93. package/dist/assets/utils-auqIw3t-.js +1 -0
  94. package/dist/assets/vendor-charts-7pRhwWOA.js +3 -0
  95. package/dist/assets/vendor-objectstack-C8-rZ_sh.js +1 -0
  96. package/dist/assets/{vendor-react-BwtAzZZ3.js → vendor-react-DmY3YWtk.js} +2 -2
  97. package/dist/assets/vendor-zod-Cu1XCR5v.js +1 -0
  98. package/dist/index.html +25 -13
  99. package/dist/mockServiceWorker.js +1 -1
  100. package/package.json +50 -47
  101. package/plugin.js +2 -2
  102. package/plugin.ts +2 -2
  103. package/dist/assets/AddressField-BLYuFwUv.js +0 -1
  104. package/dist/assets/AdvancedChartImpl-Dvg6YIfN.js +0 -7
  105. package/dist/assets/AppManagementPage-C5q5QBar.js +0 -1
  106. package/dist/assets/AuditLogPage-BpLFTD-b.js +0 -1
  107. package/dist/assets/AuthPageLayout-DDjJTsQ6.js +0 -1
  108. package/dist/assets/AutoNumberField-DLmi_0fk.js +0 -1
  109. package/dist/assets/AvatarField-BfoEDA_D.js +0 -1
  110. package/dist/assets/BooleanField-W3_x7RAZ.js +0 -1
  111. package/dist/assets/ChartImpl-Cwo6IWnY.js +0 -1
  112. package/dist/assets/CodeField-BWFqblAU.js +0 -1
  113. package/dist/assets/ColorField-Y8WM1wXE.js +0 -1
  114. package/dist/assets/CreateAppPage-A-VfItcx.js +0 -1
  115. package/dist/assets/CurrencyField-BeuE1bRa.js +0 -1
  116. package/dist/assets/DashboardDesignPage-N8NL-jkM.js +0 -1
  117. package/dist/assets/DashboardView-Dy0d2kFj.js +0 -1
  118. package/dist/assets/DateField-2Lf9jstN.js +0 -1
  119. package/dist/assets/DateTimeField-BkMuhOZJ.js +0 -1
  120. package/dist/assets/EditAppPage-B6HL4COW.js +0 -1
  121. package/dist/assets/EmailField-CP_O7tmo.js +0 -1
  122. package/dist/assets/FileField-CcczwlRk.js +0 -1
  123. package/dist/assets/ForgotPasswordPage-Slo6CHvD.js +0 -1
  124. package/dist/assets/FormulaField-DLdg1ImO.js +0 -1
  125. package/dist/assets/GeolocationField-DqeMjnyo.js +0 -1
  126. package/dist/assets/GridField-DaWMYyuc.js +0 -1
  127. package/dist/assets/ImageField-DAn05d1y.js +0 -1
  128. package/dist/assets/KanbanEnhanced-Dj7Qccu2.js +0 -1
  129. package/dist/assets/KanbanImpl-D9BbG_RT.js +0 -1
  130. package/dist/assets/LocationField-DYHVF_gq.js +0 -1
  131. package/dist/assets/LoginPage-D2CqpSi0.js +0 -1
  132. package/dist/assets/LookupField-BF9vCmht.js +0 -1
  133. package/dist/assets/MarkdownImpl-B0Iew7iJ.js +0 -29
  134. package/dist/assets/MasterDetailField-Dw4RRQ5W.js +0 -1
  135. package/dist/assets/NumberField-BKuVHBrN.js +0 -1
  136. package/dist/assets/ObjectField-z00gmFEc.js +0 -1
  137. package/dist/assets/OrgManagementPage-BqtqRi_6.js +0 -1
  138. package/dist/assets/PageDesignPage-BzIL8o0u.js +0 -1
  139. package/dist/assets/PageView-eCi7zkJr.js +0 -2
  140. package/dist/assets/PasswordField-B_rXL4g9.js +0 -1
  141. package/dist/assets/PercentField-Bn_SIbNe.js +0 -1
  142. package/dist/assets/PermissionManagementPage-BmI-0QXt.js +0 -1
  143. package/dist/assets/PhoneField-DuheMaUR.js +0 -1
  144. package/dist/assets/ProfilePage-CUo-xIgl.js +0 -1
  145. package/dist/assets/QRCodeField-IPS2Rpmi.js +0 -1
  146. package/dist/assets/RatingField-M6qZlpA4.js +0 -1
  147. package/dist/assets/RecordDetailView-CFVPmfrM.js +0 -1
  148. package/dist/assets/RegisterPage-D7PJIabW.js +0 -1
  149. package/dist/assets/ReportView-DNOPIpWM.js +0 -1
  150. package/dist/assets/RichTextField-CDGy9V9x.js +0 -1
  151. package/dist/assets/RoleManagementPage-DwtqyfDW.js +0 -1
  152. package/dist/assets/SearchResultsPage-BxzOkRnL.js +0 -1
  153. package/dist/assets/SelectField-F6UDlyvf.js +0 -1
  154. package/dist/assets/SignatureField-CHN7xBII.js +0 -1
  155. package/dist/assets/SliderField-BOfEMQyU.js +0 -1
  156. package/dist/assets/SummaryField-CZ8KzmBZ.js +0 -1
  157. package/dist/assets/SystemHubPage-RFiJSMgW.js +0 -1
  158. package/dist/assets/TextAreaField-1E39zZ_x.js +0 -1
  159. package/dist/assets/TextField-CwuU0Crc.js +0 -1
  160. package/dist/assets/TimeField-CEWXxhLE.js +0 -1
  161. package/dist/assets/UrlField-BtUImn9B.js +0 -1
  162. package/dist/assets/UserField-DSSEoy5L.js +0 -1
  163. package/dist/assets/UserManagementPage-BBS1vYGa.js +0 -1
  164. package/dist/assets/VectorField-BjfQeTZT.js +0 -1
  165. package/dist/assets/data-adapter-wZ81OFjZ.js +0 -39
  166. package/dist/assets/framework-DJlDX9E6.js +0 -1
  167. package/dist/assets/index-D9-L0QBO.css +0 -2
  168. package/dist/assets/index-DDpLaQOV.js +0 -8
  169. package/dist/assets/infrastructure-C6Ph6Ug0.js +0 -3
  170. package/dist/assets/maplibre-gl-DsUGuDud.js +0 -756
  171. package/dist/assets/plugins-core-Cfhp_BXE.css +0 -2
  172. package/dist/assets/plugins-core-PiAAytWV.js +0 -136
  173. package/dist/assets/plugins-views-CE0VP3vl.js +0 -62
  174. package/dist/assets/src-oeWLmiqa.js +0 -1
  175. package/dist/assets/systemObjects-5--4zaiX.js +0 -1
  176. package/dist/assets/ui-layout-DdDX0gzI.js +0 -3
  177. package/dist/assets/vendor-charts-Bl5l0H2K.js +0 -3
  178. package/dist/assets/vendor-objectstack-BtztJIHv.js +0 -1
@@ -1 +1 @@
1
- import{w as e}from"./framework-DJlDX9E6.js";import{Ut as t}from"./plugins-core-PiAAytWV.js";var n=e();function r({cards:e=6}){return(0,n.jsxs)(`div`,{className:`w-full space-y-6 p-4 sm:p-6`,children:[(0,n.jsxs)(`div`,{className:`space-y-2`,children:[(0,n.jsx)(t,{className:`h-7 w-56`}),(0,n.jsx)(t,{className:`h-4 w-80`})]}),(0,n.jsx)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:Array.from({length:4}).map((e,r)=>(0,n.jsxs)(`div`,{className:`rounded-lg border p-4 space-y-2`,children:[(0,n.jsx)(t,{className:`h-4 w-20`}),(0,n.jsx)(t,{className:`h-8 w-24`}),(0,n.jsx)(t,{className:`h-3 w-16`})]},`stat-${r}`))}),(0,n.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:Array.from({length:e}).map((e,r)=>(0,n.jsxs)(`div`,{className:`rounded-lg border p-4 space-y-3`,children:[(0,n.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,n.jsx)(t,{className:`h-5 w-32`}),(0,n.jsx)(t,{className:`h-5 w-5 rounded-full`})]}),(0,n.jsx)(t,{className:`h-40 w-full`}),(0,n.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,n.jsx)(t,{className:`h-3 w-16`}),(0,n.jsx)(t,{className:`h-3 w-12`})]})]},`widget-${r}`))})]})}function i({fields:e=8,columns:r=2}){return(0,n.jsxs)(`div`,{className:`w-full space-y-6 p-4 sm:p-6`,children:[(0,n.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,n.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,n.jsx)(t,{className:`h-8 w-8 rounded`}),(0,n.jsxs)(`div`,{className:`space-y-2`,children:[(0,n.jsx)(t,{className:`h-6 w-48`}),(0,n.jsx)(t,{className:`h-4 w-32`})]})]}),(0,n.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,n.jsx)(t,{className:`h-9 w-20`}),(0,n.jsx)(t,{className:`h-9 w-20`})]})]}),(0,n.jsx)(t,{className:`h-5 w-24`}),(0,n.jsx)(`div`,{className:`grid grid-cols-1 ${r===2?`md:grid-cols-2`:``} gap-4`,children:Array.from({length:e}).map((e,r)=>(0,n.jsxs)(`div`,{className:`space-y-2`,children:[(0,n.jsx)(t,{className:`h-4 w-24`}),(0,n.jsx)(t,{className:`h-9 w-full`})]},`field-${r}`))}),(0,n.jsxs)(`div`,{className:`space-y-3 pt-4 border-t`,children:[(0,n.jsx)(t,{className:`h-5 w-32`}),(0,n.jsx)(`div`,{className:`space-y-2`,children:Array.from({length:3}).map((e,r)=>(0,n.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,n.jsx)(t,{className:`h-8 w-8 rounded-full`}),(0,n.jsxs)(`div`,{className:`flex-1 space-y-1`,children:[(0,n.jsx)(t,{className:`h-4 w-40`}),(0,n.jsx)(t,{className:`h-3 w-24`})]})]},`related-${r}`))})]})]})}export{r as n,i as t};
1
+ import{k as e}from"./framework-B0ex8RpF.js";import{Wt as t}from"./plugins-core-B8C8BUw8.js";var n=e();function r({cards:e=6}){return(0,n.jsxs)(`div`,{className:`w-full space-y-6 p-4 sm:p-6`,children:[(0,n.jsxs)(`div`,{className:`space-y-2`,children:[(0,n.jsx)(t,{className:`h-7 w-56`}),(0,n.jsx)(t,{className:`h-4 w-80`})]}),(0,n.jsx)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:Array.from({length:4}).map((e,r)=>(0,n.jsxs)(`div`,{className:`rounded-lg border p-4 space-y-2`,children:[(0,n.jsx)(t,{className:`h-4 w-20`}),(0,n.jsx)(t,{className:`h-8 w-24`}),(0,n.jsx)(t,{className:`h-3 w-16`})]},`stat-${r}`))}),(0,n.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:Array.from({length:e}).map((e,r)=>(0,n.jsxs)(`div`,{className:`rounded-lg border p-4 space-y-3`,children:[(0,n.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,n.jsx)(t,{className:`h-5 w-32`}),(0,n.jsx)(t,{className:`h-5 w-5 rounded-full`})]}),(0,n.jsx)(t,{className:`h-40 w-full`}),(0,n.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,n.jsx)(t,{className:`h-3 w-16`}),(0,n.jsx)(t,{className:`h-3 w-12`})]})]},`widget-${r}`))})]})}function i({fields:e=8,columns:r=2}){return(0,n.jsxs)(`div`,{className:`w-full space-y-6 p-4 sm:p-6`,children:[(0,n.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,n.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,n.jsx)(t,{className:`h-8 w-8 rounded`}),(0,n.jsxs)(`div`,{className:`space-y-2`,children:[(0,n.jsx)(t,{className:`h-6 w-48`}),(0,n.jsx)(t,{className:`h-4 w-32`})]})]}),(0,n.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,n.jsx)(t,{className:`h-9 w-20`}),(0,n.jsx)(t,{className:`h-9 w-20`})]})]}),(0,n.jsx)(t,{className:`h-5 w-24`}),(0,n.jsx)(`div`,{className:`grid grid-cols-1 ${r===2?`md:grid-cols-2`:``} gap-4`,children:Array.from({length:e}).map((e,r)=>(0,n.jsxs)(`div`,{className:`space-y-2`,children:[(0,n.jsx)(t,{className:`h-4 w-24`}),(0,n.jsx)(t,{className:`h-9 w-full`})]},`field-${r}`))}),(0,n.jsxs)(`div`,{className:`space-y-3 pt-4 border-t`,children:[(0,n.jsx)(t,{className:`h-5 w-32`}),(0,n.jsx)(`div`,{className:`space-y-2`,children:Array.from({length:3}).map((e,r)=>(0,n.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,n.jsx)(t,{className:`h-8 w-8 rounded-full`}),(0,n.jsxs)(`div`,{className:`flex-1 space-y-1`,children:[(0,n.jsx)(t,{className:`h-4 w-40`}),(0,n.jsx)(t,{className:`h-3 w-24`})]})]},`related-${r}`))})]})]})}export{r as n,i as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{z as t}from"./framework-B0ex8RpF.js";var n=e(t(),1);function r(e){let{url:t,channel:r,autoReconnect:i=!0,reconnectInterval:a=1e3,maxReconnectAttempts:o=10,authToken:s}=e,[c,l]=(0,n.useState)(`disconnected`),[u,d]=(0,n.useState)(null),[f,p]=(0,n.useState)([]),[m,h]=(0,n.useState)(null),g=(0,n.useRef)(null),_=(0,n.useRef)(0),v=(0,n.useRef)(null),y=(0,n.useRef)(new Map),b=(0,n.useRef)([]),x=(0,n.useRef)(!0),S=(0,n.useRef)(!1),C=(0,n.useCallback)(()=>{v.current!==null&&(clearTimeout(v.current),v.current=null)},[]),w=(0,n.useCallback)(e=>{for(;b.current.length>0;){let t=b.current.shift(),n={type:t.type,channel:r,data:t.data,timestamp:new Date().toISOString()};e.send(JSON.stringify(n))}},[r]),T=(0,n.useCallback)(()=>{if(typeof WebSocket>`u`){h(Error(`WebSocket is not available in this environment`)),l(`error`);return}if(!t){h(Error(`WebSocket URL is required`)),l(`error`);return}try{let e=new URL(t);if(e.protocol!==`ws:`&&e.protocol!==`wss:`){h(Error(`WebSocket URL must use ws: or wss: protocol`)),l(`error`);return}}catch{h(Error(`Invalid WebSocket URL`)),l(`error`);return}g.current&&=(S.current=!0,g.current.close(),null),S.current=!1,l(`connecting`),h(null);let e=s?`${t}?token=${encodeURIComponent(s)}&channel=${encodeURIComponent(r)}`:`${t}?channel=${encodeURIComponent(r)}`,n;try{n=new WebSocket(e)}catch(e){if(!x.current)return;h(e instanceof Error?e:Error(`Failed to create WebSocket connection`)),l(`error`);return}g.current=n,n.onopen=()=>{x.current&&(l(`connected`),h(null),_.current=0,w(n))},n.onmessage=e=>{if(x.current)try{let t=JSON.parse(String(e.data));if(t.channel!==r)return;d(t),p(e=>[...e,t]);let n=y.current.get(t.type);n&&n.forEach(e=>e(t.data))}catch{}},n.onerror=()=>{x.current&&(h(Error(`WebSocket connection error`)),l(`error`))},n.onclose=()=>{if(x.current){if(g.current=null,S.current){l(`disconnected`);return}if(i&&_.current<o){l(`reconnecting`);let e=Math.min(a*2**_.current,3e4);_.current+=1,v.current=setTimeout(()=>{x.current&&T()},e)}else l(`disconnected`)}}},[t,r,s,i,a,o,w]),E=(0,n.useCallback)(()=>{C(),S.current=!0,_.current=0,g.current&&=(g.current.close(),null),l(`disconnected`)},[C]),D=(0,n.useCallback)(()=>{C(),_.current=0,T()},[T,C]),O=(0,n.useCallback)((e,t)=>{let n=g.current;if(n&&n.readyState===WebSocket.OPEN){let i={type:e,channel:r,data:t,timestamp:new Date().toISOString()};n.send(JSON.stringify(i))}else b.current.push({type:e,data:t})},[r]),k=(0,n.useCallback)((e,t)=>(y.current.has(e)||y.current.set(e,new Set),y.current.get(e).add(t),()=>{let n=y.current.get(e);n&&(n.delete(t),n.size===0&&y.current.delete(e))}),[]);return(0,n.useEffect)(()=>(x.current=!0,t&&T(),()=>{x.current=!1,C(),S.current=!0,g.current&&=(g.current.close(),null)}),[t,r,s]),{connectionState:c,isConnected:c===`connected`,lastMessage:u,messages:f,send:O,subscribe:k,disconnect:E,reconnect:D,error:m}}var i=0;function a(){return i+=1,`conflict-${Date.now()}-${i}`}var o=0;function s(){return o+=1,`ver-${Date.now()}-${o}`}function c(e,t,r){let[i,o]=(0,n.useState)([]),[c,l]=(0,n.useState)([]);return{versions:i,currentVersion:(0,n.useMemo)(()=>i.length===0?0:i[i.length-1].version,[i]),conflicts:c,hasConflicts:c.length>0,recordVersion:(0,n.useCallback)((n,r)=>{o(i=>{let a=i.length===0?1:i[i.length-1].version+1,o={id:s(),version:a,timestamp:new Date().toISOString(),userId:e,userName:t,changes:n,message:r};return[...i,o]})},[e,t]),resolveConflict:(0,n.useCallback)((n,r,i)=>{l(a=>{let c=a.find(e=>e.id===n);if(!c)return a;let l;switch(r){case`local`:l=c.localValue;break;case`remote`:l=c.remoteValue;break;case`merge`:l=i??c.localValue;break}return o(n=>{let i=n.length===0?1:n[n.length-1].version+1,a={id:s(),version:i,timestamp:new Date().toISOString(),userId:e,userName:t,changes:{[c.field]:{before:c.baseValue,after:l}},message:`Resolved conflict on "${c.field}" using ${r} strategy`};return[...n,a]}),a.filter(e=>e.id!==n)})},[e,t]),resolveAllConflicts:(0,n.useCallback)(n=>{l(r=>{if(r.length===0)return r;let i={};for(let e of r)i[e.field]={before:e.baseValue,after:n===`local`?e.localValue:e.remoteValue};return o(r=>{let a=r.length===0?1:r[r.length-1].version+1,o={id:s(),version:a,timestamp:new Date().toISOString(),userId:e,userName:t,changes:i,message:`Resolved all conflicts using ${n} strategy`};return[...r,o]}),[]})},[e,t]),revertToVersion:(0,n.useCallback)(n=>{let r=i.findIndex(e=>e.id===n);if(r===-1)return null;let a={};for(let e=0;e<=r;e++){let t=i[e];for(let[e,n]of Object.entries(t.changes))a[e]=n.after}let c={},l={};for(let e of i)for(let[t,n]of Object.entries(e.changes))l[t]=n.after;for(let[e,t]of Object.entries(a))l[e]!==t&&(c[e]={before:l[e],after:t});return Object.keys(c).length>0&&o(n=>{let a=n.length===0?1:n[n.length-1].version+1,o={id:s(),version:a,timestamp:new Date().toISOString(),userId:e,userName:t,changes:c,message:`Reverted to version ${i[r].version}`};return[...n,o]}),a},[i,e,t]),compareVersions:(0,n.useCallback)((e,t)=>{let n=i.findIndex(t=>t.id===e),r=i.findIndex(e=>e.id===t);if(n===-1||r===-1)return null;let[a,o]=n<r?[n,r]:[r,n],s=e=>{let t={};for(let n=0;n<=e;n++)for(let[e,r]of Object.entries(i[n].changes))t[e]=r.after;return t},c=s(a),l=s(o),u=new Set([...Object.keys(c),...Object.keys(l)]),d={};for(let e of u){let t=c[e],n=l[e];t!==n&&(d[e]={before:t,after:n})}return d},[i]),addConflict:(0,n.useCallback)(e=>{let t={...e,id:a()};l(e=>[...e,t])},[]),clearHistory:(0,n.useCallback)(()=>{o([]),l([])},[])}}var l={sm:24,md:32,lg:40},u={active:`#22c55e`,idle:`#f59e0b`,away:`#94a3b8`};function d(e){return e.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2)}function f({users:e,maxVisible:t=5,size:r=`md`,showStatus:i=!0,className:a}){let o=l[r],s=Math.round(o*.3),c=Math.round(o*.35),f=Math.max(8,Math.round(o*.28)),p=(0,n.useMemo)(()=>e.slice(0,t),[e,t]),m=Math.max(0,e.length-t),h={display:`inline-flex`,alignItems:`center`,flexDirection:`row-reverse`,fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`},g={width:`${o}px`,height:`${o}px`,borderRadius:`50%`,border:`2px solid #fff`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:`${c}px`,fontWeight:600,color:`#fff`,position:`relative`,flexShrink:0,overflow:`hidden`,boxSizing:`border-box`},_={...g,backgroundColor:`#e2e8f0`,color:`#475569`,marginLeft:`-${s}px`},v={position:`absolute`,bottom:`-1px`,right:`-1px`,width:`${f}px`,height:`${f}px`,borderRadius:`50%`,border:`2px solid #fff`,boxSizing:`border-box`},y=(0,n.useMemo)(()=>[...p].reverse(),[p]);return n.createElement(`div`,{style:h,className:a,role:`group`,"aria-label":`${e.length} user${e.length===1?``:`s`} present`},m>0&&n.createElement(`div`,{key:`overflow`,style:_,title:`${m} more user${m===1?``:`s`}`},`+${m}`),y.map((e,t)=>n.createElement(`div`,{key:e.userId,style:{...g,backgroundColor:e.color,marginLeft:t>0||m>0?`-${s}px`:`0`},title:`${e.userName} (${e.status})`},e.avatar?n.createElement(`img`,{src:e.avatar,alt:e.userName,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):d(e.userName),i&&n.createElement(`span`,{style:{...v,backgroundColor:u[e.status]}}))))}export{c as n,r,f as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{R as t,a as n,j as r,k as i,t as a,w as o,z as s}from"./framework-B0ex8RpF.js";import{$c as c,$s as l,Bc as u,Bs as d,Cc as f,Fc as p,Fl as m,Gc as h,Hc as g,Hs as _,Kc as v,Ks as y,Lc as b,Ls as x,Mc as S,Ms as C,Oc as w,Os as T,Pl as E,Ps as D,Qc as O,Qs as k,Rc as A,Ss as j,Tc as M,Uc as N,Us as P,Vc as F,Wc as I,Xc as ee,Yc as L,Ys as te,Zc as R,Zs as ne,_l as z,ac as B,bc as re,bl as ie,bs as ae,cs as V,dc as oe,dl as se,ds as ce,ec as le,es as ue,fc as de,fl as fe,fs as pe,gc as me,gl as he,hl as H,hs as U,i as ge,ic as _e,il as ve,ls as ye,ml as be,os as xe,pc as Se,pl as W,ps as G,qs as Ce,rl as we,rs as Te,sc as Ee,tc as De,tl as Oe,ts as ke,ul as Ae,us as je,vc as Me,vl as Ne,vs as Pe,wc as Fe,wl as Ie,x as Le,xc as Re,yc as ze,yl as Be,ys as Ve,zc as He}from"./plugins-core-B8C8BUw8.js";var K=e(s(),1);function Ue(e,t={}){let{maxHistory:n=50}=t,[r,i]=(0,K.useState)(e),a=(0,K.useRef)([]),o=(0,K.useRef)([]),s=(0,K.useCallback)(e=>{i(t=>(a.current=[...a.current.slice(-(n-1)),t],o.current=[],e))},[n]),c=(0,K.useCallback)(()=>{a.current.length!==0&&i(e=>{let t=[...a.current],n=t.pop();return a.current=t,o.current=[e,...o.current],n})},[]),l=(0,K.useCallback)(()=>{o.current.length!==0&&i(e=>{let t=[...o.current],n=t.shift();return o.current=t,a.current=[...a.current,e],n})},[]),u=(0,K.useCallback)(e=>{a.current=[],o.current=[],i(e)},[]);return{current:r,canUndo:a.current.length>0,canRedo:o.current.length>0,undoCount:a.current.length,redoCount:o.current.length,push:s,undo:c,redo:l,reset:u}}function We(){let[e,t]=(0,K.useState)(!1),[n,r]=(0,K.useState)(``),[i,a]=(0,K.useState)(``),o=(0,K.useRef)(null);return{isOpen:e,title:n,message:i,confirm:(0,K.useCallback)((e,n)=>(r(e),a(n),t(!0),new Promise(e=>{o.current=e})),[]),onConfirm:(0,K.useCallback)(()=>{t(!1),o.current?.(!0),o.current=null},[]),onCancel:(0,K.useCallback)(()=>{t(!1),o.current?.(!1),o.current=null},[])}}function Ge(){let[e,t]=(0,K.useState)(new Set);return{selectedIds:e,toggle:(0,K.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,K.useCallback)(e=>{t(new Set([e]))},[]),selectMany:(0,K.useCallback)(e=>{t(new Set(e))},[]),clearSelection:(0,K.useCallback)(()=>{t(new Set)},[]),isSelected:(0,K.useCallback)(t=>e.has(t),[e]),count:e.size}}function Ke(){let[e,t]=(0,K.useState)(null);return{clipboard:e,copy:(0,K.useCallback)(e=>{t(structuredClone(e))},[]),paste:(0,K.useCallback)(()=>e?structuredClone(e):null,[e]),hasContent:e!==null}}function qe(e={}){let{minZoom:t=.25,maxZoom:n=3,zoomStep:r=.1,initialZoom:i=1}=e,[a,o]=(0,K.useState)(i),[s,c]=(0,K.useState)({x:0,y:0}),l=(0,K.useRef)(!1),u=(0,K.useRef)({x:0,y:0}),d=(0,K.useCallback)(e=>Math.min(n,Math.max(t,+e.toFixed(2))),[t,n]);return{zoom:a,panOffset:s,zoomIn:(0,K.useCallback)(()=>o(e=>d(e+r)),[d,r]),zoomOut:(0,K.useCallback)(()=>o(e=>d(e-r)),[d,r]),resetZoom:(0,K.useCallback)(()=>{o(1),c({x:0,y:0})},[]),setZoom:(0,K.useCallback)(e=>o(d(e)),[d]),handleWheel:(0,K.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,K.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=i();function Je(...e){return E(m(e))}function Ye({isOpen:e,title:t,message:n,confirmLabel:r=`Delete`,cancelLabel:i=`Cancel`,destructive:a=!0,onConfirm:o,onCancel:s}){let c=(0,K.useRef)(null);return(0,K.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)(ce,{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`,{onClick:s,className:`px-4 py-2 text-sm rounded-md border hover:bg-accent`,children:i}),(0,q.jsx)(`button`,{onClick:o,className:Je(`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 Xe(...e){return E(m(e))}function Ze({title:e=`Properties`,fields:t,onChange:n,className:r}){let[i,a]=(0,K.useState)(new Set),o=(0,K.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:Xe(`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`,{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)(se,{className:`h-3 w-3`}):(0,q.jsx)(W,{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)(Qe,{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 Qe({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 $e(...e){return E(m(e))}function et({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:$e(`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 tt=(0,K.createContext)(null);tt.displayName=`CollaborationContext`;function nt(){return(0,K.useContext)(tt)}function J(...e){return E(m(e))}function rt({canvas:e={width:1200,height:800,gridSize:8,showGrid:!0,snapToGrid:!0},components:t=[],palette:n=it,showComponentTree:r=!0,undoRedo:i=!0,propertyEditor:a=!0,readOnly:o=!1,showMinimap:s=!1,onChange:c,className:l}){let u=Ue(t),f=u.current,p=(0,K.useCallback)(e=>{u.push(e),c?.(e)},[u,c]),m=qe({initialZoom:e.zoom??1}),{zoom:g}=m,v=Ge(),y=(0,K.useMemo)(()=>{let e=Array.from(v.selectedIds);return e.length>0?e[0]:null},[v.selectedIds]),x=(0,K.useMemo)(()=>f.find(e=>e.id===y),[f,y]),S=Ke(),C=We(),w=nt(),T=(0,K.useCallback)(e=>{w&&w.sendOperation({...e,userId:w.currentUserId??``})},[w]),[E,D]=(0,K.useState)(!0),[A,j]=(0,K.useState)(!0),[N,P]=(0,K.useState)(s),F=(0,K.useRef)(null),I=(0,K.useRef)(null),ee=(0,K.useCallback)(t=>!e.snapToGrid||!e.gridSize?t:Math.round(t/e.gridSize)*e.gridSize,[e.snapToGrid,e.gridSize]),L=(0,K.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??{}};p([...f,a]),v.selectOne(a.id),T({type:`insert`,elementId:a.id,data:{component:a}})},[f,o,n,p,v,T]),te=(0,K.useCallback)(e=>{o||(p(f.filter(t=>t.id!==e)),v.isSelected(e)&&v.clearSelection(),T({type:`delete`,elementId:e,data:{}}))},[f,o,p,v,T]),R=(0,K.useCallback)(async()=>{if(o||v.count===0||!await C.confirm(`Delete components`,`Are you sure you want to delete ${v.count} component${v.count>1?`s`:``}?`))return;let e=v.selectedIds;p(f.filter(t=>!e.has(t.id))),v.clearSelection(),e.forEach(e=>{T({type:`delete`,elementId:e,data:{}})})},[o,v,C,f,p,T]),ne=(0,K.useCallback)((e,t)=>{o||!y||(p(f.map(n=>n.id===y?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)),T({type:`update`,elementId:y,data:{[e]:t}}))},[o,y,f,p,T]),z=(0,K.useCallback)(()=>{let e=v.selectedIds;if(e.size===0)return;let t=f.filter(t=>e.has(t.id));S.copy(t)},[v,f,S]),B=(0,K.useCallback)(()=>{if(o)return;let e=S.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}}));p([...f,...n]),v.selectMany(n.map(e=>e.id)),n.forEach(e=>{T({type:`insert`,elementId:e.id,data:{component:e}})})},[o,S,f,p,v,T]),re=(0,K.useCallback)((e,t)=>{o||(F.current={id:t.id,startX:e.clientX,startY:e.clientY},e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t.id))},[o]),ie=(0,K.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},[]),ae=(0,K.useCallback)(e=>{e.preventDefault();let t=F.current;if(!t||o)return;let n=(e.clientX-t.startX)/g,r=(e.clientY-t.startY)/g;p(f.map(e=>e.id===t.id?{...e,position:{...e.position,x:ee(e.position.x+n),y:ee(e.position.y+r)}}:e)),T({type:`move`,elementId:t.id,data:{}}),F.current=null},[o,g,f,p,ee,T]),V=(0,K.useMemo)(()=>x?[{name:`label`,label:`Label`,type:`text`,value:x.label??``,group:`General`},{name:`x`,label:`X`,type:`number`,value:x.position.x,group:`Position`},{name:`y`,label:`Y`,type:`number`,value:x.position.y,group:`Position`},{name:`width`,label:`Width`,type:`number`,value:x.position.width,group:`Size`},{name:`height`,label:`Height`,type:`number`,value:x.position.height,group:`Size`}]:[],[x]),se=(0,K.useMemo)(()=>f.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:v.isSelected(e.id)})),[f,v]);return(0,K.useEffect)(()=>{let e=I.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`)&&v.count>0&&!t){e.preventDefault(),R();return}if(e.key===`Escape`){v.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(),z();return}if(n&&e.key===`v`&&!o){e.preventDefault(),B();return}if(n&&e.key===`a`){e.preventDefault(),v.selectMany(f.map(e=>e.id));return}}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[v,R,i,o,u,z,B,f]),(0,q.jsxs)(`div`,{ref:I,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`,E?`w-60`:`w-0 overflow-hidden`),role:`region`,"aria-label":`Component palette`,children:E&&(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`,{onClick:()=>L(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)(_,{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`,{className:`p-1.5 rounded hover:bg-accent`,title:E?`Collapse palette`:`Expand palette`,"aria-label":E?`Collapse palette`:`Expand palette`,onClick:()=>D(e=>!e),children:(0,q.jsx)(le,{className:J(`h-4 w-4`,!E&&`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`,{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)(ye,{className:`h-4 w-4`})}),(0,q.jsx)(`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)(d,{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`,{className:J(`p-1.5 rounded hover:bg-accent`,v.count===0&&`opacity-40 pointer-events-none`),title:`Copy (Ctrl+C)`,"aria-label":`Copy`,disabled:v.count===0,onClick:z,children:(0,q.jsx)(O,{className:`h-4 w-4`})}),(0,q.jsx)(`button`,{className:J(`p-1.5 rounded hover:bg-accent`,!S.hasContent&&`opacity-40 pointer-events-none`),title:`Paste (Ctrl+V)`,"aria-label":`Paste`,disabled:!S.hasContent,onClick:B,children:(0,q.jsx)(ve,{className:`h-4 w-4`})}),(0,q.jsx)(`div`,{className:`w-px h-5 bg-border mx-1`})]}),!o&&(0,q.jsx)(`button`,{className:J(`p-1.5 rounded hover:bg-accent`,v.count===0&&`opacity-40 pointer-events-none`),title:`Delete selected`,"aria-label":`Delete selected`,disabled:v.count===0,onClick:R,children:(0,q.jsx)(G,{className:`h-4 w-4`})}),(0,q.jsx)(`button`,{className:`p-1.5 rounded hover:bg-accent`,title:`Preview`,"aria-label":`Preview`,children:(0,q.jsx)(h,{className:`h-4 w-4`})}),(0,q.jsx)(`button`,{className:J(`p-1.5 rounded hover:bg-accent`,N&&`bg-accent`),title:`Toggle minimap`,"aria-label":`Toggle minimap`,onClick:()=>P(e=>!e),children:(0,q.jsx)(de,{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`,{className:`p-1 rounded hover:bg-accent text-xs`,"aria-label":`Zoom out`,onClick:m.zoomOut,children:(0,q.jsx)(Ee,{className:`h-3 w-3`})}),(0,q.jsxs)(`span`,{className:`text-xs text-muted-foreground w-10 text-center`,children:[Math.round(g*100),`%`]}),(0,q.jsx)(`button`,{className:`p-1 rounded hover:bg-accent text-xs`,"aria-label":`Zoom in`,onClick:m.zoomIn,children:(0,q.jsx)(_,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{className:`p-1 rounded hover:bg-accent text-xs`,"aria-label":`Reset zoom`,onClick:m.resetZoom,children:(0,q.jsx)(oe,{className:`h-3 w-3`})})]}),r&&(0,q.jsx)(`button`,{className:`p-1.5 rounded hover:bg-accent`,title:A?`Collapse panel`:`Expand panel`,"aria-label":A?`Collapse panel`:`Expand panel`,onClick:()=>j(e=>!e),children:(0,q.jsx)(k,{className:J(`h-4 w-4`,!A&&`rotate-180`)})})]}),(0,q.jsx)(`div`,{className:`flex-1 overflow-auto bg-muted/10 p-4 relative`,role:`region`,"aria-label":`Design canvas`,onWheel:m.handleWheel,onMouseDown:m.startPan,onDragOver:ie,onDrop:ae,children:(0,q.jsxs)(`div`,{className:`relative bg-background border rounded shadow-sm mx-auto`,style:{width:e.width*g,height:e.height*g,transform:`translate(${m.panOffset.x}px, ${m.panOffset.y}px)`,backgroundImage:e.showGrid?`radial-gradient(circle, hsl(var(--border)) 1px, transparent 1px)`:void 0,backgroundSize:e.showGrid&&e.gridSize?`${e.gridSize*g}px ${e.gridSize*g}px`:void 0},children:[f.map(e=>{let t=v.isSelected(e.id);return(0,q.jsxs)(`div`,{draggable:!o,onDragStart:t=>re(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*g,top:e.position.y*g,width:typeof e.position.width==`number`?e.position.width*g:e.position.width,height:typeof e.position.height==`number`?e.position.height*g:e.position.height},onClick:t=>v.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)(b,{className:`h-3 w-3 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`truncate`,children:e.label??e.type}),!o&&(0,q.jsx)(`button`,{onClick:t=>{t.stopPropagation(),te(e.id)},className:`ml-auto p-0.5 rounded hover:bg-destructive/10`,"aria-label":`Delete ${e.label??e.type}`,children:(0,q.jsx)(G,{className:`h-3 w-3 text-destructive`})})]}),(0,q.jsx)(`div`,{className:`p-2 text-xs text-muted-foreground`,children:e.type})]},e.id)}),N&&(0,q.jsx)(et,{items:se,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`,A?`w-60`:`w-0 overflow-hidden`),role:`region`,"aria-label":`Component tree`,children:A&&(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)(M,{className:`h-4 w-4`}),`Component Tree`]}),(0,q.jsx)(`div`,{className:`flex-1 overflow-y-auto p-2`,children:f.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.`}):f.map(e=>(0,q.jsx)(`button`,{onClick:t=>v.toggle(e.id,t.shiftKey),className:J(`w-full flex items-center gap-2 px-2 py-1.5 text-sm rounded text-left`,v.isSelected(e.id)?`bg-accent`:`hover:bg-accent/50`),children:(0,q.jsx)(`span`,{className:`truncate`,children:e.label??e.type})},e.id))}),a&&x?(0,q.jsx)(`div`,{className:`border-t`,children:(0,q.jsx)(Ze,{title:`Properties – ${x.label??x.type}`,fields:V,onChange:ne})}):x&&(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: `,x.type]}),(0,q.jsxs)(`div`,{children:[`ID: `,x.id]}),(0,q.jsxs)(`div`,{children:[`Position: `,x.position.x,`,`,` `,x.position.y]}),(0,q.jsxs)(`div`,{children:[`Size: `,x.position.width,` ×`,` `,x.position.height]})]})]})]})}),(0,q.jsx)(Ye,{isOpen:C.isOpen,title:C.title,message:C.message,onConfirm:C.onConfirm,onCancel:C.onCancel})]})}var it=[{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 at(e,t={}){return Ue(e,t)}function ot(...e){return E(m(e))}var st=[`text`,`number`,`boolean`,`date`,`datetime`,`uuid`,`email`,`url`,`phone`,`json`,`integer`,`float`,`decimal`,`currency`,`percent`,`textarea`,`select`,`multiselect`,`lookup`,`attachment`,`formula`,`autonumber`];function ct(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 lt({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,K.useRef)(null),l=at({entities:e,relationships:t},{maxHistory:50}),{entities:u,relationships:f}=l.current,p=(0,K.useCallback)(e=>{l.push(e),a?.(e.entities),o?.(e.relationships)},[l,a,o]),m=We(),h=Ge(),g=h.count>0?Array.from(h.selectedIds)[0]:null,v=Ke(),y=qe({minZoom:.25,maxZoom:3,zoomStep:.1}),b=nt(),[S,C]=(0,K.useState)(!0),[w,T]=(0,K.useState)(!0),[E,D]=(0,K.useState)(null),[k,j]=(0,K.useState)(``),[M,N]=(0,K.useState)(null),[P,F]=(0,K.useState)(``),I=(0,K.useRef)(null),ee=(0,K.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}};p({entities:[...e.entities,t],relationships:e.relationships}),h.selectOne(t.id),b?.sendOperation({type:`insert`,userId:b?.currentUserId??``,elementId:t.id,data:{name:t.name,label:t.label}})},[i,l,p,h,b]),L=(0,K.useCallback)(async e=>{if(i)return;let t=u.find(t=>t.id===e);if(!await m.confirm(`Delete Entity`,`Are you sure you want to delete "${t?.label??e}"? This action cannot be undone.`))return;let n=l.current;p({entities:n.entities.filter(t=>t.id!==e),relationships:n.relationships.filter(t=>t.sourceEntity!==e&&t.targetEntity!==e)}),h.isSelected(e)&&h.clearSelection(),b?.sendOperation({type:`delete`,userId:b?.currentUserId??``,elementId:e,data:{}})},[i,u,m,l,p,h,b]),te=(0,K.useCallback)(async()=>{if(i||h.count===0)return;let e=Array.from(h.selectedIds);if(!await m.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);p({entities:t.entities.filter(e=>!n.has(e.id)),relationships:t.relationships.filter(e=>!n.has(e.sourceEntity)&&!n.has(e.targetEntity))}),h.clearSelection()},[i,h,m,l,p]),ne=(0,K.useCallback)(()=>{if(i)return;let e=l.current;p({entities:ct(e.entities),relationships:e.relationships})},[i,l,p]),z=(0,K.useCallback)(()=>{let e=u.filter(e=>h.isSelected(e.id));e.length>0&&v.copy(e)},[u,h,v]),B=(0,K.useCallback)(()=>{if(i)return;let e=v.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}}));p({entities:[...t.entities,...n],relationships:t.relationships}),h.selectMany(n.map(e=>e.id))},[i,v,l,p,h]),ie=(0,K.useCallback)(e=>{if(i)return;let t=l.current;p({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})},[i,l,p]),ae=(0,K.useCallback)((e,t,n)=>{i||(D({entityId:e,fieldIndex:t}),j(n))},[i]),V=(0,K.useCallback)(()=>{if(!E)return;let e=k.trim();if(e===``){D(null);return}let t=l.current;p({entities:t.entities.map(t=>{if(t.id!==E.entityId)return t;let n=t.fields.map((t,n)=>n===E.fieldIndex?{...t,name:e}:t);return{...t,fields:n}}),relationships:t.relationships}),D(null)},[E,k,l,p]),oe=(0,K.useCallback)(()=>{D(null)},[]),ce=(0,K.useCallback)((e,t)=>{i||(N(e),F(t))},[i]),le=(0,K.useCallback)(()=>{if(!M)return;let e=P.trim();if(e===``){N(null);return}let t=l.current;p({entities:t.entities.map(t=>t.id===M?{...t,label:e}:t),relationships:t.relationships}),N(null)},[M,P,l,p]),de=(0,K.useCallback)(()=>{N(null)},[]),fe=(0,K.useCallback)((e,t,n)=>{if(i)return;let r=l.current;p({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})},[i,l,p]),pe=(0,K.useCallback)((e,t)=>{if(i||!u.find(e=>e.id===t))return;let n=e.target.getBoundingClientRect();I.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]),me=(0,K.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},[]),he=(0,K.useCallback)(e=>{if(e.preventDefault(),!I.current)return;let t=e.currentTarget.getBoundingClientRect(),n=y.zoom,r=(e.clientX-t.left-y.panOffset.x)/n-I.current.offsetX,i=(e.clientY-t.top-y.panOffset.y)/n-I.current.offsetY,a=l.current;p({entities:a.entities.map(e=>e.id===I.current.entityId?{...e,position:{x:Math.max(0,Math.round(r)),y:Math.max(0,Math.round(i))}}:e),relationships:a.relationships}),I.current=null},[y.zoom,y.panOffset,l,p]),H=g?u.find(e=>e.id===g):null,U=H?[{name:`name`,label:`Name`,type:`text`,value:H.name,group:`General`},{name:`label`,label:`Label`,type:`text`,value:H.label,group:`General`},{name:`description`,label:`Description`,type:`textarea`,value:H.description??``,group:`General`},{name:`color`,label:`Color`,type:`color`,value:H.color??`#3b82f6`,group:`Appearance`},{name:`position.x`,label:`X Position`,type:`number`,value:H.position.x,group:`Position`},{name:`position.y`,label:`Y Position`,type:`number`,value:H.position.y,group:`Position`}]:[],ge=(0,K.useCallback)((e,t)=>{if(!g)return;let n=l.current;p({entities:n.entities.map(n=>n.id===g?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})},[g,l,p]);(0,K.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(),z()):n&&e.key===`v`?(e.preventDefault(),B()):(e.key===`Delete`||e.key===`Backspace`)&&h.count>0?(e.preventDefault(),te()):e.key===`Escape`&&(h.clearSelection(),D(null),N(null))};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[l,z,B,te,h]);let _e=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:h.isSelected(e.id)}));return(0,q.jsxs)(`div`,{ref:c,tabIndex:0,className:ot(`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`,{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)(ye,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`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)(d,{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`,{onClick:y.zoomOut,"aria-label":`Zoom Out`,title:`Zoom Out`,className:`p-1 rounded hover:bg-accent`,children:(0,q.jsx)(ue,{className:`h-3.5 w-3.5`})}),(0,q.jsxs)(`span`,{className:`text-xs tabular-nums w-10 text-center`,children:[Math.round(y.zoom*100),`%`]}),(0,q.jsx)(`button`,{onClick:y.zoomIn,"aria-label":`Zoom In`,title:`Zoom In`,className:`p-1 rounded hover:bg-accent`,children:(0,q.jsx)(ke,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`button`,{onClick:y.resetZoom,"aria-label":`Reset Zoom`,title:`Reset Zoom`,className:`p-1 rounded hover:bg-accent`,children:(0,q.jsx)(x,{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`,{onClick:z,disabled:h.count===0,"aria-label":`Copy`,title:`Copy (Ctrl+C)`,className:`p-1 rounded hover:bg-accent disabled:opacity-40`,children:(0,q.jsx)(O,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`button`,{onClick:B,disabled:!v.hasContent,"aria-label":`Paste`,title:`Paste (Ctrl+V)`,className:`p-1 rounded hover:bg-accent disabled:opacity-40`,children:(0,q.jsx)(ve,{className:`h-3.5 w-3.5`})})]}),!i&&(0,q.jsxs)(`button`,{onClick:ne,"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)(A,{className:`h-3 w-3`}),` Auto Layout`]}),(0,q.jsx)(`div`,{className:`flex-1`}),b?.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)(xe,{className:`h-3 w-3`}),(0,q.jsxs)(`span`,{children:[b.users.length,` user`,b.users.length===1?``:`s`]})]}),h.count>1&&(0,q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[h.count,` selected`]}),!i&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{onClick:ee,"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)(_,{className:`h-3 w-3`}),` Add Entity`]}),(0,q.jsxs)(`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)(re,{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:y.handleWheel,onMouseDown:y.startPan,onDragOver:me,onDrop:he,children:[(0,q.jsxs)(`div`,{className:`relative`,style:{width:n.width,minHeight:n.height,...y.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:f.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=>pe(t,e.id),className:ot(`absolute rounded-lg border-2 bg-background shadow-sm w-60 select-none cursor-grab active:cursor-grabbing`,h.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=>h.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`}),M===e.id?(0,q.jsx)(`input`,{type:`text`,value:P,onChange:e=>F(e.target.value),onBlur:le,onKeyDown:e=>{e.key===`Enter`&&le(),e.key===`Escape`&&de()},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(),ce(e.id,e.label)},title:`Double-click to edit label`,"data-testid":`entity-label-${e.id}`,children:e.label}),!i&&(0,q.jsx)(`button`,{onClick:t=>{t.stopPropagation(),L(e.id)},"aria-label":`Delete ${e.label}`,className:`ml-auto p-0.5 rounded hover:bg-destructive/20`,children:(0,q.jsx)(G,{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:[E&&E.entityId===e.id&&E.fieldIndex===n?(0,q.jsx)(`input`,{type:`text`,value:k,onChange:e=>j(e.target.value),onBlur:V,onKeyDown:e=>{e.key===`Enter`&&V(),e.key===`Escape`&&oe()},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:ot(`font-mono cursor-text`,t.primaryKey&&`font-bold text-primary`),onClick:r=>{r.stopPropagation(),ae(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(),fe(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:st.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`,{onClick:t=>{t.stopPropagation(),ie(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)(_,{className:`h-3 w-3`}),` Add Field`]})})]},e.id))]}),w&&u.length>0&&(0,q.jsx)(et,{items:_e,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`,{onClick:()=>C(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":S,"aria-controls":`property-editor-panel`,children:[S?(0,q.jsx)(W,{className:`h-3 w-3`}):(0,q.jsx)(se,{className:`h-3 w-3`}),`Properties`]}),S&&(0,q.jsx)(`div`,{id:`property-editor-panel`,className:`flex-1 overflow-y-auto`,children:(0,q.jsx)(Ze,{title:H?H.label:`Properties`,fields:U,onChange:ge})})]}),(0,q.jsx)(`div`,{className:`border-t`,children:(0,q.jsxs)(`button`,{onClick:()=>T(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":w,children:[w?(0,q.jsx)(W,{className:`h-3 w-3`}):(0,q.jsx)(se,{className:`h-3 w-3`}),`Minimap`]})})]}),(0,q.jsx)(Ye,{isOpen:m.isOpen,title:m.title,message:m.message,onConfirm:m.onConfirm,onCancel:m.onCancel,destructive:!0})]})}function ut(...e){return E(m(e))}var dt=120,ft=50;function pt(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 mt({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:f}){let p=Ue({nodes:t,edges:n},{maxHistory:50}),m=p.current.nodes,h=p.current.edges,g=(0,K.useCallback)((e,t)=>{p.push({nodes:e,edges:t}),c?.(e),l?.(t)},[p,c,l]),_=We(),v=Ge(),y=Ke(),b=qe({initialZoom:1}),S=nt(),[C,w]=(0,K.useState)(null),[T,E]=(0,K.useState)(!1),[D,A]=(0,K.useState)(null),[M,N]=(0,K.useState)(null),[F,I]=(0,K.useState)(!0),[L,R]=(0,K.useState)(null),[z,B]=(0,K.useState)({x:0,y:0}),re=(0,K.useRef)(null),ie=(0,K.useRef)(c),ae=(0,K.useRef)(l);ie.current=c,ae.current=l,(0,K.useEffect)(()=>{ie.current?.(m),ae.current?.(h)},[p.current]);let V=(0,K.useCallback)((e,t)=>{if(s)return;let n={id:`node-${Date.now()}`,type:e,label:t,position:{x:200+m.length*160,y:200}};g([...m,n],h),w(n.id),v.selectOne(n.id),S?.sendOperation({type:`insert`,elementId:n.id,data:{label:t},userId:S.currentUserId??``})},[m,h,s,g,v,S]),oe=(0,K.useCallback)(async e=>{if(s)return;let t=m.find(t=>t.id===e);await _.confirm(`Delete Node`,`Are you sure you want to delete "${t?.label??e}"? This will also remove all connected edges.`)&&(g(m.filter(t=>t.id!==e),h.filter(t=>t.source!==e&&t.target!==e)),C===e&&w(null),v.clearSelection(),S?.sendOperation({type:`delete`,elementId:e,data:{},userId:S.currentUserId??``}))},[m,h,C,s,g,_,v,S]),se=(0,K.useCallback)(async()=>{if(s||v.count===0||!await _.confirm(`Delete Selected Nodes`,`Are you sure you want to delete ${v.count} selected node(s) and their connected edges?`))return;let e=v.selectedIds;g(m.filter(t=>!e.has(t.id)),h.filter(t=>!e.has(t.source)&&!e.has(t.target))),w(null),v.clearSelection()},[m,h,s,g,_,v]),ce=(0,K.useCallback)(()=>{let e=v.count>0?v.selectedIds:C?new Set([C]):new Set;if(e.size===0)return;let t=m.filter(t=>e.has(t.id));y.copy(t)},[m,C,v,y]),le=(0,K.useCallback)(()=>{if(s)return;let e=y.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}}));g([...m,...t],h),v.selectMany(t.map(e=>e.id)),w(t[0].id)},[s,m,h,y,g,v]),de=(0,K.useCallback)(()=>{E(e=>e?(A(null),!1):!0)},[]),fe=(0,K.useCallback)(e=>{if(!T)return!1;if(!D)return A(e),!0;if(D===e)return!0;let t={id:`edge-${Date.now()}`,source:D,target:e};return g(m,[...h,t]),A(null),E(!1),S?.sendOperation({type:`insert`,elementId:t.id,data:{source:D,target:e},userId:S.currentUserId??``}),!0},[T,D,m,h,g,S]),pe=(0,K.useCallback)(()=>{s||m.length===0||g(pt(m,h),h)},[m,h,s,g]),me=(0,K.useCallback)((e,t)=>{if(s||!m.find(e=>e.id===t))return;R(t);let n=e.target.getBoundingClientRect();B({x:e.clientX-n.left,y:e.clientY-n.top}),e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t)},[s,m]),he=(0,K.useCallback)(e=>{if(e.preventDefault(),s||!L)return;let t=e.currentTarget.getBoundingClientRect(),n=b.zoom,r=(e.clientX-t.left-b.panOffset.x)/n-z.x,i=(e.clientY-t.top-b.panOffset.y)/n-z.y,a=Math.max(0,Math.round(r/20)*20),o=Math.max(0,Math.round(i/20)*20);g(m.map(e=>e.id===L?{...e,position:{x:a,y:o}}:e),h),R(null)},[s,L,z,m,h,b.zoom,b.panOffset,g]),H=(0,K.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},[]),U=(0,K.useMemo)(()=>m.find(e=>e.id===C)??null,[m,C]),ge=(0,K.useMemo)(()=>U?[{name:`label`,label:`Name`,type:`text`,value:U.label,group:`General`},{name:`type`,label:`Type`,type:`select`,value:U.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:U.description??``,group:`General`}]:[],[U]),_e=(0,K.useCallback)((e,t)=>{s||!C||g(m.map(n=>n.id===C?{...n,[e]:t}:n),h)},[s,C,m,h,g]),be=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`}},xe=(0,K.useMemo)(()=>m.map(e=>({id:e.id,x:e.position.x,y:e.position.y,width:dt,height:ft,selected:v.isSelected(e.id)||e.id===C})),[m,v,C]);(0,K.useEffect)(()=>{let e=re.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(),p.undo();return}if(n&&e.key===`y`||n&&e.key===`z`&&e.shiftKey){e.preventDefault(),p.redo();return}if(n&&e.key===`c`){e.preventDefault(),ce();return}if(n&&e.key===`v`){e.preventDefault(),le();return}if(e.key===`Delete`||e.key===`Backspace`){v.count>0?(e.preventDefault(),se()):C&&(e.preventDefault(),oe(C));return}if(e.key===`Escape`){T?(E(!1),A(null)):(w(null),v.clearSelection());return}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[C,T,v,p,ce,le,oe,se]);let Se=(0,K.useCallback)(e=>{e.target===e.currentTarget&&(w(null),v.clearSelection(),T&&(E(!1),A(null)))},[T,v]);return(0,q.jsxs)(`div`,{ref:re,tabIndex:0,className:ut(`flex flex-col h-full w-full border rounded-lg overflow-hidden bg-background`,f),children:[(0,q.jsx)(Ye,{isOpen:_.isOpen,title:_.title,message:_.message,onConfirm:_.onConfirm,onCancel:_.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)(u,{className:`h-4 w-4`}),(0,q.jsx)(`span`,{className:`font-medium text-sm`,"aria-label":`Process name`,children:e}),S?.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`}),S.users.length,` user`,S.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`,{onClick:()=>p.undo(),disabled:!p.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)(ye,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{onClick:()=>p.redo(),disabled:!p.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)(d,{className:`h-3 w-3`})}),(0,q.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`}),(0,q.jsx)(`button`,{onClick:ce,disabled:v.count===0&&!C,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)(O,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{onClick:le,disabled:!y.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)(ve,{className:`h-3 w-3`})}),(0,q.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`}),(0,q.jsxs)(`button`,{onClick:de,className:ut(`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,T&&`bg-primary text-primary-foreground`),title:`Connect nodes`,"aria-label":`Connect nodes`,"aria-pressed":T,children:[(0,q.jsx)(ze,{className:`h-3 w-3`}),` Connect`]}),(0,q.jsxs)(`button`,{onClick:pe,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`,{onClick:b.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)(ke,{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(b.zoom*100),`%`]}),(0,q.jsx)(`button`,{onClick:b.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)(ue,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{onClick:b.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)(x,{className:`h-3 w-3`})}),(0,q.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`}),(0,q.jsxs)(`button`,{onClick:()=>V(`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)(P,{className:`h-3 w-3 text-green-600`}),` Start`]}),(0,q.jsxs)(`button`,{onClick:()=>V(`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)(j,{className:`h-3 w-3 text-blue-600`}),` Task`]}),(0,q.jsxs)(`button`,{onClick:()=>V(`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)(ee,{className:`h-3 w-3 text-yellow-600`}),` Gateway`]}),(0,q.jsxs)(`button`,{onClick:()=>V(`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)(j,{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`,{onClick:()=>I(e=>!e),className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,title:F?`Hide properties`:`Show properties`,"aria-label":F?`Hide property panel`:`Show property panel`,"aria-expanded":F,children:F?(0,q.jsx)(k,{className:`h-3 w-3`}):(0,q.jsx)(ne,{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:b.handleWheel,onMouseDown:b.startPan,children:(0,q.jsxs)(`div`,{className:`relative`,style:{...b.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:Se,onDrop:he,onDragOver:H,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))`})})}),h.map(e=>{let t=m.find(t=>t.id===e.source),n=m.find(t=>t.id===e.target);if(!t||!n)return null;t.position.x+dt/2;let r=t.position.y+ft/2;n.position.x+dt/2;let i=n.position.y+ft/2,a=t.position.x+dt,o=r,s=n.position.x,c=i;return(0,q.jsxs)(`g`,{children:[(0,q.jsx)(`path`,{d:`M ${a} ${o} Q ${(a+s)/2} ${o}, ${(a+s)/2} ${(o+c)/2} T ${s} ${c}`,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)})]}),m.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.`}),m.map(e=>{let t=v.isSelected(e.id)||C===e.id,n=D===e.id,r=M===e.id,i=T||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&&!T,onDragStart:t=>me(t,e.id),onMouseEnter:()=>N(e.id),onMouseLeave:()=>N(null),onClick:t=>{fe(e.id)||(t.shiftKey?v.toggle(e.id,!0):(w(e.id),v.selectOne(e.id)))},children:[(0,q.jsx)(`div`,{className:ut(`flex items-center justify-center border-2 min-w-[120px] min-h-[50px] px-3 py-2 transition-shadow`,be(e.type),t&&`ring-2 ring-primary shadow-md`,n&&`ring-2 ring-blue-400 shadow-lg`,T&&!n&&`cursor-crosshair`),children:(0,q.jsx)(`span`,{className:ut(`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:ft/2-6},title:`Input port`,onClick:t=>{t.stopPropagation(),fe(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:ft/2-6},title:`Output port`,onClick:t=>{t.stopPropagation(),T?fe(e.id):(E(!0),A(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:dt/2-6,top:-6},title:`Port`,onClick:t=>{t.stopPropagation(),fe(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:dt/2-6,bottom:-6},title:`Port`,onClick:t=>{t.stopPropagation(),fe(e.id)}})]}),!s&&t&&!T&&(0,q.jsx)(`button`,{onClick:t=>{t.stopPropagation(),oe(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)(G,{className:`h-3 w-3`})})]},e.id)}),a&&m.length>0&&(0,q.jsx)(et,{items:xe,canvasWidth:i.width??1400,canvasHeight:i.height??800,position:`bottom-right`})]})}),F&&!s&&(0,q.jsx)(`div`,{className:`w-64 border-l bg-background overflow-y-auto flex-shrink-0`,role:`complementary`,"aria-label":`Property panel`,children:(0,q.jsx)(Ze,{title:U?`Properties: ${U.label}`:`Properties`,fields:ge,onChange:_e})})]})]})}function Y(...e){return E(m(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`},ht={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}},gt=[{type:`header`,height:80,elements:[]},{type:`detail`,height:400,elements:[],repeat:!0},{type:`footer`,height:60,elements:[]}];function _t({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 f=Ue(a.length>0?a:gt),p=f.current,m=(0,K.useCallback)(e=>{f.push(e),l?.(e)},[f,l]),h=Ge(),g=(0,K.useMemo)(()=>{let e=Array.from(h.selectedIds);return e.length>0?e[0]:null},[h.selectedIds]),v=Ke(),y=We(),b=nt(),x=(0,K.useCallback)(e=>{b&&b.sendOperation({...e,userId:b.currentUserId??``})},[b]),[C,w]=(0,K.useState)(!0),T=(0,K.useRef)(null),E=(0,K.useRef)(null),D=ht[n],A=r===`landscape`?D.height:D.width,j=r===`landscape`?D.width:D.height,M=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}},N=(0,K.useMemo)(()=>g?p.flatMap(e=>e.elements).find(e=>e.id===g):null,[g,p]),P=(0,K.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}};m(p.map((t,r)=>r===e?{...t,elements:[...t.elements,n]}:t)),h.selectOne(n.id),x({type:`insert`,elementId:n.id,data:{element:n}})},[p,i.left,c,m,h,x]),F=(0,K.useCallback)(e=>{c||(m(p.map(t=>({...t,elements:t.elements.filter(t=>t.id!==e)}))),h.isSelected(e)&&h.clearSelection(),x({type:`delete`,elementId:e,data:{}}))},[p,c,m,h,x]),ee=(0,K.useCallback)(async()=>{if(c||h.count===0||!await y.confirm(X.deleteElementsTitle,X.deleteElementMessage(h.count)))return;let e=h.selectedIds;m(p.map(t=>({...t,elements:t.elements.filter(t=>!e.has(t.id))}))),h.clearSelection(),e.forEach(e=>{x({type:`delete`,elementId:e,data:{}})})},[c,h,y,p,m,x]),L=(0,K.useCallback)((e,t)=>{c||!g||(m(p.map(n=>({...n,elements:n.elements.map(n=>n.id===g?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)}))),x({type:`update`,elementId:g,data:{[e]:t}}))},[c,g,p,m,x]),te=(0,K.useCallback)(()=>{let e=h.selectedIds;if(e.size===0)return;let t=p.flatMap(e=>e.elements).filter(t=>e.has(t.id));v.copy(t)},[h,p,v]),R=(0,K.useCallback)(()=>{if(c)return;let e=v.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=p.findIndex(e=>e.type===`detail`),i=r>=0?r:0;m(p.map((e,t)=>t===i?{...e,elements:[...e.elements,...n]}:e)),h.selectMany(n.map(e=>e.id)),n.forEach(e=>{x({type:`insert`,elementId:e.id,data:{element:e}})})},[c,v,p,m,h,x]),ne=(0,K.useCallback)((e,t,n)=>{c||(T.current={id:t.id,sectionIndex:n,startX:e.clientX,startY:e.clientY},e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t.id))},[c]),z=(0,K.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},[]),B=(0,K.useCallback)((e,t)=>{e.preventDefault();let n=T.current;if(!n||c)return;let r=e.clientX-n.startX,i=e.clientY-n.startY;if(n.sectionIndex===t)m(p.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));else{let e=null,i=p.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)}});e&&m(i.map((n,r)=>r===t?{...n,elements:[...n.elements,e]}:n))}x({type:`move`,elementId:n.id,data:{}}),T.current=null},[c,p,m,x]),re=(0,K.useMemo)(()=>{if(!N)return[];let e=[{name:`x`,label:X.propX,type:`number`,value:N.position.x,group:X.groupPosition},{name:`y`,label:X.propY,type:`number`,value:N.position.y,group:X.groupPosition},{name:`width`,label:X.propWidth,type:`number`,value:N.position.width,group:X.groupSize},{name:`height`,label:X.propHeight,type:`number`,value:N.position.height,group:X.groupSize}];return N.type===`text`&&e.push({name:`text`,label:X.propText,type:`text`,value:N.properties.text??``,group:X.groupContent}),N.type===`field`&&e.push({name:`field`,label:X.propField,type:`text`,value:N.properties.field??``,group:X.groupContent}),e},[N]);return(0,K.useEffect)(()=>{let e=E.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(),ee();return}if(e.key===`Escape`){h.clearSelection();return}if(!t){if(n&&e.key===`z`&&!e.shiftKey&&!c){e.preventDefault(),f.undo();return}if(n&&(e.key===`z`&&e.shiftKey||e.key===`y`)&&!c){e.preventDefault(),f.redo();return}if(n&&e.key===`c`){e.preventDefault(),te();return}if(n&&e.key===`v`&&!c){e.preventDefault(),R();return}if(n&&e.key===`a`){e.preventDefault();let t=p.flatMap(e=>e.elements).map(e=>e.id);h.selectMany(t);return}}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[h,ee,c,f,te,R,p]),(0,q.jsxs)(`div`,{ref:E,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)(I,{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`,{className:Y(`p-1.5 rounded hover:bg-accent`,!f.canUndo&&`opacity-40 pointer-events-none`),title:X.undoShortcut,"aria-label":X.undo,disabled:!f.canUndo,onClick:()=>f.undo(),children:(0,q.jsx)(ye,{className:`h-4 w-4`})}),(0,q.jsx)(`button`,{className:Y(`p-1.5 rounded hover:bg-accent`,!f.canRedo&&`opacity-40 pointer-events-none`),title:X.redoShortcut,"aria-label":X.redo,disabled:!f.canRedo,onClick:()=>f.redo(),children:(0,q.jsx)(d,{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`,{className:Y(`p-1.5 rounded hover:bg-accent`,h.count===0&&`opacity-40 pointer-events-none`),title:X.copyShortcut,"aria-label":X.copy,disabled:h.count===0,onClick:te,children:(0,q.jsx)(O,{className:`h-4 w-4`})}),(0,q.jsx)(`button`,{className:Y(`p-1.5 rounded hover:bg-accent`,!v.hasContent&&`opacity-40 pointer-events-none`),title:X.pasteShortcut,"aria-label":X.paste,disabled:!v.hasContent,onClick:R,children:(0,q.jsx)(ve,{className:`h-4 w-4`})}),(0,q.jsx)(`div`,{className:`w-px h-5 bg-border mx-1`})]}),!c&&(0,q.jsx)(`button`,{className:Y(`p-1.5 rounded hover:bg-accent`,h.count===0&&`opacity-40 pointer-events-none`),title:X.deleteSelected,"aria-label":X.deleteSelected,disabled:h.count===0,onClick:ee,children:(0,q.jsx)(G,{className:`h-4 w-4`})}),(0,q.jsx)(`div`,{className:`flex-1`}),b?.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,b.users.length>1&&` (${b.users.length})`]}),(0,q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[n,` `,r]}),s&&(0,q.jsx)(`button`,{className:`p-1.5 rounded hover:bg-accent`,title:C?X.collapsePanel:X.expandPanel,"aria-label":C?X.collapsePanel:X.expandPanel,onClick:()=>w(e=>!e),children:(0,q.jsx)(k,{className:Y(`h-4 w-4`,!C&&`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:A,minHeight:j},children:p.map((e,t)=>(0,q.jsxs)(`div`,{className:`relative border-b border-dashed border-gray-300`,style:{minHeight:e.height},onDragOver:z,onDrop:e=>B(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:[M(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`,{onClick:()=>P(t,`text`),className:`p-0.5 rounded hover:bg-accent`,title:X.addText,"aria-label":X.addText,children:(0,q.jsx)(je,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{onClick:()=>P(t,`field`),className:`p-0.5 rounded hover:bg-accent`,title:X.addField,"aria-label":X.addField,children:(0,q.jsx)(_,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{onClick:()=>P(t,`image`),className:`p-0.5 rounded hover:bg-accent`,title:X.addImage,"aria-label":X.addImage,children:(0,q.jsx)(S,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{onClick:()=>P(t,`chart`),className:`p-0.5 rounded hover:bg-accent`,title:X.addChart,"aria-label":X.addChart,children:(0,q.jsx)(Ne,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{onClick:()=>P(t,`table`),className:`p-0.5 rounded hover:bg-accent`,title:X.addTable,"aria-label":X.addTable,children:(0,q.jsx)(Pe,{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=h.isSelected(e.id);return(0,q.jsxs)(`div`,{draggable:!c,onDragStart:n=>ne(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=>h.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`,{onClick:t=>{t.stopPropagation(),F(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)(G,{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`,C?`w-56`:`w-0 overflow-hidden`),children:C&&(g&&N?(0,q.jsx)(Ze,{title:`${X.properties} – ${N.type}`,fields:re,onChange:L}):(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)(Ye,{isOpen:y.isOpen,title:y.title,message:y.message,onConfirm:y.onConfirm,onCancel:y.onCancel})]})}var vt={"appDesigner.basicInfo":`Basic Info`,"appDesigner.objects":`Objects`,"appDesigner.navigation":`Navigation`,"appDesigner.branding":`Branding`,"appDesigner.stepBasicDesc":`Name, title, and layout`,"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.layout":`Layout`,"appDesigner.layoutSidebar":`Sidebar`,"appDesigner.layoutHeader":`Header`,"appDesigner.layoutEmpty":`Empty`,"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.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.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.enabled":`Enabled`,"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.indexed":`Indexed`,"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.formula":`Formula`,"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.`};function yt(e){return(t,n)=>{let r=e[t]||t;if(n)for(let[e,t]of Object.entries(n))r=r.replace(`{{${e}}}`,String(t));return r}}function Z(){try{let e=n();return e.t(`appDesigner.basicInfo`)===`appDesigner.basicInfo`?{t:yt(vt)}:{t:e.t}}catch{return{t:yt(vt)}}}function Q(...e){return E(m(e))}var bt={name:``,title:``,description:``,icon:``,template:``,layout:`sidebar`,objects:[],navigation:[],branding:{logo:``,primaryColor:`#3b82f6`,favicon:``}};function xt(e){return e.filter(e=>e.selected).map(e=>({id:e.name,type:`object`,label:e.label,icon:e.icon,objectName:e.name}))}var St=0;function Ct(e){return St+=1,`${e}_${Date.now()}_${St}`}function wt({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)(K.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)(be,{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 Tt({draft:e,templates:t,readOnly:n,onChange:r,t:i}){let o=e.name.length>0&&!a(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`,children:`*`})]}),(0,q.jsx)(`input`,{id:`app-name`,"data-testid":`app-name-input`,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`,o?`border-red-400`:`border-gray-300`)}),o&&(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`,children:`*`})]}),(0,q.jsx)(`input`,{id:`app-title`,"data-testid":`app-title-input`,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))]})]}),(0,q.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,q.jsx)(`legend`,{className:`text-sm font-medium text-gray-700`,children:i(`appDesigner.layout`)}),(0,q.jsx)(`div`,{className:`flex gap-3`,children:[{value:`sidebar`,labelKey:`appDesigner.layoutSidebar`,Icon:l},{value:`header`,labelKey:`appDesigner.layoutHeader`,Icon:te},{value:`empty`,labelKey:`appDesigner.layoutEmpty`,Icon:Re}].map(({value:t,labelKey:a,Icon:o})=>(0,q.jsxs)(`label`,{"data-testid":`app-layout-${t}`,className:Q(`flex flex-1 cursor-pointer flex-col items-center gap-1.5 rounded-lg border-2 p-3 transition-colors`,e.layout===t?`border-blue-500 bg-blue-50`:`border-gray-200 hover:border-gray-300`,n&&`pointer-events-none opacity-60`),children:[(0,q.jsx)(o,{className:`h-5 w-5 text-gray-600`}),(0,q.jsx)(`span`,{className:`text-xs font-medium text-gray-700`,children:i(a)}),(0,q.jsx)(`input`,{type:`radio`,name:`layout`,value:t,checked:e.layout===t,onChange:()=>r({layout:t}),disabled:n,className:`sr-only`})]},t))})]})]})}function Et({objects:e,readOnly:t,onToggle:n,onToggleAll:r,search:i,onSearchChange:a,t:o}){let s=(0,K.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)(D,{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)(be,{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 Dt={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 Ot({items:e,readOnly:t,onAdd:n,onRemove:r,onReorder:i,t:a}){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:()=>n(`group`),disabled:t,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)(N,{className:`h-3.5 w-3.5`}),a(`appDesigner.addGroup`)]}),(0,q.jsxs)(`button`,{type:`button`,"data-testid":`add-url-btn`,onClick:()=>n(`url`),disabled:t,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)(ze,{className:`h-3.5 w-3.5`}),a(`appDesigner.addUrl`)]}),(0,q.jsxs)(`button`,{type:`button`,"data-testid":`add-separator-btn`,onClick:()=>n(`separator`),disabled:t,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)(Ee,{className:`h-3.5 w-3.5`}),a(`appDesigner.addSeparator`)]})]}),e.length===0?(0,q.jsx)(`p`,{className:`py-8 text-center text-sm text-gray-400`,children:a(`appDesigner.noNavItemsHint`)}):(0,q.jsx)(`ul`,{className:`space-y-1.5`,children:e.map((n,s)=>(0,q.jsxs)(`li`,{"data-testid":`nav-item-${n.id}`,className:`flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2`,children:[n.icon&&(0,q.jsx)(`span`,{className:`text-xs text-gray-400`,children:n.icon}),(0,q.jsx)(`span`,{className:`flex-1 truncate text-sm text-gray-800`,children:n.type===`separator`?a(`appDesigner.separatorLabel`):o(n.label)}),(0,q.jsx)(`span`,{className:Q(`rounded-full px-2 py-0.5 text-[10px] font-medium`,Dt[n.type]??`bg-gray-100 text-gray-600`),children:n.type}),(0,q.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:()=>i(n.id,`up`),disabled:t||s===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)(Ae,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>i(n.id,`down`),disabled:t||s===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)(W,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>r(n.id),disabled:t,className:`rounded p-0.5 text-gray-400 transition-colors hover:text-red-500 disabled:opacity-30`,"aria-label":`Remove`,children:(0,q.jsx)(G,{className:`h-3.5 w-3.5`})})]})]},n.id))})]})}function kt({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)(S,{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)(De,{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)(He,{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 At({availableObjects:e=[],templates:t=[],initialDraft:n,onComplete:r,onCancel:i,onSaveDraft:o,readOnly:s=!1,className:c}){let{t:l}=Z(),u=We(),[d,f]=(0,K.useState)(0),[p,m]=(0,K.useState)(``),[h,g]=(0,K.useState)(()=>({...bt,objects:e.map(e=>({...e})),...n})),_=(0,K.useMemo)(()=>[{id:`basic`,label:l(`appDesigner.basicInfo`),description:l(`appDesigner.stepBasicDesc`),icon:`Settings`},{id:`objects`,label:l(`appDesigner.objects`),description:l(`appDesigner.stepObjectsDesc`),icon:`Database`},{id:`navigation`,label:l(`appDesigner.navigation`),description:l(`appDesigner.stepNavigationDesc`),icon:`Menu`},{id:`branding`,label:l(`appDesigner.branding`),description:l(`appDesigner.stepBrandingDesc`),icon:`Palette`}],[l]),v=d===0,y=d===_.length-1,b=(0,K.useMemo)(()=>h.name.length>0&&a(h.name)&&h.title.trim().length>0,[h.name,h.title]),x=(0,K.useMemo)(()=>d===0?b:!0,[d,b]),S=(0,K.useCallback)(e=>{g(t=>({...t,...e}))},[]),C=(0,K.useCallback)(e=>{g(t=>({...t,branding:{...t.branding,...e}}))},[]),w=(0,K.useCallback)(e=>{g(t=>({...t,objects:t.objects.map(t=>t.name===e?{...t,selected:!t.selected}:t)}))},[]),T=(0,K.useCallback)(e=>{g(t=>({...t,objects:t.objects.map(t=>({...t,selected:e}))}))},[]),E=(0,K.useCallback)(e=>{let t={id:Ct(e),type:e,label:e===`separator`?``:e===`group`?`New Group`:`New Link`,...e===`group`?{children:[]}:{},...e===`url`?{url:``}:{}};g(e=>({...e,navigation:[...e.navigation,t]}))},[]),D=(0,K.useCallback)(e=>{g(t=>({...t,navigation:t.navigation.filter(t=>t.id!==e)}))},[]),O=(0,K.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,K.useCallback)(()=>{y||(d===1&&g(e=>({...e,navigation:xt(e.objects)})),f(e=>e+1))},[d,y]),A=(0,K.useCallback)(()=>{v||f(e=>e-1)},[v]),j=(0,K.useCallback)(()=>{r?.(h)},[h,r]),M=(0,K.useCallback)(async()=>{(h.name.length>0||h.title.length>0)&&i?await u.confirm(l(`appDesigner.cancelConfirmTitle`),l(`appDesigner.cancelConfirmMessage`))&&i():i?.()},[h.name,h.title,i,u,l]),N=(0,K.useCallback)(()=>{o?.(h)},[h,o]),P=(0,K.useCallback)(e=>{e<=d?f(e):e===d+1&&x&&(d===1&&e===2&&g(e=>({...e,navigation:xt(e.objects)})),f(e))},[d,x]);return(0,q.jsxs)(`div`,{className:Q(`flex h-full flex-col rounded-xl border border-gray-200 bg-white shadow-sm`,c),children:[u.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:u.title}),(0,q.jsx)(`button`,{type:`button`,onClick:u.onCancel,className:`rounded p-1 text-gray-400 hover:text-gray-600`,"aria-label":l(`common.close`),children:(0,q.jsx)(Te,{className:`h-4 w-4`})})]}),(0,q.jsx)(`p`,{className:`mt-2 text-sm text-gray-600`,children:u.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:u.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:l(`appDesigner.keepEditing`)}),(0,q.jsx)(`button`,{type:`button`,"data-testid":`cancel-confirm-discard`,onClick:u.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:l(`appDesigner.confirmDiscard`)})]})]})}),(0,q.jsx)(`div`,{className:`border-b border-gray-100`,children:(0,q.jsx)(wt,{steps:_,currentIndex:d,onStepClick:P})}),(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6`,children:[d===0&&(0,q.jsx)(Tt,{draft:h,templates:t,readOnly:s,onChange:S,t:l}),d===1&&(0,q.jsx)(Et,{objects:h.objects,readOnly:s,onToggle:w,onToggleAll:T,search:p,onSearchChange:m,t:l}),d===2&&(0,q.jsx)(Ot,{items:h.navigation,readOnly:s,onAdd:E,onRemove:D,onReorder:O,t:l}),d===3&&(0,q.jsx)(kt,{branding:h.branding,title:h.title,readOnly:s,onChange:C,t:l})]}),(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:M,disabled:s,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:l(`common.cancel`)}),o&&(0,q.jsx)(`button`,{type:`button`,"data-testid":`wizard-save-draft`,onClick:N,disabled:s,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:l(`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:s,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)(fe,{className:`h-4 w-4`}),l(`common.back`)]}),y?(0,q.jsxs)(`button`,{type:`button`,"data-testid":`wizard-complete`,onClick:j,disabled:s||!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)(be,{className:`h-4 w-4`}),l(`appDesigner.complete`)]}):(0,q.jsxs)(`button`,{type:`button`,"data-testid":`wizard-next`,onClick:k,disabled:s||!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:[l(`common.next`),(0,q.jsx)(se,{className:`h-4 w-4`})]})]})]})]})}function jt(...e){return E(m(e))}var Mt=0;function Nt(e){return Mt+=1,`${e}_${Date.now()}_${Mt}`}var Pt={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:Fe},page:{labelKey:`appDesigner.navTypePage`,color:`bg-teal-100 text-teal-700`,Icon:I},report:{labelKey:`appDesigner.navTypeReport`,color:`bg-rose-100 text-rose-700`,Icon:Ne},url:{labelKey:`appDesigner.navTypeUrl`,color:`bg-sky-100 text-sky-700`,Icon:ze},group:{labelKey:`appDesigner.navTypeGroup`,color:`bg-purple-100 text-purple-700`,Icon:N},separator:{labelKey:`appDesigner.navTypeSeparator`,color:`bg-gray-100 text-gray-600`,Icon:Ee},action:{labelKey:`appDesigner.navTypeAction`,color:`bg-orange-100 text-orange-700`,Icon:_e}},Ft=[{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 It({item:e,depth:t,index:n,total:r,readOnly:i,onRemove:a,onMoveUp:s,onMoveDown:c,onToggleExpand:l,onUpdateLabel:u,onUpdateIcon:d,onToggleVisible:f,onAddChild:p,expandedIds:m,t:g}){let[y,x]=(0,K.useState)(!1),[S,C]=(0,K.useState)(o(e.label)??``),[w,T]=(0,K.useState)(!1),[E,D]=(0,K.useState)(e.icon||``),O=Pt[e.type];e.type===`group`&&e.children&&e.children.length;let k=m.has(e.id),A=e.visible===!1,j=()=>{S.trim()?u(e.id,S.trim()):C(o(e.label)??``),x(!1)},M=()=>{d(e.id,E.trim()),T(!1)};return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`li`,{"data-testid":`nav-designer-item-${e.id}`,className:jt(`flex items-center gap-2 rounded-md border border-gray-200 bg-white px-2 py-1.5 transition-colors hover:bg-gray-50`,A&&`opacity-50`),style:{marginLeft:t*20},children:[(0,q.jsx)(b,{className:`h-3.5 w-3.5 shrink-0 cursor-grab text-gray-300`}),e.type===`group`?(0,q.jsx)(`button`,{type:`button`,onClick:()=>l(e.id),className:`rounded p-0.5 text-gray-400 hover:text-gray-600`,"aria-label":g(k?`appDesigner.navCollapseGroup`:`appDesigner.navExpandGroup`),children:k?(0,q.jsx)(W,{className:`h-3.5 w-3.5`}):(0,q.jsx)(se,{className:`h-3.5 w-3.5`})}):(0,q.jsx)(`span`,{className:`w-5`}),w&&!i?(0,q.jsx)(`input`,{type:`text`,value:E,onChange:e=>D(e.target.value),onBlur:M,onKeyDown:t=>{t.key===`Enter`&&M(),t.key===`Escape`&&(D(e.icon||``),T(!1))},autoFocus:!0,placeholder:g(`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)(O.Icon,{className:`h-3.5 w-3.5 shrink-0 text-gray-500`}),!i&&e.type!==`separator`&&(0,q.jsx)(`button`,{type:`button`,onClick:()=>{D(e.icon||``),T(!0)},className:`rounded p-0.5 text-gray-300 hover:text-blue-500`,"aria-label":g(`appDesigner.navEditIcon`),"data-testid":`nav-designer-edit-icon-${e.id}`,children:(0,q.jsx)(Ce,{className:`h-2.5 w-2.5`})})]}),e.type===`separator`?(0,q.jsx)(`span`,{className:`flex-1 text-xs italic text-gray-400`,children:g(`appDesigner.separatorLabel`)}):y&&!i?(0,q.jsx)(`input`,{type:`text`,value:S,onChange:e=>C(e.target.value),onBlur:j,onKeyDown:t=>{t.key===`Enter`&&j(),t.key===`Escape`&&(C(o(e.label)??``),x(!1))},autoFocus:!0,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:jt(`flex-1 truncate text-sm text-gray-800`,!i&&`cursor-text`),onDoubleClick:()=>{!i&&e.type!==`separator`&&(C(o(e.label)??``),x(!0))},children:o(e.label)}),(0,q.jsx)(`span`,{className:jt(`rounded-full px-2 py-0.5 text-[10px] font-medium`,O.color),children:g(O.labelKey)}),A&&(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:g(`appDesigner.navHidden`)}),!i&&e.type!==`separator`&&(0,q.jsx)(`button`,{type:`button`,onClick:()=>f(e.id),className:`rounded p-0.5 text-gray-400 hover:text-gray-700`,"aria-label":g(`appDesigner.navToggleVisible`),"data-testid":`nav-designer-toggle-visible-${e.id}`,children:A?(0,q.jsx)(v,{className:`h-3.5 w-3.5`}):(0,q.jsx)(h,{className:`h-3.5 w-3.5`})}),e.type===`group`&&!i&&(0,q.jsx)(`button`,{type:`button`,onClick:()=>p(e.id,`page`),className:`rounded p-0.5 text-gray-400 hover:text-blue-500`,"aria-label":g(`appDesigner.navAddChild`),"data-testid":`nav-designer-add-child-${e.id}`,children:(0,q.jsx)(_,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>s(e.id),disabled:i||n===0,className:`rounded p-0.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":g(`appDesigner.navMoveUp`),children:(0,q.jsx)(Ae,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>c(e.id),disabled:i||n===r-1,className:`rounded p-0.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":g(`appDesigner.navMoveDown`),children:(0,q.jsx)(W,{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":g(`appDesigner.navRemove`),"data-testid":`nav-designer-remove-${e.id}`,children:(0,q.jsx)(G,{className:`h-3.5 w-3.5`})})]}),e.type===`group`&&k&&e.children&&(0,q.jsx)(q.Fragment,{children:e.children.map((n,r)=>(0,q.jsx)(It,{item:n,depth:t+1,index:r,total:e.children.length,readOnly:i,onRemove:a,onMoveUp:s,onMoveDown:c,onToggleExpand:l,onUpdateLabel:u,onUpdateIcon:d,onToggleVisible:f,onAddChild:p,expandedIds:m,t:g},n.id))})]})}function Lt({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)(Rt,{item:e,depth:0},e.id))})]})}function Rt({item:e,depth:t}){let n=Pt[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:o(e.label)})]}),e.type===`group`&&e.children?.map(e=>(0,q.jsx)(Rt,{item:e,depth:t+1},e.id))]})}function zt({items:e,onChange:t,readOnly:n=!1,showPreview:r=!0,className:i,onExport:a,onImport:o}){let{t:s}=Z(),c=(0,K.useRef)(null),[l,u]=(0,K.useState)(()=>new Set(e.filter(e=>e.type===`group`).map(e=>e.id))),d=(0,K.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,K.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,K.useCallback)((n,r)=>{function i(e){return e.map(e=>e.id===n?{...e,label:r}:e.children?{...e,children:i(e.children)}:e)}t(i(e))},[e,t]),m=(0,K.useCallback)((n,r)=>{function i(e){return e.map(e=>e.id===n?{...e,icon:r||void 0}:e.children?{...e,children:i(e.children)}:e)}t(i(e))},[e,t]),h=(0,K.useCallback)(n=>{function r(e){return e.map(e=>e.id===n?{...e,visible:e.visible===!1}:e.children?{...e,children:r(e.children)}:e)}t(r(e))},[e,t]),g=(0,K.useCallback)((n,r)=>{let i={id:Nt(r),type:r,label:r===`separator`?``:`New ${s(Pt[r].labelKey)}`,...r===`group`?{children:[]}:{},...r===`url`?{url:``}:{}};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]),v=(0,K.useCallback)(n=>{let r={id:Nt(n),type:n,label:n===`separator`?``:`New ${s(Pt[n].labelKey)}`,...n===`group`?{children:[]}:{},...n===`url`?{url:``}:{}};t([...e,r])},[e,t,s]),y=(0,K.useCallback)(e=>{u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),b=(0,K.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]),x=(0,K.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:jt(`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:[Ft.map(({type:e,labelKey:t})=>{let{Icon:r,color:i}=Pt[e];return(0,q.jsxs)(`button`,{type:`button`,"data-testid":`nav-designer-add-${e}`,onClick:()=>v(e),disabled:n,className:jt(`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)(_,{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:b,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)(L,{className:`h-3 w-3`}),s(`appDesigner.navExportSchema`)]}),(0,q.jsxs)(`label`,{"data-testid":`nav-designer-import`,className:jt(`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)(V,{className:`h-3 w-3`}),s(`appDesigner.navImportSchema`),(0,q.jsx)(`input`,{ref:c,type:`file`,accept:`.json`,className:`hidden`,onChange:x,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)(It,{item:t,depth:0,index:r,total:e.length,readOnly:n,onRemove:d,onMoveUp:e=>f(e,`up`),onMoveDown:e=>f(e,`down`),onToggleExpand:y,onUpdateLabel:p,onUpdateIcon:m,onToggleVisible:h,onAddChild:g,expandedIds:l,t:s},t.id))})]}),r&&(0,q.jsx)(Lt,{items:e,t:s})]})}function Bt(...e){return E(m(e))}var Vt=[{type:`metric`,label:`KPI Metric`,Icon:pe},{type:`bar`,label:`Bar Chart`,Icon:Ne},{type:`line`,label:`Line Chart`,Icon:z},{type:`pie`,label:`Pie Chart`,Icon:H},{type:`table`,label:`Table`,Icon:Pe},{type:`grid`,label:`Grid`,Icon:f}],Ht=0;function Ut(){return Ht+=1,`widget_${Date.now()}_${Ht}`}function Wt({widget:e,index:t,total:n,selected:r,readOnly:i,onSelect:a,onRemove:o,onMoveUp:s,onMoveDown:c}){let l=e.type||`metric`,u=Vt.find(e=>e.type===l)||Vt[0];return(0,q.jsxs)(`div`,{"data-testid":`dashboard-widget-${e.id}`,onClick:a,className:Bt(`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)(b,{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:e.title||`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)(Ae,{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)(W,{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)(G,{className:`h-3.5 w-3.5`})})]})]}),(0,q.jsxs)(`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}),e.object&&(0,q.jsx)(`span`,{className:`text-[10px] text-gray-400`,children:e.object})]})]})}function Gt({widget:e,readOnly:t,onChange:n,onClose:r}){let{t:i}=Z();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)(Te,{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:e.title??``,onChange:e=>n({title: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`})]}),(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=>n({type: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:Vt.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-object`,className:`text-xs font-medium text-gray-600`,children:`Data Source (Object)`}),(0,q.jsx)(`input`,{id:`widget-object`,"data-testid":`widget-prop-object`,type:`text`,value:e.object??``,onChange:e=>n({object:e.target.value}),disabled:t,placeholder:`e.g. orders`,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-value-field`,className:`text-xs font-medium text-gray-600`,children:`Value Field`}),(0,q.jsx)(`input`,{id:`widget-value-field`,"data-testid":`widget-prop-value-field`,type:`text`,value:e.valueField??``,onChange:e=>n({valueField:e.target.value}),disabled:t,placeholder:`e.g. amount`,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-aggregate`,className:`text-xs font-medium text-gray-600`,children:`Aggregate`}),(0,q.jsxs)(`select`,{id:`widget-aggregate`,"data-testid":`widget-prop-aggregate`,value:e.aggregate??`count`,onChange:e=>n({aggregate: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:`count`,children:`Count`}),(0,q.jsx)(`option`,{value:`sum`,children:`Sum`}),(0,q.jsx)(`option`,{value:`avg`,children:`Average`}),(0,q.jsx)(`option`,{value:`min`,children:`Min`}),(0,q.jsx)(`option`,{value:`max`,children:`Max`})]})]}),(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 Kt({schema:e}){let{t}=Z(),n=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:e.title||t(`appDesigner.dashboardPreview`)}),n.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:n.map(e=>{let t=Vt.find(t=>t.type===(e.type||`metric`))||Vt[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:e.title||`Untitled`})]}),(0,q.jsx)(`div`,{className:`mt-1 text-[10px] text-gray-400`,children:t.label})]},e.id)})})]})}function qt({schema:e,onChange:t,readOnly:n=!1,className:r,onExport:i,onImport:a,selectedWidgetId:o,onWidgetSelect:s}){let{t:c}=Z(),[l,u]=(0,K.useState)(null),[f,p]=(0,K.useState)(!1),m=(0,K.useRef)(null),g=(0,K.useRef)(null),_=o!==void 0,y=_?o:l,b=(0,K.useCallback)(e=>{s&&s(e),_||u(e)},[_,s,u]),{current:x,canUndo:S,canRedo:C,push:w,undo:T,redo:E}=Ue(e),D=(0,K.useCallback)(e=>{w(e),t(e)},[w,t]),O=x.widgets||[],k=O.find(e=>e.id===y),A=(0,K.useCallback)(e=>{let t=Ut(),n={id:t,title:``,type:e,layout:{x:0,y:O.length,w:x.columns??2,h:1}};D({...x,widgets:[...O,n]}),b(t)},[x,O,D,b]),j=(0,K.useCallback)(e=>{D({...x,widgets:O.filter(t=>t.id!==e)}),y===e&&b(null)},[x,O,y,D,b]),M=(0,K.useCallback)((e,t)=>{let n=O.findIndex(t=>t.id===e);if(n<0)return;let r=t===`up`?n-1:n+1;if(r<0||r>=O.length)return;let i=[...O];[i[n],i[r]]=[i[r],i[n]],D({...x,widgets:i})},[x,O,D]),N=(0,K.useCallback)(e=>{y&&D({...x,widgets:O.map(t=>t.id===y?{...t,...e}:t)})},[x,O,y,D]);(0,K.useEffect)(()=>{let e=m.current;if(!e)return;let t=e=>{if(!n){if((e.ctrlKey||e.metaKey)&&e.key===`z`&&!e.shiftKey){e.preventDefault(),T();return}if((e.ctrlKey||e.metaKey)&&(e.key===`y`||e.key===`z`&&e.shiftKey)){e.preventDefault(),E();return}if((e.key===`Delete`||e.key===`Backspace`)&&y){let t=e.target;if(t.tagName===`INPUT`||t.tagName===`SELECT`||t.tagName===`TEXTAREA`)return;e.preventDefault(),j(y)}}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[n,T,E,y,j]);let P=(0,K.useCallback)(()=>{i&&i(x)},[x,i]),F=(0,K.useCallback)(()=>{g.current?.click()},[]),I=(0,K.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`&&(D(e),a?.(e))}catch{}},n.readAsText(t),e.target.value=``},[D,a]);return(0,q.jsxs)(`div`,{ref:m,tabIndex:0,"data-testid":`dashboard-editor`,className:Bt(`flex flex-col gap-4 outline-none`,r),children:[(0,q.jsx)(`input`,{ref:g,type:`file`,accept:`.json`,className:`hidden`,"data-testid":`dashboard-import-input`,onChange:I}),k&&!f&&(0,q.jsx)(Gt,{widget:k,readOnly:n,onChange:N,onClose:()=>b(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`),`:`]}),Vt.map(({type:e,label:t,Icon:r})=>(0,q.jsxs)(`button`,{type:`button`,"data-testid":`dashboard-add-${e}`,onClick:()=>A(e),disabled:n||f,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:T,disabled:!S,className:`rounded p-1.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":c(`appDesigner.undo`),children:(0,q.jsx)(ye,{className:`h-4 w-4`})}),(0,q.jsx)(`button`,{type:`button`,"data-testid":`dashboard-redo`,onClick:E,disabled:!C,className:`rounded p-1.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":c(`appDesigner.redo`),children:(0,q.jsx)(d,{className:`h-4 w-4`})})]}),(0,q.jsx)(`button`,{type:`button`,"data-testid":`dashboard-export`,onClick:P,className:`rounded p-1.5 text-gray-400 hover:text-gray-700`,"aria-label":c(`appDesigner.navExportSchema`),children:(0,q.jsx)(L,{className:`h-4 w-4`})}),!n&&(0,q.jsx)(`button`,{type:`button`,"data-testid":`dashboard-import`,onClick:F,className:`rounded p-1.5 text-gray-400 hover:text-gray-700`,"aria-label":c(`appDesigner.navImportSchema`),children:(0,q.jsx)(V,{className:`h-4 w-4`})}),(0,q.jsx)(`button`,{type:`button`,"data-testid":`dashboard-preview-toggle`,onClick:()=>p(e=>!e),className:Bt(`rounded p-1.5 transition-colors`,f?`bg-blue-100 text-blue-600`:`text-gray-400 hover:text-gray-700`),"aria-label":c(f?`appDesigner.modeEdit`:`appDesigner.preview`),children:f?(0,q.jsx)(v,{className:`h-4 w-4`}):(0,q.jsx)(h,{className:`h-4 w-4`})})]})]}),f?(0,q.jsx)(Kt,{schema:x}):O.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(${x.columns??2}, 1fr)`},children:O.map((e,t)=>(0,q.jsx)(Wt,{widget:e,index:t,total:O.length,selected:e.id===y,readOnly:n,onSelect:()=>b(e.id??null),onRemove:()=>j(e.id),onMoveUp:()=>M(e.id,`up`),onMoveDown:()=>M(e.id,`down`)},e.id))})]})]})}function Jt(...e){return E(m(e))}var Yt=[{type:`grid`,label:`Data Grid`,Icon:Pe},{type:`kanban`,label:`Kanban Board`,Icon:w},{type:`calendar`,label:`Calendar`,Icon:ie},{type:`gallery`,label:`Gallery`,Icon:F},{type:`dashboard`,label:`Dashboard`,Icon:Ne},{type:`form`,label:`Form`,Icon:I},{type:`layout-grid`,label:`Grid Layout`,Icon:f}],Xt=[{value:`page`,labelKey:`appDesigner.modePage`},{value:`dashboard`,labelKey:`appDesigner.modeDashboard`}],Zt=0;function Qt(){return Zt+=1,`component_${Date.now()}_${Zt}`}function $t({component:e,index:t,total:n,selected:r,readOnly:i,onSelect:a,onRemove:o,onMoveUp:s,onMoveDown:c}){let l=Yt.find(t=>t.type===e.type)||Yt[0];return(0,q.jsxs)(`div`,{"data-testid":`canvas-component-${e.id}`,onClick:a,className:Jt(`group flex cursor-pointer items-center gap-3 rounded-lg border-2 px-3 py-3 transition-colors`,r?`border-blue-500 bg-blue-50`:`border-gray-200 hover:border-gray-300`),children:[(0,q.jsx)(b,{className:`h-4 w-4 shrink-0 cursor-grab text-gray-300`}),(0,q.jsx)(l.Icon,{className:`h-5 w-5 shrink-0 text-gray-500`}),(0,q.jsxs)(`div`,{className:`flex-1`,children:[(0,q.jsx)(`span`,{className:`text-sm font-medium text-gray-800`,children:e.label}),(0,q.jsx)(`span`,{className:`ml-2 text-[10px] text-gray-400`,children:l.label})]}),!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)(Ae,{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)(W,{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 component`,"data-testid":`canvas-component-remove-${e.id}`,children:(0,q.jsx)(G,{className:`h-3.5 w-3.5`})})]})]})}function en({component:e,readOnly:t,onChange:n,onClose:r}){let{t:i}=Z();return(0,q.jsxs)(`div`,{"data-testid":`component-property-panel`,className:`w-64 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.componentProperties`)}),(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)(Te,{className:`h-4 w-4`})})]}),(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsx)(`label`,{htmlFor:`component-label`,className:`text-xs font-medium text-gray-600`,children:`Label`}),(0,q.jsx)(`input`,{id:`component-label`,"data-testid":`component-prop-label`,type:`text`,value:e.label,onChange:e=>n({label: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`})]}),(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsx)(`label`,{className:`text-xs font-medium text-gray-600`,children:`Type`}),(0,q.jsx)(`div`,{className:`rounded-md bg-gray-50 px-2.5 py-1.5 text-sm text-gray-600`,children:Yt.find(t=>t.type===e.type)?.label??e.type})]}),(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsx)(`label`,{className:`text-xs font-medium text-gray-600`,children:`ID`}),(0,q.jsx)(`div`,{className:`rounded-md bg-gray-50 px-2.5 py-1.5 text-xs font-mono text-gray-500`,children:e.id})]})]})}function tn({schema:e,components:t}){let{t:n}=Z();return(0,q.jsxs)(`div`,{"data-testid":`page-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:e.title||n(`appDesigner.pagePreview`)}),t.length===0?(0,q.jsx)(`div`,{className:`text-xs text-gray-400`,children:n(`appDesigner.noComponentsPreview`)}):(0,q.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>{let t=Yt.find(t=>t.type===e.type)||Yt[0];return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-gray-200 bg-white p-2`,children:[(0,q.jsx)(t.Icon,{className:`h-4 w-4 text-gray-400`}),(0,q.jsx)(`span`,{className:`text-xs font-medium text-gray-600`,children:e.label}),(0,q.jsx)(`span`,{className:`text-[10px] text-gray-400`,children:t.label})]},e.id)})})]})}function nn({schema:e,onChange:t,readOnly:n=!1,className:r,onExport:i,onImport:a}){let{t:o}=Z(),s=(0,K.useRef)(null),c=(0,K.useRef)(null),[l,u]=(0,K.useState)(()=>(e.children?Array.isArray(e.children)?e.children:[e.children]:[]).map((e,t)=>({id:e.id||`existing_${t}`,type:e.type||`grid`,label:e.title||e.label||`Component ${t+1}`,props:e}))),[f,p]=(0,K.useState)(null),[m,g]=(0,K.useState)(!1),[_,y]=(0,K.useState)(`page`),b=l.find(e=>e.id===f),{canUndo:x,canRedo:S,push:C,undo:w,redo:T}=Ue(l),E=(0,K.useCallback)(n=>{u(n),C(n),t({...e,children:n.map(e=>({type:e.type,id:e.id,title:e.label,...e.props}))})},[e,t,C]),D=(0,K.useCallback)(e=>{let t=Qt(),n={id:t,type:e,label:Yt.find(t=>t.type===e)?.label||e};E([...l,n]),p(t)},[l,E]),O=(0,K.useCallback)(e=>{E(l.filter(t=>t.id!==e)),f===e&&p(null)},[l,f,E]),k=(0,K.useCallback)((e,t)=>{let n=l.findIndex(t=>t.id===e);if(n<0)return;let r=t===`up`?n-1:n+1;if(r<0||r>=l.length)return;let i=[...l];[i[n],i[r]]=[i[r],i[n]],E(i)},[l,E]),A=(0,K.useCallback)(e=>{f&&E(l.map(t=>t.id===f?{...t,...e}:t))},[l,f,E]);(0,K.useEffect)(()=>{let e=s.current;if(!e)return;let t=e=>{if(!n){if((e.ctrlKey||e.metaKey)&&e.key===`z`&&!e.shiftKey){e.preventDefault(),w();return}if((e.ctrlKey||e.metaKey)&&(e.key===`y`||e.key===`z`&&e.shiftKey)){e.preventDefault(),T();return}if((e.key===`Delete`||e.key===`Backspace`)&&f){let t=e.target;if(t.tagName===`INPUT`||t.tagName===`SELECT`||t.tagName===`TEXTAREA`)return;e.preventDefault(),O(f)}}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[n,w,T,f,O]);let j=(0,K.useCallback)(()=>{i&&i(e)},[e,i]),M=(0,K.useCallback)(()=>{c.current?.click()},[]),N=(0,K.useCallback)(e=>{let n=e.target.files?.[0];if(!n)return;let r=new FileReader;r.onload=()=>{try{let e=JSON.parse(r.result);if(e&&e.type===`page`){let n=(e.children?Array.isArray(e.children)?e.children:[e.children]:[]).map((e,t)=>({id:e.id||`imported_${t}`,type:e.type||`grid`,label:e.title||e.label||`Component ${t+1}`,props:e}));u(n),C(n),t(e),a?.(e)}}catch{}},r.readAsText(n),e.target.value=``},[t,C,a]);return(0,q.jsxs)(`div`,{ref:s,tabIndex:0,"data-testid":`page-canvas-editor`,className:Jt(`flex flex-col gap-4 outline-none sm:flex-row`,r),children:[(0,q.jsx)(`input`,{ref:c,type:`file`,accept:`.json`,className:`hidden`,"data-testid":`canvas-import-input`,onChange:N}),(0,q.jsxs)(`div`,{className:`flex-1 space-y-4`,children:[(0,q.jsx)(`div`,{className:`flex items-center gap-2 border-b border-gray-200 pb-2`,role:`tablist`,children:Xt.map(e=>(0,q.jsx)(`button`,{type:`button`,role:`tab`,"data-testid":`canvas-mode-${e.value}`,"aria-selected":_===e.value,onClick:()=>y(e.value),className:Jt(`rounded-t-md px-3 py-1.5 text-xs font-medium transition-colors`,_===e.value?`border-b-2 border-blue-500 text-blue-600`:`text-gray-500 hover:text-gray-700`),children:o(e.labelKey)},e.value))}),(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:[o(`appDesigner.addComponent`),`:`]}),Yt.map(({type:e,label:t,Icon:r})=>(0,q.jsxs)(`button`,{type:`button`,"data-testid":`canvas-add-${e}`,onClick:()=>D(e),disabled:n||m,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":`canvas-undo`,onClick:w,disabled:!x,className:`rounded p-1.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":o(`appDesigner.undo`),children:(0,q.jsx)(ye,{className:`h-4 w-4`})}),(0,q.jsx)(`button`,{type:`button`,"data-testid":`canvas-redo`,onClick:T,disabled:!S,className:`rounded p-1.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":o(`appDesigner.redo`),children:(0,q.jsx)(d,{className:`h-4 w-4`})})]}),(0,q.jsx)(`button`,{type:`button`,"data-testid":`canvas-export`,onClick:j,className:`rounded p-1.5 text-gray-400 hover:text-gray-700`,"aria-label":o(`appDesigner.navExportSchema`),children:(0,q.jsx)(L,{className:`h-4 w-4`})}),!n&&(0,q.jsx)(`button`,{type:`button`,"data-testid":`canvas-import`,onClick:M,className:`rounded p-1.5 text-gray-400 hover:text-gray-700`,"aria-label":o(`appDesigner.navImportSchema`),children:(0,q.jsx)(V,{className:`h-4 w-4`})}),(0,q.jsx)(`button`,{type:`button`,"data-testid":`canvas-preview-toggle`,onClick:()=>g(e=>!e),className:Jt(`rounded p-1.5 transition-colors`,m?`bg-blue-100 text-blue-600`:`text-gray-400 hover:text-gray-700`),"aria-label":o(m?`appDesigner.modeEdit`:`appDesigner.preview`),children:m?(0,q.jsx)(v,{className:`h-4 w-4`}):(0,q.jsx)(h,{className:`h-4 w-4`})})]})]}),m?(0,q.jsx)(tn,{schema:e,components:l}):l.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:o(`appDesigner.emptyPage`)}):(0,q.jsx)(`div`,{className:`space-y-2`,children:l.map((e,t)=>(0,q.jsx)($t,{component:e,index:t,total:l.length,selected:e.id===f,readOnly:n,onSelect:()=>p(e.id),onRemove:()=>O(e.id),onMoveUp:()=>k(e.id,`up`),onMoveDown:()=>k(e.id,`down`)},e.id))})]}),b&&!m&&(0,q.jsx)(en,{component:b,readOnly:n,onChange:A,onClose:()=>p(null)})]})}function rn(...e){return E(m(e))}var an={grid:{label:`Grid`,Icon:f},kanban:{label:`Kanban`,Icon:w},calendar:{label:`Calendar`,Icon:ie},gallery:{label:`Gallery`,Icon:F},timeline:{label:`Timeline`,Icon:we},map:{label:`Map`,Icon:de},gantt:{label:`Gantt`,Icon:he}},on=[{value:`compact`,label:`Compact`},{value:`medium`,label:`Medium`},{value:`tall`,label:`Tall`}];function sn({title:e,icon:t,defaultOpen:n=!0,children:r}){let[i,a]=(0,K.useState)(n);return(0,q.jsxs)(`div`,{className:`border-b border-gray-100 pb-3`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>a(!i),className:`flex w-full items-center gap-2 py-2 text-left`,children:[t,(0,q.jsx)(`span`,{className:`flex-1 text-xs font-semibold uppercase text-gray-500`,children:e}),i?(0,q.jsx)(Ae,{className:`h-3.5 w-3.5 text-gray-400`}):(0,q.jsx)(W,{className:`h-3.5 w-3.5 text-gray-400`})]}),i&&(0,q.jsx)(`div`,{className:`space-y-2`,children:r})]})}function cn({config:e,onChange:t,availableViewTypes:n=[`grid`,`kanban`,`calendar`,`gallery`,`timeline`,`map`,`gantt`],readOnly:r=!1,className:i}){let a=(0,K.useCallback)(n=>{t({...e,...n})},[e,t]),o=(0,K.useCallback)(t=>{a({columns:e.columns.map(e=>e.name===t?{...e,visible:!e.visible}:e)})},[e,a]),s=(0,K.useCallback)((t,n)=>{let r=[...e.columns],i=r.findIndex(e=>e.name===t);if(i<0)return;let o=n===`up`?i-1:i+1;o<0||o>=r.length||([r[i],r[o]]=[r[o],r[i]],a({columns:r}))},[e,a]),l=(0,K.useMemo)(()=>e.columns.filter(e=>e.visible).length,[e.columns]);return(0,q.jsxs)(`div`,{"data-testid":`object-view-configurator`,className:rn(`w-72 space-y-3 rounded-lg border border-gray-200 bg-white p-4`,i),children:[(0,q.jsx)(sn,{title:`View Type`,icon:(0,q.jsx)(f,{className:`h-3.5 w-3.5 text-gray-500`}),children:(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:n.map(t=>{let{label:n,Icon:i}=an[t];return(0,q.jsxs)(`button`,{type:`button`,"data-testid":`view-type-${t}`,onClick:()=>a({viewType:t}),disabled:r,className:rn(`inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium transition-colors`,e.viewType===t?`bg-blue-100 text-blue-700`:`text-gray-600 hover:bg-gray-100`,r&&`cursor-not-allowed opacity-50`),children:[(0,q.jsx)(i,{className:`h-3 w-3`}),n]},t)})})}),(0,q.jsx)(sn,{title:`Fields (${l}/${e.columns.length})`,icon:(0,q.jsx)(c,{className:`h-3.5 w-3.5 text-gray-500`}),children:e.columns.length===0?(0,q.jsx)(`p`,{className:`text-xs text-gray-400`,children:`No fields configured.`}):(0,q.jsx)(`ul`,{className:`space-y-0.5`,children:e.columns.map((t,n)=>(0,q.jsxs)(`li`,{"data-testid":`view-column-${t.name}`,className:`flex items-center gap-1.5 rounded px-1.5 py-1 text-xs hover:bg-gray-50`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:()=>o(t.name),disabled:r,className:rn(`rounded p-0.5 transition-colors`,t.visible?`text-blue-500`:`text-gray-300`),"aria-label":t.visible?`Hide field`:`Show field`,children:t.visible?(0,q.jsx)(h,{className:`h-3 w-3`}):(0,q.jsx)(v,{className:`h-3 w-3`})}),(0,q.jsx)(`span`,{className:`flex-1 truncate text-gray-700`,children:t.label}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>s(t.name,`up`),disabled:r||n===0,className:`rounded p-0.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":`Move up`,children:(0,q.jsx)(Ae,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>s(t.name,`down`),disabled:r||n===e.columns.length-1,className:`rounded p-0.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":`Move down`,children:(0,q.jsx)(W,{className:`h-3 w-3`})})]},t.name))})}),(0,q.jsx)(sn,{title:`Toolbar`,icon:(0,q.jsx)(g,{className:`h-3.5 w-3.5 text-gray-500`}),children:(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:e.showSearch,onChange:e=>a({showSearch:e.target.checked}),disabled:r,"data-testid":`view-toggle-search`,className:`h-3.5 w-3.5 rounded border-gray-300`}),(0,q.jsx)(`span`,{className:`text-xs text-gray-700`,children:`Show Search`})]}),(0,q.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:e.showFilters,onChange:e=>a({showFilters:e.target.checked}),disabled:r,"data-testid":`view-toggle-filters`,className:`h-3.5 w-3.5 rounded border-gray-300`}),(0,q.jsx)(`span`,{className:`text-xs text-gray-700`,children:`Show Filters`})]}),(0,q.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:e.showSort,onChange:e=>a({showSort:e.target.checked}),disabled:r,"data-testid":`view-toggle-sort`,className:`h-3.5 w-3.5 rounded border-gray-300`}),(0,q.jsx)(`span`,{className:`text-xs text-gray-700`,children:`Show Sort`})]})]})}),(0,q.jsx)(sn,{title:`Appearance`,icon:(0,q.jsx)(C,{className:`h-3.5 w-3.5 text-gray-500`}),defaultOpen:!1,children:(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsx)(`label`,{className:`text-[10px] font-medium text-gray-500`,children:`Row Height`}),(0,q.jsx)(`div`,{className:`flex gap-1`,children:on.map(({value:t,label:n})=>(0,q.jsx)(`button`,{type:`button`,"data-testid":`view-row-height-${t}`,onClick:()=>a({rowHeight:t}),disabled:r,className:rn(`flex-1 rounded px-2 py-1 text-[10px] font-medium transition-colors`,e.rowHeight===t?`bg-blue-100 text-blue-700`:`bg-gray-50 text-gray-500 hover:bg-gray-100`),children:n},t))})]}),(0,q.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:e.striped,onChange:e=>a({striped:e.target.checked}),disabled:r,"data-testid":`view-toggle-striped`,className:`h-3.5 w-3.5 rounded border-gray-300`}),(0,q.jsx)(`span`,{className:`text-xs text-gray-700`,children:`Striped Rows`})]}),(0,q.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:e.bordered,onChange:e=>a({bordered:e.target.checked}),disabled:r,"data-testid":`view-toggle-bordered`,className:`h-3.5 w-3.5 rounded border-gray-300`}),(0,q.jsx)(`span`,{className:`text-xs text-gray-700`,children:`Bordered`})]})]})})]})}function $(...e){return E(m(e))}var ln=[{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`}],un=[`Inter`,`Roboto`,`Open Sans`,`Lato`,`Montserrat`,`Poppins`,`Source Sans Pro`,`Noto Sans`,`system-ui`];function dn({branding:e,onChange:t,appTitle:n=`My App`,readOnly:r=!1,className:i,onExport:a,onImport:o}){let{t:s}=Z(),[c,l]=(0,K.useState)(`light`),{current:u,push:f,canUndo:p,canRedo:m,undo:h,redo:g}=Ue(e),_=(0,K.useRef)(!0);(0,K.useEffect)(()=>{if(_.current){_.current=!1;return}t(u)},[u]);let v=(0,K.useCallback)(e=>{let n={...u,...e};_.current=!0,f(n),t(n)},[u,f,t]),y=(0,K.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]),b=(0,K.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};f(e),t(e)}}catch{}},r.readAsText(n)},e.click()},[u,f,t,o]),x=(0,K.useCallback)(e=>{r||((e.ctrlKey||e.metaKey)&&e.key===`z`&&(e.preventDefault(),e.shiftKey?g():h()),(e.ctrlKey||e.metaKey)&&e.key===`y`&&(e.preventDefault(),g()))},[r,h,g]),C=u.primaryColor||`#3b82f6`,w=c===`dark`;return(0,q.jsxs)(`div`,{"data-testid":`branding-editor`,className:$(`flex flex-col gap-4 sm:gap-6`,i),onKeyDown:x,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: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.undo`),children:[(0,q.jsx)(ye,{className:`h-3.5 w-3.5`}),s(`appDesigner.undo`)]}),(0,q.jsxs)(`button`,{"data-testid":`branding-redo`,type:`button`,onClick:g,disabled:!m||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`,m&&!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)(d,{className:`h-3.5 w-3.5`}),s(`appDesigner.redo`)]}),(0,q.jsxs)(`button`,{"data-testid":`branding-export`,type:`button`,onClick:y,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)(L,{className:`h-3.5 w-3.5`}),s(`appDesigner.brandingExport`)]}),(0,q.jsxs)(`button`,{"data-testid":`branding-import`,type:`button`,onClick:b,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)(V,{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)(S,{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=>v({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)(De,{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=>v({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:C,onChange:e=>v({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:ln.map(e=>(0,q.jsx)(`button`,{"data-testid":`branding-swatch-${e.hex.slice(1)}`,type:`button`,onClick:()=>!r&&v({primaryColor:e.hex}),disabled:r,className:$(`h-6 w-6 rounded-full border-2 transition-transform hover:scale-110 disabled:cursor-not-allowed`,C===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)(He,{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=>v({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)(je,{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=>v({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`)}),un.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)(Ve,{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)(B,{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`,w?`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:C},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:C}}),(0,q.jsx)(`span`,{className:$(`text-xs`,w?`text-gray-400`:`text-gray-500`),children:C})]}),(0,q.jsx)(`button`,{type:`button`,className:`rounded-md px-3 py-1.5 text-xs font-medium text-white transition-colors`,style:{backgroundColor:C},tabIndex:-1,children:s(`appDesigner.brandingSampleButton`)}),(0,q.jsx)(`p`,{className:$(`text-xs`,w?`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`,w?`text-gray-400`:`text-gray-500`),children:`Favicon`})]}),u.fontFamily&&(0,q.jsxs)(`div`,{className:$(`text-xs`,w?`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`,w?`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:C},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`,w?`bg-gray-700`:`bg-gray-200`)}),(0,q.jsx)(`div`,{className:$(`h-2 w-1/2 rounded`,w?`bg-gray-700`:`bg-gray-200`)}),(0,q.jsx)(`div`,{className:$(`h-2 w-2/3 rounded`,w?`bg-gray-700`:`bg-gray-200`)})]})]})]})]})]})}function fn(...e){return E(m(e))}var pn=[`Custom Objects`,`System Objects`,`Integration`,`Analytics`],mn=[`Box`,`Database`,`Users`,`FileText`,`Settings`,`ShoppingCart`,`Calendar`,`Mail`,`Briefcase`,`Building`,`Globe`,`Heart`,`Star`,`Tag`,`Bookmark`,`Folder`,`Archive`,`Package`,`Truck`,`CreditCard`];function hn({objects:e,onObjectsChange:t,onSelectObject:n,showSystemObjects:i=!0,readOnly:a=!1,className:o}){let{t:s}=Z(),c=We(),[l,u]=(0,K.useState)(!1),[d,f]=(0,K.useState)(null),p=(0,K.useMemo)(()=>i?e:e.filter(e=>!e.isSystem),[e,i]),m=(0,K.useMemo)(()=>new r({items:p}),[p]),h=(0,K.useMemo)(()=>[{field:`name`,label:s(`appDesigner.objectManager.objectName`),width:160},{field:`label`,label:s(`appDesigner.objectManager.objectLabel`),width:160},{field:`group`,label:s(`appDesigner.objectManager.group`),width:130},{field:`fieldCount`,label:`Fields`,width:80},{field:`enabled`,label:s(`appDesigner.objectManager.enabled`),width:80}],[s]),g=(0,K.useMemo)(()=>({type:`object-grid`,objectName:`object_definition`,columns:h,searchableFields:[`name`,`label`,`description`],showSearch:!0,operations:a?void 0:{create:!0,update:!0,delete:!0}}),[h,a]),_=(0,K.useCallback)(t=>{let r=e.find(e=>e.name===t.name);r&&n?.(r)},[e,n]),v=(0,K.useCallback)(t=>{let n=e.find(e=>e.name===t.name);n&&(f(n),u(!0))},[e]),y=(0,K.useCallback)(async n=>{let r=e.find(e=>e.name===n.name);!r||r.isSystem||await c.confirm(s(`appDesigner.objectManager.deleteConfirmTitle`),s(`appDesigner.objectManager.deleteConfirmMessage`))&&t?.(e.filter(e=>e.id!==r.id))},[e,t,c,s]),b=(0,K.useCallback)(()=>{f(null),u(!0)},[]),x=(0,K.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,enabled:n.enabled!==!1};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,enabled:n.enabled!==!1,fieldCount:0};t?.([...e,r])}u(!1),f(null)},[d,e,t]),S=(0,K.useCallback)(e=>{e||(u(!1),f(null))},[]),C=(0,K.useMemo)(()=>({type:`object-form`,formType:`modal`,objectName:`object_definition`,mode:d?`edit`:`create`,title:d?`${s(`common.edit`)} — ${d.label}`:s(`appDesigner.objectManager.addObject`),open:l,onOpenChange:S,modalSize:`lg`,customFields:[{name:`name`,label:s(`appDesigner.objectManager.objectName`),type:`text`,required:!0,placeholder:`api_name`,disabled:a||(d?.isSystem??!1)},{name:`label`,label:s(`appDesigner.objectManager.objectLabel`),type:`text`,required:!0,placeholder:`Display Name`,disabled:a},{name:`pluralLabel`,label:s(`appDesigner.objectManager.pluralLabel`),type:`text`,placeholder:`Display Names`,disabled:a},{name:`description`,label:s(`appDesigner.appDescription`),type:`textarea`,disabled:a},{name:`icon`,label:s(`appDesigner.objectManager.icon`),type:`select`,options:mn.map(e=>({label:e,value:e})),disabled:a},{name:`group`,label:s(`appDesigner.objectManager.group`),type:`select`,options:pn.map(e=>({label:e,value:e})),disabled:a},{name:`sortOrder`,label:s(`appDesigner.objectManager.sortOrder`),type:`number`,disabled:a},{name:`enabled`,label:s(`appDesigner.objectManager.enabled`),type:`boolean`,disabled:a}],initialValues:d?{name:d.name,label:d.label,pluralLabel:d.pluralLabel||``,description:d.description||``,icon:d.icon||``,group:d.group||``,sortOrder:d.sortOrder??0,enabled:d.enabled!==!1}:{enabled:!0},onSuccess:x,onCancel:()=>S(!1),readOnly:a}),[d,l,S,x,a,s]);return(0,q.jsxs)(`div`,{"data-testid":`object-manager`,className:fn(`w-full space-y-3`,o),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-blue-600`}),(0,q.jsx)(`h2`,{className:`text-sm font-semibold text-gray-900`,children:s(`appDesigner.objectManager.title`)}),(0,q.jsx)(`span`,{className:`rounded-full bg-gray-100 px-1.5 py-0.5 text-[10px] text-gray-500`,children:p.length})]})}),(0,q.jsx)(ge,{schema:g,dataSource:m,onRowClick:_,onEdit:a?void 0:v,onDelete:a?void 0:y,onAddRecord:a?void 0:b}),l&&(0,q.jsx)(Le,{schema:C}),(0,q.jsx)(Ye,{isOpen:c.isOpen,title:c.title,message:c.message,confirmLabel:s(`common.delete`),cancelLabel:s(`common.cancel`),onConfirm:c.onConfirm,onCancel:c.onCancel,destructive:!0})]})}function gn(...e){return E(m(e))}var _n={text:{label:`Text`,Icon:je},textarea:{label:`Text Area`,Icon:I},number:{label:`Number`,Icon:p},boolean:{label:`Checkbox`,Icon:U},date:{label:`Date`,Icon:Be},datetime:{label:`Date/Time`,Icon:Be},time:{label:`Time`,Icon:Be},select:{label:`Picklist`,Icon:Me},email:{label:`Email`,Icon:Ie},phone:{label:`Phone`,Icon:y},url:{label:`URL`,Icon:He},password:{label:`Password`,Icon:me},currency:{label:`Currency`,Icon:p},percent:{label:`Percent`,Icon:p},lookup:{label:`Lookup`,Icon:re},formula:{label:`Formula`,Icon:Oe},autonumber:{label:`Auto Number`,Icon:p},file:{label:`File`,Icon:I},image:{label:`Image`,Icon:S},markdown:{label:`Markdown`,Icon:I},html:{label:`Rich Text`,Icon:I},color:{label:`Color`,Icon:De},code:{label:`Code`,Icon:Oe},location:{label:`Location`,Icon:Se},address:{label:`Address`,Icon:Se},rating:{label:`Rating`,Icon:ae},slider:{label:`Slider`,Icon:T}},vn=Object.keys(_n),yn=vn.map(e=>({label:_n[e].label,value:e}));function bn({objectName:e,fields:t,onFieldsChange:n,readOnly:i=!1,className:a}){let{t:o}=Z(),s=We(),[l,u]=(0,K.useState)(!1),[d,f]=(0,K.useState)(null),[p,m]=(0,K.useState)(``),h=(0,K.useMemo)(()=>p?t.filter(e=>e.type===p):t,[t,p]),g=(0,K.useMemo)(()=>new r({items:h}),[h]),_=(0,K.useMemo)(()=>[{field:`name`,label:o(`appDesigner.fieldDesigner.fieldName`),width:140},{field:`label`,label:o(`appDesigner.fieldDesigner.fieldLabel`),width:160},{field:`type`,label:o(`appDesigner.fieldDesigner.fieldType`),width:100},{field:`required`,label:o(`appDesigner.fieldDesigner.required`),width:80},{field:`unique`,label:o(`appDesigner.fieldDesigner.unique`),width:80},{field:`group`,label:o(`appDesigner.fieldDesigner.fieldGroup`),width:120}],[o]),v=(0,K.useMemo)(()=>({type:`object-grid`,objectName:`field_definition`,columns:_,searchableFields:[`name`,`label`,`description`],showSearch:!0,operations:i?void 0:{create:!0,update:!0,delete:!0}}),[_,i]),y=(0,K.useCallback)(e=>{let n=t.find(t=>t.name===e.name);n&&(f(n),u(!0))},[t]),b=(0,K.useCallback)(async e=>{let r=t.find(t=>t.name===e.name);!r||r.isSystem||await s.confirm(o(`appDesigner.fieldDesigner.deleteConfirmTitle`),o(`appDesigner.fieldDesigner.deleteConfirmMessage`))&&n?.(t.filter(e=>e.id!==r.id))},[t,n,s,o]),x=(0,K.useCallback)(()=>{f(null),u(!0)},[]),S=(0,K.useCallback)(e=>{if(d){let r={...d,name:String(e.name||d.name),label:String(e.label||d.label),type:e.type||d.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,indexed:e.indexed===!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,formula:e.formula?String(e.formula):void 0};n?.(t.map(e=>e.id===d.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,indexed:e.indexed===!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,formula:e.formula?String(e.formula):void 0,isSystem:!1};n?.([...t,r])}u(!1),f(null)},[d,t,n]),C=(0,K.useCallback)(e=>{e||(u(!1),f(null))},[]),w=(0,K.useMemo)(()=>({type:`object-form`,formType:`modal`,objectName:`field_definition`,mode:d?`edit`:`create`,title:d?`${o(`common.edit`)} — ${d.label}`:o(`appDesigner.fieldDesigner.addField`),open:l,onOpenChange:C,modalSize:`lg`,customFields:[{name:`name`,label:o(`appDesigner.fieldDesigner.fieldName`),type:`text`,required:!0,placeholder:`api_name`,disabled:i||(d?.isSystem??!1)},{name:`label`,label:o(`appDesigner.fieldDesigner.fieldLabel`),type:`text`,required:!0,placeholder:`Display Label`,disabled:i},{name:`type`,label:o(`appDesigner.fieldDesigner.fieldType`),type:`select`,required:!0,options:yn,disabled:i||(d?.isSystem??!1)},{name:`group`,label:o(`appDesigner.fieldDesigner.fieldGroup`),type:`text`,placeholder:`Field Group`,disabled:i},{name:`description`,label:o(`appDesigner.fieldDesigner.description`),type:`textarea`,disabled:i},{name:`required`,label:o(`appDesigner.fieldDesigner.required`),type:`boolean`,disabled:i},{name:`unique`,label:o(`appDesigner.fieldDesigner.unique`),type:`boolean`,disabled:i},{name:`readonly`,label:o(`appDesigner.fieldDesigner.readOnly`),type:`boolean`,disabled:i},{name:`hidden`,label:o(`appDesigner.fieldDesigner.hidden`),type:`boolean`,disabled:i},{name:`indexed`,label:o(`appDesigner.fieldDesigner.indexed`),type:`boolean`,disabled:i},{name:`externalId`,label:o(`appDesigner.fieldDesigner.externalId`),type:`boolean`,disabled:i},{name:`trackHistory`,label:o(`appDesigner.fieldDesigner.trackHistory`),type:`boolean`,disabled:i},{name:`defaultValue`,label:o(`appDesigner.fieldDesigner.defaultValue`),type:`text`,placeholder:`Default value`,disabled:i},{name:`placeholder`,label:o(`appDesigner.fieldDesigner.placeholder`),type:`text`,placeholder:`Placeholder text`,disabled:i},{name:`referenceTo`,label:o(`appDesigner.fieldDesigner.referenceTo`),type:`text`,placeholder:`Referenced object`,disabled:i},{name:`formula`,label:o(`appDesigner.fieldDesigner.formula`),type:`textarea`,placeholder:`e.g. price * quantity`,disabled:i}],initialValues:d?{name:d.name,label:d.label,type:d.type,group:d.group||``,description:d.description||``,required:d.required||!1,unique:d.unique||!1,readonly:d.readonly||!1,hidden:d.hidden||!1,indexed:d.indexed||!1,externalId:d.externalId||!1,trackHistory:d.trackHistory||!1,defaultValue:d.defaultValue==null?``:String(d.defaultValue),placeholder:d.placeholder||``,referenceTo:d.referenceTo||``,formula:d.formula||``}:{type:`text`,required:!1,unique:!1},onSuccess:S,onCancel:()=>C(!1),readOnly:i}),[d,l,C,S,i,o]);return(0,q.jsxs)(`div`,{"data-testid":`field-designer`,className:gn(`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)(c,{className:`h-4 w-4 text-blue-600`}),(0,q.jsx)(`h2`,{className:`text-sm font-semibold text-gray-900`,children:o(`appDesigner.fieldDesigner.title`)}),(0,q.jsxs)(`span`,{className:`text-xs text-gray-500`,children:[`— `,e]}),(0,q.jsx)(`span`,{className:`rounded-full bg-gray-100 px-1.5 py-0.5 text-[10px] text-gray-500`,children:h.length})]})}),(0,q.jsx)(`div`,{className:`flex gap-2`,children:(0,q.jsxs)(`select`,{value:p,onChange:e=>m(e.target.value),"data-testid":`field-designer-type-filter`,className:`rounded-md border border-gray-300 px-2 py-1.5 text-xs shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500`,children:[(0,q.jsx)(`option`,{value:``,children:o(`appDesigner.fieldDesigner.allTypes`)}),vn.map(e=>(0,q.jsx)(`option`,{value:e,children:_n[e].label},e))]})}),(0,q.jsx)(ge,{schema:v,dataSource:g,onEdit:i?void 0:y,onDelete:i?void 0:b,onAddRecord:i?void 0:x}),l&&(0,q.jsx)(Le,{schema:w}),(0,q.jsx)(Ye,{isOpen:s.isOpen,title:s.title,message:s.message,confirmLabel:o(`common.delete`),cancelLabel:o(`common.cancel`),onConfirm:s.onConfirm,onCancel:s.onCancel,destructive:!0})]})}t.register(`page-designer`,rt,{label:`Page Designer`,category:`Designer`,inputs:[{name:`canvas`,type:`code`,label:`Canvas Configuration`},{name:`components`,type:`code`,label:`Components`},{name:`showComponentTree`,type:`boolean`,label:`Show Component Tree`,defaultValue:!0},{name:`undoRedo`,type:`boolean`,label:`Undo/Redo`,defaultValue:!0},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),t.register(`data-model-designer`,lt,{label:`Data Model Designer`,category:`Designer`,inputs:[{name:`entities`,type:`code`,label:`Entities`},{name:`relationships`,type:`code`,label:`Relationships`},{name:`autoLayout`,type:`boolean`,label:`Auto Layout`,defaultValue:!1},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),t.register(`process-designer`,mt,{label:`Process Designer (BPMN)`,category:`Designer`,inputs:[{name:`processName`,type:`string`,label:`Process Name`},{name:`nodes`,type:`code`,label:`Nodes`},{name:`edges`,type:`code`,label:`Edges`},{name:`showMinimap`,type:`boolean`,label:`Show Minimap`,defaultValue:!1},{name:`showToolbar`,type:`boolean`,label:`Show Toolbar`,defaultValue:!0},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),t.register(`report-designer`,_t,{label:`Report Designer`,category:`Designer`,inputs:[{name:`reportName`,type:`string`,label:`Report Name`},{name:`objectName`,type:`string`,label:`Data Source Object`},{name:`sections`,type:`code`,label:`Sections`},{name:`showToolbar`,type:`boolean`,label:`Show Toolbar`,defaultValue:!0},{name:`showPropertyPanel`,type:`boolean`,label:`Show Property Panel`,defaultValue:!0},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),t.register(`app-creation-wizard`,At,{label:`App Creation Wizard`,category:`Designer`,inputs:[{name:`availableObjects`,type:`code`,label:`Available Objects`},{name:`templates`,type:`code`,label:`Templates`},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),t.register(`navigation-designer`,zt,{label:`Navigation Designer`,category:`Designer`,inputs:[{name:`items`,type:`code`,label:`Navigation Items`},{name:`showPreview`,type:`boolean`,label:`Show Preview`,defaultValue:!0},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),t.register(`dashboard-editor`,qt,{label:`Dashboard Editor`,category:`Designer`,inputs:[{name:`schema`,type:`code`,label:`Dashboard Schema`},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),t.register(`page-canvas-editor`,nn,{label:`Page Canvas Editor`,category:`Designer`,inputs:[{name:`schema`,type:`code`,label:`Page Schema`},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),t.register(`object-view-configurator`,cn,{label:`Object View Configurator`,category:`Designer`,inputs:[{name:`config`,type:`code`,label:`View Config`},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),t.register(`branding-editor`,dn,{label:`Branding Editor`,category:`Designer`,inputs:[{name:`branding`,type:`code`,label:`Branding Config`},{name:`appTitle`,type:`string`,label:`App Title`},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),t.register(`object-manager`,hn,{label:`Object Manager`,category:`Designer`,inputs:[{name:`objects`,type:`code`,label:`Object Definitions`},{name:`showSystemObjects`,type:`boolean`,label:`Show System Objects`,defaultValue:!0},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),t.register(`field-designer`,bn,{label:`Field Designer`,category:`Designer`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`},{name:`fields`,type:`code`,label:`Field Definitions`},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]});export{qe as _,nn as a,We as b,At as c,lt as d,at as f,Ye as g,Ze as h,cn as i,_t as l,et as m,hn as n,qt as o,rt as p,dn as r,zt as s,bn as t,mt as u,Ke as v,Ue as x,Ge as y};
@@ -0,0 +1 @@
1
+ import{a as e}from"./src-CZnjIqJM.js";export{e as PageCanvasEditor};
@@ -0,0 +1,3 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{k as t,z as n}from"./framework-B0ex8RpF.js";import{An as r,Dt as i,Ft as a,Gs as o,Io as s,It as c,Lc as l,Lt as u,Ml as d,Mt as f,Nt as p,Ot as m,Pt as h,Qo as g,Rt as _,Wc as v,Ws as y,Zt as b,b as x,bs as S,c as C,d as w,dl as T,g as ee,jn as E,kn as D,kt as O,l as k,m as te,p as ne,s as A,u as re,v as ie,y as ae}from"./plugins-core-B8C8BUw8.js";import{O as oe}from"./data-adapter-DPqgzJ64.js";var j=e(n(),1),se=`popstate`;function ce(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function le(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return fe(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:P(t)}return pe(t,n,null,e)}function M(e,t){if(e===!1||e==null)throw Error(t)}function N(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function ue(){return Math.random().toString(36).substring(2,10)}function de(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function fe(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?F(t):t,state:n,key:t&&t.key||r||ue(),unstable_mask:i}}function P({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function F(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function pe(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=ce(e)?e:fe(h.location,e,t);n&&n(r,e),l=u()+1;let d=de(r,l),f=h.createHref(r.unstable_mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=ce(e)?e:fe(h.location,e,t);n&&n(r,e),l=u();let i=de(r,l),d=h.createHref(r.unstable_mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return me(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(se,d),c=e,()=>{i.removeEventListener(se,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function me(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),M(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:P(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function he(e,t,n=`/`){return ge(e,t,n,!1)}function ge(e,t,n,r){let i=L((typeof t==`string`?F(t):t).pathname||`/`,n);if(i==null)return null;let a=ve(e);be(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=Me(i);o=Ae(a[e],t,r)}return o}function _e(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function ve(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;M(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=z([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(M(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),ve(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:Oe(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of ye(e.path))a(e,t,!0,n)}),t}function ye(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=ye(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function be(e){e.sort((e,t)=>e.score===t.score?ke(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var xe=/^:[\w-]+$/,Se=3,Ce=2,we=1,Te=10,Ee=-2,De=e=>e===`*`;function Oe(e,t){let n=e.split(`/`),r=n.length;return n.some(De)&&(r+=Ee),t&&(r+=Ce),n.filter(e=>!De(e)).reduce((e,t)=>e+(xe.test(t)?Se:t===``?we:Te),r)}function ke(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Ae(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=I({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=I({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:z([a,u.pathname]),pathnameBase:Be(z([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=z([a,u.pathnameBase]))}return o}function I(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=je(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function je(e,t=!1,n=!0){N(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Me(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return N(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function L(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var Ne=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Pe(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?F(e):e,a;return n?(n=ze(n),a=n.startsWith(`/`)?Fe(n.substring(1),`/`):Fe(n,t)):a=t,{pathname:a,search:Ve(r),hash:He(i)}}function Fe(e,t){let n=B(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Ie(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Le(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Re(e){let t=Le(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function R(e,t,n,r=!1){let i;typeof e==`string`?i=F(e):(i={...e},M(!i.pathname||!i.pathname.includes(`?`),Ie(`?`,`pathname`,`search`,i)),M(!i.pathname||!i.pathname.includes(`#`),Ie(`#`,`pathname`,`hash`,i)),M(!i.search||!i.search.includes(`#`),Ie(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=Pe(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var ze=e=>e.replace(/\/\/+/g,`/`),z=e=>ze(e.join(`/`)),B=e=>e.replace(/\/+$/,``),Be=e=>B(e).replace(/^\/*/,`/`),Ve=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,He=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Ue=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function We(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Ge(e){return z(e.map(e=>e.route.path).filter(Boolean))||`/`}var Ke=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function qe(e,t){let n=e;if(typeof n!=`string`||!Ne.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Ke)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=L(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{N(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Je=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Je);var Ye=[`GET`,...Je];new Set(Ye);var V=j.createContext(null);V.displayName=`DataRouter`;var H=j.createContext(null);H.displayName=`DataRouterState`;var Xe=j.createContext(!1);function Ze(){return j.useContext(Xe)}var Qe=j.createContext({isTransitioning:!1});Qe.displayName=`ViewTransition`;var $e=j.createContext(new Map);$e.displayName=`Fetchers`;var et=j.createContext(null);et.displayName=`Await`;var U=j.createContext(null);U.displayName=`Navigation`;var W=j.createContext(null);W.displayName=`Location`;var G=j.createContext({outlet:null,matches:[],isDataRoute:!1});G.displayName=`Route`;var tt=j.createContext(null);tt.displayName=`RouteError`;var nt=`REACT_ROUTER_ERROR`,rt=`REDIRECT`,it=`ROUTE_ERROR_RESPONSE`;function at(e){if(e.startsWith(`${nt}:${rt}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function ot(e){if(e.startsWith(`${nt}:${it}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Ue(t.status,t.statusText,t.data)}catch{}}function st(e,{relative:t}={}){M(K(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=j.useContext(U),{hash:i,pathname:a,search:o}=Y(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:z([n,a])),r.createHref({pathname:s,search:o,hash:i})}function K(){return j.useContext(W)!=null}function q(){return M(K(),`useLocation() may be used only in the context of a <Router> component.`),j.useContext(W).location}var ct=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function lt(e){j.useContext(U).static||j.useLayoutEffect(e)}function J(){let{isDataRoute:e}=j.useContext(G);return e?At():ut()}function ut(){M(K(),`useNavigate() may be used only in the context of a <Router> component.`);let e=j.useContext(V),{basename:t,navigator:n}=j.useContext(U),{matches:r}=j.useContext(G),{pathname:i}=q(),a=JSON.stringify(Re(r)),o=j.useRef(!1);return lt(()=>{o.current=!0}),j.useCallback((r,s={})=>{if(N(o.current,ct),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=R(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:z([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}j.createContext(null);function dt(){let{matches:e}=j.useContext(G),t=e[e.length-1];return t?t.params:{}}function Y(e,{relative:t}={}){let{matches:n}=j.useContext(G),{pathname:r}=q(),i=JSON.stringify(Re(n));return j.useMemo(()=>R(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function ft(e,t){return pt(e,t)}function pt(e,t,n){M(K(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=j.useContext(U),{matches:i}=j.useContext(G),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;Mt(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
2
+
3
+ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=q(),d;if(t){let e=typeof t==`string`?F(t):t;M(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=he(e,{pathname:p});N(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),N(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=bt(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:z([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:z([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?j.createElement(W.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,unstable_mask:void 0,...d},navigationType:`POP`}},h):h}function mt(){let e=kt(),t=We(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=j.createElement(j.Fragment,null,j.createElement(`p`,null,`💿 Hey developer 👋`),j.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,j.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,j.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),j.createElement(j.Fragment,null,j.createElement(`h2`,null,`Unexpected Application Error!`),j.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?j.createElement(`pre`,{style:i},n):null,o)}var ht=j.createElement(mt,null),gt=class extends j.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=ot(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:j.createElement(G.Provider,{value:this.props.routeContext},j.createElement(tt.Provider,{value:e,children:this.props.component}));return this.context?j.createElement(vt,{error:e},t):t}};gt.contextType=Xe;var _t=new WeakMap;function vt({children:e,error:t}){let{basename:n}=j.useContext(U);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=at(t.digest);if(e){let r=_t.get(t);if(r)throw r;let i=qe(e.location,n);if(Ke&&!_t.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw _t.set(t,n),n}return j.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function yt({routeContext:e,match:t,children:n}){let r=j.useContext(V);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),j.createElement(G.Provider,{value:e},n)}function bt(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);M(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},unstable_pattern:Ge(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||ht,o&&(s<0&&c===0?(Mt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?j.createElement(n.route.Component,null):n.route.element?n.route.element:e,j.createElement(yt,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?j.createElement(gt,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function xt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function St(e){let t=j.useContext(V);return M(t,xt(e)),t}function Ct(e){let t=j.useContext(H);return M(t,xt(e)),t}function wt(e){let t=j.useContext(G);return M(t,xt(e)),t}function Tt(e){let t=wt(e),n=t.matches[t.matches.length-1];return M(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Et(){return Tt(`useRouteId`)}function Dt(){return Ct(`useNavigation`).navigation}function Ot(){let{matches:e,loaderData:t}=Ct(`useMatches`);return j.useMemo(()=>e.map(e=>_e(e,t)),[e,t])}function kt(){let e=j.useContext(tt),t=Ct(`useRouteError`),n=Tt(`useRouteError`);return e===void 0?t.errors?.[n]:e}function At(){let{router:e}=St(`useNavigate`),t=Tt(`useNavigate`),n=j.useRef(!1);return lt(()=>{n.current=!0}),j.useCallback(async(r,i={})=>{N(n.current,ct),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var jt={};function Mt(e,t,n){!t&&!jt[e]&&(jt[e]=!0,N(!1,n))}j.useOptimistic,j.memo(Nt);function Nt({routes:e,future:t,state:n,isStatic:r,onError:i}){return pt(e,void 0,{state:n,isStatic:r,onError:i,future:t})}function Pt({to:e,replace:t,state:n,relative:r}){M(K(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=j.useContext(U);N(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=j.useContext(G),{pathname:o}=q(),s=J(),c=R(e,Re(a),o,r===`path`),l=JSON.stringify(c);return j.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function Ft(e){M(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function It({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){M(!K(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=j.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=F(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,unstable_mask:m}=n,h=j.useMemo(()=>{let e=L(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,unstable_mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return N(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:j.createElement(U.Provider,{value:c},j.createElement(W.Provider,{children:t,value:h}))}function Lt({children:e,location:t}){return ft(Rt(e),t)}j.Component;function Rt(e,t=[]){let n=[];return j.Children.forEach(e,(e,r)=>{if(!j.isValidElement(e))return;let i=[...t,r];if(e.type===j.Fragment){n.push.apply(n,Rt(e.props.children,i));return}M(e.type===Ft,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),M(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Rt(e.props.children,i)),n.push(a)}),n}var zt=`get`,Bt=`application/x-www-form-urlencoded`;function Vt(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Ht(e){return Vt(e)&&e.tagName.toLowerCase()===`button`}function Ut(e){return Vt(e)&&e.tagName.toLowerCase()===`form`}function Wt(e){return Vt(e)&&e.tagName.toLowerCase()===`input`}function Gt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Kt(e,t){return e.button===0&&(!t||t===`_self`)&&!Gt(e)}function qt(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Jt(e,t){let n=qt(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Yt=null;function Xt(){if(Yt===null)try{new FormData(document.createElement(`form`),0),Yt=!1}catch{Yt=!0}return Yt}var Zt=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Qt(e){return e!=null&&!Zt.has(e)?(N(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Bt}"`),null):e}function $t(e,t){let n,r,i,a,o;if(Ut(e)){let o=e.getAttribute(`action`);r=o?L(o,t):null,n=e.getAttribute(`method`)||zt,i=Qt(e.getAttribute(`enctype`))||Bt,a=new FormData(e)}else if(Ht(e)||Wt(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?L(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||zt,i=Qt(e.getAttribute(`formenctype`))||Qt(o.getAttribute(`enctype`))||Bt,a=new FormData(o,e),!Xt()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Vt(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=zt,r=null,i=Bt,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var en={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},tn=/[&><\u2028\u2029]/g;function nn(e){return e.replace(tn,e=>en[e])}function rn(e,t){if(e===!1||e==null)throw Error(t)}function an(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&L(i.pathname,t)===`/`?i.pathname=`${B(t)}/_root.${r}`:i.pathname=`${B(i.pathname)}.${r}`,i}async function on(e,t){if(e.id in t)return t[e.id];try{let n=await oe(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function sn(e){return e!=null&&typeof e.page==`string`}function cn(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function ln(e,t,n){return mn((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await on(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(cn).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function un(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function dn(e,t,{includeHydrateFallback:n}={}){return fn(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function fn(e){return[...new Set(e)]}function pn(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function mn(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!sn(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(pn(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function hn(){let e=j.useContext(V);return rn(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function gn(){let e=j.useContext(H);return rn(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var _n=j.createContext(void 0);_n.displayName=`FrameworkContext`;function vn(){let e=j.useContext(_n);return rn(e,`You must render this element inside a <HydratedRouter> element`),e}function yn(e,t){let n=j.useContext(_n),[r,i]=j.useState(!1),[a,o]=j.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=j.useRef(null);j.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),j.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:X(s,p),onBlur:X(c,m),onMouseEnter:X(l,p),onMouseLeave:X(u,m),onTouchStart:X(d,p)}]:[a,f,{}]:[!1,f,{}]}function X(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function bn({page:e,...t}){let n=Ze(),{router:r}=hn(),i=j.useMemo(()=>he(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?j.createElement(Sn,{page:e,matches:i,...t}):j.createElement(Cn,{page:e,matches:i,...t}):null}function xn(e){let{manifest:t,routeModules:n}=vn(),[r,i]=j.useState([]);return j.useEffect(()=>{let r=!1;return ln(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Sn({page:e,matches:t,...n}){let r=q(),{future:i}=vn(),{basename:a}=hn(),o=j.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=an(e,a,i.unstable_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.unstable_trailingSlashAwareDataRequests,e,r,t]);return j.createElement(j.Fragment,null,o.map(e=>j.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Cn({page:e,matches:t,...n}){let r=q(),{future:i,manifest:a,routeModules:o}=vn(),{basename:s}=hn(),{loaderData:c,matches:l}=gn(),u=j.useMemo(()=>un(e,t,l,a,r,`data`),[e,t,l,a,r]),d=j.useMemo(()=>un(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=j.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=an(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=j.useMemo(()=>dn(d,a),[d,a]),m=xn(d);return j.createElement(j.Fragment,null,f.map(e=>j.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>j.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>j.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function wn(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}j.Component;var Tn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Tn&&(window.__reactRouterVersion=`7.14.1`)}catch{}function En({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=j.useRef();i.current??=le({window:r,v5Compat:!0});let a=i.current,[o,s]=j.useState({action:a.action,location:a.location}),c=j.useCallback(e=>{n===!1?s(e):j.startTransition(()=>s(e))},[n]);return j.useLayoutEffect(()=>a.listen(c),[a,c]),j.createElement(It,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:n})}function Dn({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=j.useState({action:n.action,location:n.location}),o=j.useCallback(e=>{r===!1?a(e):j.startTransition(()=>a(e))},[r]);return j.useLayoutEffect(()=>n.listen(o),[n,o]),j.createElement(It,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}Dn.displayName=`unstable_HistoryRouter`;var On=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,kn=j.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,unstable_mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,unstable_useTransitions:_}=j.useContext(U),v=typeof l==`string`&&On.test(l),y=qe(l,h);l=y.to;let b=st(l,{relative:r}),x=q(),S=null;if(o){let e=R(o,[],x.unstable_mask?x.unstable_mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:z([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=yn(n,p),ee=In(l,{replace:a,unstable_mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:_});function E(t){e&&e(t),t.defaultPrevented||ee(t)}let D=!(y.isExternal||i),O=j.createElement(`a`,{...p,...T,href:(D?S:void 0)||y.absoluteURL||b,onClick:D?E:e,ref:wn(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?j.createElement(j.Fragment,null,O,j.createElement(bn,{page:b})):O});kn.displayName=`Link`;var An=j.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Y(a,{relative:c.relative}),d=q(),f=j.useContext(H),{navigator:p,basename:m}=j.useContext(U),h=f!=null&&qn(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=L(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return j.createElement(kn,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});An.displayName=`NavLink`;var jn=j.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=zt,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:h}=j.useContext(U),g=Bn(),_=Vn(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&On.test(s);return j.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f});h&&n!==!1?j.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});jn.displayName=`Form`;function Mn({getKey:e,storageKey:t,...n}){let r=j.useContext(_n),{basename:i}=j.useContext(U),a=q(),o=Ot();Gn({getKey:e,storageKey:t});let s=j.useMemo(()=>{if(!r||!e)return null;let t=Wn(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return j.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${nn(JSON.stringify(t||Hn))}, ${nn(JSON.stringify(s))})`}})}Mn.displayName=`ScrollRestoration`;function Nn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Pn(e){let t=j.useContext(V);return M(t,Nn(e)),t}function Fn(e){let t=j.useContext(H);return M(t,Nn(e)),t}function In(e,{target:t,replace:n,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c,unstable_useTransitions:l}={}){let u=J(),d=q(),f=Y(e,{relative:o});return j.useCallback(p=>{if(Kt(p,t)){p.preventDefault();let t=n===void 0?P(d)===P(f):n,m=()=>u(e,{replace:t,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c});l?j.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function Ln(e){N(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=j.useRef(qt(e)),n=j.useRef(!1),r=q(),i=j.useMemo(()=>Jt(r.search,n.current?null:t.current),[r.search]),a=J();return[i,j.useCallback((e,t)=>{let r=qt(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var Rn=0,zn=()=>`__${String(++Rn)}__`;function Bn(){let{router:e}=Pn(`useSubmit`),{basename:t}=j.useContext(U),n=Et(),r=e.fetch,i=e.navigate;return j.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=$t(e,t);a.navigate===!1?await r(a.fetcherKey||zn(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Vn(e,{relative:t}={}){let{basename:n}=j.useContext(U),r=j.useContext(G);M(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Y(e||`.`,{relative:t})},o=q();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:z([n,a.pathname])),P(a)}var Hn=`react-router-scroll-positions`,Un={};function Wn(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:L(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Gn({getKey:e,storageKey:t}={}){let{router:n}=Pn(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=Fn(`useScrollRestoration`),{basename:a}=j.useContext(U),o=q(),s=Ot(),c=Dt();j.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Kn(j.useCallback(()=>{if(c.state===`idle`){let t=Wn(o,s,a,e);Un[t]=window.scrollY}try{sessionStorage.setItem(t||Hn,JSON.stringify(Un))}catch(e){N(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(j.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Hn);e&&(Un=JSON.parse(e))}catch{}},[t]),j.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Un,()=>window.scrollY,e?(t,n)=>Wn(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),j.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{N(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function Kn(e,t){let{capture:n}=t||{};j.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function qn(e,{relative:t}={}){let n=j.useContext(Qe);M(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Pn(`useViewTransitionState`),i=Y(e,{relative:t});if(!n.isTransitioning)return!1;let a=L(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=L(n.nextLocation.pathname,r)||n.nextLocation.pathname;return I(i.pathname,o)!=null||I(i.pathname,a)!=null}var Z=t();function Jn(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!t)return null;let n=parseInt(t[1],16)/255,r=parseInt(t[2],16)/255,i=parseInt(t[3],16)/255,a=Math.max(n,r,i),o=Math.min(n,r,i),s=0,c=0,l=(a+o)/2;if(a!==o){let e=a-o;switch(c=l>.5?e/(2-a-o):e/(a+o),a){case n:s=((r-i)/e+(r<i?6:0))/6;break;case r:s=((i-n)/e+2)/6;break;case i:s=((n-r)/e+4)/6;break}}return`${Math.round(s*360)} ${Math.round(c*100)}% ${Math.round(l*100)}%`}function Yn(e,t){(0,j.useEffect)(()=>{let n=document.documentElement;if(e?.primaryColor){let t=Jn(e.primaryColor);t&&(n.style.setProperty(`--brand-primary`,e.primaryColor),n.style.setProperty(`--brand-primary-hsl`,t))}else n.style.removeProperty(`--brand-primary`),n.style.removeProperty(`--brand-primary-hsl`);if(e?.accentColor){let t=Jn(e.accentColor);t&&(n.style.setProperty(`--brand-accent`,e.accentColor),n.style.setProperty(`--brand-accent-hsl`,t))}else n.style.removeProperty(`--brand-accent`),n.style.removeProperty(`--brand-accent-hsl`);if(e?.favicon){let t=document.querySelector(`#favicon`)||document.querySelector(`link[rel="icon"]`);t&&(t.href=e.favicon)}return t&&(document.title=t),()=>{n.style.removeProperty(`--brand-primary`),n.style.removeProperty(`--brand-primary-hsl`),n.style.removeProperty(`--brand-accent`),n.style.removeProperty(`--brand-accent-hsl`)}},[e?.primaryColor,e?.accentColor,e?.favicon,t])}function Xn({sidebar:e,navbar:t,children:n,className:r,defaultOpen:i=!0,branding:a}){return Yn(a,a?.title),(0,Z.jsxs)(u,{defaultOpen:i,children:[e,(0,Z.jsxs)(f,{children:[(0,Z.jsxs)(`header`,{className:`flex h-14 sm:h-16 shrink-0 items-center gap-2 border-b bg-background px-2 sm:px-4`,children:[(0,Z.jsx)(_,{className:`-ml-1 hidden md:inline-flex`}),(0,Z.jsx)(`div`,{className:`w-px h-4 bg-border mx-1 sm:mx-2 hidden md:block`}),t]}),(0,Z.jsx)(`main`,{className:d(`flex-1 min-w-0 overflow-auto p-3 sm:p-4 md:p-6`,r),children:n})]})]})}var Zn=new Map;function Qn(e){if(!e)return v;let t=Zn.get(e);if(t)return t;if(g[e])return Zn.set(e,g[e]),g[e];let n=e.split(`-`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``);return g[n]?(Zn.set(e,g[n]),g[n]):v}function Q(e,t){if(typeof e==`string`)return e;if(t){let n=t(e.key,{defaultValue:e.defaultValue,...e.params});if(n&&n!==e.key)return n}return e.defaultValue||e.key}function $n(e,t,n){let r=Q(e.label,n);return t&&e.type===`object`&&e.objectName&&typeof e.label==`string`?t(e.objectName,r):r}var er=e=>!(e===!1||e===`false`),tr=()=>!0;function nr(e,t){switch(e.type){case`object`:{let n=`${t}/${e.objectName??``}`;return{href:e.viewName?`${n}/view/${e.viewName}`:n,external:!1}}case`dashboard`:return{href:e.dashboardName?`${t}/dashboard/${e.dashboardName}`:`#`,external:!1};case`page`:return{href:e.pageName?`${t}/page/${e.pageName}`:`#`,external:!1};case`report`:return{href:e.reportName?`${t}/report/${e.reportName}`:`#`,external:!1};case`url`:return{href:e.url??`#`,external:e.target===`_blank`};default:return{href:`#`,external:!1}}}function rr(e,t){if(!t.trim())return e;let n=t.toLowerCase().trim();return e.reduce((e,r)=>{if(r.type===`separator`)return e;if(r.type===`group`&&r.children?.length){let n=rr(r.children,t);return n.length>0&&e.push({...r,children:n}),e}return Q(r.label).toLowerCase().includes(n)&&e.push(r),e},[])}var ir=5;function ar({item:e,basePath:t,evalVis:n,checkPerm:r,onAction:i,enablePinning:a,onPinToggle:o,enableReorder:s,resolveObjectLabel:c,t:l}){let{attributes:u,listeners:d,setNodeRef:f,transform:p,transition:m,isDragging:h}=k({id:e.id,disabled:!s});return(0,Z.jsx)(`div`,{ref:f,style:{transform:x.Transform.toString(p),transition:m,opacity:h?.5:void 0,zIndex:h?10:void 0},...u,children:(0,Z.jsx)($,{item:e,basePath:t,evalVis:n,checkPerm:r,onAction:i,enablePinning:a,onPinToggle:o,dragListeners:s?d:void 0,resolveObjectLabel:c,t:l})})}function $({item:e,basePath:t,evalVis:n,checkPerm:u,onAction:d,enablePinning:f,onPinToggle:g,dragListeners:_,resolveObjectLabel:v,t:x}){let S=q(),[C,w]=(0,j.useState)(e.defaultOpen!==!1);if(!n(e.visible)||e.requiredPermissions?.length&&!u(e.requiredPermissions))return null;if(e.type===`separator`)return(0,Z.jsx)(b,{className:`my-2`});if(e.type===`group`){let a=(e.children??[]).slice().sort((e,t)=>(e.order??0)-(t.order??0));return(0,Z.jsx)(D,{open:C,onOpenChange:w,children:(0,Z.jsxs)(i,{children:[(0,Z.jsx)(O,{asChild:!0,children:(0,Z.jsxs)(E,{className:`flex w-full items-center justify-between`,children:[Q(e.label,x),(0,Z.jsx)(T,{className:`ml-auto h-4 w-4 transition-transform ${C?`rotate-90`:``}`})]})}),(0,Z.jsx)(r,{children:(0,Z.jsx)(m,{children:(0,Z.jsx)(p,{children:a.map(e=>(0,Z.jsx)($,{item:e,basePath:t,evalVis:n,checkPerm:u,onAction:d,enablePinning:f,onPinToggle:g,resolveObjectLabel:v,t:x},e.id))})})})]})})}if(e.type===`action`){let t=Qn(e.icon);return(0,Z.jsxs)(c,{children:[_&&(0,Z.jsx)(`span`,{className:`absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground`,"aria-label":`Drag to reorder`,..._,children:(0,Z.jsx)(l,{className:`h-3.5 w-3.5`})}),(0,Z.jsxs)(a,{tooltip:Q(e.label,x),onClick:()=>d?.(e),children:[(0,Z.jsx)(t,{className:`h-4 w-4`}),(0,Z.jsx)(`span`,{children:Q(e.label,x)}),e.badge!=null&&(0,Z.jsx)(s,{variant:e.badgeVariant??`default`,className:`ml-auto text-[10px] px-1.5 py-0`,children:e.badge})]}),f&&g&&(0,Z.jsx)(h,{showOnHover:!0,onClick:()=>g(e.id,!e.pinned),"aria-label":e.pinned?`Unpin ${Q(e.label,x)}`:`Pin ${Q(e.label,x)}`,children:e.pinned?(0,Z.jsx)(o,{className:`h-3.5 w-3.5`}):(0,Z.jsx)(y,{className:`h-3.5 w-3.5`})})]})}let ee=Qn(e.icon),{href:k,external:te}=nr(e,t),ne=k!==`#`&&S.pathname.startsWith(k),A=$n(e,v,x),re=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ee,{className:`h-4 w-4`}),(0,Z.jsx)(`span`,{children:A}),e.badge!=null&&(0,Z.jsx)(s,{variant:e.badgeVariant??`default`,className:`ml-auto text-[10px] px-1.5 py-0`,children:e.badge})]});return(0,Z.jsxs)(c,{children:[_&&(0,Z.jsx)(`span`,{className:`absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground`,"aria-label":`Drag to reorder`,..._,children:(0,Z.jsx)(l,{className:`h-3.5 w-3.5`})}),(0,Z.jsx)(a,{asChild:!0,isActive:ne,tooltip:A,children:te?(0,Z.jsx)(`a`,{href:k,target:`_blank`,rel:`noopener noreferrer`,children:re}):(0,Z.jsx)(kn,{to:k,children:re})}),f&&g&&(0,Z.jsx)(h,{showOnHover:!0,onClick:()=>g(e.id,!e.pinned),"aria-label":e.pinned?`Unpin ${A}`:`Pin ${A}`,children:e.pinned?(0,Z.jsx)(o,{className:`h-3.5 w-3.5`}):(0,Z.jsx)(y,{className:`h-3.5 w-3.5`})})]})}function or({items:e,basePath:t=``,evaluateVisibility:n=er,checkPermission:r=tr,onAction:a,searchQuery:o,enablePinning:s,onPinToggle:c,enableReorder:l,onReorder:u,resolveObjectLabel:d,t:f}){let h=(0,j.useMemo)(()=>o?rr(e,o):e,[e,o]),g=(0,j.useMemo)(()=>sr(h),[h]),_=h.slice().sort((e,t)=>(e.order??0)-(t.order??0)),v=ae(ie(te,{activationConstraint:{distance:ir}}),ie(ne)),y=e=>{let{active:t,over:n}=e;if(!n||t.id===n.id||!u)return;let r=_.findIndex(e=>e.id===t.id),i=_.findIndex(e=>e.id===n.id);r===-1||i===-1||u(C(_,r,i).map((e,t)=>({...e,order:t})))},b={basePath:t,evalVis:n,checkPerm:r,onAction:a,enablePinning:s,onPinToggle:c,resolveObjectLabel:d,t:f},x=_.some(e=>e.type===`group`),T=g.length>0&&s?(0,Z.jsxs)(i,{children:[(0,Z.jsxs)(O,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(S,{className:`h-3.5 w-3.5`}),`Favorites`]}),(0,Z.jsx)(m,{children:(0,Z.jsx)(p,{children:g.map(e=>(0,Z.jsx)($,{item:e,...b},`fav-${e.id}`))})})]}):null;if(!x){let e=_.filter(e=>e.type!==`group`).map(e=>e.id);return(0,Z.jsxs)(Z.Fragment,{children:[T,(0,Z.jsx)(i,{children:(0,Z.jsx)(m,{children:l?(0,Z.jsx)(w,{sensors:v,collisionDetection:ee,onDragEnd:y,children:(0,Z.jsx)(A,{items:e,strategy:re,children:(0,Z.jsx)(p,{children:_.map(e=>(0,Z.jsx)(ar,{item:e,enableReorder:l,...b},e.id))})})}):(0,Z.jsx)(p,{children:_.map(e=>(0,Z.jsx)($,{item:e,...b},e.id))})})})]})}let E=[],D=[],k=e=>{if(D.length===0)return;let t=D;D=[],E.push((0,Z.jsx)(i,{children:(0,Z.jsx)(m,{children:(0,Z.jsx)(p,{children:t.map(e=>(0,Z.jsx)($,{item:e,...b},e.id))})})},e))};return _.forEach((e,t)=>{e.type===`group`?(k(`leaf-${t}`),E.push((0,Z.jsx)($,{item:e,...b},e.id))):D.push(e)}),k(`leaf-end`),(0,Z.jsxs)(Z.Fragment,{children:[T,E]})}function sr(e){let t=[];for(let n of e)n.pinned&&n.type!==`group`&&n.type!==`separator`&&t.push(n),n.children?.length&&t.push(...sr(n.children));return t}export{Pt as a,q as c,Ln as d,kn as i,J as l,Xn as n,Ft as o,En as r,Lt as s,or as t,dt as u};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{k as t,z as n}from"./framework-B0ex8RpF.js";var r=e(n(),1),i=`objectui-recent-items`,a=8;function o(){try{let e=localStorage.getItem(i);return e?JSON.parse(e):[]}catch{return[]}}function s(e){try{localStorage.setItem(i,JSON.stringify(e))}catch{}}function c(){let[e,t]=(0,r.useState)(o);return(0,r.useEffect)(()=>{t(o())},[]),{recentItems:e,addRecentItem:(0,r.useCallback)(e=>{t(t=>{let n=t.filter(t=>t.id!==e.id),r=[{...e,visitedAt:new Date().toISOString()},...n].slice(0,a);return s(r),r})},[]),clearRecentItems:(0,r.useCallback)(()=>{t([]),s([])},[])}}var l=t(),u=`objectui-favorites`,d=20;function f(){try{let e=localStorage.getItem(u);return e?JSON.parse(e):[]}catch{return[]}}function p(e){try{localStorage.setItem(u,JSON.stringify(e))}catch{}}var m=(0,r.createContext)(null);function h({children:e}){let[t,n]=(0,r.useState)(f);(0,r.useEffect)(()=>{n(f())},[]);let i=(0,r.useCallback)(e=>{n(t=>{if(t.some(t=>t.id===e.id))return t;let n=[{...e,favoritedAt:new Date().toISOString()},...t].slice(0,d);return p(n),n})},[]),a=(0,r.useCallback)(e=>{n(t=>{let n=t.filter(t=>t.id!==e);return p(n),n})},[]),o=(0,r.useCallback)(e=>{n(t=>{let n=t.some(t=>t.id===e.id)?t.filter(t=>t.id!==e.id):[{...e,favoritedAt:new Date().toISOString()},...t].slice(0,d);return p(n),n})},[]),s=(0,r.useCallback)(()=>{n([]),p([])},[]),c=(0,r.useMemo)(()=>({favorites:t,addFavorite:i,removeFavorite:a,toggleFavorite:o,isFavorite:e=>t.some(t=>t.id===e),clearFavorites:s}),[t,i,a,o,s]);return(0,l.jsx)(m.Provider,{value:c,children:e})}function g(){let e=(0,r.useContext)(m);if(!e)throw Error(`useFavorites must be used within a FavoritesProvider`);return e}export{g as n,c as r,h as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{z as t}from"./framework-B0ex8RpF.js";import{n}from"./AdapterProvider-BMMNYOio.js";function r(e,t){let n=Array.isArray(e.fields)?e.fields:Object.values(e.fields||{});return{id:e.name||`obj_${t}`,name:e.name||``,label:typeof e.label==`object`?e.label.defaultValue||e.label.key||``:e.label||e.name||``,pluralLabel:e.pluralLabel||e.plural_label||void 0,description:typeof e.description==`object`?e.description.defaultValue:e.description||void 0,icon:e.icon||void 0,group:e.name?.startsWith(`sys_`)?`System Objects`:`Custom Objects`,sortOrder:t,isSystem:e.name?.startsWith(`sys_`)||!1,enabled:e.enabled!==!1,fieldCount:n.length,relationships:Array.isArray(e.relationships)?e.relationships.map(e=>({relatedObject:e.object||e.relatedObject||``,type:e.type||`one-to-many`,label:e.label||e.name||void 0,foreignKey:e.foreign_key||e.foreignKey||void 0})):void 0}}function i(e,t){return{id:e.name||`fld_${t}`,name:e.name||``,label:typeof e.label==`object`?e.label.defaultValue||e.label.key||``:e.label||e.name||``,type:e.type||`text`,group:e.group||void 0,sortOrder:t,description:e.description||e.help||void 0,required:e.required||!1,unique:e.unique||!1,readonly:e.readonly||!1,hidden:e.hidden||!1,defaultValue:e.defaultValue||e.default_value||void 0,placeholder:e.placeholder||void 0,options:Array.isArray(e.options)?e.options.map(e=>typeof e==`string`?{label:e,value:e}:{label:e.label||e.value,value:e.value,color:e.color}):void 0,isSystem:e.readonly===!0&&(e.name===`id`||e.name===`createdAt`||e.name===`updatedAt`),externalId:e.externalId||!1,trackHistory:e.trackHistory||e.track_history||!1,indexed:e.indexed||!1,referenceTo:e.reference_to||e.referenceTo||void 0,formula:e.formula||void 0}}var a=e(t(),1);function o(e,t){return{name:e.name,label:e.label,pluralLabel:e.pluralLabel,description:e.description,icon:e.icon,group:e.group,sortOrder:e.sortOrder,enabled:e.enabled,fields:t,relationships:e.relationships}}function s(e){return{name:e.name,label:e.label,type:e.type,group:e.group,description:e.description,required:e.required,unique:e.unique,readonly:e.readonly,hidden:e.hidden,defaultValue:e.defaultValue,placeholder:e.placeholder,options:e.options,externalId:e.externalId,trackHistory:e.trackHistory,indexed:e.indexed,referenceTo:e.referenceTo,formula:e.formula,sortOrder:e.sortOrder}}var c=class{constructor(e){this.adapter=e}async getItems(e){let t=await this.adapter.getClient().meta.getItems(e);return t&&typeof t==`object`&&`items`in t&&Array.isArray(t.items)?t.items:[]}async saveMetadataItem(e,t,n){await this.adapter.getClient().meta.saveItem(e,t,n),this.adapter.invalidateCache(`${e}:${t}`)}async deleteMetadataItem(e,t){await this.adapter.getClient().meta.saveItem(e,t,{name:t,enabled:!1,_deleted:!0}),this.adapter.invalidateCache(`${e}:${t}`)}async saveObject(e,t){let n=this.adapter.getClient(),r=o(e,t);await n.meta.saveItem(`object`,e.name,r),this.adapter.invalidateCache(`object:${e.name}`)}async deleteObject(e){await this.adapter.getClient().meta.saveItem(`object`,e,{name:e,enabled:!1,_deleted:!0}),this.adapter.invalidateCache(`object:${e}`)}async saveFields(e,t){let n=this.adapter.getClient(),r={};try{let t=await n.meta.getItem(`object`,e);r=t?.item??t??{}}catch{}let i={...r,name:e,fields:t.map(s)};await n.meta.saveItem(`object`,e,i),this.adapter.invalidateCache(`object:${e}`)}static diffObjects(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map(t.map(e=>[e.id,e]));for(let[e,t]of r)if(!n.has(e))return{type:`create`,object:t};for(let[e,t]of n)if(!r.has(e))return{type:`delete`,object:t};for(let[e,t]of r){let r=n.get(e);if(r&&JSON.stringify(r)!==JSON.stringify(t))return{type:`update`,object:t}}return null}static diffFields(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map(t.map(e=>[e.id,e]));for(let[e,t]of r)if(!n.has(e))return{type:`create`,field:t};for(let[e,t]of n)if(!r.has(e))return{type:`delete`,field:t};for(let[e,t]of r){let r=n.get(e);if(r&&JSON.stringify(r)!==JSON.stringify(t))return{type:`update`,field:t}}return null}};function l(){let e=n();return(0,a.useMemo)(()=>e?new c(e):null,[e])}export{r as i,c as n,i as r,l as t};