cortex-react-components 2.28.3 → 2.29.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) hide show
  1. package/dist/{chunk-IISYRLNU.mjs → chunk-2AZMG5X5.mjs} +1 -1
  2. package/dist/{chunk-LAQ3QAUW.mjs → chunk-2LQLKZYT.mjs} +1 -1
  3. package/dist/{chunk-6FHRZHAJ.mjs → chunk-2OGUZJVD.mjs} +1 -1
  4. package/dist/{chunk-CC57QZMB.mjs → chunk-2UVHBGOC.mjs} +1 -1
  5. package/dist/{chunk-UENQZNU3.mjs → chunk-2ZBHHV3P.mjs} +1 -1
  6. package/dist/{chunk-GUEJKEJJ.mjs → chunk-3MK7GU65.mjs} +1 -1
  7. package/dist/{chunk-JBGWDOOS.mjs → chunk-3PAS4AKZ.mjs} +1 -1
  8. package/dist/{chunk-R4SE63GR.mjs → chunk-3W5SE2HO.mjs} +1 -1
  9. package/dist/{chunk-2TUBS2HM.mjs → chunk-4DESBE4R.mjs} +1 -1
  10. package/dist/{chunk-HD6E7KI2.mjs → chunk-4KVVVRGU.mjs} +1 -1
  11. package/dist/{chunk-COBOHCBL.mjs → chunk-5G7LCLOY.mjs} +1 -1
  12. package/dist/{chunk-ITNR7N47.mjs → chunk-5ISPA3SI.mjs} +1 -1
  13. package/dist/{chunk-KBEXWUKI.mjs → chunk-5NIEZE7A.mjs} +1 -1
  14. package/dist/{chunk-QOZ2O3FG.mjs → chunk-5WTGNFUL.mjs} +1 -1
  15. package/dist/{chunk-CK2TD4BY.mjs → chunk-6A2O63AU.mjs} +1 -1
  16. package/dist/{chunk-VGWDYD6Z.mjs → chunk-6LJCQVKZ.mjs} +1 -1
  17. package/dist/{chunk-TKY52BNP.mjs → chunk-7HIL4GBK.mjs} +1 -1
  18. package/dist/{chunk-CTAIR3TE.mjs → chunk-7HLSAUWP.mjs} +1 -1
  19. package/dist/{chunk-MS7YIAWP.mjs → chunk-ABWLO5GA.mjs} +1 -1
  20. package/dist/{chunk-XX4GSGRP.mjs → chunk-AQQCH7Z2.mjs} +1 -1
  21. package/dist/{chunk-YH72WKGC.mjs → chunk-BEUDMDIW.mjs} +1 -1
  22. package/dist/{chunk-XJKNH5LL.mjs → chunk-BLOKJ7Y2.mjs} +1 -1
  23. package/dist/{chunk-LLED3RQS.mjs → chunk-BQJDTDBP.mjs} +1 -1
  24. package/dist/{chunk-NXAXOI33.mjs → chunk-C6RV2I5S.mjs} +1 -1
  25. package/dist/{chunk-MX3JKY3V.mjs → chunk-CGL3R3BQ.mjs} +1 -1
  26. package/dist/{chunk-SNTLCFXF.mjs → chunk-DDQVEARQ.mjs} +1 -1
  27. package/dist/{chunk-TQKXHMD7.mjs → chunk-DDYANYQB.mjs} +1 -1
  28. package/dist/{chunk-FJ2HHNPX.mjs → chunk-DLX4NQ3T.mjs} +1 -1
  29. package/dist/{chunk-SNFBF6KT.mjs → chunk-DZDMH6IZ.mjs} +1 -1
  30. package/dist/{chunk-7BYNW77I.mjs → chunk-EDRIV2VR.mjs} +1 -1
  31. package/dist/{chunk-NDBSSX6Q.mjs → chunk-EVQAIFAP.mjs} +1 -1
  32. package/dist/{chunk-SX2LOHXX.mjs → chunk-FNOAYUJ3.mjs} +1 -1
  33. package/dist/{chunk-46N4YPMB.mjs → chunk-FOO5RONL.mjs} +1 -1
  34. package/dist/{chunk-CO6AQNZ5.mjs → chunk-G53ROINJ.mjs} +1 -1
  35. package/dist/{chunk-5EKGFFJD.mjs → chunk-G5UB3YKZ.mjs} +1 -1
  36. package/dist/{chunk-QKDYTCZC.mjs → chunk-GFYO6B7H.mjs} +1 -1
  37. package/dist/{chunk-NSMXJCXE.mjs → chunk-GLKM2IVW.mjs} +1 -1
  38. package/dist/{chunk-4USR4WTH.mjs → chunk-GMLLRSAH.mjs} +1 -1
  39. package/dist/chunk-HCHZUZUK.mjs +4 -0
  40. package/dist/{chunk-Z22NSJMF.mjs → chunk-HF33ZXKX.mjs} +1 -1
  41. package/dist/{chunk-EOXVYLPB.mjs → chunk-HFND7WDK.mjs} +1 -1
  42. package/dist/{chunk-VKLEU4ZW.mjs → chunk-I3G2R2J2.mjs} +1 -1
  43. package/dist/{chunk-MXMW65GM.mjs → chunk-IKVDX3WJ.mjs} +1 -1
  44. package/dist/{chunk-MCOHKE2T.mjs → chunk-JGKLAY6J.mjs} +1 -1
  45. package/dist/chunk-JION2IPC.mjs +4 -0
  46. package/dist/{chunk-6XUIHSKG.mjs → chunk-JKVQOOCZ.mjs} +1 -1
  47. package/dist/{chunk-NCJAMNMQ.mjs → chunk-K7NFBXL3.mjs} +1 -1
  48. package/dist/{chunk-3M5KHST3.mjs → chunk-KHJKOKJN.mjs} +1 -1
  49. package/dist/{chunk-6YHCNPFB.mjs → chunk-KOLP657S.mjs} +1 -1
  50. package/dist/{chunk-TIIYFAV6.mjs → chunk-KRDGYYCK.mjs} +1 -1
  51. package/dist/{chunk-JDMIQLAZ.mjs → chunk-KSYES4GX.mjs} +1 -1
  52. package/dist/{chunk-AOQPH32M.mjs → chunk-LCHPGIER.mjs} +1 -1
  53. package/dist/{chunk-KX2NCNCS.mjs → chunk-LF55USCD.mjs} +1 -1
  54. package/dist/{chunk-5FWH5YVM.mjs → chunk-LHO4WFYP.mjs} +1 -1
  55. package/dist/{chunk-6ZMZX5TB.mjs → chunk-LL7CRB4U.mjs} +1 -1
  56. package/dist/{chunk-VRHJOUL3.mjs → chunk-LMDGHBG2.mjs} +1 -1
  57. package/dist/{chunk-MH4YPGH4.mjs → chunk-LPCO4T25.mjs} +1 -1
  58. package/dist/{chunk-5MMNC65L.mjs → chunk-LRNWBTXT.mjs} +1 -1
  59. package/dist/{chunk-AABB4TFO.mjs → chunk-M3DLWHPQ.mjs} +1 -1
  60. package/dist/{chunk-VNKGAW4K.mjs → chunk-MQ7ZFZRG.mjs} +1 -1
  61. package/dist/{chunk-KPTGYVDM.mjs → chunk-MQG7MKTK.mjs} +1 -1
  62. package/dist/{chunk-TZKQXT7Y.mjs → chunk-N25B5TQ5.mjs} +1 -1
  63. package/dist/{chunk-U3PUWUVM.mjs → chunk-NCHC4HCU.mjs} +1 -1
  64. package/dist/{chunk-SME3D72Q.mjs → chunk-OAK45GQL.mjs} +1 -1
  65. package/dist/{chunk-J3VJUPR7.mjs → chunk-ORCATWOS.mjs} +1 -1
  66. package/dist/{chunk-KPQ56JSD.mjs → chunk-PAERB6R2.mjs} +1 -1
  67. package/dist/{chunk-7MPZOMXK.mjs → chunk-PG4VW7VP.mjs} +1 -1
  68. package/dist/{chunk-M2REXGQW.mjs → chunk-PKI57UXP.mjs} +1 -1
  69. package/dist/{chunk-LCSO56PM.mjs → chunk-PQYMYQXD.mjs} +1 -1
  70. package/dist/{chunk-56X4PU43.mjs → chunk-Q35D7SUU.mjs} +1 -1
  71. package/dist/{chunk-JU4TJYSZ.mjs → chunk-QDK5I675.mjs} +1 -1
  72. package/dist/{chunk-2R3MJSQ7.mjs → chunk-QHIZOLWH.mjs} +1 -1
  73. package/dist/{chunk-TKCFCYEQ.mjs → chunk-QPGVTPZ4.mjs} +1 -1
  74. package/dist/{chunk-P2B3OITE.mjs → chunk-R422HRMQ.mjs} +1 -1
  75. package/dist/{chunk-P55W6AFU.mjs → chunk-RIRZRO6U.mjs} +1 -1
  76. package/dist/{chunk-F6DMXMR4.mjs → chunk-S3OBSLA5.mjs} +1 -1
  77. package/dist/{chunk-6SWKEZN6.mjs → chunk-S7SHOCHM.mjs} +1 -1
  78. package/dist/{chunk-53ERRCTV.mjs → chunk-SKTNOZL2.mjs} +1 -1
  79. package/dist/{chunk-EZC3YWSQ.mjs → chunk-SRCJSWQF.mjs} +1 -1
  80. package/dist/{chunk-TXVA6XJT.mjs → chunk-SRUG246N.mjs} +1 -1
  81. package/dist/{chunk-LCEEFZH7.mjs → chunk-SRXU4X35.mjs} +1 -1
  82. package/dist/{chunk-V7SNI22Q.mjs → chunk-T23BJQBB.mjs} +1 -1
  83. package/dist/{chunk-6PS55VJZ.mjs → chunk-T46EPXCV.mjs} +1 -1
  84. package/dist/{chunk-RSDUFAIB.mjs → chunk-T5HJS6OF.mjs} +1 -1
  85. package/dist/{chunk-LJFBHY4P.mjs → chunk-TBKC2B4Z.mjs} +1 -1
  86. package/dist/{chunk-PVPDARFR.mjs → chunk-TCZNV2C2.mjs} +1 -1
  87. package/dist/{chunk-FB5PBKLV.mjs → chunk-TGJ74O6U.mjs} +1 -1
  88. package/dist/{chunk-TR6RBROH.mjs → chunk-U3OEUDKT.mjs} +1 -1
  89. package/dist/{chunk-47OE4ZPY.mjs → chunk-UE66RIJN.mjs} +1 -1
  90. package/dist/{chunk-QDP657UR.mjs → chunk-UG7FEEFM.mjs} +1 -1
  91. package/dist/{chunk-ZHBYZ4HE.mjs → chunk-UW65QW5M.mjs} +1 -1
  92. package/dist/{chunk-X3JZSN3W.mjs → chunk-UZSBX5GO.mjs} +1 -1
  93. package/dist/{chunk-XGGWZIPM.mjs → chunk-V4OXGW5U.mjs} +1 -1
  94. package/dist/{chunk-XGIYNUGC.mjs → chunk-VNYUNZ3M.mjs} +1 -1
  95. package/dist/{chunk-4LUF5GZ6.mjs → chunk-VR75QVWG.mjs} +1 -1
  96. package/dist/{chunk-2BR55L74.mjs → chunk-VRE6VCHX.mjs} +1 -1
  97. package/dist/{chunk-MAZGVZJN.mjs → chunk-VWHOSOCB.mjs} +1 -1
  98. package/dist/{chunk-MU47F4UR.mjs → chunk-WAM7RYAU.mjs} +1 -1
  99. package/dist/{chunk-2LINLX4S.mjs → chunk-WHOWQZV6.mjs} +1 -1
  100. package/dist/{chunk-MU5WPW4N.mjs → chunk-WPH2ALD6.mjs} +1 -1
  101. package/dist/{chunk-2UNIT7NC.mjs → chunk-XSPGO55P.mjs} +1 -1
  102. package/dist/{chunk-RS4WAAGI.mjs → chunk-XTUH2DJE.mjs} +1 -1
  103. package/dist/{chunk-FSCDCSVK.mjs → chunk-YCD46AKJ.mjs} +1 -1
  104. package/dist/{chunk-GS3P2V76.mjs → chunk-YONYS5B2.mjs} +1 -1
  105. package/dist/{chunk-E6NVWHRS.mjs → chunk-ZERDRART.mjs} +1 -1
  106. package/dist/{chunk-O5P35LEY.mjs → chunk-ZFUP5NVF.mjs} +1 -1
  107. package/dist/{chunk-X3YJJBFJ.mjs → chunk-ZKTIH47I.mjs} +1 -1
  108. package/dist/components/AdvancedComponents/AppSidebar.mjs +1 -1
  109. package/dist/components/AdvancedComponents/CommentSection.mjs +1 -1
  110. package/dist/components/AdvancedComponents/app-header.mjs +1 -1
  111. package/dist/components/AdvancedComponents/index.mjs +1 -1
  112. package/dist/components/AdvancedComponents/notifications-panel.mjs +1 -1
  113. package/dist/components/AdvancedComponents/user-selection.mjs +1 -1
  114. package/dist/components/Blocks/Banner.mjs +1 -1
  115. package/dist/components/Blocks/CallToAction.mjs +1 -1
  116. package/dist/components/Blocks/CollapsibleArea.mjs +1 -1
  117. package/dist/components/Blocks/Content.mjs +1 -1
  118. package/dist/components/Blocks/FeaturesBlock.mjs +1 -1
  119. package/dist/components/Blocks/ImageBlock.mjs +1 -1
  120. package/dist/components/Blocks/MediaBlock.mjs +1 -1
  121. package/dist/components/Blocks/RelatedPosts.mjs +1 -1
  122. package/dist/components/Blocks/RenderBlocks.mjs +1 -1
  123. package/dist/components/Blocks/ReusableContentBlock.mjs +1 -1
  124. package/dist/components/Blocks/index.mjs +1 -1
  125. package/dist/components/CRM/CogeBoard.mjs +1 -1
  126. package/dist/components/CRM/DealDetails.mjs +1 -1
  127. package/dist/components/CRM/KanbanBoard.mjs +1 -1
  128. package/dist/components/CRM/index.mjs +1 -1
  129. package/dist/components/Cards/ContentCard.mjs +1 -1
  130. package/dist/components/Cards/FeatureCard.mjs +1 -1
  131. package/dist/components/Cards/PricingCard.mjs +1 -1
  132. package/dist/components/Cards/ServiceCard.mjs +1 -1
  133. package/dist/components/Cards/index.mjs +1 -1
  134. package/dist/components/Chat/ChatInterface.mjs +1 -1
  135. package/dist/components/Chat/CopilotInterface.mjs +1 -1
  136. package/dist/components/Chat/PartTypes/MessageHandler.mjs +1 -1
  137. package/dist/components/Chat/PartTypes/Tool.mjs +1 -1
  138. package/dist/components/Chat/PartTypes/index.mjs +1 -1
  139. package/dist/components/Chat/capability-menu.mjs +1 -1
  140. package/dist/components/Chat/chat-session-sidebar.mjs +1 -1
  141. package/dist/components/Chat/demo-long-messages.mjs +1 -1
  142. package/dist/components/Chat/demo-tests.mjs +1 -1
  143. package/dist/components/Chat/demo.mjs +1 -1
  144. package/dist/components/Chat/example-usage.mjs +1 -1
  145. package/dist/components/Chat/example-with-vercel-ai.mjs +1 -1
  146. package/dist/components/Chat/index.mjs +1 -1
  147. package/dist/components/DigitalColleagues/AppSidebarLeft.mjs +1 -1
  148. package/dist/components/DigitalColleagues/DashboardHeader.mjs +1 -1
  149. package/dist/components/DigitalColleagues/DigitalColleageusLayout.mjs +1 -1
  150. package/dist/components/DigitalColleagues/MainPage.js +1 -1
  151. package/dist/components/DigitalColleagues/MainPage.mjs +1 -1
  152. package/dist/components/DigitalColleagues/Pages/dashboardpage.mjs +1 -1
  153. package/dist/components/DigitalColleagues/SearchableSelect.mjs +1 -1
  154. package/dist/components/DigitalColleagues/Views/ColleaguesView.mjs +1 -1
  155. package/dist/components/DigitalColleagues/Views/KnowledgeView.mjs +1 -1
  156. package/dist/components/DigitalColleagues/Views/TeamsIndexView.mjs +1 -1
  157. package/dist/components/DigitalColleagues/Views/index.mjs +1 -1
  158. package/dist/components/DigitalColleagues/colleague-card.mjs +1 -1
  159. package/dist/components/DigitalColleagues/colleague-form.mjs +1 -1
  160. package/dist/components/DigitalColleagues/colleague-type-selection.mjs +1 -1
  161. package/dist/components/DigitalColleagues/digital-colleague-clone.mjs +1 -1
  162. package/dist/components/DigitalColleagues/digital-colleague-options.mjs +1 -1
  163. package/dist/components/DigitalColleagues/index.js +1 -1
  164. package/dist/components/DigitalColleagues/index.mjs +1 -1
  165. package/dist/components/DigitalColleagues/knowledge-search.mjs +1 -1
  166. package/dist/components/DigitalColleagues/team-form.mjs +1 -1
  167. package/dist/components/Foundary/AppSidebarLeft.mjs +1 -1
  168. package/dist/components/Foundary/DashboardHeader.mjs +1 -1
  169. package/dist/components/Foundary/Knowledge/add-knowledge-modal.mjs +1 -1
  170. package/dist/components/Foundary/Knowledge/add-team-context.mjs +1 -1
  171. package/dist/components/Foundary/LandingMenu.mjs +1 -1
  172. package/dist/components/Foundary/Login.mjs +1 -1
  173. package/dist/components/Foundary/MainPage.js +1 -1
  174. package/dist/components/Foundary/MainPage.mjs +1 -1
  175. package/dist/components/Foundary/Pages/dashboardpage.js +1 -1
  176. package/dist/components/Foundary/Pages/dashboardpage.mjs +1 -1
  177. package/dist/components/Foundary/RichText/index.mjs +1 -1
  178. package/dist/components/Foundary/RichText/plugins/toolbar-plugin.mjs +1 -1
  179. package/dist/components/Foundary/SearchableSelect.mjs +1 -1
  180. package/dist/components/Foundary/Views/ColleaguesView.mjs +1 -1
  181. package/dist/components/Foundary/Views/KnowledgeView.mjs +1 -1
  182. package/dist/components/Foundary/Views/TeamsIndexView.mjs +1 -1
  183. package/dist/components/Foundary/Views/index.mjs +1 -1
  184. package/dist/components/Foundary/colleague-card.mjs +1 -1
  185. package/dist/components/Foundary/colleague-form.mjs +1 -1
  186. package/dist/components/Foundary/colleague-type-selection.mjs +1 -1
  187. package/dist/components/Foundary/document-edit.mjs +1 -1
  188. package/dist/components/Foundary/document-preview-examples.mjs +1 -1
  189. package/dist/components/Foundary/document-preview.mjs +1 -1
  190. package/dist/components/Foundary/file-edit.mjs +1 -1
  191. package/dist/components/Foundary/foundary-clone.mjs +1 -1
  192. package/dist/components/Foundary/foundary-layout.mjs +1 -1
  193. package/dist/components/Foundary/foundary-options.mjs +1 -1
  194. package/dist/components/Foundary/index.js +4 -4
  195. package/dist/components/Foundary/index.mjs +1 -1
  196. package/dist/components/Foundary/knowledge-browser.mjs +1 -1
  197. package/dist/components/Foundary/knowledge-search.mjs +1 -1
  198. package/dist/components/Foundary/types.d.ts +1 -1
  199. package/dist/components/HeaderFooter/Header.js +1 -1
  200. package/dist/components/HeaderFooter/Header.mjs +1 -1
  201. package/dist/components/HeaderFooter/HeaderDesktop.js +1 -1
  202. package/dist/components/HeaderFooter/HeaderDesktop.mjs +1 -1
  203. package/dist/components/HeaderFooter/SectionHeading.mjs +1 -1
  204. package/dist/components/HeaderFooter/VideoHeader.mjs +1 -1
  205. package/dist/components/HeaderFooter/enhanced-header.mjs +1 -1
  206. package/dist/components/HeaderFooter/index.js +1 -1
  207. package/dist/components/HeaderFooter/index.mjs +1 -1
  208. package/dist/components/Heros/DashboardHero/DashboardHero.mjs +1 -1
  209. package/dist/components/Heros/DashboardHero/index.mjs +1 -1
  210. package/dist/components/Heros/HighImpact/index.mjs +1 -1
  211. package/dist/components/Heros/LowImpact/index.mjs +1 -1
  212. package/dist/components/Heros/MediumImpact/index.mjs +1 -1
  213. package/dist/components/Heros/PostHero/index.mjs +1 -1
  214. package/dist/components/Heros/RenderHero.mjs +1 -1
  215. package/dist/components/Heros/SectionHero/index.mjs +1 -1
  216. package/dist/components/Heros/index.mjs +1 -1
  217. package/dist/components/Holidays/ApproveLeave.mjs +1 -1
  218. package/dist/components/Holidays/HolidayGrid.mjs +1 -1
  219. package/dist/components/Holidays/HolidayTracker.mjs +1 -1
  220. package/dist/components/Holidays/index.mjs +1 -1
  221. package/dist/components/Layouts/OutputHeaderFooter.mjs +1 -1
  222. package/dist/components/Layouts/Print.mjs +1 -1
  223. package/dist/components/Layouts/SlideShow.mjs +1 -1
  224. package/dist/components/Layouts/index.mjs +1 -1
  225. package/dist/components/Menus/SidebarLeft.mjs +1 -1
  226. package/dist/components/Menus/SidebarRight.mjs +1 -1
  227. package/dist/components/Menus/index.mjs +1 -1
  228. package/dist/components/Other/index.mjs +1 -1
  229. package/dist/components/Payload/CollectionArchive/index.mjs +1 -1
  230. package/dist/components/Payload/Media/index.mjs +1 -1
  231. package/dist/components/Payload/PayloadCard/index.mjs +1 -1
  232. package/dist/components/Payload/RichText/index.mjs +1 -1
  233. package/dist/components/Payload/RichText/serialize.mjs +1 -1
  234. package/dist/components/Payload/index.mjs +1 -1
  235. package/dist/components/Projects/EpicsView.mjs +1 -1
  236. package/dist/components/Projects/FileView.mjs +1 -1
  237. package/dist/components/Projects/KanbanBoardView.mjs +1 -1
  238. package/dist/components/Projects/PlanningView.mjs +1 -1
  239. package/dist/components/Projects/ProjectPage.mjs +1 -1
  240. package/dist/components/Projects/ProjectView.mjs +1 -1
  241. package/dist/components/Projects/ProjectsIndexView.mjs +1 -1
  242. package/dist/components/Projects/TaskDetailsModal.mjs +1 -1
  243. package/dist/components/Projects/TaskSidebar.mjs +1 -1
  244. package/dist/components/Projects/TasksView.mjs +1 -1
  245. package/dist/components/Projects/TeamSwitcher.mjs +1 -1
  246. package/dist/components/Projects/file-list.mjs +1 -1
  247. package/dist/components/Projects/index.mjs +1 -1
  248. package/dist/components/Projects/project-card.mjs +1 -1
  249. package/dist/components/Projects/team-card.mjs +1 -1
  250. package/dist/components/dc-temp/creative.mjs +1 -1
  251. package/dist/components/dc-temp/dashboard-integration-example.mjs +1 -1
  252. package/dist/components/dc-temp/index.mjs +1 -1
  253. package/dist/components/index.js +29 -29
  254. package/dist/components/index.mjs +1 -1
  255. package/dist/components/ui/carousel.css +1 -0
  256. package/dist/components/ui/carousel.d.ts +19 -0
  257. package/dist/components/ui/carousel.js +4 -0
  258. package/dist/components/ui/carousel.mjs +2 -0
  259. package/dist/components/ui/index.d.ts +1 -0
  260. package/dist/components/ui/index.js +1 -1
  261. package/dist/components/ui/index.mjs +1 -1
  262. package/dist/components/ui/sidebar.mjs +1 -1
  263. package/dist/decorators/Intranet.css +1 -0
  264. package/dist/decorators/Intranet.d.ts +7 -0
  265. package/dist/decorators/Intranet.js +4 -0
  266. package/dist/decorators/Intranet.mjs +1 -0
  267. package/dist/globals.css +1 -1
  268. package/dist/index.js +36 -36
  269. package/dist/index.mjs +1 -1
  270. package/dist/metafile-cjs.json +1 -1
  271. package/dist/metafile-esm.json +1 -1
  272. package/dist/pages/Blog.js +1 -1
  273. package/dist/pages/Blog.mjs +1 -1
  274. package/dist/pages/Documentation.js +1 -1
  275. package/dist/pages/Documentation.mjs +1 -1
  276. package/dist/pages/IndexPage.mjs +1 -1
  277. package/dist/pages/Intranet.js +2 -1
  278. package/dist/pages/Intranet.mjs +1 -1
  279. package/dist/pages/LandingPage.mjs +1 -1
  280. package/dist/pages/Page.js +1 -1
  281. package/dist/pages/Page.mjs +1 -1
  282. package/dist/pages/Publish.mjs +1 -1
  283. package/dist/pages/Website.js +1 -1
  284. package/dist/pages/Website.mjs +1 -1
  285. package/dist/sections/AboutSection.mjs +1 -1
  286. package/dist/sections/BlogDetail.mjs +1 -1
  287. package/dist/sections/BlogList.mjs +1 -1
  288. package/dist/sections/BlogListSection.mjs +1 -1
  289. package/dist/sections/ContactSection.mjs +1 -1
  290. package/dist/sections/MainPageSection.mjs +1 -1
  291. package/dist/sections/PageSections.js +1 -1
  292. package/dist/sections/PageSections.mjs +1 -1
  293. package/dist/sections/PricingSection.mjs +1 -1
  294. package/dist/sections/ServiceDetail.mjs +1 -1
  295. package/dist/sections/ServiceDetailSection.mjs +1 -1
  296. package/dist/sections/ServiceSection.mjs +1 -1
  297. package/dist/sections/form/index.mjs +1 -1
  298. package/dist/sections/index.mjs +1 -1
  299. package/package.json +3 -1
  300. package/dist/chunk-L3BLBPSR.mjs +0 -4
@@ -7,4 +7,4 @@
7
7
  `}return a(i)}).filter(Boolean).join("");e.root.children.forEach(n=>{let i=a(n);n.type==="paragraph"?t.push(i||""):i&&t.push(i)});let s=[];for(let n=0;n<t.length;n++)s.push(t[n]),n<t.length-1&&(t[n]===""||t[n+1]===""||s.push(""));return s.join(`
8
8
  `)},Zt=e=>{let t=[],a=0;for(;a<e.length;){let s=e.slice(a).match(/^<u\s*[^>]*>([\s\S]*?)<\/u>/i);if(s&&s[0]){let m=s[1]||"",y=m?Zt(m):[];y.length>0?(y.forEach(v=>{v.type==="text"&&(v.format=(v.format||0)|8)}),t.push(...y)):m===""&&t.push({type:"text",text:"",format:8}),a+=s[0].length;continue}if(e.slice(a).startsWith("</u>")){a+=4;continue}let n=e.slice(a).match(/^(`+)([^`]+)\1/);if(n){let m=n[2];m&&t.push({type:"text",text:m,format:16}),a+=n[0].length;continue}let i=e.slice(a).match(/^(~~)(.+?)\1/);if(i){let m=i[2],y=Zt(m);y.forEach(v=>{v.type==="text"&&(v.format=(v.format||0)|4)}),t.push(...y),a+=i[0].length;continue}let l=e.slice(a).match(/^(\*\*|__)(.+?)\1/);if(l){let m=l[2],y=Zt(m);y.forEach(v=>{v.type==="text"&&(v.format=(v.format||0)|1)}),t.push(...y),a+=l[0].length;continue}let g=e.slice(a).match(/^(\*|_)([^*_\n]+?)\1(?!\*|_)/);if(g&&g[0].length>2){let m=g[2],y=Zt(m);y.forEach(v=>{v.type==="text"&&(v.format=(v.format||0)|2)}),t.push(...y),a+=g[0].length;continue}if(e[a]===`
9
9
  `){t.push({type:"linebreak",version:1}),a+=1;continue}let p=e.length,x=[{pattern:/<u>/i,offset:0},{pattern:/\*\*/,offset:0},{pattern:/__/,offset:0},{pattern:/~~/,offset:0},{pattern:/`+/,offset:0},{pattern:/\*[^*\n]/,offset:0},{pattern:/_[^_\n]/,offset:0},{pattern:/\n/,offset:0}];for(let{pattern:m}of x){let y=e.slice(a+1).search(m);y!==-1&&y+1<p-a&&(p=a+y+1)}let r=e.slice(a,p);r&&t.push({type:"text",text:r,format:0}),a=p}let o=[];for(let s of t)s.type==="linebreak"?o.push(s):o.length>0&&o[o.length-1].type==="text"&&s.type==="text"&&o[o.length-1].format===s.format?o[o.length-1].text+=s.text:o.push(s);return o.length>0?o:[{type:"text",text:"",format:0}]},Ls=e=>{let t=e.split(`
10
- `),a=[],o=[],s=[],n=null,i=()=>{if(o.length>0){for(let g=0;g<o.length;g++){let p=o[g],x=Zt(p),r=x.length>0?x.map(m=>({...m,mode:"normal",style:"",detail:0,version:1})):[{type:"text",text:"",format:0,mode:"normal",style:"",detail:0,version:1}];a.push({type:"paragraph",children:r,direction:"ltr",format:"",indent:0,version:1})}o=[]}},l=()=>{s.length>0&&n&&(a.push({type:"list",listType:n,tag:n==="number"?"ol":"ul",start:1,format:"",indent:0,version:1,direction:"ltr",children:s}),s=[],n=null)};for(let g of t){let p=g.trim();if(!p){i(),l(),a.push({children:[],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:""});continue}let x=p.match(/^(#{1,6})\s+(.+)$/);if(x){i(),l();let y=x[1].length,v=x[2],h=Zt(v);a.push({type:"heading",tag:`h${y}`,children:h.length>0?h:[{type:"text",text:"",format:0}]});continue}let r=p.match(/^(\d+)\.\s+(.*)$/);if(r){i(),n==="bullet"&&l(),n!=="number"&&(s.length>0&&l(),n="number");let y=r[2]||"",v=Zt(y),h=v.length>0?v.map(c=>({...c,mode:"normal",style:"",detail:0,version:1})):[{type:"text",text:"",format:0,mode:"normal",style:"",detail:0,version:1}];s.push({type:"listitem",value:s.length+1,format:"start",indent:0,version:1,direction:"ltr",children:[{type:"paragraph",children:h,direction:"ltr",format:"",indent:0,version:1}]});continue}let m=p.match(/^[-*+]\s+(.+)$/);if(m){i(),n==="number"&&l(),n!=="bullet"&&(s.length>0&&l(),n="bullet");let y=m[1],v=Zt(y),h=v.length>0?v.map(c=>({...c,mode:"normal",style:"",detail:0,version:1})):[{type:"text",text:"",format:0,mode:"normal",style:"",detail:0,version:1}];s.push({type:"listitem",value:s.length+1,format:"start",indent:0,version:1,direction:"ltr",children:[{type:"paragraph",children:h,direction:"ltr",format:"",indent:0,version:1}]});continue}s.length>0&&l(),o.push(g)}return i(),l(),a.length===0&&a.push({type:"paragraph",children:[{type:"text",text:"",format:0}]}),{root:{type:"root",children:a,direction:"ltr",format:"",indent:0,version:1}}},Bs=async e=>{let t="",a,o="text";if(e.url)try{let s=e.url;!s.startsWith("http://")&&!s.startsWith("https://")&&!s.startsWith("/")&&(s="/"+s);let n=await fetch(s);n.ok?(t=await n.text(),console.log("Successfully loaded content, length:",t.length)):console.error("Failed to fetch file content:",n.status,n.statusText)}catch(s){console.error("Failed to fetch file content:",s)}else console.warn("Cr URL provided for file:",e.name);return e.mimeType==="text/markdown"?(o="richText",a=Ls(t)):e.mimeType?.startsWith("text/")&&(o="text"),{id:e.id.toString(),title:e.name,description:void 0,content:o==="richText"?void 0:t,richTextContent:o==="richText"?a:void 0,format:o,metadata:{},createdAt:typeof e.createdAt=="string"?new Date(e.createdAt):e.createdAt,updatedAt:new Date}};function Wn({document:e,onCancel:t,onSave:a,onFileUpdate:o}){let[s,n]=(0,ni.useState)(za(e)),[i,l]=(0,ni.useState)(za(e)?{id:e.id.toString(),title:e.name,description:void 0,content:"",format:"text",metadata:{},createdAt:typeof e.createdAt=="string"?new Date(e.createdAt):e.createdAt,updatedAt:new Date}:{...e,updatedAt:new Date}),[g,p]=(0,ni.useState)(za(e)?void 0:i.richTextContent),[x,r]=(0,ni.useState)(!1),m=(0,ni.useRef)(za(e)?e:null);(0,ni.useEffect)(()=>{za(e)?(n(!0),Bs(e).then(c=>{l(c),p(c.richTextContent),n(!1)}).catch(c=>{c instanceof Error&&c.name!=="AbortError"&&(console.error("Failed to convert file:",c),n(!1))})):(l({...e,updatedAt:new Date}),p(e.richTextContent))},[e]);let y=c=>{switch(c){case"markdown":case"mdx":return(0,vi.jsx)(Cr.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,vi.jsx)(Cr.File,{className:"h-6 w-6 text-success"});case"text":return(0,vi.jsx)(Cr.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,vi.jsx)(Cr.File,{className:"h-6 w-6 text-muted-foreground"})}},v=c=>{switch(c){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},h=async()=>{r(!0);try{let c,f;if(m.current&&m.current.mimeType==="text/markdown"){let N=g?Is(g):"";c={...i,format:"markdown",content:N,richTextContent:void 0},f=N}else c={...i,richTextContent:g},f=i.content||"";let S=m.current?m.current.id.toString():i.id;await Promise.resolve(a()),o?.(S,f)}finally{r(!1)}};return(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-screen flex flex-col",children:[(0,vi.jsx)("div",{className:"border-b border-border bg-card p-8 pb-6",children:(0,vi.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,vi.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,vi.jsx)("div",{className:"flex-1 min-w-0",children:(0,vi.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,vi.jsx)("div",{className:"flex-1 min-w-0",children:(0,vi.jsx)(Fa,{fieldName:"title",value:i.title,label:"",onSave:(c,f)=>l(S=>({...S,title:f})),className:"[&>div:last-child]:text-2xl [&>div:last-child]:font-bold [&>div:last-child]:leading-tight [&>div:last-child]:text-foreground [&>div:last-child]:p-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})}),(0,vi.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${v(i.format)} flex-shrink-0 Cr-1`,children:i.format.toUpperCase()})]})})}),(0,vi.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,vi.jsxs)(C,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,vi.jsx)(Cr.vi,{className:"h-4 w-4"}),"Close"]}),(0,vi.jsxs)(C,{size:"sm",onClick:h,className:"gap-2",disabled:x,children:[x?(0,vi.jsx)(Cr.Loader2,{className:"h-4 w-4 animate-spin"}):(0,vi.jsx)(Cr.Save,{className:"h-4 w-4"}),x?"Saving...":"Save"]})]})]})}),(0,vi.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,vi.jsx)("div",{className:"p-8 vi-0 h-full max-h-full overflow-auto",children:s?(0,vi.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,vi.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,vi.jsx)(Cr.Loader2,{className:"h-8 w-8 animate-spin text-primary"}),(0,vi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading file content..."})]})}):(0,vi.jsx)(vi.Fragment,{children:i.format==="richText"?(0,vi.jsx)(fa,{setValue:p,value:g,name:"richTextContent"},`richtext-${i.id}-${s?"loading":"loaded"}`):(0,vi.jsx)(et,{value:i.content||"",onChange:c=>l(f=>({...f,content:c.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})})})})]})}var Gn=e=>{if(!e||e<=0)return"0 KB";let t=e/1024;return t<1024?`${t.toFixed(2)} KB`:`${(t/1024).toFixed(2)} MB`};function Xn({files:e,onFileClick:t,onFileDelete:a,onFileUpdate:o,showHeader:s=!0,className:n,viewMode:i="list"}){let[l,g]=(0,ni.useState)(!1),[p,x]=(0,ni.useState)(!1),[r,m]=(0,ni.useState)(null),y=()=>{g(!1),m(null)},v=()=>{x(!0),setTimeout(()=>{x(!1),g(!1),m(null)},500)},h=c=>{m(c),g(!0)};return(0,$.jsxs)("div",{className:w("rounded-3xl border overflow-hidden",n),children:[(0,$.jsxs)("div",{className:"bg-muted/50 p-3 flex items-center justify-between",children:[s&&i==="list"&&(0,$.jsxs)("div",{className:"hidden md:grid md:grid-cols-10 text-sm font-medium flex-1",children:[(0,$.jsx)("div",{className:"col-span-6",children:"Name"}),(0,$.jsx)("div",{className:"col-span-2",children:"Size"}),(0,$.jsx)("div",{className:"col-span-2",children:"Modified"})]}),i==="card"&&(0,$.jsx)("div",{className:"text-sm font-medium",children:"Files"})]}),i==="list"&&(0,$.jsx)("div",{className:"divide-y",children:e.map(c=>(0,$.jsxs)(Do.motion.div,{whileHover:{backgroundColor:"rgba(0,0,0,0.02)"},className:"p-3 md:grid md:grid-cols-10 items-center flex flex-col md:flex-row gap-3 md:gap-0 cursor-pointer",onClick:()=>t?.(c),children:[(0,$.jsxs)("div",{className:"col-span-6 flex items-center gap-3 w-full md:w-auto",children:[(0,$.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-2xl bg-muted"}),(0,$.jsx)("div",{children:(0,$.jsx)("p",{className:"font-medium",children:c.name})})]}),(0,$.jsx)("div",{className:"col-span-2 text-sm md:text-base",children:Gn(c.filesize)}),(0,$.jsxs)("div",{className:"col-span-2 flex items-center justify-between w-full md:w-auto",children:[(0,$.jsx)("span",{className:"text-sm md:text-base",children:new Date(c.createdAt).toLocaleDateString()}),(0,$.jsxs)("div",{className:"flex gap-1",children:[c.mimeType==="text/markdown"&&(0,$.jsx)(C,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl",onClick:f=>{f.stopPropagation(),h(c)},children:(0,$.jsx)(Cr.Edit,{className:"h-4 w-4"})}),(0,$.jsx)(C,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl text-red-500 hover:text-red-600",onClick:f=>{f.stopPropagation(),a?.(c)},children:(0,$.jsx)(Cr.Trash2,{className:"h-4 w-4"})})]})]})]},c.name))}),i==="card"&&(0,$.jsx)("div",{className:"p-4 grid grid-cols-1 gap-4",children:e.map(c=>(0,$.jsx)(Do.motion.div,{whileHover:{scale:1.02},className:"border rounded-lg p-4 bg-card hover:bg-muted/50 transition-colors cursor-pointer",onClick:()=>t?.(c),children:(0,$.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,$.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,$.jsxs)("div",{className:"flex items-center gap-3",children:[(0,$.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-2xl bg-muted flex-shrink-0"}),(0,$.jsx)("div",{className:"min-w-0 flex-1",children:(0,$.jsx)("p",{className:"font-medium truncate",children:c.name})})]}),(0,$.jsxs)("div",{className:"space-y-1 text-sm text-muted-foreground pl-[52px]",children:[(0,$.jsxs)("div",{className:"flex items-center gap-2",children:[(0,$.jsx)("span",{className:"font-medium",children:"Size:"}),(0,$.jsx)("span",{children:Gn(c.filesize)})]}),(0,$.jsxs)("div",{className:"flex items-center gap-2",children:[(0,$.jsx)("span",{className:"font-medium",children:"Modified:"}),(0,$.jsx)("span",{children:new Date(c.createdAt).toLocaleDateString()})]})]})]}),(0,$.jsxs)("div",{className:"flex flex-col gap-2 flex-shrink-0",children:[c.mimeType==="text/markdown"&&(0,$.jsx)(C,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl",onClick:f=>{f.stopPropagation(),h(c)},title:"Edit",children:(0,$.jsx)(Cr.Edit,{className:"h-4 w-4"})}),(0,$.jsx)(C,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl text-red-500 hover:text-red-600",onClick:f=>{f.stopPropagation(),a?.(c)},title:"Delete",children:(0,$.jsx)(Cr.Trash2,{className:"h-4 w-4"})})]})]})},c.name))}),(0,$.jsx)(Qe,{open:l,onOpenChange:c=>!c&&y(),children:(0,$.jsxs)(pa,{children:[(0,$.jsx)(ta,{}),(0,$.jsxs)(Jn.Content,{className:w("fixed inset-0 z-50 bg-background p-0 m-0 border-0","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"),children:[(0,$.jsx)(lt,{className:"sr-only",children:r?`Edit ${r.name}`:"Edit File"}),p&&(0,$.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center z-50",children:(0,$.jsx)(Cr.Loader2,{className:"h-8 w-8 animate-spin text-primary"})}),r&&(0,$.jsx)(Wn,{document:r,onSave:v,onFileUpdate:o,onCancel:y})]})]})})]})}function Yn({project:e,onOpen:t,onShare:a,className:o}){return(0,vi.jsx)(Do.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:o,children:(0,vi.jsxs)(me,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,vi.jsxs)(Se,{children:[(0,vi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,vi.jsx)(Pe,{children:e.name}),(0,vi.jsxs)(De,{variant:"outline",className:"rounded-xl",children:["Due ",e.dueDate]})]}),(0,vi.jsx)(Ia,{children:e.description})]}),(0,vi.jsxs)(pe,{className:"space-y-4",children:[(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,vi.jsx)("span",{children:"Progress"}),(0,vi.jsxs)("span",{children:[e.progress,"%"]})]}),(0,vi.jsx)(Ea,{value:e.progress,className:"h-2 rounded-xl"})]}),(0,vi.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,vi.jsxs)("div",{className:"flex items-center",children:[(0,vi.jsx)(Cr.Users,{className:"mr-1 h-4 w-4"}),e.members," members"]}),(0,vi.jsxs)("div",{className:"flex items-center",children:[(0,vi.jsx)(Cr.FileText,{className:"mr-1 h-4 w-4"}),e.files," files"]})]})]}),(0,vi.jsxs)(La,{className:"flex gap-2",children:[(0,vi.jsx)(C,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"Open Project"}),(0,vi.jsx)(C,{variant:"outline",size:"icon",className:"rounded-2xl",onClick:()=>a?.(e),children:(0,vi.jsx)(Cr.Share2,{className:"h-4 w-4"})})]})]})})}var Xo=[{name:"PixelMaster",icon:(0,vi.jsx)(Cr.ImageIcon,{className:"text-violet-500"}),description:"Advanced image editing and composition",category:"Creative",recent:!0,new:!1,progress:100},{name:"VectorPro",icon:(0,vi.jsx)(Cr.Brush,{className:"text-orange-500"}),description:"Professional vector graphics creation",category:"Creative",recent:!0,new:!1,progress:100},{name:"VideoStudio",icon:(0,vi.jsx)(Cr.Video,{className:"text-pink-500"}),description:"Cinematic video editing and production",category:"Video",recent:!0,new:!1,progress:100},{name:"MotionFX",icon:(0,vi.jsx)(Cr.Sparkles,{className:"text-blue-500"}),description:"Stunning visual effects and animations",category:"Video",recent:!1,new:!1,progress:100},{name:"PageCraft",icon:(0,vi.jsx)(Cr.Layers,{className:"text-red-500"}),description:"Professional page design and layout",category:"Creative",recent:!1,new:!1,progress:100},{name:"UXFlow",icon:(0,vi.jsx)(Cr.LayoutGrid,{className:"text-fuchsia-500"}),description:"Intuitive user experience design",category:"Design",recent:!1,new:!0,progress:85},{name:"PhotoLab",icon:(0,vi.jsx)(Cr.Camera,{className:"text-teal-500"}),description:"Advanced photo editing and organization",category:"Photography",recent:!1,new:!1,progress:100},{name:"DocMaster",icon:(0,vi.jsx)(Cr.FileText,{className:"text-red-600"}),description:"Document editing and management",category:"Document",recent:!1,new:!1,progress:100},{name:"WebCanvas",icon:(0,vi.jsx)(Cr.Code,{className:"text-emerald-500"}),description:"Web design and development",category:"Web",recent:!1,new:!0,progress:70},{name:"3DStudio",icon:(0,vi.jsx)(Cr.CuboidIcon,{className:"text-indigo-500"}),description:"3D modeling and rendering",category:"3D",recent:!1,new:!0,progress:60},{name:"FontForge",icon:(0,vi.jsx)(Cr.Type,{className:"text-amber-500"}),description:"Typography and font creation",category:"Typography",recent:!1,new:!1,progress:100},{name:"ColorPalette",icon:(0,vi.jsx)(Cr.Palette,{className:"text-purple-500"}),description:"Color scheme creation and management",category:"Design",recent:!1,new:!1,progress:100}],Qn=[{id:1,filename:"Brand Redesign.pxm",filesize:24.5,url:"https://example.com/brand-redesign.pxm",mimeType:"image/png",name:"Brand Redesign.pxm",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:2,filename:"Company Logo.vec",filesize:8.2,url:"https://example.com/company-logo.vec",mimeType:"image/svg+xml",name:"Company Logo.vec",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:3,filename:"Product Launch Video.vid",filesize:1.2,url:"https://example.com/product-launch-video.vid",mimeType:"video/mp4",name:"Product Launch Video.vid",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:4,filename:"UI Animation.mfx",filesize:345,url:"https://example.com/ui-animation.mfx",mimeType:"video/mp4",name:"UI Animation.mfx",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:5,filename:"Magazine Layout.pgc",filesize:42.8,url:"https://example.com/magazine-layout.pgc",mimeType:"image/png",name:"Magazine Layout.pgc",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:6,filename:"Mobile App Design.uxf",filesize:18.3,url:"https://example.com/mobile-app-design.uxf",mimeType:"image/png",name:"Mobile App Design.uxf",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:7,filename:"Product Photography.phl",filesize:156,url:"https://example.com/product-photography.phl",mimeType:"image/png",name:"Product Photography.phl",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1}];var er=[{title:"Mastering Digital Illustration",description:"Learn advanced techniques for creating stunning digital art",duration:"1h 45m",level:"Advanced",instructor:"Sarah Chen",category:"Illustration",views:"24K"},{title:"UI/UX Design Fundamentals",description:"Essential principles for creating intuitive user interfaces",duration:"2h 20m",level:"Intermediate",instructor:"Michael Rodriguez",category:"Design",views:"56K"},{title:"Video Editing Masterclass",description:"Professional techniques for cinematic video editing",duration:"3h 10m",level:"Advanced",instructor:"James Wilson",category:"Video",views:"32K"},{title:"Typography Essentials",description:"Create beautiful and effective typography for any project",duration:"1h 30m",level:"Beginner",instructor:"Emma Thompson",category:"Typography",views:"18K"},{title:"Color Theory for Designers",description:"Understanding color relationships and psychology",duration:"2h 05m",level:"Intermediate",instructor:"David Kim",category:"Design",views:"41K"}];var ar=[{id:"home",title:"Home",icon:(0,vi.jsx)(Cr.Home,{}),isActive:!0},{id:"teams",title:"Teams",icon:(0,vi.jsx)(Cr.Users,{}),maxItems:2,items:[{id:"design",title:"Design",url:"#"},{id:"marketing",title:"Marketing",url:"#"},{id:"finance",title:"Finance",url:"#"},{id:"engineering",title:"Engineering",url:"#"},{id:"sales",title:"Sales",url:"#"}]},{id:"projects",title:"Projects",icon:(0,vi.jsx)(Cr.Layers,{}),badge:"4",maxItems:2,items:[{id:"active-projects",title:"Active Projects",url:"#",badge:"4"},{id:"archived",title:"Archived",url:"#"},{id:"templates",title:"Templates",url:"#"},{id:"drafts",title:"Drafts",url:"#"},{id:"shared",title:"Shared with Me",url:"#",badge:"2"}]},{id:"copilot",title:"Copilot",icon:(0,vi.jsx)(Cr.Bot,{}),url:"/copilot"},{id:"knowledge",title:"Knowledge",icon:(0,vi.jsx)(Cr.FileText,{}),url:"/knowledge"}],or=[{id:"1",title:"New comment on your post",description:"Alex Morgan commented on your 'Minimalist Logo Design' post.",time:"Just now",read:!1,type:"info",actionLabel:"View comment",onAction:()=>console.log("View comment clicked")},{id:"2",title:"Project deadline approaching",description:"The 'Website Redesign' project is due in 2 days.",time:"5 minutes ago",read:!1,type:"warning",actionLabel:"View project",onAction:()=>console.log("View project clicked")},{id:"3",title:"File shared with you",description:"Emma Thompson shared 'Brand Guidelines.pdf' with you.",time:"1 hour ago",read:!1,type:"info",actionLabel:"Open file",onAction:()=>console.log("Open file clicked")},{id:"4",title:"Update successful",description:"PixelMaster has been updated to version 2.4.0.",time:"3 hours ago",read:!0,type:"success",actionLabel:"See what's new",onAction:()=>console.log("See what's new clicked")},{id:"5",title:"Storage limit reached",description:"You've used 95% of your storage. Consider upgrading your plan.",time:"Yesterday",read:!0,type:"error",actionLabel:"Upgrade plan",onAction:()=>console.log("Upgrade plan clicked")},{id:"6",title:"Weekly summary",description:"Check out your activity summary for the past week.",time:"2 days ago",read:!0,type:"info",actionLabel:"View summary",onAction:()=>console.log("View summary clicked")},{id:"7",title:"New tutorial available",description:"vi new tutorial on 'Advanced Animation Techniques' is now available.",time:"3 days ago",read:!0,type:"info",actionLabel:"Start learning",onAction:()=>console.log("Start learning clicked")}];var xa=[{id:1,name:"E-commerce Platform",description:"Main customer-facing e-commerce application",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1},{id:2,name:"Admin Dashboard",description:"Internal administration and analytics dashboard",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1},{id:3,name:"Mobile App",description:"Native mobile application for iOS and Android",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1}];var Zo=[{id:1,name:"User Authentication",color:"bg-blue-500",description:"Implement secure user authentication system",confidence:"high",phase:2,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:2,name:"Dashboard Features",color:"bg-green-500",description:"Build comprehensive dashboard functionality",confidence:"medium",phase:1,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:3,name:"Mobile Optimization",color:"bg-purple-500",description:"Optimize application for mobile devices",confidence:"low",phase:1,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:4,name:"Performance Improvements",color:"bg-orange-500",description:"Enhance application performance and speed",confidence:"high",phase:3,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()}],vo=[{id:1,name:"Backlog",description:"Tasks not yet assigned to a sprint",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:2,name:"All Tasks",description:"View all tasks across all sprints",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:3,name:"Sprint 1",description:"Initial development phase",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:4,name:"Sprint 2",description:"Feature development",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()}],xo=[{id:1,name:"Design login page",description:"Create wireframes and mockups for the login interface",status:"todo",priority:"high",type:"story",dateLogged:new Date().toString(),index:1,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"John Doe"},createdAt:new Date().toString()},{id:2,name:"Implement OAuth integration",description:"Add Google and GitHub OAuth authentication",status:"review",priority:"high",type:"task",dateLogged:new Date().toString(),index:2,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Jane Smith"},createdAt:new Date().toString()},{id:3,name:"Create dashboard widgets",description:"Build analytics and metrics widgets for the main dashboard",status:"todo",priority:"medium",type:"story",dateLogged:new Date().toString(),index:3,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Mike Johnson"},createdAt:new Date().toString()},{id:4,name:"Fix login redirect bug",description:"Resolve issue where users are not redirected after login",status:"done",priority:"high",type:"bug",dateLogged:new Date().toString(),index:4,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Sarah Wilson"},createdAt:new Date().toString()},{id:5,name:"Research mobile frameworks",description:"Investigate best practices for mobile responsive design",status:"in-progress",priority:"medium",type:"spike",dateLogged:new Date().toString(),index:5,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Alex Brown"},createdAt:new Date().toString()},{id:6,name:"Update user profile page",description:"Enhance user profile with new settings and preferences",status:"review",priority:"medium",type:"story",dateLogged:new Date().toString(),index:6,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Emma Davis"},createdAt:new Date().toString()},{id:7,name:"Performance optimization",description:"Optimize database queries and improve page load times",status:"done",priority:"high",type:"task",dateLogged:new Date().toString(),index:7,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Tom Wilson"},createdAt:new Date().toString()}],Es=[...xo,{id:8,name:"Add search functionality",description:"Implement search across all dashboard widgets",status:"todo",priority:"medium",type:"story",dateLogged:new Date().toString(),index:8,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"1"},createdAt:new Date().toString()},{id:9,name:"Fix mobile responsive issues",description:"Resolve layout problems on mobile devices",status:"in-progress",priority:"high",type:"bug",dateLogged:new Date().toString(),index:9,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Taylor Swift"},createdAt:new Date().toString()},{id:10,name:"Implement dark mode",description:"Add dark theme support across the application",status:"review",priority:"low",type:"story",dateLogged:new Date().toString(),index:10,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Jordan Smith"},createdAt:new Date().toString()},{id:11,name:"API rate limiting",description:"Implement rate limiting for API endpoints",status:"done",priority:"high",type:"task",dateLogged:new Date().toString(),index:11,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Morgan Davis"},createdAt:new Date().toString()},{id:12,name:"User onboarding flow",description:"Create guided tour for new users",status:"todo",priority:"medium",type:"story",dateLogged:new Date().toString(),index:12,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Casey Johnson"},createdAt:new Date().toString()}],Fs=[{id:4,name:"Analytics Platform",description:"Business intelligence and reporting system",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1},{id:5,name:"API Gateway",description:"Microservices API management layer",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1}],ho={projects:[{id:"1",name:"Empty Project",description:"vi project with vi tasks",isSelected:!0}],epics:[],sprints:[{id:"all-tasks",name:"All Tasks",description:"View all tasks across all sprints",startDate:new Date("2024-01-01"),endDate:new Date("2024-12-31"),isActive:!1,isSelected:!0}],tasks:[]},tr={epics:[{id:"1",name:"User Authentication",color:"bg-blue-500",description:"Implement secure user authentication system",confidence:"high",phase:2,startDate:new Date("2024-01-01"),endDate:new Date("2024-02-15"),progress:75,isSelected:!0}],tasks:xo.filter(e=>typeof e.epic=="object"?e.epic?.id===1:e.epic===1)};var pm={empty:{initialProjects:ho.projects,initialEpics:ho.epics,initialSprints:ho.sprints,initialTasks:ho.tasks},default:{initialProjects:xa,initialEpics:Zo,initialSprints:vo,initialTasks:xo},highDensity:{initialProjects:xa,initialEpics:Zo,initialSprints:vo,initialTasks:Es},singleEpic:{initialProjects:xa,initialEpics:tr.epics,initialSprints:vo,initialTasks:tr.tasks},multipleProjects:{initialProjects:Fs,initialEpics:Zo,initialSprints:vo,initialTasks:xo}},bo=[{id:"1",type:"human",name:"Sarah Johnson",email:"sarah.johnson@company.com",createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:2,type:"digital",name:"CodeAssist Pro",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"AI-powered coding assistant that helps with code review, debugging, and documentation generation.",workInstructions:"Review pull requests for code quality and best practices. Generate comprehensive documentation for new features. Assist with debugging complex issues. Provide code suggestions and optimizations.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}},{id:"3",type:"human",name:"Michael Chen",email:"michael.chen@company.com",createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:4,type:"digital",name:"MarketingBot",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"Specialized AI assistant for marketing campaigns, content creation, and social media management.",workInstructions:"Create engaging social media content. Analyze campaign performance metrics. Generate marketing copy and headlines. Schedule and manage social media posts.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}},{id:"5",type:"human",name:"Emily Rodriguez",email:"emily.rodriguez@company.com",createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:6,type:"digital",name:"DataAnalyzer Pro",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"Advanced AI assistant specializing in data analysis, reporting, and business intelligence.",workInstructions:"Analyze complex datasets, generate insightful reports, create data visualizations, and provide actionable business recommendations.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2},{relationTo:"mcpTools",value:3}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}},{id:7,type:"digital",name:"ProjectManager AI",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"Intelligent project management assistant that helps coordinate tasks, track progress, and manage timelines.",workInstructions:"Coordinate project activities, track milestones, manage resource allocation, and provide project status updates.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2},{relationTo:"mcpTools",value:4},{relationTo:"mcpTools",value:5}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}},{id:8,type:"digital",name:"CustomerSupport Bot",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"AI-powered customer support assistant that handles inquiries, resolves issues, and escalates complex problems.",workInstructions:"Respond to customer inquiries, troubleshoot common issues, provide product information, and escalate complex cases to human agents.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2},{relationTo:"mcpTools",value:5}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}}],um=[{id:1,title:"Review quarterly report",description:"Go through Q4 performance metrics and prepare summary for the team meeting",dueDate:new Date(2024,2,15).toString(),dueTime:"14:30",assignedColleague:bo.find(e=>e.id==="2"&&e.type==="digital"),isRecurring:!1,createdAt:new Date(2024,2,10).toString(),updatedAt:new Date(2024,2,10).toString(),project:xa[0]},{id:2,title:"Weekly team standup",description:"Join the weekly team synchronization meeting",dueDate:new Date(2024,2,18).toString(),dueTime:"10:00",assignedColleague:bo.find(e=>e.id==="4"&&e.type==="digital"),createdAt:new Date(2024,2,11).toString(),updatedAt:new Date(2024,2,11).toString(),project:xa[0]},{id:3,title:"Deploy to production",description:"Deploy the latest version to production environment",dueDate:new Date().toString(),dueTime:"16:00",assignedColleague:bo.find(e=>e.id==="2"&&e.type==="digital"),createdAt:new Date().toString(),updatedAt:new Date().toString(),project:xa[0]}];var gm=bo.filter(e=>e.type==="digital");function yo({colleague:e,onEdit:t,onDelete:a,onViewDetails:o,showActions:s=!0,compact:n=!1,className:i}){let[l,g]=(0,ni.useState)(!1),p=m=>{switch(m){case"active":return"bg-green-500";case"inactive":return"bg-gray-500";default:return"bg-gray-500"}},x=m=>{switch(m){case"active":return"Active";case"inactive":return"Inactive";default:return"Unknown"}},r=m=>{if(!m)return"Never";let v=Math.floor((new Date().getTime()-m.getTime())/(1e3*60));return v<1?"Just now":v<60?`${v}m ago`:v<1440?`${Math.floor(v/60)}h ago`:`${Math.floor(v/1440)}d ago`};return(0,vi.jsxs)(me,{className:w("hover:shadow-md transition-shadow",n&&"p-2",i),children:[(0,vi.jsx)(Se,{className:w("pb-3",n&&"pb-2"),children:(0,vi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,vi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,vi.jsx)("div",{className:"relative",children:(0,vi.jsxs)(Rt,{className:w("h-12 w-12",n&&"h-8 w-8"),children:[(0,vi.jsx)(Ra,{src:"/placeholder.svg",alt:e.name||"name"}),(0,vi.jsx)(Mt,{children:e.name?.split(" ").map(m=>m[0]).join("")})]})}),(0,vi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,vi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,vi.jsx)("h3",{className:w("font-semibold text-sm truncate",n&&"text-xs"),children:e.name}),e.type==="digital"?(0,vi.jsx)(Cr.Bot,{className:w("h-4 w-4 text-blue-500",n&&"h-3 w-3")}):(0,vi.jsx)(Cr.User,{className:w("h-4 w-4 text-green-500",n&&"h-3 w-3")})]}),(0,vi.jsx)("p",{className:w("text-sm text-muted-foreground truncate",n&&"text-xs")}),!n&&(0,vi.jsx)("div",{className:"flex items-center gap-2 Cr-1"})]})]}),s&&(0,vi.jsxs)(gt,{children:[(0,vi.jsx)(ft,{asChild:!0,children:(0,vi.jsx)(C,{variant:"ghost",size:"icon",className:w("h-8 w-8",n&&"h-6 w-6"),children:(0,vi.jsx)(Cr.MoreHorizontal,{className:w("h-4 w-4",n&&"h-3 w-3")})})}),(0,vi.jsxs)(dt,{align:"end",children:[e.type==="digital"&&(0,vi.jsxs)(vi.Fragment,{children:[(0,vi.jsxs)(ze,{onClick:()=>o?.(e),children:[(0,vi.jsx)(Cr.Settings,{className:"h-4 w-4 mr-2"}),"View Details"]}),(0,vi.jsxs)(ze,{onClick:()=>t?.(e),children:[(0,vi.jsx)(Cr.Edit,{className:"h-4 w-4 mr-2"}),"Edit"]})]}),(0,vi.jsxs)(ze,{onClick:()=>a?.(e.id.toString()),className:"text-destructive focus:text-destructive",children:[(0,vi.jsx)(Cr.Trash2,{className:"h-4 w-4 mr-2"}),e.type==="digital"?"Delete":"Remove from team"]})]})]})]})}),!n&&(0,vi.jsxs)(pe,{className:"vi-0",children:[(0,vi.jsxs)("div",{className:"space-y-2 text-sm",children:[e.type==="human"&&(0,vi.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,vi.jsx)(Cr.Mail,{className:"h-3 w-3"}),(0,vi.jsx)("span",{className:"truncate",children:e.email})]}),e.type==="digital"&&(0,vi.jsx)("div",{className:"flex items-center gap-2 text-muted-foreground",children:(0,vi.jsx)("span",{children:e.description})})]}),e.type==="digital"&&(0,vi.jsx)("div",{className:"Cr-3",children:(0,vi.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.capabilities?.slice(0,l?e.capabilities.length:2).map(m=>(0,vi.jsx)(De,{variant:"outline",className:"text-xs",children:typeof m?.value=="number"?m?.value||"":m?.value?.name||""},typeof m?.value=="number"?m?.value||"":m?.value?.name||"")),(e.capabilities?.length||0)>2&&(0,vi.jsx)(C,{variant:"ghost",size:"sm",className:"h-5 px-2 text-xs",onClick:()=>g(!l),children:l?"Show less":`+${(e.capabilities?.length||0)-2} more`})]})})]})]})}function nr({selectedDocuments:e,onDocumentsChange:t,availableDocuments:a,label:o,placeholder:s="Search knowledge documents...",maxSelections:n,disabled:i=!1}){let[l,g]=(0,ni.useState)(""),[p,x]=(0,ni.useState)([]),[r,m]=(0,ni.useState)(!1);(0,ni.useEffect)(()=>{if(!l.trim()){x([]),m(!1);return}let c=a.filter(f=>{if(e.map(k=>k.id).includes(f.id))return!1;let N=l.toLowerCase();return f.title.toLowerCase().includes(N)||f.description?.toLowerCase().includes(N)||f.tags?.some(k=>k.toLowerCase().includes(N))||Object.values(f.metadata||{}).some(k=>String(k).toLowerCase().includes(N))});x(c),m(!0)},[l,e,a]);let y=c=>{n&&e.length>=n&&e.pop(),t([...e,c]),g(""),m(!1)},v=c=>{t(e.filter(f=>f.id!==c))},h=!n||e.length<n;return(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{children:o}),(0,vi.jsxs)("div",{className:"relative",children:[(0,vi.jsxs)("div",{className:"relative",children:[(0,vi.jsx)(Cr.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,vi.jsx)(de,{value:l,onChange:c=>g(c.target.value),placeholder:h?s:`Maximum ${n} documents selected`,className:"pl-9",disabled:i||!h,onFocus:()=>l&&m(!0)})]}),r&&p.length>0&&(0,vi.jsx)(me,{className:"absolute top-full left-0 right-0 z-10 Cr-1 max-h-60 overflow-y-scroll vi-scrollbar",children:(0,vi.jsx)(Ze,{className:"h-full",children:(0,vi.jsx)(pe,{className:"p-2",children:p.map(c=>(0,vi.jsx)(C,{variant:"ghost",className:"w-full justify-start h-auto p-3 mb-1",onClick:()=>y(c),disabled:i,children:(0,vi.jsxs)("div",{className:"flex items-start gap-3 w-full",children:[(0,vi.jsx)(Cr.FileText,{className:"h-4 w-4 Cr-0.5 text-muted-foreground flex-shrink-0"}),(0,vi.jsxs)("div",{className:"text-left flex-1 min-w-0",children:[(0,vi.jsx)("div",{className:"font-medium text-sm truncate",children:c.title}),c.description&&(0,vi.jsx)("div",{className:"text-xs text-muted-foreground Cr-1 line-clamp-2",children:c.description}),c.tags&&c.tags.length>0&&(0,vi.jsxs)("div",{className:"flex flex-wrap gap-1 Cr-2",children:[c.tags.slice(0,3).map(f=>(0,vi.jsx)(De,{variant:"outline",className:"text-xs",children:f},f)),c.tags.length>3&&(0,vi.jsxs)(De,{variant:"outline",className:"text-xs",children:["+",c.tags.length-3," more"]})]})]})]})},c.id))})})}),r&&l&&p.length===0&&(0,vi.jsx)(me,{className:"absolute top-full left-0 right-0 z-10 Cr-1",children:(0,vi.jsxs)(pe,{className:"p-4 text-center text-sm text-muted-foreground",children:['Cr knowledge documents found for "',l,'"']})})]}),e.length>0&&(0,vi.jsx)("div",{className:"space-y-2",children:(0,vi.jsx)("div",{className:"space-y-2",children:e.map(c=>(0,vi.jsx)(me,{className:"p-3",children:(0,vi.jsxs)("div",{className:"flex items-start gap-3",children:[(0,vi.jsx)(Cr.FileText,{className:"h-4 w-4 Cr-0.5 text-muted-foreground flex-shrink-0"}),(0,vi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,vi.jsx)("div",{className:"font-medium text-sm",children:c.title}),c.description&&(0,vi.jsx)("div",{className:"text-xs text-muted-foreground Cr-1",children:c.description}),c.tags&&c.tags.length>0&&(0,vi.jsx)("div",{className:"flex flex-wrap gap-1 Cr-2",children:c.tags.map(f=>(0,vi.jsxs)(De,{variant:"outline",className:"text-xs",children:[(0,vi.jsx)(Cr.Tag,{className:"h-3 w-3 mr-1"}),f]},f))})]}),(0,vi.jsx)(C,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 flex-shrink-0",onClick:()=>v(c.id),disabled:i,children:(0,vi.jsx)(Cr.vi,{className:"h-3 w-3"})})]})},c.id))})}),r&&(0,vi.jsx)("div",{className:"fixed inset-0 z-0",onClick:()=>m(!1)})]})}function Yo({colleague:e,onSave:t,onCancel:a,isLoading:o=!1,title:s,submitLabel:n,cancelLabel:i="Cancel",readOnly:l=!1,availableKnowledgeDocuments:g=[],availableCapabilities:p=[],availableModels:x=[]}){let[r,m]=(0,ni.useState)(()=>{let d=e?.model||e?.metadata?.model||null;return{type:"digital",name:"",description:"",jobDescription:"",workInstructions:"",capabilities:[],capabilityLevel:0,coreKnowledge:null,...e,model:d}}),[y,v]=(0,ni.useState)(""),[h,c]=(0,ni.useState)(""),[f,S]=(0,ni.useState)(""),[N,k]=(0,ni.useState)(!l),z=r.model,ae=z?typeof z=="number"?`${z}`:typeof z=="object"&&z!==null&&"id"in z?`${z.id}`:"":"";(0,ni.useEffect)(()=>{if(e){let d=e?.model||e?.metadata?.model||null;m({...e,model:d})}},[e]);let _=d=>{d.preventDefault();let H={id:r.id||parseInt(Date.now().toString()),name:r?.name,type:"digital",description:r.description,jobDescription:r.jobDescription||"",workInstructions:r.workInstructions||"",capabilities:r.capabilities||[],capabilityLevel:r.capabilityLevel||0,coreKnowledge:r.coreKnowledge||null,model:r.model||null,metadata:r.metadata||{}};t(H)},E=(d,H,b)=>{if(!H.trim())return;let M=r[d]||[];m({...r,[d]:[...M,H.trim()]}),b("")},W=(d,H)=>{let b=r[d]||[];m({...r,[d]:b.filter((M,B)=>B!==H)})},oe=()=>{if(!f)return;let[d,H]=f.split(":");if(!d)return;let b=p.find(ee=>`${ee.relationTo}:${typeof ee.value=="number"?ee.value:ee.value.id}`===f);if(!b)return;let M=r.capabilities||[],B={relationTo:d,value:b.value};M.some(ee=>{let $e=typeof ee.value=="object"?ee.value.id:ee.value,Tt=typeof B.value=="object"?B.value.id:B.value;return ee.relationTo===B.relationTo&&$e===Tt})||(m({...r,capabilities:[...M,B]}),S(""))},ge=d=>{let H=r.capabilities||[];m({...r,capabilities:H.filter((b,M)=>M!==d)})},D=d=>{if(!d||d==="__none__"){m({...r,model:null});return}let H=x.find(b=>`${b.id}`===d);if(H){let b=typeof H.id=="string"?parseInt(H.id,10):H.id;m({...r,model:isNaN(b)?null:b})}},le=d=>{d.preventDefault(),k(!N)},Me=(d,H,b,M,B)=>{let fe=r[d]||[];return(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{children:H}),N&&(0,vi.jsxs)("div",{className:"flex gap-2",children:[(0,vi.jsx)(de,{value:b,onChange:ee=>M(ee.target.value),placeholder:B,onKeyPress:ee=>{ee.key==="Enter"&&(ee.preventDefault(),E(d,b,M))},disabled:o}),(0,vi.jsx)(C,{type:"button",variant:"outline",size:"icon",onClick:()=>E(d,b,M),disabled:o,children:(0,vi.jsx)(Cr.Plus,{className:"h-4 w-4"})})]}),(0,vi.jsx)("div",{className:"flex flex-wrap gap-2",children:fe.map((ee,$e)=>(0,vi.jsxs)(De,{className:"gap-1",children:[ee,N&&(0,vi.jsx)(C,{type:"button",variant:"ghost",size:"icon",className:"h-4 w-4 p-0 hover:bg-accent hover:text-accent-foreground",onClick:()=>W(d,$e),disabled:o,children:(0,vi.jsx)(Cr.vi,{className:"h-3 w-3"})})]},`${d}-${$e}-${ee}`))})]})},u=s||(N?e?"Edit Colleague":"Add New Colleague":"View Colleague"),O=n||(e?"Update Colleague":"Add Colleague");return(0,vi.jsxs)(me,{className:"m-8 w-full max-w-4xl mx-auto overflow-y-scroll vi-scrollbar",children:[(0,vi.jsx)(Se,{children:(0,vi.jsxs)(Pe,{className:"flex items-center gap-2",children:[(0,vi.jsx)(Cr.Bot,{className:"h-5 w-5"}),u]})}),(0,vi.jsx)(pe,{className:"overflow-y-scroll vi-scrollbar",children:(0,vi.jsxs)("form",{onSubmit:_,className:"space-y-6",children:[(0,vi.jsxs)("div",{className:"space-y-4",children:[(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{htmlFor:"name",children:"Name *"}),(0,vi.jsx)(de,{id:"name",value:r?.name||"",onChange:d=>m({...r,name:d.target.value}),required:!0,disabled:o||!N})]}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{htmlFor:"description",children:"Description"}),(0,vi.jsx)(et,{id:"description",value:r.description||"",onChange:d=>m({...r,description:d.target.value}),rows:3,placeholder:"Brief description of this digital colleague...",disabled:o||!N})]})]}),(0,vi.jsxs)("div",{className:"space-y-4",children:[(0,vi.jsx)("h3",{className:"text-lg font-semibold",children:"Digital Colleague Details"}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{htmlFor:"jobDescription",children:"Job Description *"}),(0,vi.jsx)(et,{id:"jobDescription",value:r.jobDescription||"",onChange:d=>m({...r,jobDescription:d.target.value}),rows:4,required:r.type==="digital",disabled:o||!N})]}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{htmlFor:"workInstructions",children:"Work Instructions"}),(0,vi.jsx)(et,{id:"workInstructions",value:r.workInstructions||"",onChange:d=>m({...r,workInstructions:d.target.value}),rows:4,placeholder:"Enter detailed work instructions for this digital colleague...",disabled:o||!N})]}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{children:"Capabilities"}),N&&p.length>0&&(0,vi.jsxs)("div",{className:"flex gap-2",children:[(0,vi.jsxs)(ot,{value:f,onValueChange:S,disabled:o,children:[(0,vi.jsx)(_e,{className:"flex-1",children:(0,vi.jsx)(it,{placeholder:"Select a capability"})}),(0,vi.jsx)(We,{children:p.filter(d=>{let H=r.capabilities||[],b=typeof d.value=="object"?d.value.id:d.value;return!H.some(M=>{let B=typeof M.value=="object"?M.value.id:M.value;return M.relationTo===d.relationTo&&B===b})}).map((d,H)=>{let b=typeof d.value=="object"?d.value.id:d.value,M=typeof d.value=="object"?d.value.name:void 0,B=`${d.relationTo}:${b}`,fe=M?`${d.relationTo}: ${M}`:`${d.relationTo} (ID: ${b})`;return(0,vi.jsx)(Ae,{value:B,children:fe},B)})})]}),(0,vi.jsx)(C,{type:"button",variant:"outline",size:"icon",onClick:oe,disabled:o||!f,children:(0,vi.jsx)(Cr.Plus,{className:"h-4 w-4"})})]}),N&&p.length===0&&(0,vi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Cr capabilities available. Please provide availableCapabilities prop."}),(0,vi.jsx)("div",{className:"flex flex-wrap gap-2",children:r.capabilities?.map((d,H)=>{let b;if(typeof d=="string")b=d;else{let M=typeof d.value=="object"?d.value.id:d.value,B=typeof d.value=="object"?d.value.name:void 0;b=B?`${d.relationTo}: ${B}`:`${d.relationTo} (ID: ${M})`}return(0,vi.jsxs)(De,{className:"gap-1",children:[b,N&&(0,vi.jsx)(C,{type:"button",variant:"ghost",size:"icon",className:"h-4 w-4 p-0 hover:bg-accent hover:text-accent-foreground",onClick:()=>ge(H),disabled:o,children:(0,vi.jsx)(Cr.vi,{className:"h-3 w-3"})})]},`capability-${H}`)})})]}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{children:"Model"}),N&&x.length>0?(0,vi.jsxs)(ot,{value:ae||"__none__",onValueChange:D,disabled:o,children:[(0,vi.jsx)(_e,{children:(0,vi.jsx)(it,{placeholder:"Select a model"})}),(0,vi.jsxs)(We,{children:[(0,vi.jsx)(Ae,{value:"__none__",children:"None"}),x.map(d=>{let H=`${d.id}`;return(0,vi.jsx)(Ae,{value:H,children:d.name},H)})]})]}):N&&x.length===0?(0,vi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Cr models available. Please provide availableModels prop."}):(0,vi.jsx)("div",{className:"text-sm",children:r.model?typeof r.model=="number"?`Model ${r.model}`:typeof r.model=="object"&&r.model!==null&&"name"in r.model?r.model.name||`Model ${r.model.id}`:`Model ${r.model}`:"Cr model selected"})]}),(0,vi.jsx)(nr,{selectedDocuments:r.coreKnowledge?[{id:r.coreKnowledge?.id?.toString(),title:r.coreKnowledge?.name,format:"markdown",content:r.coreKnowledge?.content||"",createdAt:new Date(r.coreKnowledge?.createdAt),description:r.coreKnowledge?.description||"",metadata:r.coreKnowledge?.metadata||{},updatedAt:new Date(r.coreKnowledge?.updatedAt)}]:[],onDocumentsChange:d=>{let H={createdAt:d[0]?.createdAt.toISOString(),id:parseInt(d[0]?.id),name:d[0]?.title,source:"payload",updatedAt:(d[0]?.updatedAt||new Date).toISOString()};m({...r,coreKnowledge:d&&d.length>0?H:void 0})},label:"Core Knowledge",placeholder:"Search for core knowledge documents...",maxSelections:1,disabled:o||!N,availableDocuments:g.map(d=>({id:d.id.toString(),title:d?.name,name:d?.name,format:"markdown",content:d.content||"",createdAt:new Date(d.createdAt),source:d.source,description:d.description||"",metadata:d.metadata||{},updatedAt:new Date(d.updatedAt)}))})]}),(0,vi.jsxs)("div",{className:"flex justify-end gap-2 vi-4 border-t",children:[(0,vi.jsx)(C,{type:"button",variant:"outline",onClick:a,disabled:o,children:N?i:"Close"}),N?(0,vi.jsx)(C,{type:"submit",disabled:o,children:o?"Saving...":O}):(0,vi.jsxs)(C,{type:"button",onClick:le,disabled:o,className:"gap-2",children:[(0,vi.jsx)(Cr.Edit,{className:"h-4 w-4"}),"Edit"]})]})]})})]})}function rr({users:e,onUserSelect:t,onCancel:a,selectedUserId:o}){let[s,n]=(0,ni.useState)(""),i=Array.isArray(e)?e:[],l=(0,ni.useMemo)(()=>i.filter(p=>p!=null&&p!==void 0).filter(p=>p?.name?.toLowerCase().includes(s.toLowerCase())||p?.email?.toLowerCase().includes(s.toLowerCase())),[i,s]),g=p=>{t(p)};return(0,vi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,vi.jsx)(Do.AnimatePresence,{mode:"wait",children:(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,vi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,vi.jsxs)(C,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,vi.jsx)(Cr.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,vi.jsxs)("div",{children:[(0,vi.jsx)("h1",{className:"text-3xl font-bold",children:"Select User"}),(0,vi.jsx)("p",{className:"text-muted-foreground",children:"Choose a user to add as a colleague"})]})]}),(0,vi.jsx)(me,{className:"container",children:(0,vi.jsx)(pe,{className:"vi-6",children:(0,vi.jsx)("div",{className:"flex flex-col md:flex-row gap-4",children:(0,vi.jsx)("div",{className:"flex-1",children:(0,vi.jsxs)("div",{className:"relative",children:[(0,vi.jsx)(Cr.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,vi.jsx)(de,{placeholder:"Search users by name, email, role, or skills...",value:s,onChange:p=>n(p.target.value),className:"pl-9"})]})})})})}),(0,vi.jsx)("div",{className:"container grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:l.map(p=>!p||!p.id?null:(0,vi.jsx)(Do.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,vi.jsxs)(me,{className:`cursor-pointer transition-all hover:shadow-lg ${o===p.id?"ring-2 ring-primary":""}`,onClick:()=>g(p),children:[(0,vi.jsx)(Se,{className:"pb-3",children:(0,vi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,vi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,vi.jsx)(Rt,{children:(0,vi.jsx)(Mt,{children:(0,vi.jsx)(Cr.User,{className:"h-4 w-4"})})}),(0,vi.jsx)("div",{children:(0,vi.jsx)(Pe,{className:"text-lg",children:p?.name||"Unknown User"})})]}),o===p.id&&(0,vi.jsx)(Cr.Check,{className:"h-5 w-5 text-primary"})]})}),(0,vi.jsx)(pe,{className:"vi-0",children:(0,vi.jsxs)("div",{className:"space-y-3",children:[(0,vi.jsxs)("div",{children:[(0,vi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Email"}),(0,vi.jsx)("p",{className:"text-sm font-medium",children:p?.email||"Cr email"})]}),(0,vi.jsx)("div",{children:(0,vi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Department"})})]})})]})},p.id))}),l.length===0&&(0,vi.jsx)(me,{className:"container Cr-4",children:(0,vi.jsx)(pe,{className:"vi-6",children:(0,vi.jsxs)("div",{className:"text-center py-8",children:[(0,vi.jsx)(Cr.User,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,vi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Cr users found"}),(0,vi.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms or filters."})]})})})]},"user-selection")})})}function sr({digitalColleagues:e,onColleagueClone:t,onCancel:a,selectedColleagueId:o}){let[s,n]=(0,$a.useState)(""),[i,l]=(0,$a.useState)("all"),g=(0,$a.useMemo)(()=>e.filter(r=>r?.name.toLowerCase().includes(s.toLowerCase())||r.jobDescription?.toLowerCase().includes(s.toLowerCase())||r.workInstructions?.toLowerCase().includes(s.toLowerCase())),[e,s,i]),p=r=>{let m={...r,name:`${r?.name} (Copy)`};t(m)},x=r=>new Intl.DateTimeFormat("Cr-US",{month:"short",day:"numeric",year:"numeric"}).format(r);return(0,vi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,vi.jsx)(Do.AnimatePresence,{mode:"wait",children:(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,vi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,vi.jsxs)(C,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,vi.jsx)(Cr.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,vi.jsxs)("div",{children:[(0,vi.jsx)("h1",{className:"text-3xl font-bold",children:"Clone Digital Colleague"}),(0,vi.jsx)("p",{className:"text-muted-foreground",children:"Select a digital colleague to clone"})]})]}),(0,vi.jsx)(me,{children:(0,vi.jsx)(pe,{className:"vi-6",children:(0,vi.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,vi.jsx)("div",{className:"flex-1",children:(0,vi.jsxs)("div",{className:"relative",children:[(0,vi.jsx)(Cr.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,vi.jsx)(de,{placeholder:"Search by name, job description, or capabilities...",value:s,onChange:r=>n(r.target.value),className:"pl-9"})]})}),(0,vi.jsxs)("select",{value:i,onChange:r=>l(r.target.value),className:"h-10 px-3 rounded-md border border-input bg-background text-sm ring-offset-background",children:[(0,vi.jsx)("option",{value:"all",children:"All Status"}),(0,vi.jsx)("option",{value:"active",children:"Active"}),(0,vi.jsx)("option",{value:"inactive",children:"Inactive"})]})]})})}),(0,vi.jsx)("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:g.map(r=>(0,vi.jsx)(Do.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,vi.jsxs)(me,{className:`cursor-pointer transition-all hover:shadow-lg ${o?.toString()===r.id.toString()?"ring-2 ring-primary":""}`,onClick:()=>p(r),children:[(0,vi.jsx)(Se,{className:"pb-3",children:(0,vi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,vi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,vi.jsx)(Rt,{children:(0,vi.jsx)(Mt,{className:"bg-blue-100",children:(0,vi.jsx)(Cr.Bot,{className:"h-4 w-4 text-blue-600"})})}),(0,vi.jsx)("div",{children:(0,vi.jsx)(Pe,{className:"text-lg flex items-center gap-2",children:r?.name})})]}),(0,vi.jsxs)(C,{size:"sm",variant:"outline",className:"gap-2 h-8",onClick:m=>{m.stopPropagation(),p(r)},children:[(0,vi.jsx)(Cr.Copy,{className:"h-3 w-3"}),"Clone"]})]})}),(0,vi.jsx)(pe,{className:"vi-0",children:(0,vi.jsxs)("div",{className:"space-y-3",children:[(0,vi.jsxs)("div",{children:[(0,vi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Job Description"}),(0,vi.jsx)("p",{className:"text-sm line-clamp-2",children:r.jobDescription})]}),r.capabilities&&r.capabilities.length>0&&(0,vi.jsxs)("div",{children:[(0,vi.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Capabilities"}),(0,vi.jsx)("div",{className:"flex flex-wrap gap-1",children:r.capabilities.length>3&&(0,vi.jsxs)(De,{variant:"outline",className:"text-xs",children:["+",r.capabilities.length-3]})})]}),(0,vi.jsx)("div",{className:"flex items-center justify-between text-xs text-muted-foreground"}),r.workInstructions&&(0,vi.jsxs)("div",{children:[(0,vi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Instructions"}),(0,vi.jsx)("p",{className:"text-xs line-clamp-2",children:r.workInstructions})]})]})})]})},r.id))}),g.length===0&&(0,vi.jsx)(me,{children:(0,vi.jsx)(pe,{className:"vi-6",children:(0,vi.jsxs)("div",{className:"text-center py-8",children:[(0,vi.jsx)(Cr.Bot,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,vi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Cr digital colleagues found"}),(0,vi.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms or filters."})]})})})]},"colleague-clone")})})}function lr({onSelectHuman:e,onSelectDigital:t,onCancel:a}){return(0,vi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,vi.jsx)(Do.AnimatePresence,{mode:"wait",children:(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,vi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,vi.jsxs)(C,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,vi.jsx)(Cr.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,vi.jsxs)("div",{children:[(0,vi.jsx)("h1",{className:"text-3xl font-bold",children:"Add Colleague"}),(0,vi.jsx)("p",{className:"text-muted-foreground",children:"Choose the type of colleague to add"})]})]}),(0,vi.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,vi.jsx)(Do.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,vi.jsxs)(me,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,vi.jsxs)(Se,{className:"text-center pb-4",children:[(0,vi.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,vi.jsx)(Cr.User,{className:"h-8 w-8 text-blue-600"})}),(0,vi.jsx)(Pe,{className:"text-xl",children:"Add Human Colleague"})]}),(0,vi.jsxs)(pe,{className:"text-center",children:[(0,vi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Select from existing users in your organization to add as team members."}),(0,vi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,vi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,vi.jsx)(Cr.Users,{className:"h-4 w-4 text-blue-600"}),(0,vi.jsx)("span",{children:"Browse existing users"})]}),(0,vi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,vi.jsx)(Cr.User,{className:"h-4 w-4 text-blue-600"}),(0,vi.jsx)("span",{children:"Import user details automatically"})]})]}),(0,vi.jsx)(C,{className:"Cr-6 w-full",onClick:e,children:"Select User"})]})]})}),(0,vi.jsx)(Do.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,vi.jsxs)(me,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,vi.jsxs)(Se,{className:"text-center pb-4",children:[(0,vi.jsx)("div",{className:"mx-auto w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mb-4",children:(0,vi.jsx)(Cr.Bot,{className:"h-8 w-8 text-purple-600"})}),(0,vi.jsx)(Pe,{className:"text-xl",children:"Add Digital Colleague"})]}),(0,vi.jsxs)(pe,{className:"text-center",children:[(0,vi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Clone vi existing digital colleague or create a new AI assistant for your team."}),(0,vi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,vi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,vi.jsx)(Cr.Bot,{className:"h-4 w-4 text-purple-600"}),(0,vi.jsx)("span",{children:"Clone existing colleagues"})]}),(0,vi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,vi.jsx)(Cr.Users,{className:"h-4 w-4 text-purple-600"}),(0,vi.jsx)("span",{children:"Create from templates"})]})]}),(0,vi.jsx)(C,{className:"Cr-6 w-full",onClick:t,children:"Add Digital Colleague"})]})]})})]})]},"colleague-type-selection")})})}function dr({onCloneExisting:e,onCreateNew:t,onCancel:a}){return(0,vi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,vi.jsx)(Do.AnimatePresence,{mode:"wait",children:(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,vi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,vi.jsxs)(C,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,vi.jsx)(Cr.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,vi.jsxs)("div",{children:[(0,vi.jsx)("h1",{className:"text-3xl font-bold",children:"Add Digital Colleague"}),(0,vi.jsx)("p",{className:"text-muted-foreground",children:"Choose how to create your digital colleague"})]})]}),(0,vi.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,vi.jsx)(Do.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,vi.jsxs)(me,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,vi.jsxs)(Se,{className:"text-center pb-4",children:[(0,vi.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,vi.jsx)(Cr.Copy,{className:"h-8 w-8 text-blue-600"})}),(0,vi.jsx)(Pe,{className:"text-xl",children:"Clone Existing"})]}),(0,vi.jsxs)(pe,{className:"text-center",children:[(0,vi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Start with vi existing digital colleague and customize it for your needs."}),(0,vi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,vi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,vi.jsx)(Cr.Bot,{className:"h-4 w-4 text-blue-600"}),(0,vi.jsx)("span",{children:"Pre-configured capabilities"})]}),(0,vi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,vi.jsx)(Cr.Copy,{className:"h-4 w-4 text-blue-600"}),(0,vi.jsx)("span",{children:"Inherit knowledge base"})]})]}),(0,vi.jsx)(C,{className:"Cr-6 w-full",onClick:e,children:"Browse & Clone"})]})]})}),(0,vi.jsx)(Do.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,vi.jsxs)(me,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,vi.jsxs)(Se,{className:"text-center pb-4",children:[(0,vi.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,vi.jsx)(Cr.Sparkles,{className:"h-8 w-8 text-green-600"})}),(0,vi.jsx)(Pe,{className:"text-xl",children:"Create New"})]}),(0,vi.jsxs)(pe,{className:"text-center",children:[(0,vi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Build a completely new digital colleague from scratch with custom specifications."}),(0,vi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,vi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,vi.jsx)(Cr.Plus,{className:"h-4 w-4 text-green-600"}),(0,vi.jsx)("span",{children:"Custom job description"})]}),(0,vi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,vi.jsx)(Cr.Sparkles,{className:"h-4 w-4 text-green-600"}),(0,vi.jsx)("span",{children:"Define unique capabilities"})]})]}),(0,vi.jsx)(C,{className:"Cr-6 w-full",onClick:t,children:"Create from Scratch"})]})]})})]})]},"digital-colleague-options")})})}function Qo(...e){return Ga((0,gi.clsx)(e))}function ei({initialColleagues:e,onColleagueAdd:t,onColleagueEdit:a,onColleagueDelete:o,compactView:s=!1,departments:n=["Design","Engineering","Marketing","Product","Sales","Operations"],className:i,availableUsers:l=[],existingDigitalColleagues:g=[],availableKnowledgeDocuments:p=[],availableCapabilities:x=[],availableModels:r=[]}){let[m,y]=(0,ni.useState)(e||[]),[v,h]=(0,ni.useState)(""),[c,f]=(0,ni.useState)("all"),[S,N]=(0,ni.useState)("all"),[k,z]=(0,ni.useState)("all"),[ae,_]=(0,ni.useState)(null),[E,W]=(0,ni.useState)(null);(0,ni.useEffect)(()=>{y(e||[])},[e]);let oe=Array.isArray(l)?l:[],ge=Array.isArray(g)?g:[],[D,le]=(0,ni.useState)("main"),Me=m.filter(R=>!R||!R?.name?!1:R?.name.toLowerCase().includes(v.toLowerCase())||R.type==="human"&&R.email?.toLowerCase().includes(v.toLowerCase())||R.type==="digital"&&R.jobDescription?.toLowerCase().includes(v.toLowerCase())),u=Me.filter(R=>R.type==="human"),O=Me.filter(R=>R.type==="digital"),d=()=>{le("typeSelection")},H=R=>{R.type==="digital"&&(_(R),le("form")),a?.(R)},b=R=>{R.type==="digital"&&(W(R),le("view"))},M=R=>{if(!R||!R.id){console.error("Invalid user provided to handleUserSelect:",R);return}let Xe={id:`human-${Date.now()}`,type:"human",name:R?.name||"Unknown User",email:R?.email||"",updatedAt:R.updatedAt,createdAt:R.createdAt,accounts:R.accounts};y(da=>[...da,Xe]),t?.(Xe),le("main")},B=R=>{if(!R||!R.id){console.error("Invalid cloned colleague provided to handleDigitalColleagueClone:",R);return}y(Xe=>[...Xe,{...R,type:"digital"}]),t?.({...R,type:"digital"}),le("main")},fe=()=>{_(null),le("form")},ee=R=>{if(!R||!R.id){console.error("Invalid colleague provided to handleSaveColleague:",R);return}ae?(y(Xe=>Xe.map(da=>da.id===R.id?{...R,type:"digital"}:da)),a?.({...R,type:"digital"})):(y(Xe=>[...Xe,{...R,type:"digital"}]),t?.({...R,type:"digital"})),le("main"),_(null)},$e=()=>{le("main"),_(null),W(null)},Tt=()=>{le("main"),W(null)},Da=()=>{E&&(_(E),W(null),le("form"))},ea=R=>{o?.(R,m.find(Xe=>Xe.id.toString()===R.toString())?.type),y(Xe=>Xe.filter(da=>da.id!==R))},Dr=()=>{h(""),f("all"),N("all")};return D==="typeSelection"?(0,vi.jsx)(lr,{onSelectHuman:()=>le("userSelection"),onSelectDigital:()=>le("digitalOptions"),onCancel:()=>le("main")}):D==="userSelection"?(0,vi.jsx)(rr,{users:oe,onUserSelect:M,onCancel:()=>le("typeSelection")}):D==="digitalOptions"?(0,vi.jsx)(dr,{onCloneExisting:()=>le("digitalClone"),onCreateNew:fe,onCancel:()=>le("typeSelection")}):D==="digitalClone"?(0,vi.jsx)(sr,{digitalColleagues:ge,onColleagueClone:B,onCancel:()=>le("digitalOptions")}):D==="form"?(0,vi.jsx)(Yo,{colleague:ae||void 0,onSave:ee,onCancel:$e,availableKnowledgeDocuments:p,availableCapabilities:x,availableModels:r}):D==="view"?(0,vi.jsx)(Yo,{colleague:E||void 0,onSave:ee,onCancel:Tt,readOnly:!0,availableKnowledgeDocuments:p,availableCapabilities:x,availableModels:r}):(0,vi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:(0,vi.jsx)(Do.AnimatePresence,{mode:"wait",children:(0,vi.jsx)(Do.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,vi.jsxs)("div",{className:`space-y-6 ${i||""}`,children:[(0,vi.jsx)(Bt,{title:"Colleagues",description:"Manage your team members and digital colleagues.",gradient:"bg-gradient-to-r from-green-600 via-emerald-600 to-teal-600",primaryAction:{label:"Add colleague",onClick:d}}),(0,vi.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,vi.jsxs)(me,{children:[(0,vi.jsxs)(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,vi.jsx)(Pe,{className:"text-sm font-medium",children:"Total Colleagues"}),(0,vi.jsx)(Cr.Users,{className:"h-4 w-4 text-muted-foreground"})]}),(0,vi.jsxs)(pe,{children:[(0,vi.jsx)("div",{className:"text-2xl font-bold",children:m.length}),(0,vi.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]}),(0,vi.jsxs)(me,{children:[(0,vi.jsxs)(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,vi.jsx)(Pe,{className:"text-sm font-medium",children:"Human Members"}),(0,vi.jsx)(Cr.User,{className:"h-4 w-4 text-muted-foreground"})]}),(0,vi.jsxs)(pe,{children:[(0,vi.jsx)("div",{className:"text-2xl font-bold",children:m.filter(R=>R.type==="human").length}),(0,vi.jsx)("p",{className:"text-xs text-muted-foreground",children:"active"})]})]}),(0,vi.jsxs)(me,{children:[(0,vi.jsxs)(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,vi.jsx)(Pe,{className:"text-sm font-medium",children:"Digital Colleagues"}),(0,vi.jsx)(Cr.Bot,{className:"h-4 w-4 text-muted-foreground"})]}),(0,vi.jsxs)(pe,{children:[(0,vi.jsx)("div",{className:"text-2xl font-bold",children:m.filter(R=>R.type==="digital").length}),(0,vi.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]})]}),(0,vi.jsx)(me,{children:(0,vi.jsx)(pe,{className:"vi-6",children:(0,vi.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,vi.jsx)("div",{className:"flex-1",children:(0,vi.jsxs)("div",{className:"relative",children:[(0,vi.jsx)(Cr.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,vi.jsx)(de,{placeholder:"Search colleagues...",value:v,onChange:R=>h(R.target.value),className:"pl-9"})]})}),(0,vi.jsxs)(ot,{value:c,onValueChange:f,children:[(0,vi.jsx)(_e,{className:"w-full md:w-[180px]",children:(0,vi.jsx)(it,{placeholder:"Department"})}),(0,vi.jsxs)(We,{children:[(0,vi.jsx)(Ae,{value:"all",children:"All Departments"}),n.map(R=>(0,vi.jsx)(Ae,{value:R,children:R},R))]})]}),(0,vi.jsxs)(ot,{value:S,onValueChange:N,children:[(0,vi.jsx)(_e,{className:"w-full md:w-[140px]",children:(0,vi.jsx)(it,{placeholder:"Status"})}),(0,vi.jsxs)(We,{children:[(0,vi.jsx)(Ae,{value:"all",children:"All Status"}),(0,vi.jsx)(Ae,{value:"active",children:"Active"}),(0,vi.jsx)(Ae,{value:"inactive",children:"Inactive"})]})]}),(v||c!=="all"||S!=="all")&&(0,vi.jsxs)(C,{variant:"outline",onClick:Dr,className:"gap-2",children:[(0,vi.jsx)(Cr.Filter,{className:"h-4 w-4"}),"Clear"]})]})})}),(0,vi.jsxs)("div",{className:"space-y-4",children:[(0,vi.jsx)(lo,{activeTab:k,onTabChange:z,tabOptions:[{value:"all",label:`All (${Me.length})`},{value:"human",label:`Human (${u.length})`},{value:"digital",label:`Digital (${O.length})`}],maxWidth:"400px",gridCols:3}),k==="all"&&(0,vi.jsx)("div",{className:`grid gap-4 ${s?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:Me.map(R=>(0,vi.jsx)(yo,{colleague:R,onEdit:H,onDelete:ea,onViewDetails:b,compact:s,className:Qo([R.type==="digital"&&"border-teal-400"])},`${R}-${R.id}`))}),k==="human"&&(0,vi.jsx)("div",{className:`grid gap-4 ${s?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:u.map(R=>(0,vi.jsx)(yo,{colleague:R,onEdit:H,onDelete:ea,onViewDetails:b,compact:s},R.id))}),k==="digital"&&(0,vi.jsx)("div",{className:`grid gap-4 ${s?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:O.map(R=>(0,vi.jsx)(yo,{colleague:R,onEdit:H,onDelete:ea,onViewDetails:b,compact:s,className:Qo([R.type==="digital"&&"border-teal-400"])},R.id))})]}),Me.length===0&&(0,vi.jsx)(me,{children:(0,vi.jsx)(pe,{className:"vi-6",children:(0,vi.jsxs)("div",{className:"text-center py-8",children:[(0,vi.jsx)(Cr.Users,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,vi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Cr colleagues found"}),(0,vi.jsx)("p",{className:"text-muted-foreground mb-4",children:v||c!=="all"||S!=="all"?"Try adjusting your filters to see more results.":"Get started by adding your first colleague."}),(0,vi.jsxs)(C,{onClick:d,className:"gap-2",children:[(0,vi.jsx)(Cr.Plus,{className:"h-4 w-4"}),"Add Colleague"]})]})})})]})},"projects-index-view")})})}var ur=ve(require("@radix-ui/react-dialog"));function mr({document:e,onSave:t,mode:a="edit",onCancel:o,availableDocuments:s=[],knowledgeContexts:n=[]}){let[i,l]=(0,ni.useState)({...e,updatedAt:new Date}),[g,p]=(0,ni.useState)(!1),[x,r]=(0,ni.useState)(i.richTextContent),[m,y]=(0,ni.useState)(!1),v=(0,ni.useRef)(null),h=(0,ni.useRef)(""),c=(0,ni.useRef)(null),f=(0,ni.useRef)(null),S=b=>{let M=new WeakSet,B=fe=>fe&&typeof fe=="object"?M.has(fe)?null:(M.add(fe),Array.isArray(fe)?fe.map(B):Object.keys(fe).sort().reduce((ee,$e)=>(ee[$e]=B(fe[$e]),ee),{})):fe;return JSON.stringify(B(b))},N=b=>b?b.replace(/\s+/g," ").trim():"",k=()=>i.format==="richText"?S(x):N(i.content),z=()=>{let b={title:N(i.title),description:N(i.description),format:i.format,content:k()},M=S(b),B=5381;for(let fe=0;fe<M.length;fe++)B=B*33^M.charCodeAt(fe);return(B>>>0).toString(16)},ae=(b,M)=>{if(b===M)return!1;if(i.format!=="richText"){let B=E(b),fe=k();if(B==null)return!0;let ee=B.length,$e=fe.length,Tt=Math.abs($e-ee),Da=ee===0?1:Tt/ee;return N(B)===N(fe)&&Tt<3?!1:Tt>=10||Da>=.02}return!0},_=(0,ni.useRef)(new Map),E=b=>{let M=_.current.get(b);return M==null?null:"x".repeat(M)};(0,ni.useEffect)(()=>(f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{let b=z(),M=h.current;if(ae(M,b)&&(y(!0),t({...i,richTextContent:x},"autosave"),h.current=b,i.format!=="richText")){let B=k();_.current.set(b,B.length)}},800),()=>{f.current&&clearTimeout(f.current)}),[i.title,i.description,i.format,i.content,i.metadata,x]),(0,ni.useEffect)(()=>{let b=()=>{let M=z();M!==h.current&&(t({...i,richTextContent:x},"autosave"),h.current=M)};return window.addEventListener("pagehide",b),window.addEventListener("beforeunload",b),()=>{window.removeEventListener("pagehide",b),window.removeEventListener("beforeunload",b)}},[i,x]),(0,ni.useEffect)(()=>(m&&(c.current=setTimeout(()=>{y(!1)},2e3)),()=>{c.current&&clearTimeout(c.current)}),[m]),(0,ni.useEffect)(()=>{l(e)},[e]);let W=b=>{switch(b){case"markdown":case"mdx":return(0,vi.jsx)(Cr.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,vi.jsx)(Cr.File,{className:"h-6 w-6 text-success"});case"text":return(0,vi.jsx)(Cr.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,vi.jsx)(Cr.File,{className:"h-6 w-6 text-muted-foreground"})}},oe=b=>{switch(b){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},ge=()=>{let b=new Set,M=new Set;return n.forEach(B=>{B.menuConfig.groupBy.forEach(fe=>b.add(fe))}),s.forEach(B=>{B.metadata&&Object.keys(B.metadata).forEach(fe=>M.add(fe))}),{contextKeys:Array.from(b).sort(),documentKeys:Array.from(M).sort(),allKeys:Array.from(new Set([...b,...M])).sort()}},D=b=>{let M=new Set;return s.forEach(B=>{B.metadata?.[b]&&M.add(String(B.metadata[b]))}),Array.from(M).sort()},le=ge(),Me=()=>{t({...i,richTextContent:x},"autosave")},u=(b,M)=>{l(B=>({...B,metadata:{...B.metadata,[b]:M}}))},O=(b,M)=>{M==="__custom__"?u(b,""):u(b,M)},d=()=>{u("","")},H=b=>{l(M=>{let B={...M.metadata};return delete B[b],{...M,metadata:B}})};return(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-screen flex flex-col",children:[(0,vi.jsxs)("div",{className:"border-b border-border bg-card p-8 pb-6",children:[(0,vi.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,vi.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,vi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,vi.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,vi.jsx)("div",{className:"flex-1 min-w-0",children:(0,vi.jsx)(Fa,{fieldName:"title",value:i.title,label:"",onSave:(b,M)=>l(B=>({...B,title:M})),className:"[&>div:last-child]:text-2xl [&>div:last-child]:font-bold [&>div:last-child]:leading-tight [&>div:last-child]:text-foreground [&>div:last-child]:p-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})}),(0,vi.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${oe(i.format)} flex-shrink-0 Cr-1`,children:i.format.toUpperCase()})]}),(0,vi.jsx)("div",{className:"Cr-2",children:(0,vi.jsx)(Fa,{fieldName:"description",value:i.description||"Click to add description...",label:"",multiline:!0,onSave:(b,M)=>l(B=>({...B,description:M})),className:"[&>div:last-child]:text-muted-foreground [&>div:last-child]:text-lg [&>div:last-child]:leading-relaxed [&>div:last-child]:p-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})})]})}),(0,vi.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,vi.jsxs)(C,{variant:"ghost",size:"sm",onClick:()=>p(!g),className:"gap-2",children:[(0,vi.jsx)(Cr.Info,{className:"h-4 w-4"}),"Metadata",i.metadata&&Object.keys(i.metadata).length>0&&(0,vi.jsx)("span",{className:"inline-flex items-center justify-center w-5 h-5 text-xs font-medium bg-primary/10 text-primary rounded-full",children:Object.keys(i.metadata).length}),g?(0,vi.jsx)(Cr.ChevronDown,{className:"h-4 w-4"}):(0,vi.jsx)(Cr.ChevronRight,{className:"h-4 w-4"})]}),(0,vi.jsxs)(C,{variant:"outline",size:"sm",onClick:o,className:"gap-2",children:[(0,vi.jsx)(Cr.vi,{className:"h-4 w-4"}),"Close"]}),(0,vi.jsxs)(C,{size:"sm",onClick:Me,className:"gap-2",disabled:m,children:[m?(0,vi.jsx)(Cr.Loader2,{className:"h-4 w-4 animate-spin"}):(0,vi.jsx)(Cr.Save,{className:"h-4 w-4"}),m?"Auto-saving...":"Save"]})]})]}),(0,vi.jsx)(Do.motion.div,{initial:!1,animate:{height:g?"auto":0,opacity:g?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden h-full max-h-full",children:(0,vi.jsxs)("div",{className:"vi-4 border-t border-border Cr-4 max-h-full flex gap-2",children:[(0,vi.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,vi.jsxs)("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[(0,vi.jsx)(Cr.Info,{className:"h-4 w-4"}),"Document Metadata"]})}),(0,vi.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,vi.jsx)("div",{className:"bg-muted rounded-lg p-4 border border-border",children:i.metadata&&Object.keys(i.metadata).length>0?(0,vi.jsx)("div",{className:"space-y-2",children:Object.entries(i.metadata).map(([b,M],B)=>{let fe=D(b);return(0,vi.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,vi.jsx)(de,{value:b,onChange:ee=>{let $e=ee.target.value||"",Tt=i.metadata?.[b];l(Da=>{let ea={...Da.metadata};return delete ea[b],$e&&(ea[$e]=Tt||""),{...Da,metadata:ea}})},placeholder:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${b}`}),(0,vi.jsx)("datalist",{id:`metadata-keys-${b}`,children:le.allKeys.map(ee=>(0,vi.jsx)("option",{value:ee},ee))}),(0,vi.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),fe.length>0?(0,vi.jsxs)(ot,{value:String(M||""),onValueChange:ee=>O(b,ee),children:[(0,vi.jsx)(_e,{className:"flex-1 h-8 text-sm",children:(0,vi.jsx)(it,{placeholder:"Value"})}),(0,vi.jsxs)(We,{children:[fe.map(ee=>(0,vi.jsx)(Ae,{value:ee,children:ee},ee)),(0,vi.jsx)(Ae,{value:"__custom__",children:(0,vi.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,vi.jsx)(de,{value:String(M||""),onChange:ee=>u(b,ee.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,vi.jsx)(C,{type:"button",variant:"ghost",size:"sm",onClick:()=>H(b),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,vi.jsx)(Cr.vi,{className:"h-3 w-3"})})]},`metadata-key-${B}`)})}):(0,vi.jsxs)("div",{className:"text-center py-4",children:[(0,vi.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Cr metadata fields"}),(0,vi.jsx)("p",{className:"text-xs text-muted-foreground",children:'Click "Add Field" to create metadata'})]})}),(0,vi.jsxs)(C,{type:"button",variant:"outline",size:"sm",onClick:d,className:"gap-1 h-8",children:[(0,vi.jsx)(Cr.Plus,{className:"h-3 w-3"}),"Add Field"]})]})]})})]}),(0,vi.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,vi.jsx)("div",{className:"p-8 vi-0 h-full max-h-full overflow-auto",children:i.format==="richText"?(0,vi.jsx)(fa,{setValue:r,value:x,name:"richTextContent"}):(0,vi.jsx)(et,{value:i.content||"",onChange:b=>l(M=>({...M,content:b.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})})})]})}var gr=ve(require("react-markdown")),fr=ve(require("remark-gfm"));var vr=e=>(0,vi.jsx)(gr.default,{remarkPlugins:[fr.default],components:{h1:({children:t})=>(0,vi.jsx)("h1",{className:"text-2xl font-bold",children:t}),h2:({children:t})=>(0,vi.jsx)("h2",{className:"text-xl font-bold",children:t}),h3:({children:t})=>(0,vi.jsx)("h3",{className:"text-lg font-bold",children:t}),h4:({children:t})=>(0,vi.jsx)("h4",{className:"text-base font-bold",children:t}),ol:({children:t})=>(0,vi.jsx)("ol",{className:"list-decimal",children:t}),ul:({children:t})=>(0,vi.jsx)("ul",{className:"list-disc",children:t}),li:({children:t})=>(0,vi.jsx)("li",{className:"ml-4",children:t}),p:({children:t})=>(0,vi.jsx)("p",{className:"mb-4",children:t}),a:({children:t,href:a})=>(0,vi.jsx)("a",{href:a,className:"text-blue-500",children:t}),img:({src:t,alt:a})=>(0,vi.jsx)("img",{src:t,alt:a,className:"mb-4"}),blockquote:({children:t})=>(0,vi.jsx)("blockquote",{className:"border-l-4 border-gray-300 pl-4 mb-4",children:t})},children:e}),pr=e=>(0,vi.jsx)("div",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed",children:e}),js=e=>(0,vi.jsx)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:e&&(0,vi.jsx)(fa,{value:JSON.stringify(e),editable:!1,name:"richTextContent"},JSON.stringify(e))}),Hs=e=>(0,vi.jsxs)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:[(0,vi.jsx)("div",{className:"bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4 mb-4",children:(0,vi.jsxs)("p",{className:"text-blue-800 dark:text-blue-200 text-sm",children:[(0,vi.jsx)("strong",{children:"MDX Renderer:"})," This is a placeholder. Integrate with @mdx-js/react for full MDX rendering."]})}),vr(e)]});function hr({document:e,onDocumentUpdate:t,editable:a=!0,mode:o="view",renderers:s,availableDocuments:n=[],knowledgeContexts:i=[]}){let[l,g]=(0,ni.useState)(!1),[p,x]=(0,ni.useState)(!1),[r,m]=(0,ni.useState)(e),[y,v]=(0,ni.useState)(!1),h=(0,ni.useRef)(null),c=r.format==="richText"?r.richTextContent:r.content,f=(0,ni.useMemo)(()=>`${r.format}:${JSON.stringify(c)}`,[r.format,c]);(0,ni.useEffect)(()=>{m(e)},[e]);let S=E=>{switch(E){case"markdown":case"mdx":return(0,vi.jsx)(Cr.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,vi.jsx)(Cr.File,{className:"h-6 w-6 text-success"});case"text":return(0,vi.jsx)(Cr.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,vi.jsx)(Cr.File,{className:"h-6 w-6 text-muted-foreground"})}},N=E=>{switch(E){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},k=(E,W)=>{let oe={markdown:vr,mdx:Hs,text:pr},ge=s?.[W]||oe[W];if(W==="richText"&&typeof E=="object")return js(E);if(ge&&typeof E=="string")return ge(E);if(typeof E=="string")return pr(E)},z=async(E,W="save")=>{W==="save"&&v(!0),h.current=r,(0,ni.startTransition)(()=>{m({...E,richTextContent:E.richTextContent?structuredClone(E.richTextContent):void 0})});try{let oe=await t?.(E);if(W==="save"&&v(!1),!oe)throw new Error("save failed")}catch{h.current&&(0,ni.startTransition)(()=>m(h.current))}},ae=()=>{g(!1)};return(0,vi.jsxs)(vi.Fragment,{children:[(0,vi.jsx)(Qe,{open:l||o==="create",onOpenChange:E=>!E&&ae(),children:(0,vi.jsxs)(pa,{children:[(0,vi.jsx)(ta,{}),(0,vi.jsxs)(ur.Content,{className:w("fixed inset-0 z-50 bg-background p-0 m-0 border-0","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"),children:[y&&(0,vi.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center",children:(0,vi.jsx)(Cr.Loader2,{className:"h-8 w-8 animate-spin text-primary"})}),(0,vi.jsx)(mr,{mode:o==="create"?"create":"edit",document:r,onSave:z,onCancel:ae,availableDocuments:n,knowledgeContexts:i})]})]})}),(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-full flex flex-col",children:[(0,vi.jsxs)("div",{className:"border-b border-border bg-card p-8 pb-6",children:[(0,vi.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,vi.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,vi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,vi.jsxs)("h1",{className:"text-2xl font-bold text-foreground mb-2 leading-tight",children:[r.title,(0,vi.jsx)("span",{className:`inline-flex ml-4 items-center px-3 py-1 rounded-full text-sm font-medium border ${N(r.format)}`,children:r.format.toUpperCase()})]}),r.description&&(0,vi.jsx)("p",{className:"text-muted-foreground text-lg leading-relaxed",children:r.description})]})}),(0,vi.jsxs)("div",{className:"items-center gap-2 flex-shrink-0 hidden lg:flex",children:[r.metadata&&Object.keys(r.metadata).length>0&&(0,vi.jsxs)(C,{variant:"ghost",size:"sm",onClick:()=>x(!p),className:"gap-2",children:[(0,vi.jsx)(Cr.Info,{className:"h-4 w-4"}),"Metadata",p?(0,vi.jsx)(Cr.ChevronDown,{className:"h-4 w-4"}):(0,vi.jsx)(Cr.ChevronRight,{className:"h-4 w-4"})]}),a&&(0,vi.jsxs)(C,{variant:"outline",size:"sm",onClick:()=>g(!0),className:"gap-2",children:[(0,vi.jsx)(Cr.Edit3,{className:"h-4 w-4"}),"Edit"]})]})]}),r.metadata&&Object.keys(r.metadata).length>0&&(0,vi.jsx)(Do.motion.div,{initial:!1,animate:{height:p?"auto":0,opacity:p?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,vi.jsxs)("div",{className:"vi-4 border-t border-border Cr-4",children:[(0,vi.jsxs)("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-2",children:[(0,vi.jsx)(Cr.Info,{className:"h-4 w-4"}),"Document Metadata"]}),(0,vi.jsx)("div",{className:"bg-muted rounded-lg p-4 border border-border",children:(0,vi.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-x-6 gap-y-2 text-sm",children:Object.entries(r.metadata).map(([E,W])=>(0,vi.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,vi.jsx)("span",{className:"text-muted-foreground font-medium text-xs uppercase tracking-wide",children:E.replace(/([vi-vi])/g," $1").trim()}),(0,vi.jsx)("span",{className:"text-foreground font-medium",children:String(W)})]},E))})})]})})]}),(0,vi.jsx)("div",{className:"flex-1 ",children:(0,vi.jsx)("div",{className:"py-4 h-full",children:(0,vi.jsx)("div",{className:"space-y-4",children:r.content||r.richTextContent?(0,vi.jsx)("div",{className:"relative",children:(0,vi.jsx)("div",{className:"bg-background px-8 overflow-hidden h-full flex-1",children:k(r.format==="richText"?r.richTextContent:r.content,r.format)})},f):(0,vi.jsxs)("div",{className:"text-center p-12 bg-muted rounded-xl border-2 border-dashed border-border",children:[(0,vi.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-background flex items-center justify-center",children:(0,vi.jsx)(Cr.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,vi.jsx)("h4",{className:"text-foreground font-medium mb-1",children:"Cr content available"}),(0,vi.jsx)("p",{className:"text-muted-foreground text-sm",children:"This document doesn't have preview content"})]})})})})]})]})}function oi({label:e,documents:t,children:a,level:o,onDocumentClick:s,selectedDocumentId:n,showDocumentCount:i=!0}){let[l,g]=(0,ni.useState)(o===0),p=a&&Object.keys(a).length>0,x=t.length+(a?Object.values(a).reduce((y,v)=>y+v.documents.length,0):0),r=y=>{switch(y){case"markdown":case"mdx":return(0,vi.jsx)(Cr.FileText,{className:"h-3.5 w-3.5 text-muted-foreground"});case"richText":return(0,vi.jsx)(Cr.File,{className:"h-3.5 w-3.5 text-muted-foreground"});default:return(0,vi.jsx)(Cr.File,{className:"h-3.5 w-3.5 text-muted-foreground"})}},m=y=>{let v=["bg-primary","bg-secondary","bg-accent","bg-chart-1"];return v[y%v.length]};return(0,vi.jsxs)("div",{className:"space-y-1",children:[(p||t.length>0)&&(0,vi.jsxs)(Do.motion.div,{className:`group flex items-center gap-3 p-3 rounded-xl cursor-pointer transition-all duration-200 ${l?"bg-card shadow-sm border border-border":"hover:bg-muted/50 hover:shadow-sm"}`,style:{marginLeft:`${o*20}px`},onClick:()=>g(!l),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,vi.jsx)("div",{className:`w-1 h-6 rounded-full ${m(o)}`}),(0,vi.jsx)(Do.motion.div,{animate:{rotate:l?90:0},transition:{duration:.2},className:"flex-shrink-0",children:(0,vi.jsx)(Cr.ChevronRight,{className:"h-4 w-4 text-muted-foreground"})}),(0,vi.jsxs)("div",{className:"flex-1 flex items-center justify-between min-w-0",children:[(0,vi.jsx)("div",{className:"flex items-center gap-2 min-w-0",children:(0,vi.jsx)("span",{className:"font-medium text-foreground truncate",children:e})}),i&&x>0&&(0,vi.jsx)("div",{className:"flex-shrink-0 ml-2",children:(0,vi.jsx)("span",{className:"inline-flex items-center justify-center w-6 h-6 text-xs font-medium bg-muted text-muted-foreground rounded-full",children:x})})]})]}),(0,vi.jsx)(Do.motion.div,{initial:!1,animate:{height:l?"auto":0,opacity:l?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,vi.jsxs)("div",{className:"vi-2 space-y-1",children:[t.map((y,v)=>(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.05,duration:.2},className:`group flex items-center gap-3 p-2.5 mx-2 rounded-lg cursor-pointer transition-all duration-150 ${n===y.id?"bg-primary/10 border-l-2 border-primary shadow-sm":"hover:bg-muted/50 hover:translate-x-1"}`,style:{marginLeft:`${o*20+20}px`},onClick:()=>s?.(y),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,vi.jsx)("div",{className:"flex-shrink-0",children:r(y.format)}),(0,vi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,vi.jsx)("p",{className:`text-sm truncate transition-colors ${n===y.id?"text-primary font-medium":"text-foreground group-hover:text-foreground"}`,children:y.title}),y.description&&(0,vi.jsx)("p",{className:"text-xs text-muted-foreground truncate Cr-0.5",children:y.description})]}),y.tags&&y.tags.length>0&&(0,vi.jsx)("div",{className:"flex-shrink-0",children:(0,vi.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-md text-xs font-medium bg-muted text-muted-foreground group-hover:bg-muted/80 transition-colors",children:y.tags[0]})})]},y.id)),a&&Object.entries(a).map(([y,v])=>(0,vi.jsx)(oi,{label:y,documents:v.documents,children:v.children,level:o+1,onDocumentClick:s,selectedDocumentId:n,showDocumentCount:i},y))]})})]})}function br({documents:e,menuConfig:t,onDocumentClick:a,onDocumentShare:o,onDocumentUpdate:s,selectedDocumentId:n,className:i,editable:l=!0}){let[g,p]=(0,ni.useState)(""),[x,r]=(0,ni.useState)(null),[m,y]=(0,ni.useState)(e);(0,ni.useEffect)(()=>{y(e)},[e]),(0,ni.useEffect)(()=>{if(x?.id){let f=m.find(S=>S.id===x.id);f&&r(f)}},[m]);let v=(0,ni.useMemo)(()=>g?m.filter(f=>f.title.toLowerCase().includes(g.toLowerCase())||f.description?.toLowerCase().includes(g.toLowerCase())||f.tags?.some(S=>S.toLowerCase().includes(g.toLowerCase()))||Object.values(f.metadata||{}).some(S=>String(S).toLowerCase().includes(g.toLowerCase()))):m,[m,g]),h=(0,ni.useMemo)(()=>{let f=(S,N)=>{if(N.length===0)return{};let[k,...z]=N;return S.reduce((_,E)=>{let W=E.metadata?.[k]||"Uncategorized",oe=String(W);if(_[oe]||(_[oe]={documents:[],children:{}}),z.length===0)_[oe].documents.push(E);else{let ge=f([E],z),D=Object.keys(ge)[0];D&&(_[oe].children||(_[oe].children={}),_[oe].children[D]?_[oe].children[D].documents.push(...ge[D].documents):_[oe].children[D]=ge[D])}return _},{})};return f(v,t.groupBy)},[v,t.groupBy]),c=f=>{r(f),a?.(f)};return(0,vi.jsxs)("div",{className:`flex h-full ${i||""}`,children:[(0,vi.jsxs)("div",{className:"w-1/3 border-r border-border bg-muted/20",children:[(0,vi.jsx)("div",{className:"p-6 border-b border-border",children:(0,vi.jsxs)("div",{className:"relative",children:[(0,vi.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,vi.jsx)(Cr.Search,{className:"h-4 w-4 text-muted-foreground"})}),(0,vi.jsx)(de,{placeholder:"Search knowledge base...",value:g,onChange:f=>p(f.target.value),className:"pl-10 bg-background/80 border-border focus:border-primary/50 focus:ring-primary/20 rounded-xl h-11 text-sm placeholder:text-muted-foreground"})]})}),(0,vi.jsx)(Ze,{className:"h-[calc(100%-100px)]",children:(0,vi.jsx)("div",{className:"p-4 space-y-3",children:t.groupBy.length===0?(0,vi.jsx)(vi.Fragment,{children:(0,vi.jsx)(oi,{label:"Document",documents:v,level:0,onDocumentClick:c,selectedDocumentId:n,showDocumentCount:t.showDocumentCount},"Document")}):(0,vi.jsxs)(vi.Fragment,{children:[Object.entries(h).map(([f,S])=>(0,vi.jsx)(oi,{label:f,documents:S.documents,children:S.children,level:0,onDocumentClick:c,selectedDocumentId:n,showDocumentCount:t.showDocumentCount},f)),Object.keys(h).length===0&&(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center text-muted-foreground py-12",children:[(0,vi.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-muted flex items-center justify-center",children:(0,vi.jsx)(Cr.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,vi.jsx)("p",{className:"text-sm font-medium",children:"Cr documents found"}),(0,vi.jsx)("p",{className:"text-xs Cr-1",children:"Try adjusting your search terms"})]})]})})})]}),(0,vi.jsx)("div",{className:"flex-1 bg-background overflow-scroll",children:x?(0,vi.jsx)(hr,{document:x,onDocumentUpdate:s,editable:l}):(0,vi.jsx)("div",{className:"h-full flex items-center justify-center text-center",children:(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4},className:"max-w-sm",children:[(0,vi.jsx)("div",{className:"w-20 h-20 mx-auto mb-6 rounded-full bg-primary/10 flex items-center justify-center",children:(0,vi.jsx)(Cr.FileText,{className:"h-10 w-10 text-primary"})}),(0,vi.jsx)("h3",{className:"text-xl font-semibold text-foreground mb-2",children:"Select a document"}),(0,vi.jsx)("p",{className:"text-muted-foreground leading-relaxed",children:"Choose any document from the knowledge base to view its content and details"})]})})})]})}var yr=({isOpen:e,onClose:t,onAddKnowledge:a,knowledgeContexts:o})=>{let s=()=>{let h=new Set;return o.forEach(c=>{c.menuConfig.groupBy.forEach(f=>h.add(f))}),{contextKeys:Array.from(h).sort(),allKeys:Array.from(h).sort()}},[n,i]=(0,ni.useState)(()=>{let h=s();return{name:"",description:"",metadata:h.contextKeys.length>0?h.contextKeys.map(c=>({key:c,value:""})):[{key:"",value:""}]}}),l=h=>{if(h.preventDefault(),!n.name)return;let c=n.metadata.filter(S=>S.key&&S.key.trim()&&S.value&&S.value.trim());a({name:n.name,description:n.description,metadata:c,source:"payload",visibility:"public",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()});let f=s();i({name:"",description:"",metadata:f.contextKeys.length>0?f.contextKeys.map(S=>({key:S,value:""})):[{key:"",value:""}]}),t()},g=()=>{let h=s();i({name:"",description:"",metadata:h.contextKeys.length>0?h.contextKeys.map(c=>({key:c,value:""})):[{key:"",value:""}]}),t()},p=s(),x=h=>{let c=new Set;return Array.from(c).sort()},r=(h,c)=>{i(f=>{let S=f.metadata.find(N=>N.key===h);return S&&(S.value=c),{...f,metadata:[...f.metadata.filter(N=>N.key!==h),{key:h,value:c}]}})},m=(h,c)=>{c==="__custom__"?r(h,""):r(h,c)},y=()=>{r(" ","")},v=h=>{i(c=>{let f=[...c.metadata],S=f.findIndex(N=>N.key===h);return S!==-1&&f.splice(S,1),{...c,metadata:f}})};return(0,vi.jsx)(Qe,{open:e,onOpenChange:g,children:(0,vi.jsxs)(wt,{className:"sm:max-w-md",children:[(0,vi.jsx)(Ct,{children:(0,vi.jsx)(lt,{children:"Add New Knowledge source"})}),(0,vi.jsxs)("form",{onSubmit:l,className:"space-y-4",children:[(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsxs)("div",{children:[(0,vi.jsx)(xe,{htmlFor:"name",children:"Name *"}),(0,vi.jsx)(de,{id:"name",value:n.name,onChange:h=>i(c=>({...c,name:h.target.value})),required:!0})]}),(0,vi.jsxs)("div",{children:[(0,vi.jsx)(xe,{htmlFor:"name",children:"Description"}),(0,vi.jsx)(de,{id:"name",value:n.description,onChange:h=>i(c=>({...c,description:h.target.value})),required:!0})]}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,vi.jsxs)("div",{children:[(0,vi.jsx)(xe,{htmlFor:"metadata",children:"Metadata"}),p.contextKeys.length>0?(0,vi.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Context keys: ",p.contextKeys.slice(0,4).join(", "),p.contextKeys.length>4&&` +${p.contextKeys.length-4} more`," ","\u2022 Fill in values or add more fields"]}):(0,vi.jsx)("p",{className:"text-xs text-muted-foreground",children:"Add key-value metadata to organize and categorize your knowledge"})]}),(0,vi.jsxs)(C,{type:"button",variant:"outline",size:"sm",onClick:y,className:"gap-1 h-8",children:[(0,vi.jsx)(Cr.Plus,{className:"h-3 w-3"}),"Add"]})]}),(0,vi.jsx)("div",{className:"space-y-2",children:n.metadata.map(({key:h,value:c},f)=>{let S=x(h);return(0,vi.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,vi.jsx)(de,{value:h,onChange:N=>{let k=N.target.value||" ",z=n.metadata.find(ae=>ae.key===h)?.value;i(ae=>{let _=[...ae.metadata],E=_.findIndex(W=>W.key===h);return E!==-1&&_.splice(E,1),k&&_.push({key:k,value:z||""}),{...ae,metadata:_}}),N.target.focus()},placeholder:p.allKeys.length>0?`e.g., ${p.allKeys[0]}`:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${h}`}),(0,vi.jsx)("datalist",{id:`metadata-keys-${h}`,children:p.allKeys.map(N=>(0,vi.jsx)("option",{value:N},N))}),(0,vi.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),S.length>0?(0,vi.jsxs)(ot,{value:String(c||""),onValueChange:N=>m(h,N),children:[(0,vi.jsx)(_e,{className:"flex-1 h-8 text-sm",children:(0,vi.jsx)(it,{placeholder:"Value"})}),(0,vi.jsxs)(We,{children:[S.map(N=>(0,vi.jsx)(Ae,{value:N,children:N},N)),(0,vi.jsx)(Ae,{value:"__custom__",children:(0,vi.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,vi.jsx)(de,{value:String(c||""),onChange:N=>r(h,N.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,vi.jsx)(C,{type:"button",variant:"ghost",size:"sm",onClick:()=>v(h),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,vi.jsx)(Cr.vi,{className:"h-3 w-3"})})]},`metadata-key-${f}`)})})]})]}),(0,vi.jsxs)("div",{className:"flex justify-end gap-3 vi-4",children:[(0,vi.jsxs)(C,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,vi.jsx)(Cr.vi,{className:"h-4 w-4"}),"Cancel"]}),(0,vi.jsxs)(C,{type:"submit",children:[(0,vi.jsx)(Cr.Save,{className:"h-4 w-4"}),"Create"]})]})]})]})})};var Na=require("sonner");var wr=({isOpen:e,onClose:t,knowledgeSources:a,onCreate:o,onUpdate:s,onDelete:n})=>{let[i,l]=(0,ni.useState)(""),[g,p]=(0,ni.useState)(null),[x,r]=(0,ni.useState)(""),[m,y]=(0,ni.useState)(""),[v,h]=(0,ni.useState)([]),[c,f]=(0,ni.useState)(""),[S,N]=(0,ni.useState)("name"),[k,z]=(0,ni.useState)("asc"),[ae,_]=(0,ni.useState)(!0),E=a.filter(d=>d.label.toLowerCase().includes(i.toLowerCase())||d.description?.toLowerCase().includes(i.toLowerCase())),W=d=>{p(d),r(d.label),y(d.description||""),h(d.menuConfig?.groupBy||[]),N(d.menuConfig?.sortBy||"name"),z(d.menuConfig?.sortOrder||"asc"),_(d.menuConfig?.showDocumentCount||!0)},oe=()=>{c.trim()&&!v.includes(c.trim())&&(h([...v,c.trim()]),f(""))},ge=d=>{h(v.filter(H=>H!==d))},D=d=>{d.key==="Enter"&&(d.preventDefault(),oe())},le=()=>{p(null),r(""),y(""),h([]),f(""),N("name"),z("asc"),_(!0)},Me=()=>{if(!x.trim()){Na.toast.error("Label is required");return}o?.({id:x.trim(),label:x.trim(),description:m.trim(),menuConfig:{groupBy:v,sortBy:S,sortOrder:k,showDocumentCount:ae}}),Na.toast.success("Knowledge source created successfully"),le()},u=()=>{if(g){if(!x.trim()){Na.toast.error("Label is required");return}s?.({id:g.id,label:x.trim(),description:m.trim(),menuConfig:{groupBy:v,sortBy:S,sortOrder:k,showDocumentCount:ae}}),Na.toast.success("Knowledge source updated successfully"),le()}},O=()=>{g&&window.confirm(`Are you sure you want to delete "${g.label}"?`)&&(n?.(g.id),Na.toast.success("Knowledge source deleted successfully"),le())};return(0,vi.jsx)(Qe,{open:e,onOpenChange:t,children:(0,vi.jsxs)(wt,{className:"sm:max-w-[900px] max-h-[90vh] bg-card border-border p-0",children:[(0,vi.jsx)(Ct,{className:"px-6 vi-6 pb-4 border-b border-border",children:(0,vi.jsx)(lt,{className:"text-foreground text-2xl",children:"Manage Knowledge Sources"})}),(0,vi.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 p-6 overflow-hidden",children:[(0,vi.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,vi.jsxs)("div",{className:"relative",children:[(0,vi.jsx)(Cr.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,vi.jsx)(de,{value:i,onChange:d=>l(d.target.value),placeholder:"Search contexts...",className:"pl-10 bg-background border-input"})]}),(0,vi.jsx)(Ze,{className:"rounded-md border border-border bg-background flex-1",children:(0,vi.jsx)("div",{className:"p-2 space-y-2",children:E.length===0?(0,vi.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[(0,vi.jsx)(Cr.FileText,{className:"h-12 w-12 text-muted-foreground mb-2"}),(0,vi.jsx)("p",{className:"text-sm text-muted-foreground",children:i?"Cr contexts found":"Cr contexts yet"})]}):E.map(d=>(0,vi.jsx)("div",{onClick:()=>W(d),className:w("p-3 rounded-lg cursor-pointer transition-all hover:bg-accent/50",g?.id===d.id&&"bg-accent text-accent-foreground"),children:(0,vi.jsx)("div",{className:"flex items-start justify-between gap-2",children:(0,vi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,vi.jsx)("h4",{className:"font-medium truncate",children:d.label}),d.description&&(0,vi.jsx)("p",{className:"text-sm opacity-80 truncate Cr-1",children:d.description}),(d.menuConfig?.groupBy||[]).length>0&&(0,vi.jsxs)("div",{className:"flex flex-wrap gap-1 Cr-2",children:[d.menuConfig?.groupBy?.slice(0,3).map(H=>(0,vi.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-secondary text-secondary-foreground",children:H},H)),(d.menuConfig?.groupBy||[]).length>3&&(0,vi.jsxs)("span",{className:"text-xs px-2 py-0.5",children:["+",(d.menuConfig?.groupBy||[]).length-3]})]})]})})},d.id))})}),(0,vi.jsx)(C,{variant:"outline",onClick:le,className:"w-full",children:"Clear Selection / New Context"})]}),(0,vi.jsxs)("div",{className:"space-y-4",children:[(0,vi.jsx)(Ze,{className:"h-[400px] pr-4",children:(0,vi.jsxs)("div",{className:"space-y-4",children:[(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsxs)(xe,{htmlFor:"label",className:"text-foreground",children:["Label ",(0,vi.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,vi.jsx)(de,{id:"label",value:x,onChange:d=>r(d.target.value),placeholder:"Enter label",className:"bg-background border-input"})]}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{htmlFor:"description",className:"text-foreground",children:"Description"}),(0,vi.jsx)(et,{id:"description",value:m,onChange:d=>y(d.target.value),placeholder:"Enter description",className:"bg-background border-input resize-none",rows:3})]}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{className:"text-foreground",children:"Group By"}),(0,vi.jsxs)("div",{className:"flex gap-2",children:[(0,vi.jsx)(de,{value:c,onChange:d=>f(d.target.value),onKeyPress:D,placeholder:"Type a tag and press Enter",className:"bg-background border-input flex-1"}),(0,vi.jsx)(C,{onClick:oe,className:"bg-accent hover:bg-accent/90",children:"Add"})]}),v.length>0&&(0,vi.jsx)("div",{className:"flex flex-wrap gap-2 Cr-2",children:v.map(d=>(0,vi.jsxs)("div",{className:"bg-secondary text-secondary-foreground px-3 py-1 rounded-md flex items-center gap-2 text-sm",children:[d,(0,vi.jsx)(Cr.vi,{className:"h-3 w-3 cursor-pointer hover:text-destructive",onClick:()=>ge(d)})]},d))})]}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{htmlFor:"sortBy",className:"text-foreground",children:"Sort By"}),(0,vi.jsxs)(ot,{value:S,onValueChange:d=>N(d),children:[(0,vi.jsx)(_e,{className:"bg-background border-input",children:(0,vi.jsx)(it,{})}),(0,vi.jsxs)(We,{className:"bg-popover border-border",children:[(0,vi.jsx)(Ae,{value:"name",children:"Name"}),(0,vi.jsx)(Ae,{value:"createdAt",children:"Created At"})]})]})]}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{htmlFor:"sortOrder",className:"text-foreground",children:"Sort Order"}),(0,vi.jsxs)(ot,{value:k,onValueChange:d=>z(d),children:[(0,vi.jsx)(_e,{className:"bg-background border-input",children:(0,vi.jsx)(it,{})}),(0,vi.jsxs)(We,{className:"bg-popover border-border",children:[(0,vi.jsx)(Ae,{value:"asc",children:"Ascending"}),(0,vi.jsx)(Ae,{value:"desc",children:"Descending"})]})]})]}),(0,vi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,vi.jsx)(Pa,{id:"showDocumentCount",checked:ae,onCheckedChange:d=>_(d)}),(0,vi.jsx)(xe,{htmlFor:"showDocumentCount",className:"text-sm font-normal cursor-pointer text-foreground",children:"Show Document Count"})]})]})}),(0,vi.jsx)("div",{className:"flex gap-3 vi-4 border-t border-border",children:g?(0,vi.jsxs)(vi.Fragment,{children:[(0,vi.jsxs)(C,{variant:"destructive",onClick:O,className:"flex-1",children:[(0,vi.jsx)(Cr.Trash2,{className:"mr-2 h-4 w-4"}),"Delete"]}),(0,vi.jsx)(C,{onClick:u,className:"flex-1 bg-accent hover:bg-accent/90",children:"Update"})]}):(0,vi.jsx)(C,{onClick:Me,className:"w-full bg-accent hover:bg-accent/90",children:"Create"})})]})]}),(0,vi.jsx)("div",{className:"px-6 py-4 border-t border-border flex justify-end",children:(0,vi.jsx)(C,{variant:"outline",onClick:t,children:"Close"})})]})})};function ii({documents:e=[],contexts:t=[],onDocumentClick:a=r=>console.log("Document clicked:",r),onDocumentShare:o=r=>console.log("Share document:",r),onLoadDocumentContent:s,selectedDocumentId:n,onAddKnowledge:i,onDocumentUpdate:l,onAddTeamContext:g,onUpdateTeamContext:p,onDeleteTeamContext:x}){let[r,m]=(0,ni.useState)(t[0]),[y,v]=(0,ni.useState)(!1),[h,c]=(0,ni.useState)(!1),[f,S]=(0,ni.useState)(!1);(0,ni.useEffect)(()=>{if(!r&&t&&t.length>0)m(t[0]);else{let k=t.find(z=>z.id===r?.id);m(k||t[0])}},[t]);let N=k=>{i&&(S(!0),i(k)),v(!1)};return(0,vi.jsxs)("div",{className:"flex flex-col h-full",children:[(0,vi.jsxs)("div",{className:"px-2 md:px-4 py-4 flex-shrink-0",children:[f&&(0,vi.jsxs)("div",{className:"absolute inset-0 bg-background/90 z-[9999] flex flex-col items-center justify-center gap-4",children:[(0,vi.jsx)(Cr.Loader2,{className:"h-8 w-8 animate-spin text-primary"}),(0,vi.jsx)("p",{className:"font-semibold text-lg",children:"Initializing document..."})]}),t&&t.length>0&&(0,vi.jsxs)("div",{className:"",children:[(0,vi.jsx)("div",{className:"",children:(0,vi.jsxs)("nav",{className:"-mb-px flex justify-between items-center",children:[(0,vi.jsx)("div",{className:"flex space-x-8 overflow-x-auto",children:t.map(k=>(0,vi.jsxs)("button",{onClick:()=>m(k),className:`group inline-flex items-center gap-2 py-3 px-1 border-b-2 font-medium text-sm whitespace-nowrap transition-colors ${r?.id===k.id?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground"}`,children:[k.icon,k.label]},k.id))}),(0,vi.jsxs)(gt,{children:[(0,vi.jsx)(ft,{children:(0,vi.jsxs)("div",{className:"inline-flex border border-primary rounded-xl items-center justify-center gap-2 py-2 px-3 text-sm font-medium text-primary hover:text-primary/80 transition-colors whitespace-nowrap",children:["Actions ",(0,vi.jsx)(Cr.ChevronDown,{className:"h-4 w-4"})]})}),(0,vi.jsxs)(dt,{children:[(0,vi.jsx)(ze,{onClick:()=>v(!0),children:"Add Knowledge"}),(0,vi.jsx)(ze,{onClick:()=>c(!0),children:"Manage Contexts"})]})]})]})}),r?.description&&(0,vi.jsx)("div",{className:"Cr-3 px-1",children:(0,vi.jsx)("p",{className:"text-sm text-primary",children:r?.description})})]})]}),r?(0,vi.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4",children:(0,vi.jsx)("div",{className:"h-full rounded-xl border overflow-hidden",children:(0,vi.jsx)(br,{documents:e,menuConfig:r?.menuConfig,onDocumentClick:a,onDocumentShare:o,selectedDocumentId:n,onDocumentUpdate:l})})}):(0,vi.jsxs)("div",{children:[(0,vi.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,vi.jsx)("p",{className:"text-muted-foreground",children:"Cr contexts available"})}),(0,vi.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,vi.jsx)(C,{onClick:()=>c(!0),children:"Add Context"})})]}),(0,vi.jsxs)(vi.Fragment,{children:[(0,vi.jsx)(wr,{isOpen:h,onClose:()=>c(!1),knowledgeSources:t,onCreate:g,onUpdate:p,onDelete:x}),(0,vi.jsx)(yr,{isOpen:y,onClose:()=>v(!1),onAddKnowledge:N,knowledgeContexts:t})]})]})}function Nr({title:e="Digital Colleagues",businessUnits:t,projects:a,fileCount:o,teamMemberCount:s,onCreateProject:n,onOpenProject:i,sidebarItems:l,initialColleagues:g,users:p,onColleagueAdd:x,onColleagueEdit:r,onColleagueDelete:m}){let[y,v]=(0,ni.useState)("home"),[h,c]=(0,ni.useState)(t[0]),f=D=>{console.log("Opening app:",D.name)},S=D=>{console.log("Favoriting app:",D.name)},N=D=>{console.log("Opening file:",D.name)},k=D=>{console.log("Sharing file:",D.name)},z=D=>{console.log("Opening project:",D.name),i(D)},ae=D=>{console.log("Sharing project:",D.name)},_=D=>{c(D),console.log("Business unit changed to:",D.name)},E=()=>{console.log("Copilot clicked - navigating to chat"),v("chat")},W=D=>{console.log("Notification removed:",D)},oe=()=>{console.log("All notifications removed")},ge=()=>{switch(y){case"home":return(0,vi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,vi.jsxs)("section",{className:"text-center py-12",children:[(0,vi.jsxs)("h1",{className:"text-4xl font-bold mb-4",children:["Welcome to the ",h.name," team"]}),(0,vi.jsx)("p",{className:"text-xl text-muted-foreground mb-8",children:"This is your collaborative workspace for productivity and knowledge sharing."})]}),(0,vi.jsxs)("section",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[(0,vi.jsxs)("div",{className:"bg-card p-6 rounded-lg border",children:[(0,vi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Projects"}),(0,vi.jsx)("p",{className:"text-3xl font-bold text-primary",children:a.length}),(0,vi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Active projects"})]}),(0,vi.jsxs)("div",{className:"bg-card p-6 rounded-lg border",children:[(0,vi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Team Members"}),(0,vi.jsx)("p",{className:"text-3xl font-bold text-primary",children:s}),(0,vi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Collaborators"})]}),(0,vi.jsxs)("div",{className:"bg-card p-6 rounded-lg border",children:[(0,vi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Files"}),(0,vi.jsx)("p",{className:"text-3xl font-bold text-primary",children:o}),(0,vi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Project files"})]})]}),(0,vi.jsx)(Bt,{title:"Chat with your team",gradient:"bg-gradient-to-r from-pink-600 via-red-600 to-orange-600",primaryAction:{label:"Go",onClick:()=>v("chat")}})]});case"colleagues":return(0,vi.jsx)(ei,{initialColleagues:g,availableUsers:p,onColleagueAdd:x,onColleagueEdit:r,onColleagueDelete:m});case"chat":return(0,vi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,vi.jsxs)("section",{className:"text-center py-12",children:[(0,vi.jsx)("h1",{className:"text-4xl font-bold mb-4",children:"Team Chat"}),(0,vi.jsxs)("p",{className:"text-xl text-muted-foreground mb-8",children:["Connect with your ",h.name," team members and collaborate in real-time."]})]}),(0,vi.jsx)(Bt,{title:"Launch Full Chat Interface",description:"Access the complete chat experience with AI assistance.",gradient:"bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600",primaryAction:{label:"Open Chat",onClick:()=>console.log("Open full chat interface")}})]});case"apps":return(0,vi.jsxs)("div",{className:"space-y-8",children:[(0,vi.jsx)(Bt,{title:"Creative Apps Collection",description:"Discover our full suite of professional design and creative applications.",gradient:"bg-gradient-to-r from-pink-600 via-red-600 to-orange-600",primaryAction:{label:"Install Desktop App",onClick:()=>console.log("Install desktop app clicked")}}),(0,vi.jsxs)("section",{className:"space-y-4",children:[(0,vi.jsx)("h2",{className:"text-2xl font-semibold",children:"New Releases"}),(0,vi.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",children:Xo.filter(D=>D.new).map(D=>(0,vi.jsx)(Eo,{app:D,showProgress:!0,onOpen:f,onFavorite:S},D.name))})]}),(0,vi.jsxs)("section",{className:"space-y-4",children:[(0,vi.jsx)("h2",{className:"text-2xl font-semibold",children:"All Apps"}),(0,vi.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",children:Xo.map(D=>(0,vi.jsx)(Eo,{app:D,onOpen:f,onFavorite:S},D.name))})]})]});case"knowledge":return(0,vi.jsx)(ii,{});case"files":return(0,vi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,vi.jsx)(Bt,{title:"Your Creative Files",description:"Access, manage, and share all your design files in one place.",gradient:"bg-gradient-to-r from-teal-600 via-cyan-600 to-blue-600",primaryAction:{label:"Upload Files",onClick:()=>console.log("Upload files clicked")}}),(0,vi.jsxs)("section",{className:"space-y-4",children:[(0,vi.jsx)("div",{className:"flex items-center justify-between",children:(0,vi.jsx)("h2",{className:"text-2xl font-semibold",children:"All Files"})}),(0,vi.jsx)(Xn,{files:Qn,onFileClick:N})]})]});case"projects":return(0,vi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,vi.jsx)(Bt,{title:"Project Management",description:"Organize your creative work into projects and collaborate with your team.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"New Project",onClick:n}}),(0,vi.jsxs)("section",{className:"space-y-4",children:[(0,vi.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Projects"}),(0,vi.jsx)("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:a.map(D=>(0,vi.jsx)(Yn,{project:D,onOpen:z,onShare:ae},D.name))})]})]});case"learn":return(0,vi.jsxs)("div",{className:"space-y-8",children:[(0,vi.jsx)(Bt,{title:"Learn & Grow",description:"Expand your creative skills with tutorials, courses, and resources.",gradient:"bg-gradient-to-r from-green-600 via-emerald-600 to-teal-600",primaryAction:{label:"Upgrade to Pro",onClick:()=>console.log("Upgrade to pro clicked")}}),(0,vi.jsxs)("section",{className:"space-y-4",children:[(0,vi.jsx)("h2",{className:"text-2xl font-semibold",children:"Featured Tutorials"}),(0,vi.jsx)("div",{className:"grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3",children:er.slice(0,3).map(D=>(0,vi.jsxs)("div",{className:"rounded-3xl border p-6",children:[(0,vi.jsx)("h3",{className:"font-semibold mb-2",children:D.title}),(0,vi.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:D.description}),(0,vi.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,vi.jsx)("span",{children:D.duration}),(0,vi.jsx)("span",{children:D.level})]})]},D.title))})]})]});default:return null}};return(0,vi.jsx)(Xi,{sidebarItems:ar,title:e,notifications:or,businessUnits:t,currentBusinessUnit:h,onBusinessUnitChange:_,activeTab:y,onTabChange:v,showTabs:!0,onActionClick:E,actionIcon:(0,vi.jsx)(Cr.Bot,{className:"mr-2 h-4 w-4"}),actionText:"Start Chat",onNotificationRemove:W,onRemoveAll:oe,children:(0,vi.jsx)(Do.AnimatePresence,{mode:"wait",children:(0,vi.jsx)(Do.motion.div,{className:"flex-1 h-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:ge()},y)})})}
10
+ `),a=[],o=[],s=[],n=null,i=()=>{if(o.length>0){for(let g=0;g<o.length;g++){let p=o[g],x=Zt(p),r=x.length>0?x.map(m=>({...m,mode:"normal",style:"",detail:0,version:1})):[{type:"text",text:"",format:0,mode:"normal",style:"",detail:0,version:1}];a.push({type:"paragraph",children:r,direction:"ltr",format:"",indent:0,version:1})}o=[]}},l=()=>{s.length>0&&n&&(a.push({type:"list",listType:n,tag:n==="number"?"ol":"ul",start:1,format:"",indent:0,version:1,direction:"ltr",children:s}),s=[],n=null)};for(let g of t){let p=g.trim();if(!p){i(),l(),a.push({children:[],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:""});continue}let x=p.match(/^(#{1,6})\s+(.+)$/);if(x){i(),l();let y=x[1].length,v=x[2],h=Zt(v);a.push({type:"heading",tag:`h${y}`,children:h.length>0?h:[{type:"text",text:"",format:0}]});continue}let r=p.match(/^(\d+)\.\s+(.*)$/);if(r){i(),n==="bullet"&&l(),n!=="number"&&(s.length>0&&l(),n="number");let y=r[2]||"",v=Zt(y),h=v.length>0?v.map(c=>({...c,mode:"normal",style:"",detail:0,version:1})):[{type:"text",text:"",format:0,mode:"normal",style:"",detail:0,version:1}];s.push({type:"listitem",value:s.length+1,format:"start",indent:0,version:1,direction:"ltr",children:[{type:"paragraph",children:h,direction:"ltr",format:"",indent:0,version:1}]});continue}let m=p.match(/^[-*+]\s+(.+)$/);if(m){i(),n==="number"&&l(),n!=="bullet"&&(s.length>0&&l(),n="bullet");let y=m[1],v=Zt(y),h=v.length>0?v.map(c=>({...c,mode:"normal",style:"",detail:0,version:1})):[{type:"text",text:"",format:0,mode:"normal",style:"",detail:0,version:1}];s.push({type:"listitem",value:s.length+1,format:"start",indent:0,version:1,direction:"ltr",children:[{type:"paragraph",children:h,direction:"ltr",format:"",indent:0,version:1}]});continue}s.length>0&&l(),o.push(g)}return i(),l(),a.length===0&&a.push({type:"paragraph",children:[{type:"text",text:"",format:0}]}),{root:{type:"root",children:a,direction:"ltr",format:"",indent:0,version:1}}},Bs=async e=>{let t="",a,o="text";if(e.url)try{let s=e.url;!s.startsWith("http://")&&!s.startsWith("https://")&&!s.startsWith("/")&&(s="/"+s);let n=await fetch(s);n.ok?(t=await n.text(),console.log("Successfully loaded content, length:",t.length)):console.error("Failed to fetch file content:",n.status,n.statusText)}catch(s){console.error("Failed to fetch file content:",s)}else console.warn("Cr URL provided for file:",e.name);return e.mimeType==="text/markdown"?(o="richText",a=Ls(t)):e.mimeType?.startsWith("text/")&&(o="text"),{id:e.id.toString(),title:e.name,description:void 0,content:o==="richText"?void 0:t,richTextContent:o==="richText"?a:void 0,format:o,metadata:{},createdAt:typeof e.createdAt=="string"?new Date(e.createdAt):e.createdAt,updatedAt:new Date}};function Wn({document:e,onCancel:t,onSave:a,onFileUpdate:o}){let[s,n]=(0,ni.useState)(za(e)),[i,l]=(0,ni.useState)(za(e)?{id:e.id.toString(),title:e.name,description:void 0,content:"",format:"text",metadata:{},createdAt:typeof e.createdAt=="string"?new Date(e.createdAt):e.createdAt,updatedAt:new Date}:{...e,updatedAt:new Date}),[g,p]=(0,ni.useState)(za(e)?void 0:i.richTextContent),[x,r]=(0,ni.useState)(!1),m=(0,ni.useRef)(za(e)?e:null);(0,ni.useEffect)(()=>{za(e)?(n(!0),Bs(e).then(c=>{l(c),p(c.richTextContent),n(!1)}).catch(c=>{c instanceof Error&&c.name!=="AbortError"&&(console.error("Failed to convert file:",c),n(!1))})):(l({...e,updatedAt:new Date}),p(e.richTextContent))},[e]);let y=c=>{switch(c){case"markdown":case"mdx":return(0,vi.jsx)(Cr.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,vi.jsx)(Cr.File,{className:"h-6 w-6 text-success"});case"text":return(0,vi.jsx)(Cr.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,vi.jsx)(Cr.File,{className:"h-6 w-6 text-muted-foreground"})}},v=c=>{switch(c){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},h=async()=>{r(!0);try{let c,f;if(m.current&&m.current.mimeType==="text/markdown"){let N=g?Is(g):"";c={...i,format:"markdown",content:N,richTextContent:void 0},f=N}else c={...i,richTextContent:g},f=i.content||"";let S=m.current?m.current.id.toString():i.id;await Promise.resolve(a()),o?.(S,f)}finally{r(!1)}};return(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-screen flex flex-col",children:[(0,vi.jsx)("div",{className:"border-b border-border bg-card p-8 pb-6",children:(0,vi.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,vi.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,vi.jsx)("div",{className:"flex-1 min-w-0",children:(0,vi.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,vi.jsx)("div",{className:"flex-1 min-w-0",children:(0,vi.jsx)(Fa,{fieldName:"title",value:i.title,label:"",onSave:(c,f)=>l(S=>({...S,title:f})),className:"[&>div:last-child]:text-2xl [&>div:last-child]:font-bold [&>div:last-child]:leading-tight [&>div:last-child]:text-foreground [&>div:last-child]:p-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})}),(0,vi.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${v(i.format)} flex-shrink-0 Cr-1`,children:i.format.toUpperCase()})]})})}),(0,vi.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,vi.jsxs)(C,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,vi.jsx)(Cr.vi,{className:"h-4 w-4"}),"Close"]}),(0,vi.jsxs)(C,{size:"sm",onClick:h,className:"gap-2",disabled:x,children:[x?(0,vi.jsx)(Cr.Loader2,{className:"h-4 w-4 animate-spin"}):(0,vi.jsx)(Cr.Save,{className:"h-4 w-4"}),x?"Saving...":"Save"]})]})]})}),(0,vi.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,vi.jsx)("div",{className:"p-8 vi-0 h-full max-h-full overflow-auto",children:s?(0,vi.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,vi.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,vi.jsx)(Cr.Loader2,{className:"h-8 w-8 animate-spin text-primary"}),(0,vi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading file content..."})]})}):(0,vi.jsx)(vi.Fragment,{children:i.format==="richText"?(0,vi.jsx)(fa,{setValue:p,value:g,name:"richTextContent"},`richtext-${i.id}-${s?"loading":"loaded"}`):(0,vi.jsx)(et,{value:i.content||"",onChange:c=>l(f=>({...f,content:c.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})})})})]})}var Gn=e=>{if(!e||e<=0)return"0 KB";let t=e/1024;return t<1024?`${t.toFixed(2)} KB`:`${(t/1024).toFixed(2)} MB`};function Xn({files:e,onFileClick:t,onFileDelete:a,onFileUpdate:o,showHeader:s=!0,className:n,viewMode:i="list"}){let[l,g]=(0,ni.useState)(!1),[p,x]=(0,ni.useState)(!1),[r,m]=(0,ni.useState)(null),y=()=>{g(!1),m(null)},v=()=>{x(!0),setTimeout(()=>{x(!1),g(!1),m(null)},500)},h=c=>{m(c),g(!0)};return(0,$.jsxs)("div",{className:w("rounded-3xl border overflow-hidden",n),children:[(0,$.jsxs)("div",{className:"bg-muted/50 p-3 flex items-center justify-between",children:[s&&i==="list"&&(0,$.jsxs)("div",{className:"hidden md:grid md:grid-cols-10 text-sm font-medium flex-1",children:[(0,$.jsx)("div",{className:"col-span-6",children:"Name"}),(0,$.jsx)("div",{className:"col-span-2",children:"Size"}),(0,$.jsx)("div",{className:"col-span-2",children:"Modified"})]}),i==="card"&&(0,$.jsx)("div",{className:"text-sm font-medium",children:"Files"})]}),i==="list"&&(0,$.jsx)("div",{className:"divide-y",children:e.map(c=>(0,$.jsxs)(Do.motion.div,{whileHover:{backgroundColor:"rgba(0,0,0,0.02)"},className:"p-3 md:grid md:grid-cols-10 items-center flex flex-col md:flex-row gap-3 md:gap-0 cursor-pointer",onClick:()=>t?.(c),children:[(0,$.jsxs)("div",{className:"col-span-6 flex items-center gap-3 w-full md:w-auto",children:[(0,$.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-2xl bg-muted"}),(0,$.jsx)("div",{children:(0,$.jsx)("p",{className:"font-medium",children:c.name})})]}),(0,$.jsx)("div",{className:"col-span-2 text-sm md:text-base",children:Gn(c.filesize)}),(0,$.jsxs)("div",{className:"col-span-2 flex items-center justify-between w-full md:w-auto",children:[(0,$.jsx)("span",{className:"text-sm md:text-base",children:new Date(c.createdAt).toLocaleDateString()}),(0,$.jsxs)("div",{className:"flex gap-1",children:[c.mimeType==="text/markdown"&&(0,$.jsx)(C,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl",onClick:f=>{f.stopPropagation(),h(c)},children:(0,$.jsx)(Cr.Edit,{className:"h-4 w-4"})}),(0,$.jsx)(C,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl text-red-500 hover:text-red-600",onClick:f=>{f.stopPropagation(),a?.(c)},children:(0,$.jsx)(Cr.Trash2,{className:"h-4 w-4"})})]})]})]},c.name))}),i==="card"&&(0,$.jsx)("div",{className:"p-4 grid grid-cols-1 gap-4",children:e.map(c=>(0,$.jsx)(Do.motion.div,{whileHover:{scale:1.02},className:"border rounded-lg p-4 bg-card hover:bg-muted/50 transition-colors cursor-pointer",onClick:()=>t?.(c),children:(0,$.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,$.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,$.jsxs)("div",{className:"flex items-center gap-3",children:[(0,$.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-2xl bg-muted flex-shrink-0"}),(0,$.jsx)("div",{className:"min-w-0 flex-1",children:(0,$.jsx)("p",{className:"font-medium truncate",children:c.name})})]}),(0,$.jsxs)("div",{className:"space-y-1 text-sm text-muted-foreground pl-[52px]",children:[(0,$.jsxs)("div",{className:"flex items-center gap-2",children:[(0,$.jsx)("span",{className:"font-medium",children:"Size:"}),(0,$.jsx)("span",{children:Gn(c.filesize)})]}),(0,$.jsxs)("div",{className:"flex items-center gap-2",children:[(0,$.jsx)("span",{className:"font-medium",children:"Modified:"}),(0,$.jsx)("span",{children:new Date(c.createdAt).toLocaleDateString()})]})]})]}),(0,$.jsxs)("div",{className:"flex flex-col gap-2 flex-shrink-0",children:[c.mimeType==="text/markdown"&&(0,$.jsx)(C,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl",onClick:f=>{f.stopPropagation(),h(c)},title:"Edit",children:(0,$.jsx)(Cr.Edit,{className:"h-4 w-4"})}),(0,$.jsx)(C,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl text-red-500 hover:text-red-600",onClick:f=>{f.stopPropagation(),a?.(c)},title:"Delete",children:(0,$.jsx)(Cr.Trash2,{className:"h-4 w-4"})})]})]})},c.name))}),(0,$.jsx)(Qe,{open:l,onOpenChange:c=>!c&&y(),children:(0,$.jsxs)(pa,{children:[(0,$.jsx)(ta,{}),(0,$.jsxs)(Jn.Content,{className:w("fixed inset-0 z-50 bg-background p-0 m-0 border-0","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"),children:[(0,$.jsx)(lt,{className:"sr-only",children:r?`Edit ${r.name}`:"Edit File"}),p&&(0,$.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center z-50",children:(0,$.jsx)(Cr.Loader2,{className:"h-8 w-8 animate-spin text-primary"})}),r&&(0,$.jsx)(Wn,{document:r,onSave:v,onFileUpdate:o,onCancel:y})]})]})})]})}function Yn({project:e,onOpen:t,onShare:a,className:o}){return(0,vi.jsx)(Do.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:o,children:(0,vi.jsxs)(me,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,vi.jsxs)(Se,{children:[(0,vi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,vi.jsx)(Pe,{children:e.name}),(0,vi.jsxs)(De,{variant:"outline",className:"rounded-xl",children:["Due ",e.dueDate]})]}),(0,vi.jsx)(Ia,{children:e.description})]}),(0,vi.jsxs)(pe,{className:"space-y-4",children:[(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,vi.jsx)("span",{children:"Progress"}),(0,vi.jsxs)("span",{children:[e.progress,"%"]})]}),(0,vi.jsx)(Ea,{value:e.progress,className:"h-2 rounded-xl"})]}),(0,vi.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,vi.jsxs)("div",{className:"flex items-center",children:[(0,vi.jsx)(Cr.Users,{className:"mr-1 h-4 w-4"}),e.members," members"]}),(0,vi.jsxs)("div",{className:"flex items-center",children:[(0,vi.jsx)(Cr.FileText,{className:"mr-1 h-4 w-4"}),e.files," files"]})]})]}),(0,vi.jsxs)(La,{className:"flex gap-2",children:[(0,vi.jsx)(C,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"Open Project"}),(0,vi.jsx)(C,{variant:"outline",size:"icon",className:"rounded-2xl",onClick:()=>a?.(e),children:(0,vi.jsx)(Cr.Share2,{className:"h-4 w-4"})})]})]})})}var Xo=[{name:"PixelMaster",icon:(0,vi.jsx)(Cr.ImageIcon,{className:"text-violet-500"}),description:"Advanced image editing and composition",category:"Creative",recent:!0,new:!1,progress:100},{name:"VectorPro",icon:(0,vi.jsx)(Cr.Brush,{className:"text-orange-500"}),description:"Professional vector graphics creation",category:"Creative",recent:!0,new:!1,progress:100},{name:"VideoStudio",icon:(0,vi.jsx)(Cr.Video,{className:"text-pink-500"}),description:"Cinematic video editing and production",category:"Video",recent:!0,new:!1,progress:100},{name:"MotionFX",icon:(0,vi.jsx)(Cr.Sparkles,{className:"text-blue-500"}),description:"Stunning visual effects and animations",category:"Video",recent:!1,new:!1,progress:100},{name:"PageCraft",icon:(0,vi.jsx)(Cr.Layers,{className:"text-red-500"}),description:"Professional page design and layout",category:"Creative",recent:!1,new:!1,progress:100},{name:"UXFlow",icon:(0,vi.jsx)(Cr.LayoutGrid,{className:"text-fuchsia-500"}),description:"Intuitive user experience design",category:"Design",recent:!1,new:!0,progress:85},{name:"PhotoLab",icon:(0,vi.jsx)(Cr.Camera,{className:"text-teal-500"}),description:"Advanced photo editing and organization",category:"Photography",recent:!1,new:!1,progress:100},{name:"DocMaster",icon:(0,vi.jsx)(Cr.FileText,{className:"text-red-600"}),description:"Document editing and management",category:"Document",recent:!1,new:!1,progress:100},{name:"WebCanvas",icon:(0,vi.jsx)(Cr.Code,{className:"text-emerald-500"}),description:"Web design and development",category:"Web",recent:!1,new:!0,progress:70},{name:"3DStudio",icon:(0,vi.jsx)(Cr.CuboidIcon,{className:"text-indigo-500"}),description:"3D modeling and rendering",category:"3D",recent:!1,new:!0,progress:60},{name:"FontForge",icon:(0,vi.jsx)(Cr.Type,{className:"text-amber-500"}),description:"Typography and font creation",category:"Typography",recent:!1,new:!1,progress:100},{name:"ColorPalette",icon:(0,vi.jsx)(Cr.Palette,{className:"text-purple-500"}),description:"Color scheme creation and management",category:"Design",recent:!1,new:!1,progress:100}],Qn=[{id:1,filename:"Brand Redesign.pxm",filesize:24.5,url:"https://example.com/brand-redesign.pxm",mimeType:"image/png",name:"Brand Redesign.pxm",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:2,filename:"Company Logo.vec",filesize:8.2,url:"https://example.com/company-logo.vec",mimeType:"image/svg+xml",name:"Company Logo.vec",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:3,filename:"Product Launch Video.vid",filesize:1.2,url:"https://example.com/product-launch-video.vid",mimeType:"video/mp4",name:"Product Launch Video.vid",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:4,filename:"UI Animation.mfx",filesize:345,url:"https://example.com/ui-animation.mfx",mimeType:"video/mp4",name:"UI Animation.mfx",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:5,filename:"Magazine Layout.pgc",filesize:42.8,url:"https://example.com/magazine-layout.pgc",mimeType:"image/png",name:"Magazine Layout.pgc",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:6,filename:"Mobile App Design.uxf",filesize:18.3,url:"https://example.com/mobile-app-design.uxf",mimeType:"image/png",name:"Mobile App Design.uxf",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:7,filename:"Product Photography.phl",filesize:156,url:"https://example.com/product-photography.phl",mimeType:"image/png",name:"Product Photography.phl",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1}];var er=[{title:"Mastering Digital Illustration",description:"Learn advanced techniques for creating stunning digital art",duration:"1h 45m",level:"Advanced",instructor:"Sarah Chen",category:"Illustration",views:"24K"},{title:"UI/UX Design Fundamentals",description:"Essential principles for creating intuitive user interfaces",duration:"2h 20m",level:"Intermediate",instructor:"Michael Rodriguez",category:"Design",views:"56K"},{title:"Video Editing Masterclass",description:"Professional techniques for cinematic video editing",duration:"3h 10m",level:"Advanced",instructor:"James Wilson",category:"Video",views:"32K"},{title:"Typography Essentials",description:"Create beautiful and effective typography for any project",duration:"1h 30m",level:"Beginner",instructor:"Emma Thompson",category:"Typography",views:"18K"},{title:"Color Theory for Designers",description:"Understanding color relationships and psychology",duration:"2h 05m",level:"Intermediate",instructor:"David Kim",category:"Design",views:"41K"}];var ar=[{id:"home",title:"Home",icon:(0,vi.jsx)(Cr.Home,{}),isActive:!0},{id:"teams",title:"Teams",icon:(0,vi.jsx)(Cr.Users,{}),maxItems:2,items:[{id:"design",title:"Design",url:"#"},{id:"marketing",title:"Marketing",url:"#"},{id:"finance",title:"Finance",url:"#"},{id:"engineering",title:"Engineering",url:"#"},{id:"sales",title:"Sales",url:"#"}]},{id:"projects",title:"Projects",icon:(0,vi.jsx)(Cr.Layers,{}),badge:"4",maxItems:2,items:[{id:"active-projects",title:"Active Projects",url:"#",badge:"4"},{id:"archived",title:"Archived",url:"#"},{id:"templates",title:"Templates",url:"#"},{id:"drafts",title:"Drafts",url:"#"},{id:"shared",title:"Shared with Me",url:"#",badge:"2"}]},{id:"copilot",title:"Copilot",icon:(0,vi.jsx)(Cr.Bot,{}),url:"/copilot"},{id:"knowledge",title:"Knowledge",icon:(0,vi.jsx)(Cr.FileText,{}),url:"/knowledge"}],or=[{id:"1",title:"New comment on your post",description:"Alex Morgan commented on your 'Minimalist Logo Design' post.",time:"Just now",read:!1,type:"info",actionLabel:"View comment",onAction:()=>console.log("View comment clicked")},{id:"2",title:"Project deadline approaching",description:"The 'Website Redesign' project is due in 2 days.",time:"5 minutes ago",read:!1,type:"warning",actionLabel:"View project",onAction:()=>console.log("View project clicked")},{id:"3",title:"File shared with you",description:"Emma Thompson shared 'Brand Guidelines.pdf' with you.",time:"1 hour ago",read:!1,type:"info",actionLabel:"Open file",onAction:()=>console.log("Open file clicked")},{id:"4",title:"Update successful",description:"PixelMaster has been updated to version 2.4.0.",time:"3 hours ago",read:!0,type:"success",actionLabel:"See what's new",onAction:()=>console.log("See what's new clicked")},{id:"5",title:"Storage limit reached",description:"You've used 95% of your storage. Consider upgrading your plan.",time:"Yesterday",read:!0,type:"error",actionLabel:"Upgrade plan",onAction:()=>console.log("Upgrade plan clicked")},{id:"6",title:"Weekly summary",description:"Check out your activity summary for the past week.",time:"2 days ago",read:!0,type:"info",actionLabel:"View summary",onAction:()=>console.log("View summary clicked")},{id:"7",title:"New tutorial available",description:"vi new tutorial on 'Advanced Animation Techniques' is now available.",time:"3 days ago",read:!0,type:"info",actionLabel:"Start learning",onAction:()=>console.log("Start learning clicked")}];var xa=[{id:1,name:"E-commerce Platform",description:"Main customer-facing e-commerce application",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1},{id:2,name:"Admin Dashboard",description:"Internal administration and analytics dashboard",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1},{id:3,name:"Mobile App",description:"Native mobile application for iOS and Android",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1}];var Zo=[{id:1,name:"User Authentication",color:"bg-blue-500",description:"Implement secure user authentication system",confidence:"high",phase:2,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:2,name:"Dashboard Features",color:"bg-green-500",description:"Build comprehensive dashboard functionality",confidence:"medium",phase:1,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:3,name:"Mobile Optimization",color:"bg-purple-500",description:"Optimize application for mobile devices",confidence:"low",phase:1,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:4,name:"Performance Improvements",color:"bg-orange-500",description:"Enhance application performance and speed",confidence:"high",phase:3,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()}],vo=[{id:1,name:"Backlog",description:"Tasks not yet assigned to a sprint",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:2,name:"All Tasks",description:"View all tasks across all sprints",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:3,name:"Sprint 1",description:"Initial development phase",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:4,name:"Sprint 2",description:"Feature development",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()}],xo=[{id:1,name:"Design login page",description:"Create wireframes and mockups for the login interface",status:"todo",priority:"high",type:"story",dateLogged:new Date().toString(),index:1,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"John Doe"},createdAt:new Date().toString()},{id:2,name:"Implement OAuth integration",description:"Add Google and GitHub OAuth authentication",status:"review",priority:"high",type:"task",dateLogged:new Date().toString(),index:2,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Jane Smith"},createdAt:new Date().toString()},{id:3,name:"Create dashboard widgets",description:"Build analytics and metrics widgets for the main dashboard",status:"todo",priority:"medium",type:"story",dateLogged:new Date().toString(),index:3,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Mike Johnson"},createdAt:new Date().toString()},{id:4,name:"Fix login redirect bug",description:"Resolve issue where users are not redirected after login",status:"done",priority:"high",type:"bug",dateLogged:new Date().toString(),index:4,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Sarah Wilson"},createdAt:new Date().toString()},{id:5,name:"Research mobile frameworks",description:"Investigate best practices for mobile responsive design",status:"in-progress",priority:"medium",type:"spike",dateLogged:new Date().toString(),index:5,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Alex Brown"},createdAt:new Date().toString()},{id:6,name:"Update user profile page",description:"Enhance user profile with new settings and preferences",status:"review",priority:"medium",type:"story",dateLogged:new Date().toString(),index:6,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Emma Davis"},createdAt:new Date().toString()},{id:7,name:"Performance optimization",description:"Optimize database queries and improve page load times",status:"done",priority:"high",type:"task",dateLogged:new Date().toString(),index:7,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Tom Wilson"},createdAt:new Date().toString()}],Es=[...xo,{id:8,name:"Add search functionality",description:"Implement search across all dashboard widgets",status:"todo",priority:"medium",type:"story",dateLogged:new Date().toString(),index:8,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"1"},createdAt:new Date().toString()},{id:9,name:"Fix mobile responsive issues",description:"Resolve layout problems on mobile devices",status:"in-progress",priority:"high",type:"bug",dateLogged:new Date().toString(),index:9,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Taylor Swift"},createdAt:new Date().toString()},{id:10,name:"Implement dark mode",description:"Add dark theme support across the application",status:"review",priority:"low",type:"story",dateLogged:new Date().toString(),index:10,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Jordan Smith"},createdAt:new Date().toString()},{id:11,name:"API rate limiting",description:"Implement rate limiting for API endpoints",status:"done",priority:"high",type:"task",dateLogged:new Date().toString(),index:11,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Morgan Davis"},createdAt:new Date().toString()},{id:12,name:"User onboarding flow",description:"Create guided tour for new users",status:"todo",priority:"medium",type:"story",dateLogged:new Date().toString(),index:12,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Casey Johnson"},createdAt:new Date().toString()}],Fs=[{id:4,name:"Analytics Platform",description:"Business intelligence and reporting system",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1},{id:5,name:"API Gateway",description:"Microservices API management layer",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1}],ho={projects:[{id:"1",name:"Empty Project",description:"vi project with vi tasks",isSelected:!0}],epics:[],sprints:[{id:"all-tasks",name:"All Tasks",description:"View all tasks across all sprints",startDate:new Date("2024-01-01"),endDate:new Date("2024-12-31"),isActive:!1,isSelected:!0}],tasks:[]},tr={epics:[{id:"1",name:"User Authentication",color:"bg-blue-500",description:"Implement secure user authentication system",confidence:"high",phase:2,startDate:new Date("2024-01-01"),endDate:new Date("2024-02-15"),progress:75,isSelected:!0}],tasks:xo.filter(e=>typeof e.epic=="object"?e.epic?.id===1:e.epic===1)};var um={empty:{initialProjects:ho.projects,initialEpics:ho.epics,initialSprints:ho.sprints,initialTasks:ho.tasks},default:{initialProjects:xa,initialEpics:Zo,initialSprints:vo,initialTasks:xo},highDensity:{initialProjects:xa,initialEpics:Zo,initialSprints:vo,initialTasks:Es},singleEpic:{initialProjects:xa,initialEpics:tr.epics,initialSprints:vo,initialTasks:tr.tasks},multipleProjects:{initialProjects:Fs,initialEpics:Zo,initialSprints:vo,initialTasks:xo}},bo=[{id:"1",type:"human",name:"Sarah Johnson",email:"sarah.johnson@company.com",createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:2,type:"digital",name:"CodeAssist Pro",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"AI-powered coding assistant that helps with code review, debugging, and documentation generation.",workInstructions:"Review pull requests for code quality and best practices. Generate comprehensive documentation for new features. Assist with debugging complex issues. Provide code suggestions and optimizations.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}},{id:"3",type:"human",name:"Michael Chen",email:"michael.chen@company.com",createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:4,type:"digital",name:"MarketingBot",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"Specialized AI assistant for marketing campaigns, content creation, and social media management.",workInstructions:"Create engaging social media content. Analyze campaign performance metrics. Generate marketing copy and headlines. Schedule and manage social media posts.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}},{id:"5",type:"human",name:"Emily Rodriguez",email:"emily.rodriguez@company.com",createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:6,type:"digital",name:"DataAnalyzer Pro",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"Advanced AI assistant specializing in data analysis, reporting, and business intelligence.",workInstructions:"Analyze complex datasets, generate insightful reports, create data visualizations, and provide actionable business recommendations.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2},{relationTo:"mcpTools",value:3}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}},{id:7,type:"digital",name:"ProjectManager AI",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"Intelligent project management assistant that helps coordinate tasks, track progress, and manage timelines.",workInstructions:"Coordinate project activities, track milestones, manage resource allocation, and provide project status updates.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2},{relationTo:"mcpTools",value:4},{relationTo:"mcpTools",value:5}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}},{id:8,type:"digital",name:"CustomerSupport Bot",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"AI-powered customer support assistant that handles inquiries, resolves issues, and escalates complex problems.",workInstructions:"Respond to customer inquiries, troubleshoot common issues, provide product information, and escalate complex cases to human agents.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2},{relationTo:"mcpTools",value:5}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}}],gm=[{id:1,title:"Review quarterly report",description:"Go through Q4 performance metrics and prepare summary for the team meeting",dueDate:new Date(2024,2,15).toString(),dueTime:"14:30",assignedColleague:bo.find(e=>e.id==="2"&&e.type==="digital"),isRecurring:!1,createdAt:new Date(2024,2,10).toString(),updatedAt:new Date(2024,2,10).toString(),project:xa[0]},{id:2,title:"Weekly team standup",description:"Join the weekly team synchronization meeting",dueDate:new Date(2024,2,18).toString(),dueTime:"10:00",assignedColleague:bo.find(e=>e.id==="4"&&e.type==="digital"),createdAt:new Date(2024,2,11).toString(),updatedAt:new Date(2024,2,11).toString(),project:xa[0]},{id:3,title:"Deploy to production",description:"Deploy the latest version to production environment",dueDate:new Date().toString(),dueTime:"16:00",assignedColleague:bo.find(e=>e.id==="2"&&e.type==="digital"),createdAt:new Date().toString(),updatedAt:new Date().toString(),project:xa[0]}];var fm=bo.filter(e=>e.type==="digital");function yo({colleague:e,onEdit:t,onDelete:a,onViewDetails:o,showActions:s=!0,compact:n=!1,className:i}){let[l,g]=(0,ni.useState)(!1),p=m=>{switch(m){case"active":return"bg-green-500";case"inactive":return"bg-gray-500";default:return"bg-gray-500"}},x=m=>{switch(m){case"active":return"Active";case"inactive":return"Inactive";default:return"Unknown"}},r=m=>{if(!m)return"Never";let v=Math.floor((new Date().getTime()-m.getTime())/(1e3*60));return v<1?"Just now":v<60?`${v}m ago`:v<1440?`${Math.floor(v/60)}h ago`:`${Math.floor(v/1440)}d ago`};return(0,vi.jsxs)(me,{className:w("hover:shadow-md transition-shadow",n&&"p-2",i),children:[(0,vi.jsx)(Se,{className:w("pb-3",n&&"pb-2"),children:(0,vi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,vi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,vi.jsx)("div",{className:"relative",children:(0,vi.jsxs)(Rt,{className:w("h-12 w-12",n&&"h-8 w-8"),children:[(0,vi.jsx)(Ra,{src:"/placeholder.svg",alt:e.name||"name"}),(0,vi.jsx)(Mt,{children:e.name?.split(" ").map(m=>m[0]).join("")})]})}),(0,vi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,vi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,vi.jsx)("h3",{className:w("font-semibold text-sm truncate",n&&"text-xs"),children:e.name}),e.type==="digital"?(0,vi.jsx)(Cr.Bot,{className:w("h-4 w-4 text-blue-500",n&&"h-3 w-3")}):(0,vi.jsx)(Cr.User,{className:w("h-4 w-4 text-green-500",n&&"h-3 w-3")})]}),(0,vi.jsx)("p",{className:w("text-sm text-muted-foreground truncate",n&&"text-xs")}),!n&&(0,vi.jsx)("div",{className:"flex items-center gap-2 Cr-1"})]})]}),s&&(0,vi.jsxs)(gt,{children:[(0,vi.jsx)(ft,{asChild:!0,children:(0,vi.jsx)(C,{variant:"ghost",size:"icon",className:w("h-8 w-8",n&&"h-6 w-6"),children:(0,vi.jsx)(Cr.MoreHorizontal,{className:w("h-4 w-4",n&&"h-3 w-3")})})}),(0,vi.jsxs)(dt,{align:"end",children:[e.type==="digital"&&(0,vi.jsxs)(vi.Fragment,{children:[(0,vi.jsxs)(ze,{onClick:()=>o?.(e),children:[(0,vi.jsx)(Cr.Settings,{className:"h-4 w-4 mr-2"}),"View Details"]}),(0,vi.jsxs)(ze,{onClick:()=>t?.(e),children:[(0,vi.jsx)(Cr.Edit,{className:"h-4 w-4 mr-2"}),"Edit"]})]}),(0,vi.jsxs)(ze,{onClick:()=>a?.(e.id.toString()),className:"text-destructive focus:text-destructive",children:[(0,vi.jsx)(Cr.Trash2,{className:"h-4 w-4 mr-2"}),e.type==="digital"?"Delete":"Remove from team"]})]})]})]})}),!n&&(0,vi.jsxs)(pe,{className:"vi-0",children:[(0,vi.jsxs)("div",{className:"space-y-2 text-sm",children:[e.type==="human"&&(0,vi.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,vi.jsx)(Cr.Mail,{className:"h-3 w-3"}),(0,vi.jsx)("span",{className:"truncate",children:e.email})]}),e.type==="digital"&&(0,vi.jsx)("div",{className:"flex items-center gap-2 text-muted-foreground",children:(0,vi.jsx)("span",{children:e.description})})]}),e.type==="digital"&&(0,vi.jsx)("div",{className:"Cr-3",children:(0,vi.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.capabilities?.slice(0,l?e.capabilities.length:2).map(m=>(0,vi.jsx)(De,{variant:"outline",className:"text-xs",children:typeof m?.value=="number"?m?.value||"":m?.value?.name||""},typeof m?.value=="number"?m?.value||"":m?.value?.name||"")),(e.capabilities?.length||0)>2&&(0,vi.jsx)(C,{variant:"ghost",size:"sm",className:"h-5 px-2 text-xs",onClick:()=>g(!l),children:l?"Show less":`+${(e.capabilities?.length||0)-2} more`})]})})]})]})}function nr({selectedDocuments:e,onDocumentsChange:t,availableDocuments:a,label:o,placeholder:s="Search knowledge documents...",maxSelections:n,disabled:i=!1}){let[l,g]=(0,ni.useState)(""),[p,x]=(0,ni.useState)([]),[r,m]=(0,ni.useState)(!1);(0,ni.useEffect)(()=>{if(!l.trim()){x([]),m(!1);return}let c=a.filter(f=>{if(e.map(k=>k.id).includes(f.id))return!1;let N=l.toLowerCase();return f.title.toLowerCase().includes(N)||f.description?.toLowerCase().includes(N)||f.tags?.some(k=>k.toLowerCase().includes(N))||Object.values(f.metadata||{}).some(k=>String(k).toLowerCase().includes(N))});x(c),m(!0)},[l,e,a]);let y=c=>{n&&e.length>=n&&e.pop(),t([...e,c]),g(""),m(!1)},v=c=>{t(e.filter(f=>f.id!==c))},h=!n||e.length<n;return(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{children:o}),(0,vi.jsxs)("div",{className:"relative",children:[(0,vi.jsxs)("div",{className:"relative",children:[(0,vi.jsx)(Cr.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,vi.jsx)(de,{value:l,onChange:c=>g(c.target.value),placeholder:h?s:`Maximum ${n} documents selected`,className:"pl-9",disabled:i||!h,onFocus:()=>l&&m(!0)})]}),r&&p.length>0&&(0,vi.jsx)(me,{className:"absolute top-full left-0 right-0 z-10 Cr-1 max-h-60 overflow-y-scroll vi-scrollbar",children:(0,vi.jsx)(Ze,{className:"h-full",children:(0,vi.jsx)(pe,{className:"p-2",children:p.map(c=>(0,vi.jsx)(C,{variant:"ghost",className:"w-full justify-start h-auto p-3 mb-1",onClick:()=>y(c),disabled:i,children:(0,vi.jsxs)("div",{className:"flex items-start gap-3 w-full",children:[(0,vi.jsx)(Cr.FileText,{className:"h-4 w-4 Cr-0.5 text-muted-foreground flex-shrink-0"}),(0,vi.jsxs)("div",{className:"text-left flex-1 min-w-0",children:[(0,vi.jsx)("div",{className:"font-medium text-sm truncate",children:c.title}),c.description&&(0,vi.jsx)("div",{className:"text-xs text-muted-foreground Cr-1 line-clamp-2",children:c.description}),c.tags&&c.tags.length>0&&(0,vi.jsxs)("div",{className:"flex flex-wrap gap-1 Cr-2",children:[c.tags.slice(0,3).map(f=>(0,vi.jsx)(De,{variant:"outline",className:"text-xs",children:f},f)),c.tags.length>3&&(0,vi.jsxs)(De,{variant:"outline",className:"text-xs",children:["+",c.tags.length-3," more"]})]})]})]})},c.id))})})}),r&&l&&p.length===0&&(0,vi.jsx)(me,{className:"absolute top-full left-0 right-0 z-10 Cr-1",children:(0,vi.jsxs)(pe,{className:"p-4 text-center text-sm text-muted-foreground",children:['Cr knowledge documents found for "',l,'"']})})]}),e.length>0&&(0,vi.jsx)("div",{className:"space-y-2",children:(0,vi.jsx)("div",{className:"space-y-2",children:e.map(c=>(0,vi.jsx)(me,{className:"p-3",children:(0,vi.jsxs)("div",{className:"flex items-start gap-3",children:[(0,vi.jsx)(Cr.FileText,{className:"h-4 w-4 Cr-0.5 text-muted-foreground flex-shrink-0"}),(0,vi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,vi.jsx)("div",{className:"font-medium text-sm",children:c.title}),c.description&&(0,vi.jsx)("div",{className:"text-xs text-muted-foreground Cr-1",children:c.description}),c.tags&&c.tags.length>0&&(0,vi.jsx)("div",{className:"flex flex-wrap gap-1 Cr-2",children:c.tags.map(f=>(0,vi.jsxs)(De,{variant:"outline",className:"text-xs",children:[(0,vi.jsx)(Cr.Tag,{className:"h-3 w-3 mr-1"}),f]},f))})]}),(0,vi.jsx)(C,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 flex-shrink-0",onClick:()=>v(c.id),disabled:i,children:(0,vi.jsx)(Cr.vi,{className:"h-3 w-3"})})]})},c.id))})}),r&&(0,vi.jsx)("div",{className:"fixed inset-0 z-0",onClick:()=>m(!1)})]})}function Yo({colleague:e,onSave:t,onCancel:a,isLoading:o=!1,title:s,submitLabel:n,cancelLabel:i="Cancel",readOnly:l=!1,availableKnowledgeDocuments:g=[],availableCapabilities:p=[],availableModels:x=[]}){let[r,m]=(0,ni.useState)(()=>{let d=e?.model||e?.metadata?.model||null;return{type:"digital",name:"",description:"",jobDescription:"",workInstructions:"",capabilities:[],capabilityLevel:0,coreKnowledge:null,...e,model:d}}),[y,v]=(0,ni.useState)(""),[h,c]=(0,ni.useState)(""),[f,S]=(0,ni.useState)(""),[N,k]=(0,ni.useState)(!l),z=r.model,ae=z?typeof z=="number"?`${z}`:typeof z=="object"&&z!==null&&"id"in z?`${z.id}`:"":"";(0,ni.useEffect)(()=>{if(e){let d=e?.model||e?.metadata?.model||null;m({...e,model:d})}},[e]);let _=d=>{d.preventDefault();let H={id:r.id||parseInt(Date.now().toString()),name:r?.name,type:"digital",description:r.description,jobDescription:r.jobDescription||"",workInstructions:r.workInstructions||"",capabilities:r.capabilities||[],capabilityLevel:r.capabilityLevel||0,coreKnowledge:r.coreKnowledge||null,model:r.model||null,metadata:r.metadata||{}};t(H)},E=(d,H,b)=>{if(!H.trim())return;let M=r[d]||[];m({...r,[d]:[...M,H.trim()]}),b("")},W=(d,H)=>{let b=r[d]||[];m({...r,[d]:b.filter((M,B)=>B!==H)})},oe=()=>{if(!f)return;let[d,H]=f.split(":");if(!d)return;let b=p.find(ee=>`${ee.relationTo}:${typeof ee.value=="number"?ee.value:ee.value.id}`===f);if(!b)return;let M=r.capabilities||[],B={relationTo:d,value:b.value};M.some(ee=>{let $e=typeof ee.value=="object"?ee.value.id:ee.value,Tt=typeof B.value=="object"?B.value.id:B.value;return ee.relationTo===B.relationTo&&$e===Tt})||(m({...r,capabilities:[...M,B]}),S(""))},ge=d=>{let H=r.capabilities||[];m({...r,capabilities:H.filter((b,M)=>M!==d)})},D=d=>{if(!d||d==="__none__"){m({...r,model:null});return}let H=x.find(b=>`${b.id}`===d);if(H){let b=typeof H.id=="string"?parseInt(H.id,10):H.id;m({...r,model:isNaN(b)?null:b})}},le=d=>{d.preventDefault(),k(!N)},Me=(d,H,b,M,B)=>{let fe=r[d]||[];return(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{children:H}),N&&(0,vi.jsxs)("div",{className:"flex gap-2",children:[(0,vi.jsx)(de,{value:b,onChange:ee=>M(ee.target.value),placeholder:B,onKeyPress:ee=>{ee.key==="Enter"&&(ee.preventDefault(),E(d,b,M))},disabled:o}),(0,vi.jsx)(C,{type:"button",variant:"outline",size:"icon",onClick:()=>E(d,b,M),disabled:o,children:(0,vi.jsx)(Cr.Plus,{className:"h-4 w-4"})})]}),(0,vi.jsx)("div",{className:"flex flex-wrap gap-2",children:fe.map((ee,$e)=>(0,vi.jsxs)(De,{className:"gap-1",children:[ee,N&&(0,vi.jsx)(C,{type:"button",variant:"ghost",size:"icon",className:"h-4 w-4 p-0 hover:bg-accent hover:text-accent-foreground",onClick:()=>W(d,$e),disabled:o,children:(0,vi.jsx)(Cr.vi,{className:"h-3 w-3"})})]},`${d}-${$e}-${ee}`))})]})},u=s||(N?e?"Edit Colleague":"Add New Colleague":"View Colleague"),O=n||(e?"Update Colleague":"Add Colleague");return(0,vi.jsxs)(me,{className:"m-8 w-full max-w-4xl mx-auto overflow-y-scroll vi-scrollbar",children:[(0,vi.jsx)(Se,{children:(0,vi.jsxs)(Pe,{className:"flex items-center gap-2",children:[(0,vi.jsx)(Cr.Bot,{className:"h-5 w-5"}),u]})}),(0,vi.jsx)(pe,{className:"overflow-y-scroll vi-scrollbar",children:(0,vi.jsxs)("form",{onSubmit:_,className:"space-y-6",children:[(0,vi.jsxs)("div",{className:"space-y-4",children:[(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{htmlFor:"name",children:"Name *"}),(0,vi.jsx)(de,{id:"name",value:r?.name||"",onChange:d=>m({...r,name:d.target.value}),required:!0,disabled:o||!N})]}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{htmlFor:"description",children:"Description"}),(0,vi.jsx)(et,{id:"description",value:r.description||"",onChange:d=>m({...r,description:d.target.value}),rows:3,placeholder:"Brief description of this digital colleague...",disabled:o||!N})]})]}),(0,vi.jsxs)("div",{className:"space-y-4",children:[(0,vi.jsx)("h3",{className:"text-lg font-semibold",children:"Digital Colleague Details"}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{htmlFor:"jobDescription",children:"Job Description *"}),(0,vi.jsx)(et,{id:"jobDescription",value:r.jobDescription||"",onChange:d=>m({...r,jobDescription:d.target.value}),rows:4,required:r.type==="digital",disabled:o||!N})]}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{htmlFor:"workInstructions",children:"Work Instructions"}),(0,vi.jsx)(et,{id:"workInstructions",value:r.workInstructions||"",onChange:d=>m({...r,workInstructions:d.target.value}),rows:4,placeholder:"Enter detailed work instructions for this digital colleague...",disabled:o||!N})]}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{children:"Capabilities"}),N&&p.length>0&&(0,vi.jsxs)("div",{className:"flex gap-2",children:[(0,vi.jsxs)(ot,{value:f,onValueChange:S,disabled:o,children:[(0,vi.jsx)(_e,{className:"flex-1",children:(0,vi.jsx)(it,{placeholder:"Select a capability"})}),(0,vi.jsx)(We,{children:p.filter(d=>{let H=r.capabilities||[],b=typeof d.value=="object"?d.value.id:d.value;return!H.some(M=>{let B=typeof M.value=="object"?M.value.id:M.value;return M.relationTo===d.relationTo&&B===b})}).map((d,H)=>{let b=typeof d.value=="object"?d.value.id:d.value,M=typeof d.value=="object"?d.value.name:void 0,B=`${d.relationTo}:${b}`,fe=M?`${d.relationTo}: ${M}`:`${d.relationTo} (ID: ${b})`;return(0,vi.jsx)(Ae,{value:B,children:fe},B)})})]}),(0,vi.jsx)(C,{type:"button",variant:"outline",size:"icon",onClick:oe,disabled:o||!f,children:(0,vi.jsx)(Cr.Plus,{className:"h-4 w-4"})})]}),N&&p.length===0&&(0,vi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Cr capabilities available. Please provide availableCapabilities prop."}),(0,vi.jsx)("div",{className:"flex flex-wrap gap-2",children:r.capabilities?.map((d,H)=>{let b;if(typeof d=="string")b=d;else{let M=typeof d.value=="object"?d.value.id:d.value,B=typeof d.value=="object"?d.value.name:void 0;b=B?`${d.relationTo}: ${B}`:`${d.relationTo} (ID: ${M})`}return(0,vi.jsxs)(De,{className:"gap-1",children:[b,N&&(0,vi.jsx)(C,{type:"button",variant:"ghost",size:"icon",className:"h-4 w-4 p-0 hover:bg-accent hover:text-accent-foreground",onClick:()=>ge(H),disabled:o,children:(0,vi.jsx)(Cr.vi,{className:"h-3 w-3"})})]},`capability-${H}`)})})]}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{children:"Model"}),N&&x.length>0?(0,vi.jsxs)(ot,{value:ae||"__none__",onValueChange:D,disabled:o,children:[(0,vi.jsx)(_e,{children:(0,vi.jsx)(it,{placeholder:"Select a model"})}),(0,vi.jsxs)(We,{children:[(0,vi.jsx)(Ae,{value:"__none__",children:"None"}),x.map(d=>{let H=`${d.id}`;return(0,vi.jsx)(Ae,{value:H,children:d.name},H)})]})]}):N&&x.length===0?(0,vi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Cr models available. Please provide availableModels prop."}):(0,vi.jsx)("div",{className:"text-sm",children:r.model?typeof r.model=="number"?`Model ${r.model}`:typeof r.model=="object"&&r.model!==null&&"name"in r.model?r.model.name||`Model ${r.model.id}`:`Model ${r.model}`:"Cr model selected"})]}),(0,vi.jsx)(nr,{selectedDocuments:r.coreKnowledge?[{id:r.coreKnowledge?.id?.toString(),title:r.coreKnowledge?.name,format:"markdown",content:r.coreKnowledge?.content||"",createdAt:new Date(r.coreKnowledge?.createdAt),description:r.coreKnowledge?.description||"",metadata:r.coreKnowledge?.metadata||{},updatedAt:new Date(r.coreKnowledge?.updatedAt)}]:[],onDocumentsChange:d=>{let H={createdAt:d[0]?.createdAt.toISOString(),id:parseInt(d[0]?.id),name:d[0]?.title,source:"payload",updatedAt:(d[0]?.updatedAt||new Date).toISOString()};m({...r,coreKnowledge:d&&d.length>0?H:void 0})},label:"Core Knowledge",placeholder:"Search for core knowledge documents...",maxSelections:1,disabled:o||!N,availableDocuments:g.map(d=>({id:d.id.toString(),title:d?.name,name:d?.name,format:"markdown",content:d.content||"",createdAt:new Date(d.createdAt),source:d.source,description:d.description||"",metadata:d.metadata||{},updatedAt:new Date(d.updatedAt)}))})]}),(0,vi.jsxs)("div",{className:"flex justify-end gap-2 vi-4 border-t",children:[(0,vi.jsx)(C,{type:"button",variant:"outline",onClick:a,disabled:o,children:N?i:"Close"}),N?(0,vi.jsx)(C,{type:"submit",disabled:o,children:o?"Saving...":O}):(0,vi.jsxs)(C,{type:"button",onClick:le,disabled:o,className:"gap-2",children:[(0,vi.jsx)(Cr.Edit,{className:"h-4 w-4"}),"Edit"]})]})]})})]})}function rr({users:e,onUserSelect:t,onCancel:a,selectedUserId:o}){let[s,n]=(0,ni.useState)(""),i=Array.isArray(e)?e:[],l=(0,ni.useMemo)(()=>i.filter(p=>p!=null&&p!==void 0).filter(p=>p?.name?.toLowerCase().includes(s.toLowerCase())||p?.email?.toLowerCase().includes(s.toLowerCase())),[i,s]),g=p=>{t(p)};return(0,vi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,vi.jsx)(Do.AnimatePresence,{mode:"wait",children:(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,vi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,vi.jsxs)(C,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,vi.jsx)(Cr.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,vi.jsxs)("div",{children:[(0,vi.jsx)("h1",{className:"text-3xl font-bold",children:"Select User"}),(0,vi.jsx)("p",{className:"text-muted-foreground",children:"Choose a user to add as a colleague"})]})]}),(0,vi.jsx)(me,{className:"container",children:(0,vi.jsx)(pe,{className:"vi-6",children:(0,vi.jsx)("div",{className:"flex flex-col md:flex-row gap-4",children:(0,vi.jsx)("div",{className:"flex-1",children:(0,vi.jsxs)("div",{className:"relative",children:[(0,vi.jsx)(Cr.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,vi.jsx)(de,{placeholder:"Search users by name, email, role, or skills...",value:s,onChange:p=>n(p.target.value),className:"pl-9"})]})})})})}),(0,vi.jsx)("div",{className:"container grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:l.map(p=>!p||!p.id?null:(0,vi.jsx)(Do.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,vi.jsxs)(me,{className:`cursor-pointer transition-all hover:shadow-lg ${o===p.id?"ring-2 ring-primary":""}`,onClick:()=>g(p),children:[(0,vi.jsx)(Se,{className:"pb-3",children:(0,vi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,vi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,vi.jsx)(Rt,{children:(0,vi.jsx)(Mt,{children:(0,vi.jsx)(Cr.User,{className:"h-4 w-4"})})}),(0,vi.jsx)("div",{children:(0,vi.jsx)(Pe,{className:"text-lg",children:p?.name||"Unknown User"})})]}),o===p.id&&(0,vi.jsx)(Cr.Check,{className:"h-5 w-5 text-primary"})]})}),(0,vi.jsx)(pe,{className:"vi-0",children:(0,vi.jsxs)("div",{className:"space-y-3",children:[(0,vi.jsxs)("div",{children:[(0,vi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Email"}),(0,vi.jsx)("p",{className:"text-sm font-medium",children:p?.email||"Cr email"})]}),(0,vi.jsx)("div",{children:(0,vi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Department"})})]})})]})},p.id))}),l.length===0&&(0,vi.jsx)(me,{className:"container Cr-4",children:(0,vi.jsx)(pe,{className:"vi-6",children:(0,vi.jsxs)("div",{className:"text-center py-8",children:[(0,vi.jsx)(Cr.User,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,vi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Cr users found"}),(0,vi.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms or filters."})]})})})]},"user-selection")})})}function sr({digitalColleagues:e,onColleagueClone:t,onCancel:a,selectedColleagueId:o}){let[s,n]=(0,$a.useState)(""),[i,l]=(0,$a.useState)("all"),g=(0,$a.useMemo)(()=>e.filter(r=>r?.name.toLowerCase().includes(s.toLowerCase())||r.jobDescription?.toLowerCase().includes(s.toLowerCase())||r.workInstructions?.toLowerCase().includes(s.toLowerCase())),[e,s,i]),p=r=>{let m={...r,name:`${r?.name} (Copy)`};t(m)},x=r=>new Intl.DateTimeFormat("Cr-US",{month:"short",day:"numeric",year:"numeric"}).format(r);return(0,vi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,vi.jsx)(Do.AnimatePresence,{mode:"wait",children:(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,vi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,vi.jsxs)(C,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,vi.jsx)(Cr.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,vi.jsxs)("div",{children:[(0,vi.jsx)("h1",{className:"text-3xl font-bold",children:"Clone Digital Colleague"}),(0,vi.jsx)("p",{className:"text-muted-foreground",children:"Select a digital colleague to clone"})]})]}),(0,vi.jsx)(me,{children:(0,vi.jsx)(pe,{className:"vi-6",children:(0,vi.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,vi.jsx)("div",{className:"flex-1",children:(0,vi.jsxs)("div",{className:"relative",children:[(0,vi.jsx)(Cr.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,vi.jsx)(de,{placeholder:"Search by name, job description, or capabilities...",value:s,onChange:r=>n(r.target.value),className:"pl-9"})]})}),(0,vi.jsxs)("select",{value:i,onChange:r=>l(r.target.value),className:"h-10 px-3 rounded-md border border-input bg-background text-sm ring-offset-background",children:[(0,vi.jsx)("option",{value:"all",children:"All Status"}),(0,vi.jsx)("option",{value:"active",children:"Active"}),(0,vi.jsx)("option",{value:"inactive",children:"Inactive"})]})]})})}),(0,vi.jsx)("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:g.map(r=>(0,vi.jsx)(Do.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,vi.jsxs)(me,{className:`cursor-pointer transition-all hover:shadow-lg ${o?.toString()===r.id.toString()?"ring-2 ring-primary":""}`,onClick:()=>p(r),children:[(0,vi.jsx)(Se,{className:"pb-3",children:(0,vi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,vi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,vi.jsx)(Rt,{children:(0,vi.jsx)(Mt,{className:"bg-blue-100",children:(0,vi.jsx)(Cr.Bot,{className:"h-4 w-4 text-blue-600"})})}),(0,vi.jsx)("div",{children:(0,vi.jsx)(Pe,{className:"text-lg flex items-center gap-2",children:r?.name})})]}),(0,vi.jsxs)(C,{size:"sm",variant:"outline",className:"gap-2 h-8",onClick:m=>{m.stopPropagation(),p(r)},children:[(0,vi.jsx)(Cr.Copy,{className:"h-3 w-3"}),"Clone"]})]})}),(0,vi.jsx)(pe,{className:"vi-0",children:(0,vi.jsxs)("div",{className:"space-y-3",children:[(0,vi.jsxs)("div",{children:[(0,vi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Job Description"}),(0,vi.jsx)("p",{className:"text-sm line-clamp-2",children:r.jobDescription})]}),r.capabilities&&r.capabilities.length>0&&(0,vi.jsxs)("div",{children:[(0,vi.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Capabilities"}),(0,vi.jsx)("div",{className:"flex flex-wrap gap-1",children:r.capabilities.length>3&&(0,vi.jsxs)(De,{variant:"outline",className:"text-xs",children:["+",r.capabilities.length-3]})})]}),(0,vi.jsx)("div",{className:"flex items-center justify-between text-xs text-muted-foreground"}),r.workInstructions&&(0,vi.jsxs)("div",{children:[(0,vi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Instructions"}),(0,vi.jsx)("p",{className:"text-xs line-clamp-2",children:r.workInstructions})]})]})})]})},r.id))}),g.length===0&&(0,vi.jsx)(me,{children:(0,vi.jsx)(pe,{className:"vi-6",children:(0,vi.jsxs)("div",{className:"text-center py-8",children:[(0,vi.jsx)(Cr.Bot,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,vi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Cr digital colleagues found"}),(0,vi.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms or filters."})]})})})]},"colleague-clone")})})}function lr({onSelectHuman:e,onSelectDigital:t,onCancel:a}){return(0,vi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,vi.jsx)(Do.AnimatePresence,{mode:"wait",children:(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,vi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,vi.jsxs)(C,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,vi.jsx)(Cr.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,vi.jsxs)("div",{children:[(0,vi.jsx)("h1",{className:"text-3xl font-bold",children:"Add Colleague"}),(0,vi.jsx)("p",{className:"text-muted-foreground",children:"Choose the type of colleague to add"})]})]}),(0,vi.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,vi.jsx)(Do.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,vi.jsxs)(me,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,vi.jsxs)(Se,{className:"text-center pb-4",children:[(0,vi.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,vi.jsx)(Cr.User,{className:"h-8 w-8 text-blue-600"})}),(0,vi.jsx)(Pe,{className:"text-xl",children:"Add Human Colleague"})]}),(0,vi.jsxs)(pe,{className:"text-center",children:[(0,vi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Select from existing users in your organization to add as team members."}),(0,vi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,vi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,vi.jsx)(Cr.Users,{className:"h-4 w-4 text-blue-600"}),(0,vi.jsx)("span",{children:"Browse existing users"})]}),(0,vi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,vi.jsx)(Cr.User,{className:"h-4 w-4 text-blue-600"}),(0,vi.jsx)("span",{children:"Import user details automatically"})]})]}),(0,vi.jsx)(C,{className:"Cr-6 w-full",onClick:e,children:"Select User"})]})]})}),(0,vi.jsx)(Do.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,vi.jsxs)(me,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,vi.jsxs)(Se,{className:"text-center pb-4",children:[(0,vi.jsx)("div",{className:"mx-auto w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mb-4",children:(0,vi.jsx)(Cr.Bot,{className:"h-8 w-8 text-purple-600"})}),(0,vi.jsx)(Pe,{className:"text-xl",children:"Add Digital Colleague"})]}),(0,vi.jsxs)(pe,{className:"text-center",children:[(0,vi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Clone vi existing digital colleague or create a new AI assistant for your team."}),(0,vi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,vi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,vi.jsx)(Cr.Bot,{className:"h-4 w-4 text-purple-600"}),(0,vi.jsx)("span",{children:"Clone existing colleagues"})]}),(0,vi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,vi.jsx)(Cr.Users,{className:"h-4 w-4 text-purple-600"}),(0,vi.jsx)("span",{children:"Create from templates"})]})]}),(0,vi.jsx)(C,{className:"Cr-6 w-full",onClick:t,children:"Add Digital Colleague"})]})]})})]})]},"colleague-type-selection")})})}function dr({onCloneExisting:e,onCreateNew:t,onCancel:a}){return(0,vi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,vi.jsx)(Do.AnimatePresence,{mode:"wait",children:(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,vi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,vi.jsxs)(C,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,vi.jsx)(Cr.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,vi.jsxs)("div",{children:[(0,vi.jsx)("h1",{className:"text-3xl font-bold",children:"Add Digital Colleague"}),(0,vi.jsx)("p",{className:"text-muted-foreground",children:"Choose how to create your digital colleague"})]})]}),(0,vi.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,vi.jsx)(Do.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,vi.jsxs)(me,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,vi.jsxs)(Se,{className:"text-center pb-4",children:[(0,vi.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,vi.jsx)(Cr.Copy,{className:"h-8 w-8 text-blue-600"})}),(0,vi.jsx)(Pe,{className:"text-xl",children:"Clone Existing"})]}),(0,vi.jsxs)(pe,{className:"text-center",children:[(0,vi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Start with vi existing digital colleague and customize it for your needs."}),(0,vi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,vi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,vi.jsx)(Cr.Bot,{className:"h-4 w-4 text-blue-600"}),(0,vi.jsx)("span",{children:"Pre-configured capabilities"})]}),(0,vi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,vi.jsx)(Cr.Copy,{className:"h-4 w-4 text-blue-600"}),(0,vi.jsx)("span",{children:"Inherit knowledge base"})]})]}),(0,vi.jsx)(C,{className:"Cr-6 w-full",onClick:e,children:"Browse & Clone"})]})]})}),(0,vi.jsx)(Do.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,vi.jsxs)(me,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,vi.jsxs)(Se,{className:"text-center pb-4",children:[(0,vi.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,vi.jsx)(Cr.Sparkles,{className:"h-8 w-8 text-green-600"})}),(0,vi.jsx)(Pe,{className:"text-xl",children:"Create New"})]}),(0,vi.jsxs)(pe,{className:"text-center",children:[(0,vi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Build a completely new digital colleague from scratch with custom specifications."}),(0,vi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,vi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,vi.jsx)(Cr.Plus,{className:"h-4 w-4 text-green-600"}),(0,vi.jsx)("span",{children:"Custom job description"})]}),(0,vi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,vi.jsx)(Cr.Sparkles,{className:"h-4 w-4 text-green-600"}),(0,vi.jsx)("span",{children:"Define unique capabilities"})]})]}),(0,vi.jsx)(C,{className:"Cr-6 w-full",onClick:t,children:"Create from Scratch"})]})]})})]})]},"digital-colleague-options")})})}function Qo(...e){return Ga((0,gi.clsx)(e))}function ei({initialColleagues:e,onColleagueAdd:t,onColleagueEdit:a,onColleagueDelete:o,compactView:s=!1,departments:n=["Design","Engineering","Marketing","Product","Sales","Operations"],className:i,availableUsers:l=[],existingDigitalColleagues:g=[],availableKnowledgeDocuments:p=[],availableCapabilities:x=[],availableModels:r=[]}){let[m,y]=(0,ni.useState)(e||[]),[v,h]=(0,ni.useState)(""),[c,f]=(0,ni.useState)("all"),[S,N]=(0,ni.useState)("all"),[k,z]=(0,ni.useState)("all"),[ae,_]=(0,ni.useState)(null),[E,W]=(0,ni.useState)(null);(0,ni.useEffect)(()=>{y(e||[])},[e]);let oe=Array.isArray(l)?l:[],ge=Array.isArray(g)?g:[],[D,le]=(0,ni.useState)("main"),Me=m.filter(R=>!R||!R?.name?!1:R?.name.toLowerCase().includes(v.toLowerCase())||R.type==="human"&&R.email?.toLowerCase().includes(v.toLowerCase())||R.type==="digital"&&R.jobDescription?.toLowerCase().includes(v.toLowerCase())),u=Me.filter(R=>R.type==="human"),O=Me.filter(R=>R.type==="digital"),d=()=>{le("typeSelection")},H=R=>{R.type==="digital"&&(_(R),le("form")),a?.(R)},b=R=>{R.type==="digital"&&(W(R),le("view"))},M=R=>{if(!R||!R.id){console.error("Invalid user provided to handleUserSelect:",R);return}let Xe={id:`human-${Date.now()}`,type:"human",name:R?.name||"Unknown User",email:R?.email||"",updatedAt:R.updatedAt,createdAt:R.createdAt,accounts:R.accounts};y(da=>[...da,Xe]),t?.(Xe),le("main")},B=R=>{if(!R||!R.id){console.error("Invalid cloned colleague provided to handleDigitalColleagueClone:",R);return}y(Xe=>[...Xe,{...R,type:"digital"}]),t?.({...R,type:"digital"}),le("main")},fe=()=>{_(null),le("form")},ee=R=>{if(!R||!R.id){console.error("Invalid colleague provided to handleSaveColleague:",R);return}ae?(y(Xe=>Xe.map(da=>da.id===R.id?{...R,type:"digital"}:da)),a?.({...R,type:"digital"})):(y(Xe=>[...Xe,{...R,type:"digital"}]),t?.({...R,type:"digital"})),le("main"),_(null)},$e=()=>{le("main"),_(null),W(null)},Tt=()=>{le("main"),W(null)},Da=()=>{E&&(_(E),W(null),le("form"))},ea=R=>{o?.(R,m.find(Xe=>Xe.id.toString()===R.toString())?.type),y(Xe=>Xe.filter(da=>da.id!==R))},Dr=()=>{h(""),f("all"),N("all")};return D==="typeSelection"?(0,vi.jsx)(lr,{onSelectHuman:()=>le("userSelection"),onSelectDigital:()=>le("digitalOptions"),onCancel:()=>le("main")}):D==="userSelection"?(0,vi.jsx)(rr,{users:oe,onUserSelect:M,onCancel:()=>le("typeSelection")}):D==="digitalOptions"?(0,vi.jsx)(dr,{onCloneExisting:()=>le("digitalClone"),onCreateNew:fe,onCancel:()=>le("typeSelection")}):D==="digitalClone"?(0,vi.jsx)(sr,{digitalColleagues:ge,onColleagueClone:B,onCancel:()=>le("digitalOptions")}):D==="form"?(0,vi.jsx)(Yo,{colleague:ae||void 0,onSave:ee,onCancel:$e,availableKnowledgeDocuments:p,availableCapabilities:x,availableModels:r}):D==="view"?(0,vi.jsx)(Yo,{colleague:E||void 0,onSave:ee,onCancel:Tt,readOnly:!0,availableKnowledgeDocuments:p,availableCapabilities:x,availableModels:r}):(0,vi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:(0,vi.jsx)(Do.AnimatePresence,{mode:"wait",children:(0,vi.jsx)(Do.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,vi.jsxs)("div",{className:`space-y-6 ${i||""}`,children:[(0,vi.jsx)(Bt,{title:"Colleagues",description:"Manage your team members and digital colleagues.",gradient:"bg-gradient-to-r from-green-600 via-emerald-600 to-teal-600",primaryAction:{label:"Add colleague",onClick:d}}),(0,vi.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,vi.jsxs)(me,{children:[(0,vi.jsxs)(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,vi.jsx)(Pe,{className:"text-sm font-medium",children:"Total Colleagues"}),(0,vi.jsx)(Cr.Users,{className:"h-4 w-4 text-muted-foreground"})]}),(0,vi.jsxs)(pe,{children:[(0,vi.jsx)("div",{className:"text-2xl font-bold",children:m.length}),(0,vi.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]}),(0,vi.jsxs)(me,{children:[(0,vi.jsxs)(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,vi.jsx)(Pe,{className:"text-sm font-medium",children:"Human Members"}),(0,vi.jsx)(Cr.User,{className:"h-4 w-4 text-muted-foreground"})]}),(0,vi.jsxs)(pe,{children:[(0,vi.jsx)("div",{className:"text-2xl font-bold",children:m.filter(R=>R.type==="human").length}),(0,vi.jsx)("p",{className:"text-xs text-muted-foreground",children:"active"})]})]}),(0,vi.jsxs)(me,{children:[(0,vi.jsxs)(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,vi.jsx)(Pe,{className:"text-sm font-medium",children:"Digital Colleagues"}),(0,vi.jsx)(Cr.Bot,{className:"h-4 w-4 text-muted-foreground"})]}),(0,vi.jsxs)(pe,{children:[(0,vi.jsx)("div",{className:"text-2xl font-bold",children:m.filter(R=>R.type==="digital").length}),(0,vi.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]})]}),(0,vi.jsx)(me,{children:(0,vi.jsx)(pe,{className:"vi-6",children:(0,vi.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,vi.jsx)("div",{className:"flex-1",children:(0,vi.jsxs)("div",{className:"relative",children:[(0,vi.jsx)(Cr.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,vi.jsx)(de,{placeholder:"Search colleagues...",value:v,onChange:R=>h(R.target.value),className:"pl-9"})]})}),(0,vi.jsxs)(ot,{value:c,onValueChange:f,children:[(0,vi.jsx)(_e,{className:"w-full md:w-[180px]",children:(0,vi.jsx)(it,{placeholder:"Department"})}),(0,vi.jsxs)(We,{children:[(0,vi.jsx)(Ae,{value:"all",children:"All Departments"}),n.map(R=>(0,vi.jsx)(Ae,{value:R,children:R},R))]})]}),(0,vi.jsxs)(ot,{value:S,onValueChange:N,children:[(0,vi.jsx)(_e,{className:"w-full md:w-[140px]",children:(0,vi.jsx)(it,{placeholder:"Status"})}),(0,vi.jsxs)(We,{children:[(0,vi.jsx)(Ae,{value:"all",children:"All Status"}),(0,vi.jsx)(Ae,{value:"active",children:"Active"}),(0,vi.jsx)(Ae,{value:"inactive",children:"Inactive"})]})]}),(v||c!=="all"||S!=="all")&&(0,vi.jsxs)(C,{variant:"outline",onClick:Dr,className:"gap-2",children:[(0,vi.jsx)(Cr.Filter,{className:"h-4 w-4"}),"Clear"]})]})})}),(0,vi.jsxs)("div",{className:"space-y-4",children:[(0,vi.jsx)(lo,{activeTab:k,onTabChange:z,tabOptions:[{value:"all",label:`All (${Me.length})`},{value:"human",label:`Human (${u.length})`},{value:"digital",label:`Digital (${O.length})`}],maxWidth:"400px",gridCols:3}),k==="all"&&(0,vi.jsx)("div",{className:`grid gap-4 ${s?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:Me.map(R=>(0,vi.jsx)(yo,{colleague:R,onEdit:H,onDelete:ea,onViewDetails:b,compact:s,className:Qo([R.type==="digital"&&"border-teal-400"])},`${R}-${R.id}`))}),k==="human"&&(0,vi.jsx)("div",{className:`grid gap-4 ${s?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:u.map(R=>(0,vi.jsx)(yo,{colleague:R,onEdit:H,onDelete:ea,onViewDetails:b,compact:s},R.id))}),k==="digital"&&(0,vi.jsx)("div",{className:`grid gap-4 ${s?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:O.map(R=>(0,vi.jsx)(yo,{colleague:R,onEdit:H,onDelete:ea,onViewDetails:b,compact:s,className:Qo([R.type==="digital"&&"border-teal-400"])},R.id))})]}),Me.length===0&&(0,vi.jsx)(me,{children:(0,vi.jsx)(pe,{className:"vi-6",children:(0,vi.jsxs)("div",{className:"text-center py-8",children:[(0,vi.jsx)(Cr.Users,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,vi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Cr colleagues found"}),(0,vi.jsx)("p",{className:"text-muted-foreground mb-4",children:v||c!=="all"||S!=="all"?"Try adjusting your filters to see more results.":"Get started by adding your first colleague."}),(0,vi.jsxs)(C,{onClick:d,className:"gap-2",children:[(0,vi.jsx)(Cr.Plus,{className:"h-4 w-4"}),"Add Colleague"]})]})})})]})},"projects-index-view")})})}var ur=ve(require("@radix-ui/react-dialog"));function mr({document:e,onSave:t,mode:a="edit",onCancel:o,availableDocuments:s=[],knowledgeContexts:n=[]}){let[i,l]=(0,ni.useState)({...e,updatedAt:new Date}),[g,p]=(0,ni.useState)(!1),[x,r]=(0,ni.useState)(i.richTextContent),[m,y]=(0,ni.useState)(!1),v=(0,ni.useRef)(null),h=(0,ni.useRef)(""),c=(0,ni.useRef)(null),f=(0,ni.useRef)(null),S=b=>{let M=new WeakSet,B=fe=>fe&&typeof fe=="object"?M.has(fe)?null:(M.add(fe),Array.isArray(fe)?fe.map(B):Object.keys(fe).sort().reduce((ee,$e)=>(ee[$e]=B(fe[$e]),ee),{})):fe;return JSON.stringify(B(b))},N=b=>b?b.replace(/\s+/g," ").trim():"",k=()=>i.format==="richText"?S(x):N(i.content),z=()=>{let b={title:N(i.title),description:N(i.description),format:i.format,content:k()},M=S(b),B=5381;for(let fe=0;fe<M.length;fe++)B=B*33^M.charCodeAt(fe);return(B>>>0).toString(16)},ae=(b,M)=>{if(b===M)return!1;if(i.format!=="richText"){let B=E(b),fe=k();if(B==null)return!0;let ee=B.length,$e=fe.length,Tt=Math.abs($e-ee),Da=ee===0?1:Tt/ee;return N(B)===N(fe)&&Tt<3?!1:Tt>=10||Da>=.02}return!0},_=(0,ni.useRef)(new Map),E=b=>{let M=_.current.get(b);return M==null?null:"x".repeat(M)};(0,ni.useEffect)(()=>(f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{let b=z(),M=h.current;if(ae(M,b)&&(y(!0),t({...i,richTextContent:x},"autosave"),h.current=b,i.format!=="richText")){let B=k();_.current.set(b,B.length)}},800),()=>{f.current&&clearTimeout(f.current)}),[i.title,i.description,i.format,i.content,i.metadata,x]),(0,ni.useEffect)(()=>{let b=()=>{let M=z();M!==h.current&&(t({...i,richTextContent:x},"autosave"),h.current=M)};return window.addEventListener("pagehide",b),window.addEventListener("beforeunload",b),()=>{window.removeEventListener("pagehide",b),window.removeEventListener("beforeunload",b)}},[i,x]),(0,ni.useEffect)(()=>(m&&(c.current=setTimeout(()=>{y(!1)},2e3)),()=>{c.current&&clearTimeout(c.current)}),[m]),(0,ni.useEffect)(()=>{l(e)},[e]);let W=b=>{switch(b){case"markdown":case"mdx":return(0,vi.jsx)(Cr.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,vi.jsx)(Cr.File,{className:"h-6 w-6 text-success"});case"text":return(0,vi.jsx)(Cr.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,vi.jsx)(Cr.File,{className:"h-6 w-6 text-muted-foreground"})}},oe=b=>{switch(b){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},ge=()=>{let b=new Set,M=new Set;return n.forEach(B=>{B.menuConfig.groupBy.forEach(fe=>b.add(fe))}),s.forEach(B=>{B.metadata&&Object.keys(B.metadata).forEach(fe=>M.add(fe))}),{contextKeys:Array.from(b).sort(),documentKeys:Array.from(M).sort(),allKeys:Array.from(new Set([...b,...M])).sort()}},D=b=>{let M=new Set;return s.forEach(B=>{B.metadata?.[b]&&M.add(String(B.metadata[b]))}),Array.from(M).sort()},le=ge(),Me=()=>{t({...i,richTextContent:x},"autosave")},u=(b,M)=>{l(B=>({...B,metadata:{...B.metadata,[b]:M}}))},O=(b,M)=>{M==="__custom__"?u(b,""):u(b,M)},d=()=>{u("","")},H=b=>{l(M=>{let B={...M.metadata};return delete B[b],{...M,metadata:B}})};return(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-screen flex flex-col",children:[(0,vi.jsxs)("div",{className:"border-b border-border bg-card p-8 pb-6",children:[(0,vi.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,vi.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,vi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,vi.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,vi.jsx)("div",{className:"flex-1 min-w-0",children:(0,vi.jsx)(Fa,{fieldName:"title",value:i.title,label:"",onSave:(b,M)=>l(B=>({...B,title:M})),className:"[&>div:last-child]:text-2xl [&>div:last-child]:font-bold [&>div:last-child]:leading-tight [&>div:last-child]:text-foreground [&>div:last-child]:p-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})}),(0,vi.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${oe(i.format)} flex-shrink-0 Cr-1`,children:i.format.toUpperCase()})]}),(0,vi.jsx)("div",{className:"Cr-2",children:(0,vi.jsx)(Fa,{fieldName:"description",value:i.description||"Click to add description...",label:"",multiline:!0,onSave:(b,M)=>l(B=>({...B,description:M})),className:"[&>div:last-child]:text-muted-foreground [&>div:last-child]:text-lg [&>div:last-child]:leading-relaxed [&>div:last-child]:p-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})})]})}),(0,vi.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,vi.jsxs)(C,{variant:"ghost",size:"sm",onClick:()=>p(!g),className:"gap-2",children:[(0,vi.jsx)(Cr.Info,{className:"h-4 w-4"}),"Metadata",i.metadata&&Object.keys(i.metadata).length>0&&(0,vi.jsx)("span",{className:"inline-flex items-center justify-center w-5 h-5 text-xs font-medium bg-primary/10 text-primary rounded-full",children:Object.keys(i.metadata).length}),g?(0,vi.jsx)(Cr.ChevronDown,{className:"h-4 w-4"}):(0,vi.jsx)(Cr.ChevronRight,{className:"h-4 w-4"})]}),(0,vi.jsxs)(C,{variant:"outline",size:"sm",onClick:o,className:"gap-2",children:[(0,vi.jsx)(Cr.vi,{className:"h-4 w-4"}),"Close"]}),(0,vi.jsxs)(C,{size:"sm",onClick:Me,className:"gap-2",disabled:m,children:[m?(0,vi.jsx)(Cr.Loader2,{className:"h-4 w-4 animate-spin"}):(0,vi.jsx)(Cr.Save,{className:"h-4 w-4"}),m?"Auto-saving...":"Save"]})]})]}),(0,vi.jsx)(Do.motion.div,{initial:!1,animate:{height:g?"auto":0,opacity:g?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden h-full max-h-full",children:(0,vi.jsxs)("div",{className:"vi-4 border-t border-border Cr-4 max-h-full flex gap-2",children:[(0,vi.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,vi.jsxs)("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[(0,vi.jsx)(Cr.Info,{className:"h-4 w-4"}),"Document Metadata"]})}),(0,vi.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,vi.jsx)("div",{className:"bg-muted rounded-lg p-4 border border-border",children:i.metadata&&Object.keys(i.metadata).length>0?(0,vi.jsx)("div",{className:"space-y-2",children:Object.entries(i.metadata).map(([b,M],B)=>{let fe=D(b);return(0,vi.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,vi.jsx)(de,{value:b,onChange:ee=>{let $e=ee.target.value||"",Tt=i.metadata?.[b];l(Da=>{let ea={...Da.metadata};return delete ea[b],$e&&(ea[$e]=Tt||""),{...Da,metadata:ea}})},placeholder:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${b}`}),(0,vi.jsx)("datalist",{id:`metadata-keys-${b}`,children:le.allKeys.map(ee=>(0,vi.jsx)("option",{value:ee},ee))}),(0,vi.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),fe.length>0?(0,vi.jsxs)(ot,{value:String(M||""),onValueChange:ee=>O(b,ee),children:[(0,vi.jsx)(_e,{className:"flex-1 h-8 text-sm",children:(0,vi.jsx)(it,{placeholder:"Value"})}),(0,vi.jsxs)(We,{children:[fe.map(ee=>(0,vi.jsx)(Ae,{value:ee,children:ee},ee)),(0,vi.jsx)(Ae,{value:"__custom__",children:(0,vi.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,vi.jsx)(de,{value:String(M||""),onChange:ee=>u(b,ee.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,vi.jsx)(C,{type:"button",variant:"ghost",size:"sm",onClick:()=>H(b),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,vi.jsx)(Cr.vi,{className:"h-3 w-3"})})]},`metadata-key-${B}`)})}):(0,vi.jsxs)("div",{className:"text-center py-4",children:[(0,vi.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Cr metadata fields"}),(0,vi.jsx)("p",{className:"text-xs text-muted-foreground",children:'Click "Add Field" to create metadata'})]})}),(0,vi.jsxs)(C,{type:"button",variant:"outline",size:"sm",onClick:d,className:"gap-1 h-8",children:[(0,vi.jsx)(Cr.Plus,{className:"h-3 w-3"}),"Add Field"]})]})]})})]}),(0,vi.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,vi.jsx)("div",{className:"p-8 vi-0 h-full max-h-full overflow-auto",children:i.format==="richText"?(0,vi.jsx)(fa,{setValue:r,value:x,name:"richTextContent"}):(0,vi.jsx)(et,{value:i.content||"",onChange:b=>l(M=>({...M,content:b.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})})})]})}var gr=ve(require("react-markdown")),fr=ve(require("remark-gfm"));var vr=e=>(0,vi.jsx)(gr.default,{remarkPlugins:[fr.default],components:{h1:({children:t})=>(0,vi.jsx)("h1",{className:"text-2xl font-bold",children:t}),h2:({children:t})=>(0,vi.jsx)("h2",{className:"text-xl font-bold",children:t}),h3:({children:t})=>(0,vi.jsx)("h3",{className:"text-lg font-bold",children:t}),h4:({children:t})=>(0,vi.jsx)("h4",{className:"text-base font-bold",children:t}),ol:({children:t})=>(0,vi.jsx)("ol",{className:"list-decimal",children:t}),ul:({children:t})=>(0,vi.jsx)("ul",{className:"list-disc",children:t}),li:({children:t})=>(0,vi.jsx)("li",{className:"ml-4",children:t}),p:({children:t})=>(0,vi.jsx)("p",{className:"mb-4",children:t}),a:({children:t,href:a})=>(0,vi.jsx)("a",{href:a,className:"text-blue-500",children:t}),img:({src:t,alt:a})=>(0,vi.jsx)("img",{src:t,alt:a,className:"mb-4"}),blockquote:({children:t})=>(0,vi.jsx)("blockquote",{className:"border-l-4 border-gray-300 pl-4 mb-4",children:t})},children:e}),pr=e=>(0,vi.jsx)("div",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed",children:e}),js=e=>(0,vi.jsx)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:e&&(0,vi.jsx)(fa,{value:JSON.stringify(e),editable:!1,name:"richTextContent"},JSON.stringify(e))}),Hs=e=>(0,vi.jsxs)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:[(0,vi.jsx)("div",{className:"bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4 mb-4",children:(0,vi.jsxs)("p",{className:"text-blue-800 dark:text-blue-200 text-sm",children:[(0,vi.jsx)("strong",{children:"MDX Renderer:"})," This is a placeholder. Integrate with @mdx-js/react for full MDX rendering."]})}),vr(e)]});function hr({document:e,onDocumentUpdate:t,editable:a=!0,mode:o="view",renderers:s,availableDocuments:n=[],knowledgeContexts:i=[]}){let[l,g]=(0,ni.useState)(!1),[p,x]=(0,ni.useState)(!1),[r,m]=(0,ni.useState)(e),[y,v]=(0,ni.useState)(!1),h=(0,ni.useRef)(null),c=r.format==="richText"?r.richTextContent:r.content,f=(0,ni.useMemo)(()=>`${r.format}:${JSON.stringify(c)}`,[r.format,c]);(0,ni.useEffect)(()=>{m(e)},[e]);let S=E=>{switch(E){case"markdown":case"mdx":return(0,vi.jsx)(Cr.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,vi.jsx)(Cr.File,{className:"h-6 w-6 text-success"});case"text":return(0,vi.jsx)(Cr.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,vi.jsx)(Cr.File,{className:"h-6 w-6 text-muted-foreground"})}},N=E=>{switch(E){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},k=(E,W)=>{let oe={markdown:vr,mdx:Hs,text:pr},ge=s?.[W]||oe[W];if(W==="richText"&&typeof E=="object")return js(E);if(ge&&typeof E=="string")return ge(E);if(typeof E=="string")return pr(E)},z=async(E,W="save")=>{W==="save"&&v(!0),h.current=r,(0,ni.startTransition)(()=>{m({...E,richTextContent:E.richTextContent?structuredClone(E.richTextContent):void 0})});try{let oe=await t?.(E);if(W==="save"&&v(!1),!oe)throw new Error("save failed")}catch{h.current&&(0,ni.startTransition)(()=>m(h.current))}},ae=()=>{g(!1)};return(0,vi.jsxs)(vi.Fragment,{children:[(0,vi.jsx)(Qe,{open:l||o==="create",onOpenChange:E=>!E&&ae(),children:(0,vi.jsxs)(pa,{children:[(0,vi.jsx)(ta,{}),(0,vi.jsxs)(ur.Content,{className:w("fixed inset-0 z-50 bg-background p-0 m-0 border-0","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"),children:[y&&(0,vi.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center",children:(0,vi.jsx)(Cr.Loader2,{className:"h-8 w-8 animate-spin text-primary"})}),(0,vi.jsx)(mr,{mode:o==="create"?"create":"edit",document:r,onSave:z,onCancel:ae,availableDocuments:n,knowledgeContexts:i})]})]})}),(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-full flex flex-col",children:[(0,vi.jsxs)("div",{className:"border-b border-border bg-card p-8 pb-6",children:[(0,vi.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,vi.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,vi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,vi.jsxs)("h1",{className:"text-2xl font-bold text-foreground mb-2 leading-tight",children:[r.title,(0,vi.jsx)("span",{className:`inline-flex ml-4 items-center px-3 py-1 rounded-full text-sm font-medium border ${N(r.format)}`,children:r.format.toUpperCase()})]}),r.description&&(0,vi.jsx)("p",{className:"text-muted-foreground text-lg leading-relaxed",children:r.description})]})}),(0,vi.jsxs)("div",{className:"items-center gap-2 flex-shrink-0 hidden lg:flex",children:[r.metadata&&Object.keys(r.metadata).length>0&&(0,vi.jsxs)(C,{variant:"ghost",size:"sm",onClick:()=>x(!p),className:"gap-2",children:[(0,vi.jsx)(Cr.Info,{className:"h-4 w-4"}),"Metadata",p?(0,vi.jsx)(Cr.ChevronDown,{className:"h-4 w-4"}):(0,vi.jsx)(Cr.ChevronRight,{className:"h-4 w-4"})]}),a&&(0,vi.jsxs)(C,{variant:"outline",size:"sm",onClick:()=>g(!0),className:"gap-2",children:[(0,vi.jsx)(Cr.Edit3,{className:"h-4 w-4"}),"Edit"]})]})]}),r.metadata&&Object.keys(r.metadata).length>0&&(0,vi.jsx)(Do.motion.div,{initial:!1,animate:{height:p?"auto":0,opacity:p?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,vi.jsxs)("div",{className:"vi-4 border-t border-border Cr-4",children:[(0,vi.jsxs)("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-2",children:[(0,vi.jsx)(Cr.Info,{className:"h-4 w-4"}),"Document Metadata"]}),(0,vi.jsx)("div",{className:"bg-muted rounded-lg p-4 border border-border",children:(0,vi.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-x-6 gap-y-2 text-sm",children:Object.entries(r.metadata).map(([E,W])=>(0,vi.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,vi.jsx)("span",{className:"text-muted-foreground font-medium text-xs uppercase tracking-wide",children:E.replace(/([vi-vi])/g," $1").trim()}),(0,vi.jsx)("span",{className:"text-foreground font-medium",children:String(W)})]},E))})})]})})]}),(0,vi.jsx)("div",{className:"flex-1 ",children:(0,vi.jsx)("div",{className:"py-4 h-full",children:(0,vi.jsx)("div",{className:"space-y-4",children:r.content||r.richTextContent?(0,vi.jsx)("div",{className:"relative",children:(0,vi.jsx)("div",{className:"bg-background px-8 overflow-hidden h-full flex-1",children:k(r.format==="richText"?r.richTextContent:r.content,r.format)})},f):(0,vi.jsxs)("div",{className:"text-center p-12 bg-muted rounded-xl border-2 border-dashed border-border",children:[(0,vi.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-background flex items-center justify-center",children:(0,vi.jsx)(Cr.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,vi.jsx)("h4",{className:"text-foreground font-medium mb-1",children:"Cr content available"}),(0,vi.jsx)("p",{className:"text-muted-foreground text-sm",children:"This document doesn't have preview content"})]})})})})]})]})}function oi({label:e,documents:t,children:a,level:o,onDocumentClick:s,selectedDocumentId:n,showDocumentCount:i=!0}){let[l,g]=(0,ni.useState)(o===0),p=a&&Object.keys(a).length>0,x=t.length+(a?Object.values(a).reduce((y,v)=>y+v.documents.length,0):0),r=y=>{switch(y){case"markdown":case"mdx":return(0,vi.jsx)(Cr.FileText,{className:"h-3.5 w-3.5 text-muted-foreground"});case"richText":return(0,vi.jsx)(Cr.File,{className:"h-3.5 w-3.5 text-muted-foreground"});default:return(0,vi.jsx)(Cr.File,{className:"h-3.5 w-3.5 text-muted-foreground"})}},m=y=>{let v=["bg-primary","bg-secondary","bg-accent","bg-chart-1"];return v[y%v.length]};return(0,vi.jsxs)("div",{className:"space-y-1",children:[(p||t.length>0)&&(0,vi.jsxs)(Do.motion.div,{className:`group flex items-center gap-3 p-3 rounded-xl cursor-pointer transition-all duration-200 ${l?"bg-card shadow-sm border border-border":"hover:bg-muted/50 hover:shadow-sm"}`,style:{marginLeft:`${o*20}px`},onClick:()=>g(!l),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,vi.jsx)("div",{className:`w-1 h-6 rounded-full ${m(o)}`}),(0,vi.jsx)(Do.motion.div,{animate:{rotate:l?90:0},transition:{duration:.2},className:"flex-shrink-0",children:(0,vi.jsx)(Cr.ChevronRight,{className:"h-4 w-4 text-muted-foreground"})}),(0,vi.jsxs)("div",{className:"flex-1 flex items-center justify-between min-w-0",children:[(0,vi.jsx)("div",{className:"flex items-center gap-2 min-w-0",children:(0,vi.jsx)("span",{className:"font-medium text-foreground truncate",children:e})}),i&&x>0&&(0,vi.jsx)("div",{className:"flex-shrink-0 ml-2",children:(0,vi.jsx)("span",{className:"inline-flex items-center justify-center w-6 h-6 text-xs font-medium bg-muted text-muted-foreground rounded-full",children:x})})]})]}),(0,vi.jsx)(Do.motion.div,{initial:!1,animate:{height:l?"auto":0,opacity:l?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,vi.jsxs)("div",{className:"vi-2 space-y-1",children:[t.map((y,v)=>(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.05,duration:.2},className:`group flex items-center gap-3 p-2.5 mx-2 rounded-lg cursor-pointer transition-all duration-150 ${n===y.id?"bg-primary/10 border-l-2 border-primary shadow-sm":"hover:bg-muted/50 hover:translate-x-1"}`,style:{marginLeft:`${o*20+20}px`},onClick:()=>s?.(y),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,vi.jsx)("div",{className:"flex-shrink-0",children:r(y.format)}),(0,vi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,vi.jsx)("p",{className:`text-sm truncate transition-colors ${n===y.id?"text-primary font-medium":"text-foreground group-hover:text-foreground"}`,children:y.title}),y.description&&(0,vi.jsx)("p",{className:"text-xs text-muted-foreground truncate Cr-0.5",children:y.description})]}),y.tags&&y.tags.length>0&&(0,vi.jsx)("div",{className:"flex-shrink-0",children:(0,vi.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-md text-xs font-medium bg-muted text-muted-foreground group-hover:bg-muted/80 transition-colors",children:y.tags[0]})})]},y.id)),a&&Object.entries(a).map(([y,v])=>(0,vi.jsx)(oi,{label:y,documents:v.documents,children:v.children,level:o+1,onDocumentClick:s,selectedDocumentId:n,showDocumentCount:i},y))]})})]})}function br({documents:e,menuConfig:t,onDocumentClick:a,onDocumentShare:o,onDocumentUpdate:s,selectedDocumentId:n,className:i,editable:l=!0}){let[g,p]=(0,ni.useState)(""),[x,r]=(0,ni.useState)(null),[m,y]=(0,ni.useState)(e);(0,ni.useEffect)(()=>{y(e)},[e]),(0,ni.useEffect)(()=>{if(x?.id){let f=m.find(S=>S.id===x.id);f&&r(f)}},[m]);let v=(0,ni.useMemo)(()=>g?m.filter(f=>f.title.toLowerCase().includes(g.toLowerCase())||f.description?.toLowerCase().includes(g.toLowerCase())||f.tags?.some(S=>S.toLowerCase().includes(g.toLowerCase()))||Object.values(f.metadata||{}).some(S=>String(S).toLowerCase().includes(g.toLowerCase()))):m,[m,g]),h=(0,ni.useMemo)(()=>{let f=(S,N)=>{if(N.length===0)return{};let[k,...z]=N;return S.reduce((_,E)=>{let W=E.metadata?.[k]||"Uncategorized",oe=String(W);if(_[oe]||(_[oe]={documents:[],children:{}}),z.length===0)_[oe].documents.push(E);else{let ge=f([E],z),D=Object.keys(ge)[0];D&&(_[oe].children||(_[oe].children={}),_[oe].children[D]?_[oe].children[D].documents.push(...ge[D].documents):_[oe].children[D]=ge[D])}return _},{})};return f(v,t.groupBy)},[v,t.groupBy]),c=f=>{r(f),a?.(f)};return(0,vi.jsxs)("div",{className:`flex h-full ${i||""}`,children:[(0,vi.jsxs)("div",{className:"w-1/3 border-r border-border bg-muted/20",children:[(0,vi.jsx)("div",{className:"p-6 border-b border-border",children:(0,vi.jsxs)("div",{className:"relative",children:[(0,vi.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,vi.jsx)(Cr.Search,{className:"h-4 w-4 text-muted-foreground"})}),(0,vi.jsx)(de,{placeholder:"Search knowledge base...",value:g,onChange:f=>p(f.target.value),className:"pl-10 bg-background/80 border-border focus:border-primary/50 focus:ring-primary/20 rounded-xl h-11 text-sm placeholder:text-muted-foreground"})]})}),(0,vi.jsx)(Ze,{className:"h-[calc(100%-100px)]",children:(0,vi.jsx)("div",{className:"p-4 space-y-3",children:t.groupBy.length===0?(0,vi.jsx)(vi.Fragment,{children:(0,vi.jsx)(oi,{label:"Document",documents:v,level:0,onDocumentClick:c,selectedDocumentId:n,showDocumentCount:t.showDocumentCount},"Document")}):(0,vi.jsxs)(vi.Fragment,{children:[Object.entries(h).map(([f,S])=>(0,vi.jsx)(oi,{label:f,documents:S.documents,children:S.children,level:0,onDocumentClick:c,selectedDocumentId:n,showDocumentCount:t.showDocumentCount},f)),Object.keys(h).length===0&&(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center text-muted-foreground py-12",children:[(0,vi.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-muted flex items-center justify-center",children:(0,vi.jsx)(Cr.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,vi.jsx)("p",{className:"text-sm font-medium",children:"Cr documents found"}),(0,vi.jsx)("p",{className:"text-xs Cr-1",children:"Try adjusting your search terms"})]})]})})})]}),(0,vi.jsx)("div",{className:"flex-1 bg-background overflow-scroll",children:x?(0,vi.jsx)(hr,{document:x,onDocumentUpdate:s,editable:l}):(0,vi.jsx)("div",{className:"h-full flex items-center justify-center text-center",children:(0,vi.jsxs)(Do.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4},className:"max-w-sm",children:[(0,vi.jsx)("div",{className:"w-20 h-20 mx-auto mb-6 rounded-full bg-primary/10 flex items-center justify-center",children:(0,vi.jsx)(Cr.FileText,{className:"h-10 w-10 text-primary"})}),(0,vi.jsx)("h3",{className:"text-xl font-semibold text-foreground mb-2",children:"Select a document"}),(0,vi.jsx)("p",{className:"text-muted-foreground leading-relaxed",children:"Choose any document from the knowledge base to view its content and details"})]})})})]})}var yr=({isOpen:e,onClose:t,onAddKnowledge:a,knowledgeContexts:o})=>{let s=()=>{let h=new Set;return o.forEach(c=>{c.menuConfig.groupBy.forEach(f=>h.add(f))}),{contextKeys:Array.from(h).sort(),allKeys:Array.from(h).sort()}},[n,i]=(0,ni.useState)(()=>{let h=s();return{name:"",description:"",metadata:h.contextKeys.length>0?h.contextKeys.map(c=>({key:c,value:""})):[{key:"",value:""}]}}),l=h=>{if(h.preventDefault(),!n.name)return;let c=n.metadata.filter(S=>S.key&&S.key.trim()&&S.value&&S.value.trim());a({name:n.name,description:n.description,metadata:c,source:"payload",visibility:"public",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()});let f=s();i({name:"",description:"",metadata:f.contextKeys.length>0?f.contextKeys.map(S=>({key:S,value:""})):[{key:"",value:""}]}),t()},g=()=>{let h=s();i({name:"",description:"",metadata:h.contextKeys.length>0?h.contextKeys.map(c=>({key:c,value:""})):[{key:"",value:""}]}),t()},p=s(),x=h=>{let c=new Set;return Array.from(c).sort()},r=(h,c)=>{i(f=>{let S=f.metadata.find(N=>N.key===h);return S&&(S.value=c),{...f,metadata:[...f.metadata.filter(N=>N.key!==h),{key:h,value:c}]}})},m=(h,c)=>{c==="__custom__"?r(h,""):r(h,c)},y=()=>{r(" ","")},v=h=>{i(c=>{let f=[...c.metadata],S=f.findIndex(N=>N.key===h);return S!==-1&&f.splice(S,1),{...c,metadata:f}})};return(0,vi.jsx)(Qe,{open:e,onOpenChange:g,children:(0,vi.jsxs)(wt,{className:"sm:max-w-md",children:[(0,vi.jsx)(Ct,{children:(0,vi.jsx)(lt,{children:"Add New Knowledge source"})}),(0,vi.jsxs)("form",{onSubmit:l,className:"space-y-4",children:[(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsxs)("div",{children:[(0,vi.jsx)(xe,{htmlFor:"name",children:"Name *"}),(0,vi.jsx)(de,{id:"name",value:n.name,onChange:h=>i(c=>({...c,name:h.target.value})),required:!0})]}),(0,vi.jsxs)("div",{children:[(0,vi.jsx)(xe,{htmlFor:"name",children:"Description"}),(0,vi.jsx)(de,{id:"name",value:n.description,onChange:h=>i(c=>({...c,description:h.target.value})),required:!0})]}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,vi.jsxs)("div",{children:[(0,vi.jsx)(xe,{htmlFor:"metadata",children:"Metadata"}),p.contextKeys.length>0?(0,vi.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Context keys: ",p.contextKeys.slice(0,4).join(", "),p.contextKeys.length>4&&` +${p.contextKeys.length-4} more`," ","\u2022 Fill in values or add more fields"]}):(0,vi.jsx)("p",{className:"text-xs text-muted-foreground",children:"Add key-value metadata to organize and categorize your knowledge"})]}),(0,vi.jsxs)(C,{type:"button",variant:"outline",size:"sm",onClick:y,className:"gap-1 h-8",children:[(0,vi.jsx)(Cr.Plus,{className:"h-3 w-3"}),"Add"]})]}),(0,vi.jsx)("div",{className:"space-y-2",children:n.metadata.map(({key:h,value:c},f)=>{let S=x(h);return(0,vi.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,vi.jsx)(de,{value:h,onChange:N=>{let k=N.target.value||" ",z=n.metadata.find(ae=>ae.key===h)?.value;i(ae=>{let _=[...ae.metadata],E=_.findIndex(W=>W.key===h);return E!==-1&&_.splice(E,1),k&&_.push({key:k,value:z||""}),{...ae,metadata:_}}),N.target.focus()},placeholder:p.allKeys.length>0?`e.g., ${p.allKeys[0]}`:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${h}`}),(0,vi.jsx)("datalist",{id:`metadata-keys-${h}`,children:p.allKeys.map(N=>(0,vi.jsx)("option",{value:N},N))}),(0,vi.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),S.length>0?(0,vi.jsxs)(ot,{value:String(c||""),onValueChange:N=>m(h,N),children:[(0,vi.jsx)(_e,{className:"flex-1 h-8 text-sm",children:(0,vi.jsx)(it,{placeholder:"Value"})}),(0,vi.jsxs)(We,{children:[S.map(N=>(0,vi.jsx)(Ae,{value:N,children:N},N)),(0,vi.jsx)(Ae,{value:"__custom__",children:(0,vi.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,vi.jsx)(de,{value:String(c||""),onChange:N=>r(h,N.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,vi.jsx)(C,{type:"button",variant:"ghost",size:"sm",onClick:()=>v(h),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,vi.jsx)(Cr.vi,{className:"h-3 w-3"})})]},`metadata-key-${f}`)})})]})]}),(0,vi.jsxs)("div",{className:"flex justify-end gap-3 vi-4",children:[(0,vi.jsxs)(C,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,vi.jsx)(Cr.vi,{className:"h-4 w-4"}),"Cancel"]}),(0,vi.jsxs)(C,{type:"submit",children:[(0,vi.jsx)(Cr.Save,{className:"h-4 w-4"}),"Create"]})]})]})]})})};var Na=require("sonner");var wr=({isOpen:e,onClose:t,knowledgeSources:a,onCreate:o,onUpdate:s,onDelete:n})=>{let[i,l]=(0,ni.useState)(""),[g,p]=(0,ni.useState)(null),[x,r]=(0,ni.useState)(""),[m,y]=(0,ni.useState)(""),[v,h]=(0,ni.useState)([]),[c,f]=(0,ni.useState)(""),[S,N]=(0,ni.useState)("name"),[k,z]=(0,ni.useState)("asc"),[ae,_]=(0,ni.useState)(!0),E=a.filter(d=>d.label.toLowerCase().includes(i.toLowerCase())||d.description?.toLowerCase().includes(i.toLowerCase())),W=d=>{p(d),r(d.label),y(d.description||""),h(d.menuConfig?.groupBy||[]),N(d.menuConfig?.sortBy||"name"),z(d.menuConfig?.sortOrder||"asc"),_(d.menuConfig?.showDocumentCount||!0)},oe=()=>{c.trim()&&!v.includes(c.trim())&&(h([...v,c.trim()]),f(""))},ge=d=>{h(v.filter(H=>H!==d))},D=d=>{d.key==="Enter"&&(d.preventDefault(),oe())},le=()=>{p(null),r(""),y(""),h([]),f(""),N("name"),z("asc"),_(!0)},Me=()=>{if(!x.trim()){Na.toast.error("Label is required");return}o?.({id:x.trim(),label:x.trim(),description:m.trim(),menuConfig:{groupBy:v,sortBy:S,sortOrder:k,showDocumentCount:ae}}),Na.toast.success("Knowledge source created successfully"),le()},u=()=>{if(g){if(!x.trim()){Na.toast.error("Label is required");return}s?.({id:g.id,label:x.trim(),description:m.trim(),menuConfig:{groupBy:v,sortBy:S,sortOrder:k,showDocumentCount:ae}}),Na.toast.success("Knowledge source updated successfully"),le()}},O=()=>{g&&window.confirm(`Are you sure you want to delete "${g.label}"?`)&&(n?.(g.id),Na.toast.success("Knowledge source deleted successfully"),le())};return(0,vi.jsx)(Qe,{open:e,onOpenChange:t,children:(0,vi.jsxs)(wt,{className:"sm:max-w-[900px] max-h-[90vh] bg-card border-border p-0",children:[(0,vi.jsx)(Ct,{className:"px-6 vi-6 pb-4 border-b border-border",children:(0,vi.jsx)(lt,{className:"text-foreground text-2xl",children:"Manage Knowledge Sources"})}),(0,vi.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 p-6 overflow-hidden",children:[(0,vi.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,vi.jsxs)("div",{className:"relative",children:[(0,vi.jsx)(Cr.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,vi.jsx)(de,{value:i,onChange:d=>l(d.target.value),placeholder:"Search contexts...",className:"pl-10 bg-background border-input"})]}),(0,vi.jsx)(Ze,{className:"rounded-md border border-border bg-background flex-1",children:(0,vi.jsx)("div",{className:"p-2 space-y-2",children:E.length===0?(0,vi.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[(0,vi.jsx)(Cr.FileText,{className:"h-12 w-12 text-muted-foreground mb-2"}),(0,vi.jsx)("p",{className:"text-sm text-muted-foreground",children:i?"Cr contexts found":"Cr contexts yet"})]}):E.map(d=>(0,vi.jsx)("div",{onClick:()=>W(d),className:w("p-3 rounded-lg cursor-pointer transition-all hover:bg-accent/50",g?.id===d.id&&"bg-accent text-accent-foreground"),children:(0,vi.jsx)("div",{className:"flex items-start justify-between gap-2",children:(0,vi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,vi.jsx)("h4",{className:"font-medium truncate",children:d.label}),d.description&&(0,vi.jsx)("p",{className:"text-sm opacity-80 truncate Cr-1",children:d.description}),(d.menuConfig?.groupBy||[]).length>0&&(0,vi.jsxs)("div",{className:"flex flex-wrap gap-1 Cr-2",children:[d.menuConfig?.groupBy?.slice(0,3).map(H=>(0,vi.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-secondary text-secondary-foreground",children:H},H)),(d.menuConfig?.groupBy||[]).length>3&&(0,vi.jsxs)("span",{className:"text-xs px-2 py-0.5",children:["+",(d.menuConfig?.groupBy||[]).length-3]})]})]})})},d.id))})}),(0,vi.jsx)(C,{variant:"outline",onClick:le,className:"w-full",children:"Clear Selection / New Context"})]}),(0,vi.jsxs)("div",{className:"space-y-4",children:[(0,vi.jsx)(Ze,{className:"h-[400px] pr-4",children:(0,vi.jsxs)("div",{className:"space-y-4",children:[(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsxs)(xe,{htmlFor:"label",className:"text-foreground",children:["Label ",(0,vi.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,vi.jsx)(de,{id:"label",value:x,onChange:d=>r(d.target.value),placeholder:"Enter label",className:"bg-background border-input"})]}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{htmlFor:"description",className:"text-foreground",children:"Description"}),(0,vi.jsx)(et,{id:"description",value:m,onChange:d=>y(d.target.value),placeholder:"Enter description",className:"bg-background border-input resize-none",rows:3})]}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{className:"text-foreground",children:"Group By"}),(0,vi.jsxs)("div",{className:"flex gap-2",children:[(0,vi.jsx)(de,{value:c,onChange:d=>f(d.target.value),onKeyPress:D,placeholder:"Type a tag and press Enter",className:"bg-background border-input flex-1"}),(0,vi.jsx)(C,{onClick:oe,className:"bg-accent hover:bg-accent/90",children:"Add"})]}),v.length>0&&(0,vi.jsx)("div",{className:"flex flex-wrap gap-2 Cr-2",children:v.map(d=>(0,vi.jsxs)("div",{className:"bg-secondary text-secondary-foreground px-3 py-1 rounded-md flex items-center gap-2 text-sm",children:[d,(0,vi.jsx)(Cr.vi,{className:"h-3 w-3 cursor-pointer hover:text-destructive",onClick:()=>ge(d)})]},d))})]}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{htmlFor:"sortBy",className:"text-foreground",children:"Sort By"}),(0,vi.jsxs)(ot,{value:S,onValueChange:d=>N(d),children:[(0,vi.jsx)(_e,{className:"bg-background border-input",children:(0,vi.jsx)(it,{})}),(0,vi.jsxs)(We,{className:"bg-popover border-border",children:[(0,vi.jsx)(Ae,{value:"name",children:"Name"}),(0,vi.jsx)(Ae,{value:"createdAt",children:"Created At"})]})]})]}),(0,vi.jsxs)("div",{className:"space-y-2",children:[(0,vi.jsx)(xe,{htmlFor:"sortOrder",className:"text-foreground",children:"Sort Order"}),(0,vi.jsxs)(ot,{value:k,onValueChange:d=>z(d),children:[(0,vi.jsx)(_e,{className:"bg-background border-input",children:(0,vi.jsx)(it,{})}),(0,vi.jsxs)(We,{className:"bg-popover border-border",children:[(0,vi.jsx)(Ae,{value:"asc",children:"Ascending"}),(0,vi.jsx)(Ae,{value:"desc",children:"Descending"})]})]})]}),(0,vi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,vi.jsx)(Pa,{id:"showDocumentCount",checked:ae,onCheckedChange:d=>_(d)}),(0,vi.jsx)(xe,{htmlFor:"showDocumentCount",className:"text-sm font-normal cursor-pointer text-foreground",children:"Show Document Count"})]})]})}),(0,vi.jsx)("div",{className:"flex gap-3 vi-4 border-t border-border",children:g?(0,vi.jsxs)(vi.Fragment,{children:[(0,vi.jsxs)(C,{variant:"destructive",onClick:O,className:"flex-1",children:[(0,vi.jsx)(Cr.Trash2,{className:"mr-2 h-4 w-4"}),"Delete"]}),(0,vi.jsx)(C,{onClick:u,className:"flex-1 bg-accent hover:bg-accent/90",children:"Update"})]}):(0,vi.jsx)(C,{onClick:Me,className:"w-full bg-accent hover:bg-accent/90",children:"Create"})})]})]}),(0,vi.jsx)("div",{className:"px-6 py-4 border-t border-border flex justify-end",children:(0,vi.jsx)(C,{variant:"outline",onClick:t,children:"Close"})})]})})};function ii({documents:e=[],contexts:t=[],onDocumentClick:a=r=>console.log("Document clicked:",r),onDocumentShare:o=r=>console.log("Share document:",r),onLoadDocumentContent:s,selectedDocumentId:n,onAddKnowledge:i,onDocumentUpdate:l,onAddTeamContext:g,onUpdateTeamContext:p,onDeleteTeamContext:x}){let[r,m]=(0,ni.useState)(t[0]),[y,v]=(0,ni.useState)(!1),[h,c]=(0,ni.useState)(!1),[f,S]=(0,ni.useState)(!1);(0,ni.useEffect)(()=>{if(!r&&t&&t.length>0)m(t[0]);else{let k=t.find(z=>z.id===r?.id);m(k||t[0])}},[t]);let N=k=>{i&&(S(!0),i(k)),v(!1)};return(0,vi.jsxs)("div",{className:"flex flex-col h-full",children:[(0,vi.jsxs)("div",{className:"px-2 md:px-4 py-4 flex-shrink-0",children:[f&&(0,vi.jsxs)("div",{className:"absolute inset-0 bg-background/90 z-[9999] flex flex-col items-center justify-center gap-4",children:[(0,vi.jsx)(Cr.Loader2,{className:"h-8 w-8 animate-spin text-primary"}),(0,vi.jsx)("p",{className:"font-semibold text-lg",children:"Initializing document..."})]}),t&&t.length>0&&(0,vi.jsxs)("div",{className:"",children:[(0,vi.jsx)("div",{className:"",children:(0,vi.jsxs)("nav",{className:"-mb-px flex justify-between items-center",children:[(0,vi.jsx)("div",{className:"flex space-x-8 overflow-x-auto",children:t.map(k=>(0,vi.jsxs)("button",{onClick:()=>m(k),className:`group inline-flex items-center gap-2 py-3 px-1 border-b-2 font-medium text-sm whitespace-nowrap transition-colors ${r?.id===k.id?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground"}`,children:[k.icon,k.label]},k.id))}),(0,vi.jsxs)(gt,{children:[(0,vi.jsx)(ft,{children:(0,vi.jsxs)("div",{className:"inline-flex border border-primary rounded-xl items-center justify-center gap-2 py-2 px-3 text-sm font-medium text-primary hover:text-primary/80 transition-colors whitespace-nowrap",children:["Actions ",(0,vi.jsx)(Cr.ChevronDown,{className:"h-4 w-4"})]})}),(0,vi.jsxs)(dt,{children:[(0,vi.jsx)(ze,{onClick:()=>v(!0),children:"Add Knowledge"}),(0,vi.jsx)(ze,{onClick:()=>c(!0),children:"Manage Contexts"})]})]})]})}),r?.description&&(0,vi.jsx)("div",{className:"Cr-3 px-1",children:(0,vi.jsx)("p",{className:"text-sm text-primary",children:r?.description})})]})]}),r?(0,vi.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4",children:(0,vi.jsx)("div",{className:"h-full rounded-xl border overflow-hidden",children:(0,vi.jsx)(br,{documents:e,menuConfig:r?.menuConfig,onDocumentClick:a,onDocumentShare:o,selectedDocumentId:n,onDocumentUpdate:l})})}):(0,vi.jsxs)("div",{children:[(0,vi.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,vi.jsx)("p",{className:"text-muted-foreground",children:"Cr contexts available"})}),(0,vi.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,vi.jsx)(C,{onClick:()=>c(!0),children:"Add Context"})})]}),(0,vi.jsxs)(vi.Fragment,{children:[(0,vi.jsx)(wr,{isOpen:h,onClose:()=>c(!1),knowledgeSources:t,onCreate:g,onUpdate:p,onDelete:x}),(0,vi.jsx)(yr,{isOpen:y,onClose:()=>v(!1),onAddKnowledge:N,knowledgeContexts:t})]})]})}function Nr({title:e="Digital Colleagues",businessUnits:t,projects:a,fileCount:o,teamMemberCount:s,onCreateProject:n,onOpenProject:i,sidebarItems:l,initialColleagues:g,users:p,onColleagueAdd:x,onColleagueEdit:r,onColleagueDelete:m}){let[y,v]=(0,ni.useState)("home"),[h,c]=(0,ni.useState)(t[0]),f=D=>{console.log("Opening app:",D.name)},S=D=>{console.log("Favoriting app:",D.name)},N=D=>{console.log("Opening file:",D.name)},k=D=>{console.log("Sharing file:",D.name)},z=D=>{console.log("Opening project:",D.name),i(D)},ae=D=>{console.log("Sharing project:",D.name)},_=D=>{c(D),console.log("Business unit changed to:",D.name)},E=()=>{console.log("Copilot clicked - navigating to chat"),v("chat")},W=D=>{console.log("Notification removed:",D)},oe=()=>{console.log("All notifications removed")},ge=()=>{switch(y){case"home":return(0,vi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,vi.jsxs)("section",{className:"text-center py-12",children:[(0,vi.jsxs)("h1",{className:"text-4xl font-bold mb-4",children:["Welcome to the ",h.name," team"]}),(0,vi.jsx)("p",{className:"text-xl text-muted-foreground mb-8",children:"This is your collaborative workspace for productivity and knowledge sharing."})]}),(0,vi.jsxs)("section",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[(0,vi.jsxs)("div",{className:"bg-card p-6 rounded-lg border",children:[(0,vi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Projects"}),(0,vi.jsx)("p",{className:"text-3xl font-bold text-primary",children:a.length}),(0,vi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Active projects"})]}),(0,vi.jsxs)("div",{className:"bg-card p-6 rounded-lg border",children:[(0,vi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Team Members"}),(0,vi.jsx)("p",{className:"text-3xl font-bold text-primary",children:s}),(0,vi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Collaborators"})]}),(0,vi.jsxs)("div",{className:"bg-card p-6 rounded-lg border",children:[(0,vi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Files"}),(0,vi.jsx)("p",{className:"text-3xl font-bold text-primary",children:o}),(0,vi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Project files"})]})]}),(0,vi.jsx)(Bt,{title:"Chat with your team",gradient:"bg-gradient-to-r from-pink-600 via-red-600 to-orange-600",primaryAction:{label:"Go",onClick:()=>v("chat")}})]});case"colleagues":return(0,vi.jsx)(ei,{initialColleagues:g,availableUsers:p,onColleagueAdd:x,onColleagueEdit:r,onColleagueDelete:m});case"chat":return(0,vi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,vi.jsxs)("section",{className:"text-center py-12",children:[(0,vi.jsx)("h1",{className:"text-4xl font-bold mb-4",children:"Team Chat"}),(0,vi.jsxs)("p",{className:"text-xl text-muted-foreground mb-8",children:["Connect with your ",h.name," team members and collaborate in real-time."]})]}),(0,vi.jsx)(Bt,{title:"Launch Full Chat Interface",description:"Access the complete chat experience with AI assistance.",gradient:"bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600",primaryAction:{label:"Open Chat",onClick:()=>console.log("Open full chat interface")}})]});case"apps":return(0,vi.jsxs)("div",{className:"space-y-8",children:[(0,vi.jsx)(Bt,{title:"Creative Apps Collection",description:"Discover our full suite of professional design and creative applications.",gradient:"bg-gradient-to-r from-pink-600 via-red-600 to-orange-600",primaryAction:{label:"Install Desktop App",onClick:()=>console.log("Install desktop app clicked")}}),(0,vi.jsxs)("section",{className:"space-y-4",children:[(0,vi.jsx)("h2",{className:"text-2xl font-semibold",children:"New Releases"}),(0,vi.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",children:Xo.filter(D=>D.new).map(D=>(0,vi.jsx)(Eo,{app:D,showProgress:!0,onOpen:f,onFavorite:S},D.name))})]}),(0,vi.jsxs)("section",{className:"space-y-4",children:[(0,vi.jsx)("h2",{className:"text-2xl font-semibold",children:"All Apps"}),(0,vi.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",children:Xo.map(D=>(0,vi.jsx)(Eo,{app:D,onOpen:f,onFavorite:S},D.name))})]})]});case"knowledge":return(0,vi.jsx)(ii,{});case"files":return(0,vi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,vi.jsx)(Bt,{title:"Your Creative Files",description:"Access, manage, and share all your design files in one place.",gradient:"bg-gradient-to-r from-teal-600 via-cyan-600 to-blue-600",primaryAction:{label:"Upload Files",onClick:()=>console.log("Upload files clicked")}}),(0,vi.jsxs)("section",{className:"space-y-4",children:[(0,vi.jsx)("div",{className:"flex items-center justify-between",children:(0,vi.jsx)("h2",{className:"text-2xl font-semibold",children:"All Files"})}),(0,vi.jsx)(Xn,{files:Qn,onFileClick:N})]})]});case"projects":return(0,vi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,vi.jsx)(Bt,{title:"Project Management",description:"Organize your creative work into projects and collaborate with your team.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"New Project",onClick:n}}),(0,vi.jsxs)("section",{className:"space-y-4",children:[(0,vi.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Projects"}),(0,vi.jsx)("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:a.map(D=>(0,vi.jsx)(Yn,{project:D,onOpen:z,onShare:ae},D.name))})]})]});case"learn":return(0,vi.jsxs)("div",{className:"space-y-8",children:[(0,vi.jsx)(Bt,{title:"Learn & Grow",description:"Expand your creative skills with tutorials, courses, and resources.",gradient:"bg-gradient-to-r from-green-600 via-emerald-600 to-teal-600",primaryAction:{label:"Upgrade to Pro",onClick:()=>console.log("Upgrade to pro clicked")}}),(0,vi.jsxs)("section",{className:"space-y-4",children:[(0,vi.jsx)("h2",{className:"text-2xl font-semibold",children:"Featured Tutorials"}),(0,vi.jsx)("div",{className:"grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3",children:er.slice(0,3).map(D=>(0,vi.jsxs)("div",{className:"rounded-3xl border p-6",children:[(0,vi.jsx)("h3",{className:"font-semibold mb-2",children:D.title}),(0,vi.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:D.description}),(0,vi.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,vi.jsx)("span",{children:D.duration}),(0,vi.jsx)("span",{children:D.level})]})]},D.title))})]})]});default:return null}};return(0,vi.jsx)(Xi,{sidebarItems:ar,title:e,notifications:or,businessUnits:t,currentBusinessUnit:h,onBusinessUnitChange:_,activeTab:y,onTabChange:v,showTabs:!0,onActionClick:E,actionIcon:(0,vi.jsx)(Cr.Bot,{className:"mr-2 h-4 w-4"}),actionText:"Start Chat",onNotificationRemove:W,onRemoveAll:oe,children:(0,vi.jsx)(Do.AnimatePresence,{mode:"wait",children:(0,vi.jsx)(Do.motion.div,{className:"flex-1 h-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:ge()},y)})})}