adminizer 5.0.0-build.9 → 5.1.0-build.24

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 (232) hide show
  1. package/assets/abnfDiagram-VCTEODGH-DFY3Pztx.js +1 -0
  2. package/assets/add-31tS-g4V.js +1 -0
  3. package/assets/add-group-Cf3zT7WE.js +1 -0
  4. package/assets/add-user-C62wOna-.js +1 -0
  5. package/assets/ai-assistant/agent.es.js +28464 -0
  6. package/assets/app-DPmI-MvN.css +1 -0
  7. package/assets/app-vdHbjOQX.js +138 -0
  8. package/assets/arc-DP4o1zz3.js +1 -0
  9. package/assets/architectureDiagram-5GKGNRK7-BjXW5Zu0.js +36 -0
  10. package/assets/asmcrypto-DZeQH0LC.js +1 -0
  11. package/assets/blockDiagram-I7D4REHJ-BUPnDwN0.js +129 -0
  12. package/assets/c4Diagram-7LVT6UL2-Cmb_dAhd.js +38 -0
  13. package/assets/{catalog-dk6a0I1u.js → catalog-C-y5rMaG.js} +3 -3
  14. package/assets/channel-CkJRUsq_.js +1 -0
  15. package/assets/chunk-2Q5K7J3B-CmS-dWwQ.js +1 -0
  16. package/assets/chunk-5VM5RSS4-Cqs2Ow64.js +15 -0
  17. package/assets/chunk-F27PBJKO-BoMCpJA1.js +1 -0
  18. package/assets/chunk-IMKFNOWR-DlDcPk1x.js +231 -0
  19. package/assets/chunk-JWPE2WC7-DzL_SU8s.js +1 -0
  20. package/assets/chunk-POPQ4Y6H-Cwq2-Vb8.js +1 -0
  21. package/assets/chunk-SVP7TREG-BfRHY5FU.js +88 -0
  22. package/assets/chunk-TICWLB2K-CRP7rHkW.js +206 -0
  23. package/assets/chunk-XXDRQBXY-Bg2jg-98.js +1 -0
  24. package/assets/classDiagram-ZZMXUADV-D4EF3HGj.js +1 -0
  25. package/assets/classDiagram-v2-VYDZK3BY-D4EF3HGj.js +1 -0
  26. package/assets/controls/ckeditor.es.js +9382 -9320
  27. package/assets/controls/handsontable.es.js +11971 -11938
  28. package/assets/controls/jsoneditor.es.js +10442 -10233
  29. package/assets/controls/toast-ui.es.js +1308 -1279
  30. package/assets/cose-bilkent-JH36ORCC-CCJ0SGyO.js +1 -0
  31. package/assets/cynefin-OW5HDTMX-B2Jx5fw3.js +166 -0
  32. package/assets/cynefinDiagram-5FMLGOSQ-DuK0Lb62.js +62 -0
  33. package/assets/cytoscape.esm-DzSz-X2X.js +321 -0
  34. package/assets/dagre-GXQ25YYZ-DnOYexET.js +4 -0
  35. package/assets/dashboard-X8k4X6Sw.js +3 -0
  36. package/assets/debounce-B3mXI_sx.js +1 -0
  37. package/assets/defaultLocale-DX6XiGOO.js +1 -0
  38. package/assets/diagram-S7CK7UJ4-DDgPBHsK.js +30 -0
  39. package/assets/diagram-UQ7AKVKN-qlL0GZs8.js +41 -0
  40. package/assets/diagram-VSXAHHWV-CQbiU1_c.js +3 -0
  41. package/assets/diagram-VX7I27RA-DFDI9_au.js +24 -0
  42. package/assets/diagram-Z3DM3KII-B5C9dtmJ.js +24 -0
  43. package/assets/docs-BiZOD7PP.js +1 -0
  44. package/assets/ebnfDiagram-PWID7BFC-CLMUsXEI.js +1 -0
  45. package/assets/erDiagram-RLTQ6QDP-ax9Xol5-.js +99 -0
  46. package/assets/flowDiagram-HODETNUW-CvaH7l3S.js +168 -0
  47. package/assets/ganttDiagram-EL5Y4UJY-Cga5U19j.js +292 -0
  48. package/assets/gitGraphDiagram-WWUBYQGX-B6o1T3-d.js +106 -0
  49. package/assets/history-CVBJUNSQ.js +1 -0
  50. package/assets/infoDiagram-27XIBGKW-BpWxgBCE.js +2 -0
  51. package/assets/init-Gi6I4Gst.js +1 -0
  52. package/assets/init-user-xSvnFTF0.js +1 -0
  53. package/assets/isObject-DL-BuaBl.js +1 -0
  54. package/assets/ishikawaDiagram-5VMMS53U-zE83db4H.js +70 -0
  55. package/assets/journeyDiagram-3NMN7TZE-DZNVFqrX.js +139 -0
  56. package/assets/kanban-definition-UXKFOSKX-CqxNgk27.js +89 -0
  57. package/assets/katex-HP8lGamR.js +257 -0
  58. package/assets/layout-CN3kt_jt.js +1 -0
  59. package/assets/linear-nvkaQ6BA.js +1 -0
  60. package/assets/{list-CcMtS4hD.js → list-CrIU2eZz.js} +2 -2
  61. package/assets/login-CX9xVjCn.js +1 -0
  62. package/assets/manifest.json +834 -58
  63. package/assets/media-manager-BfYftLIH.js +6 -0
  64. package/assets/mermaid.core-C0V1NaVJ.js +310 -0
  65. package/assets/mindmap-definition-YA3MSWOX-Bh7_d9f1.js +96 -0
  66. package/assets/module-DPEvnad3.js +1 -0
  67. package/assets/notification-Dqpt5AIZ.js +20 -0
  68. package/assets/ordinal-Cboi1Yqb.js +1 -0
  69. package/assets/pegDiagram-XKGWAZYB-DMnjm6Z1.js +1 -0
  70. package/assets/pieDiagram-E7YTZNPT-D-RWCgYb.js +39 -0
  71. package/assets/quadrantDiagram-AXDQQJYC-BNBGP7RM.js +7 -0
  72. package/assets/railroadDiagram-O6MQD6OU-BIjVPT01.js +1 -0
  73. package/assets/register-CF4KQ97e.js +1 -0
  74. package/assets/requirementDiagram-BXWQKSXE-VPrtGdjM.js +84 -0
  75. package/assets/ru-CFJ4fysR.js +1 -0
  76. package/assets/sankeyDiagram-P5KCCOFB-ct9mLF3U.js +40 -0
  77. package/assets/sequenceDiagram-WJ2MYXX4-TC06Mbmw.js +162 -0
  78. package/assets/sizeCapture-INFHLROL-BMMwriCf.js +1 -0
  79. package/assets/stateDiagram-D77RDMKH-DtwYRPCX.js +1 -0
  80. package/assets/stateDiagram-v2-MP3YSRHH-C1yB0O5U.js +1 -0
  81. package/assets/swimlanes-42K2YHIH-DE3hRbbr.js +1 -0
  82. package/assets/swimlanesDiagram-VR7AAH4N-Ce4l1sQD.js +8 -0
  83. package/assets/timeline-definition-24CTP7MA-N7s_hfjj.js +120 -0
  84. package/assets/toNumber-DZb-r9sy.js +1 -0
  85. package/assets/use-appearance-DYTIKpT2.js +1 -0
  86. package/assets/user-filters-list-fR0YNJ3l.js +1 -0
  87. package/assets/vennDiagram-4TSXK5OY-Dj5bFQkR.js +34 -0
  88. package/assets/wardleyDiagram-VM6X3IG4-83ax25Z6.js +78 -0
  89. package/assets/welcome-v11MTsRK.js +1 -0
  90. package/assets/with-app-layout-CH6RIib1.js +31 -0
  91. package/assets/xychartDiagram-S5SC5T6Z-CW9Br5Xp.js +7 -0
  92. package/controllers/access-rights/permissionOptions.d.ts +2 -0
  93. package/controllers/access-rights/permissionOptions.js +23 -0
  94. package/controllers/add.js +2 -2
  95. package/controllers/addGroup.js +15 -6
  96. package/controllers/ai/AiAgentController.d.ts +66 -0
  97. package/controllers/ai/AiAgentController.js +435 -0
  98. package/controllers/ai/AiAssistantController.d.ts +0 -4
  99. package/controllers/ai/AiAssistantController.js +4 -78
  100. package/controllers/catalog/FrontendCatalogAdapter.js +7 -8
  101. package/controllers/docs/index.d.ts +22 -0
  102. package/controllers/docs/index.js +126 -0
  103. package/controllers/edit.js +2 -2
  104. package/controllers/editGroup.js +15 -6
  105. package/controllers/filter-fields/savedFilters.js +1 -1
  106. package/controllers/history-actions/HistoryController.js +7 -7
  107. package/controllers/inlineUpdate.js +10 -3
  108. package/controllers/list.js +1 -1
  109. package/controllers/login.js +1 -1
  110. package/controllers/notifications/NotificationController.js +14 -8
  111. package/controllers/view.js +3 -3
  112. package/controllers/widgets/filterInfo.js +1 -1
  113. package/helpers/accessRightsHelper.d.ts +30 -3
  114. package/helpers/accessRightsHelper.js +140 -12
  115. package/helpers/assetVersionHelper.d.ts +14 -0
  116. package/helpers/assetVersionHelper.js +42 -0
  117. package/helpers/configHelper.js +19 -18
  118. package/helpers/controllerHelper.d.ts +1 -0
  119. package/helpers/controllerHelper.js +25 -15
  120. package/helpers/fieldsHelper.d.ts +2 -1
  121. package/helpers/fieldsHelper.js +11 -5
  122. package/helpers/inertiaActionsHelper.d.ts +1 -1
  123. package/helpers/inertiaActionsHelper.js +4 -5
  124. package/helpers/inertiaAddHelper.d.ts +1 -1
  125. package/helpers/inertiaAddHelper.js +7 -6
  126. package/helpers/inertiaGroupHelper.js +10 -2
  127. package/helpers/inertiaListHelper.d.ts +1 -1
  128. package/helpers/inertiaListHelper.js +7 -8
  129. package/helpers/inertiaMenuHelper.d.ts +7 -2
  130. package/helpers/inertiaMenuHelper.js +12 -27
  131. package/helpers/menuHelper.d.ts +11 -1
  132. package/helpers/menuHelper.js +12 -0
  133. package/helpers/modelResourceHelper.d.ts +9 -0
  134. package/helpers/modelResourceHelper.js +43 -0
  135. package/helpers/navigationAccessHelper.d.ts +13 -0
  136. package/helpers/navigationAccessHelper.js +45 -0
  137. package/index.d.ts +11 -0
  138. package/index.js +11 -0
  139. package/interfaces/adminpanelConfig.d.ts +160 -2
  140. package/interfaces/queryCriteria.d.ts +13 -0
  141. package/interfaces/types.d.ts +169 -0
  142. package/lib/Adminizer.d.ts +8 -0
  143. package/lib/Adminizer.js +29 -2
  144. package/lib/DataAccessor.d.ts +100 -3
  145. package/lib/DataAccessor.js +454 -245
  146. package/lib/access-graph/AccessGraphResolver.d.ts +136 -0
  147. package/lib/access-graph/AccessGraphResolver.js +605 -0
  148. package/lib/access-graph/RecordAccessCache.d.ts +23 -0
  149. package/lib/access-graph/RecordAccessCache.js +30 -0
  150. package/lib/access-graph/RecordAccessResolver.d.ts +83 -0
  151. package/lib/access-graph/RecordAccessResolver.js +295 -0
  152. package/lib/access-graph/shared.d.ts +60 -0
  153. package/lib/access-graph/shared.js +121 -0
  154. package/lib/admin-links/AdminLinkHandler.d.ts +72 -0
  155. package/lib/admin-links/AdminLinkHandler.js +183 -0
  156. package/lib/ai-assistant/AbstractAiConversationHistoryService.d.ts +39 -0
  157. package/lib/ai-assistant/AbstractAiConversationHistoryService.js +98 -0
  158. package/lib/ai-assistant/AbstractAiModelService.d.ts +139 -2
  159. package/lib/ai-assistant/AbstractAiModelService.js +154 -1
  160. package/lib/ai-assistant/AiAgentRunManager.d.ts +35 -0
  161. package/lib/ai-assistant/AiAgentRunManager.js +109 -0
  162. package/lib/ai-assistant/AiAssistantAgentSkillHandler.d.ts +61 -0
  163. package/lib/ai-assistant/AiAssistantAgentSkillHandler.js +90 -0
  164. package/lib/ai-assistant/AiAssistantHandler.d.ts +1 -0
  165. package/lib/ai-assistant/AiAssistantHandler.js +4 -0
  166. package/lib/ai-assistant/AiAssistantUiMethodHandler.d.ts +60 -0
  167. package/lib/ai-assistant/AiAssistantUiMethodHandler.js +144 -0
  168. package/lib/ai-assistant/builtinAgentSkills.d.ts +9 -0
  169. package/lib/ai-assistant/builtinAgentSkills.js +259 -0
  170. package/lib/ai-assistant/jsonSafe.d.ts +13 -0
  171. package/lib/ai-assistant/jsonSafe.js +81 -0
  172. package/lib/app-manager/AdminizerApp.d.ts +31 -2
  173. package/lib/app-manager/AppManager.js +43 -42
  174. package/lib/app-manager/ConfigLayerHandler.js +4 -0
  175. package/lib/docs/AbstractDocumentation.d.ts +100 -0
  176. package/lib/docs/AbstractDocumentation.js +108 -0
  177. package/lib/docs/DocumentationHandler.d.ts +100 -0
  178. package/lib/docs/DocumentationHandler.js +198 -0
  179. package/lib/docs/FileDocumentation.d.ts +47 -0
  180. package/lib/docs/FileDocumentation.js +189 -0
  181. package/lib/docs/docsAgentSkills.d.ts +10 -0
  182. package/lib/docs/docsAgentSkills.js +93 -0
  183. package/lib/filters/FilterService.js +4 -3
  184. package/lib/history-actions/AbstractHistoryAdapter.d.ts +26 -1
  185. package/lib/history-actions/AbstractHistoryAdapter.js +155 -25
  186. package/lib/media-manager/helpers/MediaManagerHelper.js +9 -7
  187. package/lib/model/AbstractModel.d.ts +48 -0
  188. package/lib/model/AbstractModel.js +14 -4
  189. package/lib/model/ModelHandler.d.ts +50 -2
  190. package/lib/model/ModelHandler.js +117 -8
  191. package/lib/model/adapter/sequelize.d.ts +40 -1
  192. package/lib/model/adapter/sequelize.js +243 -77
  193. package/lib/model/adapter/typeorm.d.ts +16 -0
  194. package/lib/model/adapter/typeorm.js +136 -9
  195. package/lib/notifications/GeneralNotificationService.js +6 -5
  196. package/lib/notifications/SystemNotificationService.js +1 -1
  197. package/lib/ui-i18n/uiTranslationKeys.d.ts +2 -1
  198. package/lib/ui-i18n/uiTranslationKeys.js +42 -1
  199. package/lib/widgets/widgetHandler.js +10 -6
  200. package/models/Group.d.ts +2 -1
  201. package/package.json +35 -23
  202. package/policies/authPolicies.js +6 -6
  203. package/policies/permissionResolvers.d.ts +1 -0
  204. package/policies/permissionResolvers.js +3 -0
  205. package/system/Router.js +21 -3
  206. package/system/bindAccessRights.js +13 -3
  207. package/system/bindDocs.d.ts +13 -0
  208. package/system/bindDocs.js +77 -0
  209. package/system/bindInertia.js +30 -7
  210. package/system/buildInternalModelAccess.d.ts +8 -0
  211. package/system/buildInternalModelAccess.js +36 -4
  212. package/system/defaults.js +7 -1
  213. package/system/validateSystemModels.js +29 -9
  214. package/assets/add-CBlLpLr0.js +0 -1
  215. package/assets/add-group-H0IKIsNm.js +0 -1
  216. package/assets/add-user-CoTLmxtF.js +0 -1
  217. package/assets/app-DNXiApCk.css +0 -1
  218. package/assets/app-layout-xxJpLAvb.js +0 -1
  219. package/assets/app.js +0 -138
  220. package/assets/dashboard-DVJS5EPP.js +0 -3
  221. package/assets/debounce-BMmXVQ06.js +0 -1
  222. package/assets/history-bWRuzbye.js +0 -1
  223. package/assets/init-user-8aUohVDq.js +0 -1
  224. package/assets/login-CO4laf6m.js +0 -1
  225. package/assets/media-manager-BDbpSSjH.js +0 -6
  226. package/assets/module-CqO_BKsH.js +0 -1
  227. package/assets/notification-B5l2wwmi.js +0 -20
  228. package/assets/register-DBYIMXGQ.js +0 -1
  229. package/assets/ru-rYKdQbWF.js +0 -1
  230. package/assets/use-appearance-_EbbjHTh.js +0 -1
  231. package/assets/user-filters-list-C7kMKN5f.js +0 -1
  232. package/assets/welcome-6z-7sXnQ.js +0 -1
@@ -1 +0,0 @@
1
- import{r,j as e,bl as Ne,aV as ve,u as F,bm as se,bn as we,w as J,bo as ye,bp as L,bq as ke,br as O,bs as H,bt as _,bu as Ce,bv as V,bw as K,bx as q,L as z,G as te,D as Se,aa as Ae,by as Me,bz as Ee,y as Pe,z as De,F as Te,bA as Ie,b1 as ze,ab as Fe,c as U,d as $e,b9 as ae,B as I,bB as Oe,aW as ne,b8 as _e,b as R,p as T,bC as Le,bD as Re,bE as Be,bF as Ge,bG as Je,bH as re,bI as Ue,bJ as He,bK as Ve,bL as Ke,bM as Q,bN as X,bO as W,bP as qe,bQ as Ye,bR as Ze,bS as Qe,bT as Xe,bU as We,bV as es,bW as ss,bX as ts,bY as as,bZ as ns,aC as rs,aD as ie,bd as le,b_ as is,b$ as ls,c0 as os,aA as oe,W as ce,Y as de,I as cs,c1 as ds,c2 as us,c3 as xs,v as hs,c4 as ps,Z as fs,e as ue,f as xe,E as ms,h as he,H as js,c5 as pe,c6 as Y,c7 as gs,c8 as bs,c9 as Ns,ca as vs,S as ws,i as ys,k as ks,l as Cs,m as Ss,cb as As}from"./app.js";import{u as Ms}from"./use-appearance-_EbbjHTh.js";const Es=r.memo(({children:a,variant:s="header"})=>{const[t,i]=r.useState(()=>typeof window<"u"?localStorage.getItem("sidebar")!=="false":!0),o=d=>{i(d),typeof window<"u"&&localStorage.setItem("sidebar",String(d))};return s==="header"?e.jsx("div",{className:"flex min-h-screen w-full flex-col",children:a}):e.jsx(Ne,{defaultOpen:t,open:t,onOpenChange:o,children:a})});function S({name:a,className:s,style:t}){return e.jsx("span",{className:ve("material-icons-outlined",s),style:t,children:a})}function Ps({items:a=[]}){const s=F(),t=n=>n.split("?")[0].replace(/\/$/,""),i=a.reduce((n,l)=>{const f=l.section||"Platform";return n[f]||(n[f]=[]),n[f].push(l),n},{}),o=Object.keys(i).sort((n,l)=>n==="Platform"?-1:l==="Platform"||n==="System"?1:l==="System"?-1:n.localeCompare(l)),[d,m]=r.useState(()=>{const n={};return a.forEach(l=>{const f=l.section||"Platform";n[f]=!1}),n}),[w,p]=r.useState(()=>{const n={};return a.forEach(l=>{const f=l.section||"Platform";n[f]=!1}),n}),u=n=>{const l=t(s.url),f=t(n);return l===f||l.startsWith(`${f}/`)},v=r.useRef(d),g=r.useRef(w);v.current=d,g.current=w;const k=({item:n})=>n.actions?.length>0?e.jsx(ke,{asChild:!0,defaultOpen:u(n.link),className:"group/collapsible",children:e.jsxs(O,{children:[e.jsx(H,{asChild:!0,children:e.jsxs(_,{tooltip:n.title,children:[e.jsx(S,{name:n.icon,className:"!text-[18px]"}),e.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:n.title}),e.jsx(J,{className:"ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"})]})}),e.jsx(Ce,{children:e.jsx(V,{children:n.actions?.map(l=>e.jsx(K,{children:e.jsx(q,{asChild:!0,isActive:u(l.link),children:l.type==="blank"?e.jsxs("a",{href:l.link,target:"_blank",rel:"noopener noreferrer",children:[l.icon&&e.jsx(S,{name:l.icon,className:"!text-[18px]"}),e.jsx("span",{children:l.title})]}):e.jsxs(z,{href:l.link,children:[l.icon&&e.jsx(S,{name:l.icon,className:"!text-[18px]"}),e.jsx("span",{children:l.title})]})})},l.id))})})]})},n.title):e.jsx(O,{children:e.jsx(_,{asChild:!0,isActive:u(n.link),tooltip:{children:n.title},children:n.type==="blank"?e.jsxs("a",{href:n.link,target:"_blank",rel:"noopener noreferrer",children:[n.icon&&e.jsx(S,{name:n.icon,className:"!text-[18px]"}),e.jsx("span",{children:n.title})]}):e.jsxs(z,{href:n.link,children:[n.icon&&e.jsx(S,{name:n.icon,className:"!text-[18px]"}),e.jsx("span",{children:n.title})]})})},n.title);return e.jsx(e.Fragment,{children:o.map(n=>{const l=i[n],f=l.some(b=>b.actions?.length>0?b.actions.some(c=>u(c.link)):u(b.link)),E=w[n]?d[n]:f;return e.jsxs(se,{className:"px-2 py-0",children:[e.jsx(we,{asChild:!0,className:"cursor-pointer",onClick:()=>{const A=!(g.current[n]?v.current[n]:f);p(P=>({...P,[n]:!0})),m(P=>({...P,[n]:A}))},children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(J,{className:`transform transition-transform duration-200 ${E?"rotate-90":""}`}),e.jsx("span",{children:n})]})}),E&&e.jsx(ye,{children:e.jsx(L,{children:l.map(b=>e.jsx(k,{item:b},b.id||b.title))})})]},n)})})}const Ds=5*1024*1024,Ts=(a,s)=>{const t=a?.response?.data;if(!t)return s;if(typeof t=="string")try{const i=JSON.parse(t);return i.error??i.message??s}catch{return t||s}if(typeof t=="object"){const i=t;return i.error??i.message??s}return s},fe=r.memo(({routePrefix:a,triggerLabel:s,placeholder:t,t:i,onClose:o})=>{const[d,m]=r.useState(""),[w,p]=r.useState(""),[u,v]=r.useState([]),[g,k]=r.useState({}),[n,l]=r.useState(!1),[f,E]=r.useState(!1),b=r.useRef(null),c=j=>{if(!j)return;const C={},D=[];Array.from(j).forEach(M=>{M.size>Ds?C[M.name]=i("File size exceeds the 5 MB limit"):D.push(M)}),v(M=>[...M,...D]),Object.keys(C).length&&k(M=>({...M,...C}))},A=j=>v(C=>C.filter((D,M)=>M!==j)),P=async j=>{if(j.preventDefault(),!d.trim()){k({title:i("Title is required")});return}l(!0),k({});const C=new FormData;C.append("title",d.trim()),C.append("description",w.trim()),u.forEach(D=>C.append("files",D));try{await T.post(`${a}/api/feedback`,C),E(!0)}catch(D){const M=Ts(D,i("Internal server error"));k({_global:M}),l(!1)}};return r.useEffect(()=>{if(!f)return;const j=setTimeout(o,2e3);return()=>clearTimeout(j)},[f,o]),f?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 py-24 text-center",children:[e.jsx(Ie,{size:48,className:"text-green-500 dark:text-green-400"}),e.jsx("p",{className:"text-base font-medium",children:i("Feedback sent successfully")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(ze,{className:"mb-4",children:[e.jsx(Fe,{children:s??i("Feedback")}),t&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t})]}),e.jsxs("form",{onSubmit:P,className:"space-y-5",noValidate:!0,children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(U,{htmlFor:"fb-title",children:i("Title")}),e.jsx($e,{id:"fb-title",value:d,onChange:j=>m(j.target.value),disabled:n,placeholder:i("Title"),className:g.title?"border-destructive":""}),g.title&&e.jsx("p",{className:"text-xs text-destructive",children:g.title})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(U,{htmlFor:"fb-desc",children:i("Description")}),e.jsx(ae,{id:"fb-desc",value:w,onChange:j=>p(j.target.value),disabled:n,placeholder:i("Description"),rows:5,className:"resize-none"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(U,{children:i("Attach files")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(I,{type:"button",variant:"outline",size:"sm",onClick:()=>b.current?.click(),disabled:n,children:[e.jsx(Oe,{size:14,className:"mr-1"}),i("Attach files")]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:i("Max 5 MB per file")})]}),e.jsx("input",{ref:b,type:"file",multiple:!0,className:"hidden",onChange:j=>c(j.target.files),disabled:n}),u.length>0&&e.jsx("ul",{className:"mt-2 space-y-1",children:u.map((j,C)=>e.jsxs("li",{className:"flex items-center justify-between rounded-md border bg-muted/40 px-3 py-1.5 text-xs",children:[e.jsx("span",{className:"truncate max-w-[340px]",children:j.name}),e.jsx("button",{type:"button",onClick:()=>A(C),className:"ml-2 text-muted-foreground hover:text-destructive transition-colors","aria-label":i("Remove file"),disabled:n,children:e.jsx(ne,{size:13})})]},C))}),Object.entries(g).filter(([j])=>j!=="title"&&j!=="_global").map(([j,C])=>e.jsx("p",{className:"text-xs text-destructive",children:C},j))]}),g._global&&e.jsx("p",{className:"text-xs text-destructive",children:g._global}),e.jsx(_e,{children:e.jsx(I,{type:"submit",disabled:n,children:n?e.jsxs(e.Fragment,{children:[e.jsx(R,{size:14,className:"mr-1.5 animate-spin"}),i("Sending...")]}):i("Send")})})]})]})});fe.displayName="FeedbackForm";function Is(){const a=F(),{t:s}=te(),t=a.props.routePrefix??window.routePrefix??"",i=a.props.feedbackTriggerLabel??null,o=a.props.feedbackPlaceholder??null,[d,m]=r.useState(!1),[w,p]=r.useState(0),u=r.useCallback(()=>m(!1),[]),v=r.useCallback(g=>{m(g),g||p(k=>k+1)},[]);return e.jsxs(Se,{open:d,onOpenChange:v,children:[e.jsx(Ae,{asChild:!0,children:e.jsxs("button",{className:"flex items-center gap-1.5 text-xs opacity-60 hover:opacity-100 transition-opacity cursor-pointer mt-1 mx-auto","aria-label":i??s("Send feedback"),children:[e.jsx(Me,{size:13}),i??s("Send feedback")]})}),Ee.createPortal(e.jsx(Pe,{}),document.body),e.jsx(De,{children:e.jsx(Te,{children:e.jsx(fe,{routePrefix:t,triggerLabel:i,placeholder:o,t:s,onClose:u},w)})})]})}function zs(){const a=F();return e.jsxs(Le,{collapsible:"icon",variant:"inset",children:[e.jsx(Re,{children:e.jsx(L,{children:e.jsxs(O,{children:[e.jsx(Be,{className:"p-0 shadow-none border-none bg-transparent hidden md:block",children:e.jsxs(Ge,{children:[e.jsx(Je,{asChild:!0,className:"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground rounded-md",children:e.jsx(_,{asChild:!0,children:e.jsx(I,{variant:"ghost",asChild:!0,className:`w-full ${a.props.section?"":"pointer-events-none"}`,children:e.jsxs("div",{children:[e.jsx(S,{name:"rocket_launch",className:"!text-[18px]"}),e.jsx("span",{className:"group-data-[state=collapsed]:hidden",children:a.props.brand}),a.props.section&&e.jsx(re,{className:"ml-auto group-data-[state=collapsed]:hidden"})]})})})}),a.props.section&&e.jsx(Ue,{side:"right",className:"z-[1003]",children:a.props.section.map(s=>e.jsx("div",{children:s.subItems?e.jsxs(He,{children:[e.jsxs(Ve,{className:"flex gap-2 items-center cursor-pointer",children:[e.jsx(S,{name:s.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:s.title})]}),e.jsx(Ke,{children:s.subItems.map(t=>e.jsx(Q,{children:t.type==="blank"?e.jsxs("a",{href:t.link,target:"_blank",className:"flex gap-2 items-center",children:[t.icon&&e.jsx(S,{name:t.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:t.title})]},t.id):e.jsxs(z,{href:t.link,className:"flex gap-2 items-center",children:[t.icon&&e.jsx(S,{name:t.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:t.title})]},t.id)},t.id))})]}):e.jsx(Q,{children:s.type==="blank"?e.jsxs("a",{href:s.link,target:"_blank",className:"flex gap-2 items-center",children:[s.icon&&e.jsx(S,{name:s.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:s.title})]}):e.jsxs(z,{href:s.link,className:"flex gap-2 items-center",children:[s.icon&&e.jsx(S,{name:s.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:s.title})]})})},s.id))})]})}),e.jsx(se,{className:"px-2 py-0 block md:hidden",children:e.jsx(L,{children:e.jsx(X,{asChild:!0,className:"group/collapsible",children:e.jsxs(O,{children:[e.jsx(H,{asChild:!0,children:e.jsxs(_,{children:[e.jsx(S,{name:"rocket_launch",className:"!text-[18px]"}),e.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:a.props.brand}),a.props.section&&e.jsx(J,{className:"ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"})]})}),a.props.section&&e.jsx(W,{children:e.jsx(V,{children:a.props.section&&a.props.section.map(s=>s.subItems?e.jsx(L,{children:e.jsx(X,{asChild:!0,className:"group/collapsible-sub",children:e.jsxs(O,{children:[e.jsx(H,{asChild:!0,children:e.jsxs(_,{children:[e.jsx(S,{name:s.icon,className:"!text-[18px]"}),e.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:s.title}),e.jsx(J,{className:"ml-auto transition-transform duration-200 group-data-[state=open]/collapsible-sub:rotate-90"})]})}),e.jsx(W,{children:e.jsx(V,{children:s.subItems.map(t=>e.jsx(K,{children:e.jsx(q,{asChild:!0,children:t.type==="blank"?e.jsxs("a",{href:t.link,target:"_blank",className:"flex gap-2 items-center",children:[t.icon&&e.jsx(S,{name:t.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:t.title})]}):e.jsxs(z,{href:t.link,className:"flex gap-2 items-center",children:[t.icon&&e.jsx(S,{name:t.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:t.title})]})})},t.id))})})]})})},s.id):e.jsx(K,{children:e.jsx(q,{asChild:!0,children:s.type==="blank"?e.jsxs("a",{href:s.link,target:"_blank",className:"flex gap-2 items-center",children:[s.icon&&e.jsx(S,{name:s.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:s.title})]}):e.jsxs(z,{href:s.link,className:"flex gap-2 items-center",children:[s.icon&&e.jsx(S,{name:s.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:s.title})]})})},s.id))})})]})})})})]},a.props.brand)})}),e.jsx(qe,{children:e.jsx(Ps,{items:a.props.menu})}),e.jsx(Ye,{children:e.jsxs("div",{className:"flex flex-col items-center",children:[a.props.version&&(()=>{const s=a.props.version,t=s.text||"5.0.0",i=new Date("2026-07-28T22:06:29.671Z").toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),o=s.text?`v.${t}`:`v.${t} · ${i}`,d="text-center opacity-70 hover:opacity-100 transition-opacity text-xs";return s.link?e.jsx("a",{href:s.link,target:"_blank",rel:"noreferrer",title:s.hint??void 0,className:d,children:o}):e.jsx("span",{title:s.hint??void 0,className:d,children:o})})(),a.props.showFeedback&&e.jsx(Is,{})]})})]})}function Fs({breadcrumbs:a}){return e.jsx(e.Fragment,{children:a.length>0&&e.jsx(Ze,{children:e.jsx(Qe,{children:a.map((s,t)=>{const i=t===a.length-1;return e.jsxs(r.Fragment,{children:[e.jsx(Xe,{children:i?e.jsx(We,{children:s.title}):e.jsx(es,{asChild:!0,children:e.jsx(z,{href:s.href,children:s.title})})}),!i&&e.jsx(ss,{})]},t)})})})})}function $s(){return r.useCallback(s=>{const t=s.trim().split(" ");if(t.length===0)return"";if(t.length===1)return t[0].charAt(0).toUpperCase();const i=t[0].charAt(0),o=t[t.length-1].charAt(0);return`${i}${o}`.toUpperCase()},[])}function me({user:a,showEmail:s=!1}){const t=$s();return e.jsxs(e.Fragment,{children:[e.jsxs(ts,{className:"h-8 w-8 overflow-hidden rounded-full",children:[e.jsx(as,{src:a.avatar,alt:a.login}),e.jsx(ns,{className:"rounded-lg bg-neutral-200 text-black dark:bg-neutral-700 dark:text-white",children:t(a.login)})]}),e.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[e.jsx("span",{className:"truncate font-medium",children:a.login}),s&&e.jsx("span",{className:"text-muted-foreground truncate text-xs",children:a.email})]})]})}function Os(){return r.useCallback(()=>{document.body.style.removeProperty("pointer-events")},[])}function _s({user:a,logout:s,logoutBtn:t}){const i=Os();return e.jsxs(e.Fragment,{children:[e.jsx(rs,{className:"p-0 font-normal",children:e.jsx("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm",children:e.jsx(me,{user:a,showEmail:!0})})}),e.jsx(ie,{}),e.jsx(le,{asChild:!0,children:e.jsxs(z,{className:"block w-full cursor-pointer",method:"get",href:s,as:"button",onClick:i,children:[e.jsx(is,{className:"mr-2"}),t]})})]})}function Ls(){const{auth:a,logout:s,logoutBtn:t}=F().props,{state:i}=ls(),o=os();return e.jsx(L,{children:e.jsx(O,{children:e.jsxs(oe,{children:[e.jsx(ce,{asChild:!0,children:e.jsxs(_,{size:"lg",className:"text-sidebar-accent-foreground data-[state=open]:bg-sidebar-accent group focus-visible:ring-0 cursor-pointer",children:[e.jsx(me,{user:a.user}),e.jsx(re,{className:"ml-auto size-4"})]})}),e.jsx(de,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg z-[1002]",align:"end",side:o?"bottom":i==="collapsed"?"left":"bottom",children:e.jsx(_s,{user:a.user,logout:s,logoutBtn:t})})]})})})}function Rs(){const{appearance:a,updateAppearance:s}=Ms(),t={light:"dark",dark:"system",system:"light"},i={light:xs,dark:us,system:ds},o=()=>s(t[a]),d=i[a];return e.jsx(I,{variant:"ghost",size:"icon",onClick:o,className:"shrink-0",children:e.jsx(cs,{iconNode:d})})}const je=r.createContext(void 0),Bs=({children:a})=>{const[s,t]=r.useState([]),[i,o]=r.useState([]),[d,m]=r.useState([]),[w,p]=r.useState(!1),[u,v]=r.useState(null),[g,k]=r.useState(""),n=F(),{t:l}=te(),f=hs.useMemo(()=>({"Make read":l("Make read"),"View All":l("View All"),Search:l("Search"),"Make all read":l("Make all read"),Title:l("Title"),Message:l("Message"),Date:l("Date"),Diff:l("Diff"),"No notifications":l("No notifications"),"No notifications found":l("No notifications found"),"The end of the list has been reached":l("The end of the list has been reached")}),[l]),E=[...i,...d],b=async()=>{try{const x=await T.getJson(`${window.routePrefix}/notifications/api`,{params:{unreadOnly:!0,limit:4}});t(x.data)}catch(x){console.error("Error fetching bell notifications:",x)}},c=async()=>{await b()},A=async()=>{try{const x=await T.getJson(`${window.routePrefix}/notifications/api/get-classes`);x.data&&(v(x.data.activeServices),k(x.data.initTab))}catch(x){console.error("Error fetching tabs:",x)}},P=async(x,y)=>{try{if(!x){await j(y);return}const h=await T.postJson(`${window.routePrefix}/notifications/api/search`,{s:x,notificationClass:y});m(h.data)}catch(h){console.error("Error searching notifications:",h)}},j=async x=>{p(!0);try{const y=`${window.routePrefix}/notifications/api/${x}`,h=await T.getJson(y,{params:{limit:20,skip:0,unreadOnly:!1}});return o([]),m(h.data),h.data}catch(y){return console.error("Error fetching all notifications:",y),[]}finally{p(!1)}},C=async(x,y)=>{try{const h=`${window.routePrefix}/notifications/api/${x}`,N=await T.getJson(h,{params:{limit:20,skip:y,unreadOnly:!1}});return m(G=>[...G,...N.data]),N.data}catch(h){return console.error("Error paginating notifications:",h),[]}};r.useEffect(()=>{if(!n.props.notifications)return;b();const x=new EventSource(`${window.routePrefix}/notifications/api/stream`);return x.addEventListener("connected",y=>{A()}),x.addEventListener("notification",y=>{const h=JSON.parse(y.data);o(N=>[h,...N]),t(N=>[h,...N].slice(0,4))}),x.onerror=()=>{console.error("SSE connection error")},()=>x.close()},[]);const D=async(x,y)=>{try{await T.putJson(`${window.routePrefix}/notifications/api/${x}/${y}/read`,{}),o(h=>h.map(N=>N.id===y?{...N,read:!0}:N)),m(h=>h.map(N=>N.id===y?{...N,read:!0}:N)),t([])}catch(h){console.error("Error marking as read:",h)}},M=async()=>{try{await T.putJson(`${window.routePrefix}/notifications/api/read-all`,{}),o(x=>x.map(y=>({...y,read:!0}))),m(x=>x.map(y=>({...y,read:!0}))),await b()}catch(x){console.error("Error marking all as read:",x)}},B=s.filter(x=>!x.read).length;return e.jsx(je.Provider,{value:{bellNotifications:s,allNotifications:E,unreadCount:B,getTabs:A,tabs:u,initTab:g,search:P,markAsRead:D,markAllAsRead:M,messages:f,fetchAllNotifications:j,paginateNotifications:C,loading:w,refreshBellNotifications:c},children:a})},ge=()=>{const a=r.useContext(je);if(a===void 0)throw new Error("useNotifications must be used within a NotificationProvider");return a};function Gs(){const{bellNotifications:a,markAsRead:s,unreadCount:t,refreshBellNotifications:i,messages:o}=ge(),[d,m]=r.useState(!1),w=async(u,v)=>{m(!0);try{await s(u,v),await i()}catch(g){console.error("Error marking as read:",g)}finally{m(!1)}},p=u=>{const v=new Date,g=new Date(u),k=v.getTime()-g.getTime(),n=Math.floor(k/1e3),l=new Intl.RelativeTimeFormat("en",{numeric:"auto"});if(n<60)return l.format(-n,"second");const f=Math.floor(n/60);if(f<60)return l.format(-f,"minute");const E=Math.floor(f/60);if(E<24)return l.format(-E,"hour");const b=Math.floor(E/24);if(b<30)return l.format(-b,"day");const c=Math.floor(b/30);if(c<12)return l.format(-c,"month");const A=Math.floor(c/12);return l.format(-A,"year")};return e.jsxs(oe,{children:[e.jsx(ce,{asChild:!0,className:"cursor-pointer data-[state=open]:bg-sidebar-accent",children:e.jsxs(I,{variant:"ghost",className:"relative",children:[e.jsx(ps,{}),t>0&&e.jsx("div",{className:"absolute top-1.5 right-1.5 size-1.5 rounded-full bg-destructive"})]})}),e.jsxs(de,{className:"z-[1002] p-2",align:"end",onCloseAutoFocus:u=>u.preventDefault(),children:[e.jsx(fs,{className:`${d?"opacity-50 pointer-events-none":""}`,children:a.length===0?e.jsx("div",{className:"p-4 text-center text-muted-foreground",children:o["No notifications"]}):a.map(u=>e.jsxs("div",{children:[e.jsx(le,{asChild:!0,className:"cursor-pointer",onSelect:v=>{v.preventDefault(),js.visit(`${window.routePrefix}/notifications?type=${u.notificationClass}`)},children:e.jsxs("div",{className:"grid grid-cols-[32px_250px] grid-rows-[auto_1fr] items-start gap-x-4 gap-y-2",children:[u.icon?e.jsx(S,{name:u.icon.icon,style:{color:u.icon.iconColor},className:"!text-[32px]"}):e.jsx("div",{}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium",children:u.title}),e.jsx("span",{className:"truncate",children:u.message})]}),e.jsxs("div",{className:"col-start-2 flex justify-between flex-nowrap items-center",children:[e.jsx("div",{className:"flex flex-nowrap gap-2 items-center",children:e.jsx("div",{children:p(u.createdAt)})}),e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsx(I,{variant:"ghost",size:"icon",className:"size-4",onClick:v=>{v.stopPropagation(),w(u.notificationClass,u.id)},children:e.jsx(ms,{className:"text-primary"})})}),e.jsx(he,{side:"left",className:"z-[1003]",children:e.jsx("p",{children:o["Make read"]})})]})]})]})}),e.jsx(ie,{})]},u.id))}),e.jsx(I,{variant:"secondary",asChild:!0,children:e.jsxs(z,{href:`${window.routePrefix}/notifications`,className:`w-full ${d?"opacity-50 pointer-events-none":""}`,children:[o["View All"],d&&e.jsx(R,{className:"h-4 w-4 animate-spin"})]})})]})]})}const Js=()=>{if(!(typeof window>"u"))return window.__adminizerAiAssistantState__??void 0},Us=a=>{typeof window>"u"||(window.__adminizerAiAssistantState__=a)},be=r.createContext(void 0),Hs=({children:a})=>{const t=F().props.aiAssistant,i=r.useMemo(()=>Js(),[]),[o,d]=r.useState(()=>i?.isOpen??!1),[m,w]=r.useState([]),[p,u]=r.useState(()=>i?.activeModel??t?.defaultModel??void 0),[v,g]=r.useState([]),[k,n]=r.useState(!1),[l,f]=r.useState(!1),[E,b]=r.useState(null),c=t?.enabled??!1,A=r.useCallback(async()=>{if(c)try{n(!0);const{data:h}=await T.getJson(`${window.routePrefix}/api/ai-assistant/models`);w(h),u(N=>N||(t?.defaultModel&&h.some($=>$.id===t.defaultModel)?t.defaultModel:h[0]?.id))}catch(h){console.error("Failed to load AI assistant models",h),b("Unable to load AI assistant models")}finally{n(!1)}},[t?.defaultModel,c]),P=r.useCallback(async h=>{if(!(!c||!h))try{n(!0);const{data:N}=await T.getJson(`${window.routePrefix}/api/ai-assistant/history/${h}`);g(N.history??[])}catch(N){console.error("Failed to load AI assistant history",N),b("Unable to load AI assistant history")}finally{n(!1)}},[c]);r.useEffect(()=>{if(!c){g([]);return}A()},[A,c]),r.useEffect(()=>{!c||!p||P(p)},[p,P,c]);const j=r.useCallback(h=>{u(h)},[]),C=r.useCallback(()=>d(!0),[]),D=r.useCallback(()=>d(!1),[]),M=r.useCallback(()=>d(h=>!h),[]),B=r.useCallback(async h=>{if(!c||!p)return;const N=h.trim();if(!N)return;const G={id:`tmp-${Date.now()}`,role:"user",content:N,timestamp:new Date().toISOString(),modelId:p};g($=>[...$,G]),f(!0),b(null);try{const{data:$}=await T.postJson(`${window.routePrefix}/api/ai-assistant/query`,{modelId:p,message:N});g($.history??[])}catch($){console.error("Failed to send AI assistant message",$),b("Unable to reach AI assistant"),await P(p)}finally{f(!1)}},[p,P,c]),x=r.useCallback(async()=>{p&&await P(p)},[p,P]);r.useEffect(()=>{c||d(!1)},[c]),r.useEffect(()=>{Us({isOpen:o,activeModel:p})},[p,o]);const y=r.useMemo(()=>({isEnabled:c,isOpen:o,openChat:C,closeChat:D,toggleChat:M,models:m,activeModel:p,setActiveModel:j,messages:v,loading:k,sending:l,error:E,sendMessage:B,refreshHistory:x}),[p,D,E,c,o,k,v,m,C,x,B,l,j,M]);return e.jsx(be.Provider,{value:y,children:a})},Z=()=>{const a=r.useContext(be);if(!a)throw new Error("useAiAssistant must be used within an AiAssistantProvider");return a};function Vs(){const{isEnabled:a,isOpen:s,toggleChat:t,models:i,sending:o,loading:d}=Z();if(!a)return null;const m=i.length>0;return e.jsx(e.Fragment,{children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsx(I,{variant:"ghost",className:Y("relative",{"text-primary":s}),onClick:t,"aria-expanded":s,"aria-haspopup":"true","aria-controls":"ai-assistant-panel",disabled:!m&&d,children:o?e.jsx(R,{className:"size-4 animate-spin"}):e.jsx(pe,{className:"size-4"})})}),e.jsx(he,{side:"bottom",className:"z-[1002]",children:e.jsx("span",{children:"AI assistant"})})]})})}function Ks({breadcrumbs:a=[]}){const{tabs:s}=ge(),t=F();return e.jsx("header",{className:"border-sidebar-border/50 flex h-16 shrink-0 items-center gap-2 border-b px-6 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12 md:px-4",children:e.jsxs("div",{className:"flex justify-between w-full",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(gs,{className:"-ml-1"}),e.jsx(Fs,{breadcrumbs:a})]}),e.jsxs("div",{className:"flex gap-4 items-center",children:[e.jsx(Vs,{}),t.props.history&&e.jsx(z,{href:`${window.routePrefix}/history/view-all`,children:e.jsx(I,{variant:"ghost",size:"icon",className:"shrink-0",children:e.jsx(bs,{})})}),e.jsx(Rs,{}),t.props.notifications&&(s===null?e.jsx("div",{className:"w-[40px] flex-none flex justify-center",children:e.jsx(R,{className:"size-4 animate-spin"})}):s.length?e.jsx(Gs,{}):null),e.jsx(Ls,{})]})]})})}const qs=r.memo(({children:a,breadcrumbs:s=[],className:t})=>{const i=F();return e.jsxs(Es,{variant:"sidebar",children:[e.jsx(Ns,{title:i.props.title}),e.jsx(zs,{}),e.jsxs(vs,{className:t,children:[e.jsx(Ks,{breadcrumbs:s}),e.jsx("div",{className:"relative flex min-h-0 flex-1 overflow-auto",children:e.jsx("div",{className:"flex h-full min-h-0 w-full flex-col",children:a})})]})]})});function Ys({width:a="min(25vw, 420px)"}){const{isEnabled:s,isOpen:t,closeChat:i,models:o,activeModel:d,setActiveModel:m,messages:w,loading:p,sending:u,error:v,sendMessage:g}=Z(),[k,n]=r.useState(""),l=r.useRef(null);r.useEffect(()=>{t||n("")},[t]),r.useEffect(()=>{l.current&&l.current.scrollIntoView({behavior:"smooth"})},[w]);const f=o.length>0,E=async c=>{c.preventDefault();const A=k.trim();A&&(await g(A),n(""))},b=c=>{if((c.ctrlKey||c.metaKey)&&c.key==="Enter"){c.preventDefault();const A=k.trim();A&&!u&&(g(A),n(""))}};return s?e.jsxs("aside",{id:"ai-assistant-panel","aria-label":"AI assistant chat","aria-hidden":!t,className:Y("bg-card text-card-foreground fixed bottom-0 right-0 top-0 z-[60] flex h-full flex-col border-l shadow-xl transition-all duration-300 ease-in-out","md:w-auto w-full",t?"translate-x-0 opacity-100":"translate-x-full opacity-0 pointer-events-none"),style:{width:"var(--ai-assistant-panel-actual-width, "+a+")"},children:[e.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(pe,{className:"size-5 text-primary"}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-semibold leading-tight",children:"AI assistant"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Chat with your selected model."})]})]}),e.jsx(I,{variant:"ghost",size:"icon",onClick:i,"aria-label":"Close AI assistant",children:e.jsx(ne,{className:"size-4"})})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-hidden px-4 py-4",children:[!f&&!p&&e.jsx("div",{className:"flex flex-1 items-center justify-center rounded-md border border-dashed p-6 text-sm text-muted-foreground",children:"No AI models are available for your account."}),f&&e.jsxs(e.Fragment,{children:[e.jsxs(ws,{value:d,onValueChange:m,children:[e.jsx(ys,{className:"w-full",children:e.jsx(ks,{placeholder:"Select a model"})}),e.jsx(Cs,{className:"z-[70]",children:o.map(c=>e.jsx(Ss,{value:c.id,children:e.jsxs("div",{className:"flex flex-col text-left",children:[e.jsx("span",{className:"font-medium",children:c.name}),c.description&&e.jsx("span",{className:"text-xs text-muted-foreground",children:c.description})]})},c.id))})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-3 overflow-hidden rounded-md border bg-background p-4",children:[e.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto pr-2","data-ai-assistant-messages":!0,children:[p&&e.jsx("div",{className:"flex justify-center py-6 text-sm text-muted-foreground",children:"Loading conversation..."}),!p&&w.length===0&&e.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"Start a conversation to see responses here."}),w.map(c=>e.jsxs("div",{className:Y("flex flex-col gap-1 rounded-md border p-3 text-sm shadow-xs",c.role==="assistant"?"border-primary/30 bg-primary/5":"border-border bg-background"),children:[e.jsx("span",{className:"font-semibold",children:c.role==="assistant"?"Assistant":"You"}),e.jsx("p",{className:"whitespace-pre-wrap leading-relaxed",children:c.content}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(c.timestamp).toLocaleTimeString()})]},c.id)),e.jsx("div",{ref:l})]}),e.jsxs("form",{className:"space-y-2",onSubmit:E,children:[e.jsx(ae,{placeholder:f?"Type your question... (Ctrl+Enter to send)":"No models available",value:k,onChange:c=>n(c.target.value),onKeyDown:b,disabled:!f||u,rows:3}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[v&&e.jsx("span",{className:"text-xs text-destructive",children:v}),e.jsx(I,{type:"submit",disabled:!f||u||!k.trim(),children:u?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"size-4 animate-spin"}),"Sending…"]}):"Send"})]})]})]})]})]})]}):null}const Zs="min(25vw, 420px)",ee="margin-right 300ms ease-in-out";function Qs({children:a,panelWidth:s=Zs}){const{isEnabled:t,isOpen:i}=Z();return r.useEffect(()=>{const o=document.getElementById("app");if(!o)return;const d=o.style.transition,m=d?.includes("margin-right");return m||(o.style.transition=d?`${d}, ${ee}`:ee),o.classList.add("ai-assistant-host"),o.style.setProperty("--ai-assistant-panel-width",s),()=>{o.classList.remove("ai-assistant-host"),o.style.removeProperty("--ai-assistant-panel-width"),o.style.removeProperty("--ai-assistant-panel-actual-width"),o.style.removeProperty("margin-right"),delete o.dataset.aiAssistantOpen,m||(o.style.transition=d)}},[s]),r.useEffect(()=>{const o=document.getElementById("app");if(!o)return;const d=window.innerWidth<768,m=d?"100vw":s;o.style.setProperty("--ai-assistant-panel-actual-width",m),t&&i?(o.style.marginRight=d?"0":s,o.dataset.aiAssistantOpen="true"):(o.style.removeProperty("margin-right"),o.dataset.aiAssistantOpen="false");const w=()=>{const p=window.innerWidth<768,u=p?"100vw":s;o.style.setProperty("--ai-assistant-panel-actual-width",u),t&&i&&(o.style.marginRight=p?"0":s)};return window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[t,i,s]),e.jsxs(e.Fragment,{children:[a,e.jsx(Ys,{width:s})]})}const et=r.memo(({children:a,className:s,breadcrumbs:t,...i})=>e.jsx(Bs,{children:e.jsx(Hs,{children:e.jsxs(As,{children:[e.jsx(qs,{breadcrumbs:t,className:s,...i,children:a}),e.jsx(Qs,{})]})})}));export{et as A,S as M,ge as u};