adminizer 4.7.0-build.222 → 5.0.0-build.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +2 -1
- package/assets/add-a4odXvQk.js +1 -0
- package/assets/add-group-D-NleXth.js +1 -0
- package/assets/add-user-B4SVJT5P.js +1 -0
- package/assets/app-CtWuWD5N.css +1 -0
- package/assets/app-layout-eaSzcROf.js +1 -0
- package/assets/app.js +35 -39
- package/assets/catalog-ByUICd5z.js +6 -0
- package/assets/controls/chunks/_commonjsHelpers-C6fGbg64.js +6 -0
- package/assets/controls/chunks/index-CjiZ2FIa.js +93 -0
- package/assets/controls/chunks/jsx-runtime-jIxVPx5o.js +31 -0
- package/assets/controls/chunks/use-appearance-CFLOwiSX.js +38 -0
- package/assets/controls/chunks/use-window-size-BXgBKW65.js +19 -0
- package/assets/controls/chunks/vanilla-picker-Dg97NL4h.js +529 -0
- package/assets/{RelationDialogStack-CnHFOYyR.css → controls/ckeditor.css} +1 -1
- package/assets/controls/ckeditor.es.js +83663 -0
- package/assets/controls/handsontable.css +1 -0
- package/assets/controls/handsontable.es.js +70550 -0
- package/assets/controls/jsoneditor.css +1 -0
- package/assets/controls/jsoneditor.es.js +42009 -0
- package/assets/controls/leaflet.css +1 -0
- package/assets/controls/leaflet.es.js +10299 -0
- package/assets/controls/monaco.es.js +618 -0
- package/assets/controls/toast-ui.css +1 -0
- package/assets/controls/toast-ui.es.js +41768 -0
- package/assets/dashboard-BYd8G2cW.js +3 -0
- package/assets/debounce-BMmXVQ06.js +1 -0
- package/assets/history-B8KIDy44.js +1 -0
- package/assets/init-user-8aUohVDq.js +1 -0
- package/assets/list-ChmtBGjG.js +4 -0
- package/assets/login-CO4laf6m.js +1 -0
- package/assets/manifest.json +60 -615
- package/assets/{media-manager-WcKe1EvD.js → media-manager-BDbpSSjH.js} +3 -3
- package/assets/module-D59aE9uv.js +1 -0
- package/assets/notification-DNoyfNmT.js +20 -0
- package/assets/register-DBYIMXGQ.js +1 -0
- package/assets/{ru-eW0WKkga.js → ru-rYKdQbWF.js} +1 -1
- package/assets/use-appearance-_EbbjHTh.js +1 -0
- package/assets/user-filters-list-BMFRwkYF.js +1 -0
- package/assets/welcome-37rNVUHt.js +1 -0
- package/controllers/add.d.ts +1 -1
- package/controllers/addGroup.js +3 -3
- package/controllers/addUser.js +3 -3
- package/controllers/catalog/Catalog.d.ts +1 -1
- package/controllers/catalog/Catalog.js +2 -1
- package/controllers/catalog/FrontendCatalogAdapter.d.ts +2 -12
- package/controllers/catalog/FrontendCatalogAdapter.js +3 -16
- package/controllers/catalog/FrontentCatalogAdapter.d.ts +2 -12
- package/controllers/catalog/FrontentCatalogAdapter.js +0 -16
- package/controllers/edit.js +6 -11
- package/controllers/editGroup.d.ts +1 -1
- package/controllers/editGroup.js +3 -3
- package/controllers/editUser.d.ts +1 -1
- package/controllers/editUser.js +3 -3
- package/controllers/feed.js +1 -1
- package/controllers/filter-fields/columns.js +1 -1
- package/controllers/filter-fields/getAllUserFilters.js +2 -2
- package/controllers/filter-fields/groups.js +2 -2
- package/controllers/filter-fields/savedFilters.js +1 -1
- package/controllers/history-actions/HistoryController.js +1 -1
- package/controllers/initUser.js +2 -2
- package/controllers/list.d.ts +1 -1
- package/controllers/login.d.ts +1 -1
- package/controllers/login.js +3 -3
- package/controllers/media-manager/ThumbController.js +2 -2
- package/controllers/media-manager/mediaManagerApi.js +13 -15
- package/controllers/register.d.ts +1 -1
- package/controllers/register.js +5 -5
- package/controllers/remove.d.ts +1 -1
- package/controllers/userApiKey.js +2 -2
- package/controllers/view.d.ts +1 -1
- package/controllers/view.js +5 -5
- package/controllers/widgets/Action.js +5 -2
- package/controllers/widgets/Info.js +1 -1
- package/controllers/widgets/filterInfo.js +1 -1
- package/files/favicon.png +0 -0
- package/helpers/accessRightsHelper.d.ts +6 -4
- package/helpers/accessRightsHelper.js +13 -0
- package/helpers/diffHelpers.js +1 -1
- package/helpers/fieldsHelper.d.ts +1 -1
- package/helpers/fieldsHelper.js +8 -4
- package/helpers/filterDatetimeHelper.d.ts +1 -1
- package/helpers/inertiaAddHelper.d.ts +6 -5
- package/helpers/inertiaAddHelper.js +45 -37
- package/helpers/inertiaAutHelper.js +5 -5
- package/helpers/inertiaGroupHelper.d.ts +4 -4
- package/helpers/inertiaMenuHelper.js +1 -1
- package/helpers/inertiaUserHelper.d.ts +3 -3
- package/helpers/inertiaUserHelper.js +1 -1
- package/helpers/menuHelper.d.ts +2 -2
- package/index.d.ts +18 -6
- package/index.js +18 -6
- package/interfaces/adminpanelConfig.d.ts +10 -33
- package/interfaces/global.d.ts +10 -15
- package/interfaces/listQueryBuilder.d.ts +1 -1
- package/lib/Adminizer.d.ts +25 -2
- package/lib/Adminizer.js +124 -50
- package/lib/DataAccessor.d.ts +9 -5
- package/lib/DataAccessor.js +89 -42
- package/lib/access-rights/AccessRightsHandler.d.ts +17 -0
- package/lib/access-rights/AccessRightsHandler.js +63 -0
- package/lib/ai-assistant/AbstractAiModelService.d.ts +5 -8
- package/lib/ai-assistant/AbstractAiModelService.js +3 -14
- package/lib/ai-assistant/AiAssistantHandler.d.ts +2 -2
- package/lib/app-manager/AdminizerApp.d.ts +228 -0
- package/lib/app-manager/AdminizerApp.js +17 -0
- package/lib/app-manager/AppManager.d.ts +18 -0
- package/lib/app-manager/AppManager.js +537 -0
- package/lib/app-manager/AssetHandler.d.ts +17 -0
- package/lib/app-manager/AssetHandler.js +67 -0
- package/lib/app-manager/ConfigLayerHandler.d.ts +18 -0
- package/lib/app-manager/ConfigLayerHandler.js +119 -0
- package/lib/app-manager/ControllerHandler.d.ts +25 -0
- package/lib/app-manager/ControllerHandler.js +140 -0
- package/lib/catalog/AbstractCatalog.d.ts +28 -19
- package/lib/catalog/AbstractCatalog.js +41 -10
- package/lib/catalog/CatalogHandler.d.ts +13 -0
- package/lib/catalog/CatalogHandler.js +48 -2
- package/lib/catalog/CatalogTemplateComponentHandler.d.ts +23 -0
- package/lib/catalog/CatalogTemplateComponentHandler.js +59 -0
- package/lib/controls/Control.d.ts +17 -0
- package/lib/controls/Control.js +1 -0
- package/lib/controls/ControlsHandler.d.ts +5 -6
- package/lib/controls/ControlsHandler.js +0 -13
- package/lib/controls/codeEditor/MonacoEditor.d.ts +3 -4
- package/lib/controls/codeEditor/MonacoEditor.js +13 -8
- package/lib/controls/geojsoneditor/GeoEditor.d.ts +3 -4
- package/lib/controls/geojsoneditor/GeoEditor.js +14 -9
- package/lib/controls/jsoneditor/JsonEditor.d.ts +5 -6
- package/lib/controls/jsoneditor/JsonEditor.js +14 -13
- package/lib/controls/markdown/ToastUiEditor.d.ts +5 -6
- package/lib/controls/markdown/ToastUiEditor.js +14 -13
- package/lib/controls/table/Handsontable.d.ts +5 -6
- package/lib/controls/table/Handsontable.js +14 -13
- package/lib/controls/wysiwyg/CKeditor.d.ts +5 -6
- package/lib/controls/wysiwyg/CKeditor.js +14 -13
- package/lib/filters/ConditionValidator.d.ts +1 -1
- package/lib/filters/FilterService.d.ts +18 -18
- package/lib/filters/FilterService.js +11 -11
- package/lib/history-actions/AbstractHistoryAdapter.d.ts +14 -14
- package/lib/history-actions/AbstractHistoryAdapter.js +5 -6
- package/lib/history-actions/DefaultHistoryAdapter.d.ts +7 -7
- package/lib/history-actions/DefaultHistoryAdapter.js +2 -2
- package/lib/list-query-builder/ListQueryBuilder.d.ts +1 -1
- package/lib/media-manager/AbstractMediaManager.d.ts +14 -3
- package/lib/media-manager/AbstractMediaManager.js +16 -5
- package/lib/media-manager/MediaManagerHandler.d.ts +3 -0
- package/lib/media-manager/MediaManagerHandler.js +30 -5
- package/lib/media-manager/Thumb.js +7 -13
- package/lib/media-manager/helpers/MediaManagerHelper.d.ts +6 -4
- package/lib/media-manager/helpers/MediaManagerHelper.js +18 -18
- package/lib/model/AbstractModel.d.ts +9 -5
- package/lib/model/AbstractModel.js +9 -13
- package/lib/model/InternalModelAccessFactory.js +9 -10
- package/lib/model/ModelHandler.d.ts +45 -7
- package/lib/model/ModelHandler.js +168 -11
- package/lib/model/adapter/sequelize.d.ts +2 -4
- package/lib/model/adapter/sequelize.js +16 -193
- package/lib/model/adapter/typeorm.d.ts +2 -4
- package/lib/model/adapter/typeorm.js +2 -35
- package/lib/notifications/AbstractNotificationService.d.ts +9 -9
- package/lib/notifications/AbstractNotificationService.js +8 -8
- package/lib/notifications/GeneralNotificationService.js +1 -1
- package/lib/notifications/SystemNotificationService.js +1 -1
- package/lib/ui-i18n/uiTranslationKeys.d.ts +1 -1
- package/lib/ui-i18n/uiTranslationKeys.js +1 -0
- package/lib/widgets/abstractCustom.d.ts +7 -2
- package/lib/widgets/abstractCustom.js +6 -0
- package/lib/widgets/abstractInfo.d.ts +4 -1
- package/lib/widgets/abstractWidgetBase.d.ts +2 -0
- package/lib/widgets/abstractWidgetBase.js +2 -0
- package/lib/widgets/widgetHandler.d.ts +6 -2
- package/lib/widgets/widgetHandler.js +70 -19
- package/models/{FilterAP.d.ts → Filter.d.ts} +4 -70
- package/models/Filter.js +1 -0
- package/models/FilterColumn.d.ts +10 -0
- package/models/FilterColumn.js +1 -0
- package/models/Group.d.ts +8 -0
- package/models/Group.js +1 -0
- package/models/HistoryActions.d.ts +14 -0
- package/models/HistoryActions.js +1 -0
- package/models/MediaManagerAP.d.ts +2 -54
- package/models/MediaManagerAP.js +1 -51
- package/models/MediaManagerAssociationsAP.d.ts +1 -35
- package/models/MediaManagerAssociationsAP.js +1 -33
- package/models/MediaManagerMetaAP.d.ts +2 -30
- package/models/MediaManagerMetaAP.js +1 -27
- package/models/Notification.d.ts +13 -0
- package/models/Notification.js +1 -0
- package/models/User.d.ts +23 -0
- package/models/User.js +1 -0
- package/models/UserNotification.d.ts +7 -0
- package/models/UserNotification.js +1 -0
- package/package.json +25 -30
- package/services/FeedService.d.ts +5 -5
- package/services/FeedService.js +1 -1
- package/system/Router.js +2 -10
- package/system/bindAccessRights.js +1 -1
- package/system/bindAuthorization.js +2 -2
- package/system/bindControls.js +7 -6
- package/system/bindDashboardWidgets.js +3 -2
- package/system/bindDev.js +1 -1
- package/system/bindHistory.d.ts +1 -1
- package/system/bindHistory.js +1 -1
- package/system/bindInertia.js +0 -6
- package/system/bindMediaManager.js +4 -17
- package/system/bindNotifications.d.ts +1 -1
- package/system/bindNotifications.js +1 -1
- package/system/bindReqFunctions.d.ts +1 -0
- package/system/bindReqFunctions.js +20 -3
- package/system/buildInternalModelAccess.js +2 -15
- package/system/defaults.js +5 -10
- package/system/systemModelContracts.d.ts +22 -0
- package/system/systemModelContracts.js +155 -0
- package/system/validateSystemModels.d.ts +2 -0
- package/system/validateSystemModels.js +101 -0
- package/translations/ar.json +2 -1
- package/translations/cn.json +2 -1
- package/translations/de.json +2 -1
- package/translations/en.json +1 -0
- package/translations/es.json +2 -1
- package/translations/fr.json +2 -1
- package/translations/hi.json +2 -1
- package/translations/jp.json +2 -1
- package/translations/ko.json +2 -1
- package/translations/pt.json +2 -1
- package/translations/ru.json +2 -1
- package/translations/ua.json +2 -1
- package/translations/uz.json +2 -1
- package/translations/vi.json +2 -1
- package/ui/components/VanillaJSONEditor.d.ts +1 -1
- package/ui/components/handsontable.d.ts +1 -1
- package/ui/components/ui/avatar.d.ts +3 -3
- package/ui/components/ui/badge.d.ts +1 -1
- package/ui/components/ui/breadcrumb.d.ts +7 -7
- package/ui/components/ui/button.d.ts +1 -1
- package/ui/components/ui/calendar.d.ts +1 -1
- package/ui/components/ui/card.d.ts +7 -7
- package/ui/components/ui/checkbox.d.ts +1 -1
- package/ui/components/ui/collapsible.d.ts +3 -3
- package/ui/components/ui/command.d.ts +9 -9
- package/ui/components/ui/context-menu.d.ts +15 -15
- package/ui/components/ui/dialog-stack.d.ts +10 -10
- package/ui/components/ui/dialog.d.ts +10 -10
- package/ui/components/ui/dropdown-menu.d.ts +15 -15
- package/ui/components/ui/input.d.ts +1 -1
- package/ui/components/ui/label.d.ts +1 -1
- package/ui/components/ui/menubar.d.ts +16 -16
- package/ui/components/ui/pagination.d.ts +7 -7
- package/ui/components/ui/popover.d.ts +4 -4
- package/ui/components/ui/select.d.ts +10 -10
- package/ui/components/ui/separator.d.ts +1 -1
- package/ui/components/ui/sheet.d.ts +8 -8
- package/ui/components/ui/sidebar.d.ts +23 -23
- package/ui/components/ui/skeleton.d.ts +1 -1
- package/ui/components/ui/slider.d.ts +1 -1
- package/ui/components/ui/sonner.d.ts +1 -1
- package/ui/components/ui/switch.d.ts +1 -1
- package/ui/components/ui/table.d.ts +8 -8
- package/ui/components/ui/tabs.d.ts +4 -4
- package/ui/components/ui/textarea.d.ts +1 -1
- package/ui/components/ui/tooltip.d.ts +4 -4
- package/assets/RelationDialogStack-DI2bZxQX.js +0 -20
- package/assets/add-DCQ7ZW4B.js +0 -1
- package/assets/add-group-DCVPryBo.js +0 -1
- package/assets/add-group-form-DKRXC2n-.js +0 -1
- package/assets/add-user-B7OOiYxv.js +0 -1
- package/assets/add-user-form-UXAToWQd.js +0 -1
- package/assets/app-AKbNCggP.css +0 -1
- package/assets/app-layout-6EwNBvnR.js +0 -1
- package/assets/app-shell-D8wtkECO.js +0 -1
- package/assets/app-sidebar-DfGjL-2K.js +0 -1
- package/assets/app-sidebar-header-BZbIBQjq.js +0 -1
- package/assets/breadcrumbs-CODaqVkB.js +0 -1
- package/assets/catalog-DVvFGa2X.js +0 -6
- package/assets/dashboard-BadoiH_a.js +0 -3
- package/assets/date-picker-DSOkNiNo.js +0 -1
- package/assets/del-modal-Cd4M7af8.js +0 -1
- package/assets/dynamic-controls-BsrJhPDY.js +0 -1
- package/assets/geo-json-CzR5JBXL.js +0 -1
- package/assets/handsontable-BI98OF5R.js +0 -336
- package/assets/history-D1iLA6rs.js +0 -1
- package/assets/home-DbWj-W_k.js +0 -2
- package/assets/icon-C2JNaLxH.js +0 -1
- package/assets/init-user-D2HSyXup.js +0 -1
- package/assets/input-error-CH2caTtO.js +0 -1
- package/assets/jsoneditor-DVNQmA6G.js +0 -3869
- package/assets/list-CVoljVUw.js +0 -4
- package/assets/login-DFSLEO17.js +0 -1
- package/assets/material-icon-Bx9pGQiQ.js +0 -1
- package/assets/module-DJsC37CM.js +0 -1
- package/assets/monaco-Bl4zdWCn.js +0 -11
- package/assets/nav-footer-BiSQkPt4.js +0 -1
- package/assets/nav-main-rTH0PfDw.js +0 -1
- package/assets/nav-user-Bj6cWs0a.js +0 -1
- package/assets/notification-DKrNfaAB.js +0 -20
- package/assets/pagination-render-AKJvTIRA.js +0 -1
- package/assets/register-BTP4uxsK.js +0 -1
- package/assets/theme-switcher-Dm8EOGzx.js +0 -1
- package/assets/toast-editor-DOg_gvSp.js +0 -668
- package/assets/user-filters-list-C9R9J6Om.js +0 -1
- package/assets/user-info-BgSbT02v.js +0 -1
- package/assets/user-menu-content-TQTXHIv6.js +0 -1
- package/assets/vanilla-picker-B3LgXoKV.js +0 -2
- package/assets/vendor-l0sNRNKZ.js +0 -1
- package/assets/welcome-BwDlAOGh.js +0 -1
- package/controllers/navigation/edit.d.ts +0 -1
- package/controllers/navigation/edit.js +0 -8
- package/lib/ai-assistant/DummyAiModelService.d.ts +0 -8
- package/lib/ai-assistant/DummyAiModelService.js +0 -14
- package/lib/ai-assistant/OpenAiModelService.d.ts +0 -24
- package/lib/ai-assistant/OpenAiModelService.js +0 -184
- package/lib/catalog/Navigation.d.ts +0 -49
- package/lib/catalog/Navigation.js +0 -492
- package/lib/controls/AbstractControls.d.ts +0 -30
- package/lib/controls/AbstractControls.js +0 -14
- package/lib/media-manager/DefaultMediaManager.d.ts +0 -20
- package/lib/media-manager/DefaultMediaManager.js +0 -127
- package/lib/media-manager/Items.d.ts +0 -50
- package/lib/media-manager/Items.js +0 -296
- package/models/FilterAP.js +0 -68
- package/models/FilterColumnAP.d.ts +0 -32
- package/models/FilterColumnAP.js +0 -21
- package/models/GroupAP.d.ts +0 -31
- package/models/GroupAP.js +0 -22
- package/models/HistoryActionsAP.d.ts +0 -56
- package/models/HistoryActionsAP.js +0 -42
- package/models/NavigationAP.d.ts +0 -22
- package/models/NavigationAP.js +0 -16
- package/models/NotificationAP.d.ts +0 -44
- package/models/NotificationAP.js +0 -30
- package/models/UserAP.d.ts +0 -81
- package/models/UserAP.js +0 -57
- package/models/UserNotificationAP.d.ts +0 -26
- package/models/UserNotificationAP.js +0 -18
- package/system/bindAiAssistant.d.ts +0 -2
- package/system/bindAiAssistant.js +0 -30
- package/system/bindModels.d.ts +0 -2
- package/system/bindModels.js +0 -48
- package/system/bindNavigation.d.ts +0 -2
- package/system/bindNavigation.js +0 -38
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ck as E,c8 as e,as as I,bk as P,bv as L,r as y,bW as R,b7 as T,ba as z,bb as C,b8 as k,b9 as D,c0 as b,bL as M,aA as O}from"./app.js";import K from"./app-shell-D8wtkECO.js";import{AppSidebar as V}from"./app-sidebar-DfGjL-2K.js";import{a as _,u as N,N as B,A as F}from"./app-sidebar-header-BZbIBQjq.js";import{aZ as l}from"./handsontable-BI98OF5R.js";import{R as H}from"./RelationDialogStack-DI2bZxQX.js";const $=l.memo(({children:o,breadcrumbs:a=[],className:i})=>{const r=E();return e.jsxs(K,{variant:"sidebar",children:[e.jsx(I,{title:r.props.title}),e.jsx(V,{}),e.jsxs(P,{className:i,children:[e.jsx(_,{breadcrumbs:a}),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:o})})]})]})});function q({width:o="min(25vw, 420px)"}){const{isEnabled:a,isOpen:i,closeChat:r,models:s,activeModel:n,setActiveModel:d,messages:c,loading:m,sending:x,error:j,sendMessage:v}=N(),[f,h]=l.useState(""),g=l.useRef(null);l.useEffect(()=>{i||h("")},[i]),l.useEffect(()=>{g.current&&g.current.scrollIntoView({behavior:"smooth"})},[c]);const u=s.length>0,A=async t=>{t.preventDefault();const p=f.trim();p&&(await v(p),h(""))},S=t=>{if((t.ctrlKey||t.metaKey)&&t.key==="Enter"){t.preventDefault();const p=f.trim();p&&!x&&(v(p),h(""))}};return a?e.jsxs("aside",{id:"ai-assistant-panel","aria-label":"AI assistant chat","aria-hidden":!i,className:b("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",i?"translate-x-0 opacity-100":"translate-x-full opacity-0 pointer-events-none"),style:{width:"var(--ai-assistant-panel-actual-width, "+o+")"},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(L,{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(y,{variant:"ghost",size:"icon",onClick:r,"aria-label":"Close AI assistant",children:e.jsx(R,{className:"size-4"})})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-hidden px-4 py-4",children:[!u&&!m&&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."}),u&&e.jsxs(e.Fragment,{children:[e.jsxs(T,{value:n,onValueChange:d,children:[e.jsx(z,{className:"w-full",children:e.jsx(C,{placeholder:"Select a model"})}),e.jsx(k,{className:"z-[70]",children:s.map(t=>e.jsx(D,{value:t.id,children:e.jsxs("div",{className:"flex flex-col text-left",children:[e.jsx("span",{className:"font-medium",children:t.name}),t.description&&e.jsx("span",{className:"text-xs text-muted-foreground",children:t.description})]})},t.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:[m&&e.jsx("div",{className:"flex justify-center py-6 text-sm text-muted-foreground",children:"Loading conversation..."}),!m&&c.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."}),c.map(t=>e.jsxs("div",{className:b("flex flex-col gap-1 rounded-md border p-3 text-sm shadow-xs",t.role==="assistant"?"border-primary/30 bg-primary/5":"border-border bg-background"),children:[e.jsx("span",{className:"font-semibold",children:t.role==="assistant"?"Assistant":"You"}),e.jsx("p",{className:"whitespace-pre-wrap leading-relaxed",children:t.content}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(t.timestamp).toLocaleTimeString()})]},t.id)),e.jsx("div",{ref:g})]}),e.jsxs("form",{className:"space-y-2",onSubmit:A,children:[e.jsx(M,{placeholder:u?"Type your question... (Ctrl+Enter to send)":"No models available",value:f,onChange:t=>h(t.target.value),onKeyDown:S,disabled:!u||x,rows:3}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[j&&e.jsx("span",{className:"text-xs text-destructive",children:j}),e.jsx(y,{type:"submit",disabled:!u||x||!f.trim(),children:x?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(O,{className:"size-4 animate-spin"}),"Sending…"]}):"Send"})]})]})]})]})]})]}):null}const G="min(25vw, 420px)",w="margin-right 300ms ease-in-out";function U({children:o,panelWidth:a=G}){const{isEnabled:i,isOpen:r}=N();return l.useEffect(()=>{const s=document.getElementById("app");if(!s)return;const n=s.style.transition,d=n?.includes("margin-right");return d||(s.style.transition=n?`${n}, ${w}`:w),s.classList.add("ai-assistant-host"),s.style.setProperty("--ai-assistant-panel-width",a),()=>{s.classList.remove("ai-assistant-host"),s.style.removeProperty("--ai-assistant-panel-width"),s.style.removeProperty("--ai-assistant-panel-actual-width"),s.style.removeProperty("margin-right"),delete s.dataset.aiAssistantOpen,d||(s.style.transition=n)}},[a]),l.useEffect(()=>{const s=document.getElementById("app");if(!s)return;const n=window.innerWidth<768,d=n?"100vw":a;s.style.setProperty("--ai-assistant-panel-actual-width",d),i&&r?(s.style.marginRight=n?"0":a,s.dataset.aiAssistantOpen="true"):(s.style.removeProperty("margin-right"),s.dataset.aiAssistantOpen="false");const c=()=>{const m=window.innerWidth<768,x=m?"100vw":a;s.style.setProperty("--ai-assistant-panel-actual-width",x),i&&r&&(s.style.marginRight=m?"0":a)};return window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)},[i,r,a]),e.jsxs(e.Fragment,{children:[o,e.jsx(q,{width:a})]})}const ee=l.memo(({children:o,className:a,breadcrumbs:i,...r})=>e.jsx(B,{children:e.jsx(F,{children:e.jsxs(H,{children:[e.jsx($,{breadcrumbs:i,className:a,...r,children:o}),e.jsx(U,{})]})})}));export{ee as A};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c8 as a,br as d}from"./app.js";import{aZ as o}from"./handsontable-BI98OF5R.js";import"./jsoneditor-DVNQmA6G.js";import"./monaco-Bl4zdWCn.js";const u=o.memo(({children:e,variant:s="header"})=>{const[t,n]=o.useState(()=>typeof window<"u"?localStorage.getItem("sidebar")!=="false":!0),i=r=>{n(r),typeof window<"u"&&localStorage.setItem("sidebar",String(r))};return s==="header"?a.jsx("div",{className:"flex min-h-screen w-full flex-col",children:e}):a.jsx(d,{defaultOpen:t,open:t,onOpenChange:i,children:e})});export{u as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ck as B,ci as q,c8 as e,a2 as G,aa as Z,aM as J,a8 as U,a3 as V,a4 as W,H as Y,a7 as Q,a9 as I,ay as y,aw as ee,bL as se,r as w,aX as ae,bW as re,a6 as te,aA as ne,bX as le,bd as ie,bj as ce,bl as C,bn as M,aE as oe,aH as de,aL as xe,bm as F,G as pe,aF as he,aI as me,aK as ue,aJ as je,aG as _,az as N,bg as be,I as T,M as E,E as z,K as L,bo as P,bq as A,bp as O,be as fe,bf as ge}from"./app.js";import{NavMain as Ne}from"./nav-main-rTH0PfDw.js";import{aZ as i,aY as ve}from"./handsontable-BI98OF5R.js";import c from"./material-icon-Bx9pGQiQ.js";import"./jsoneditor-DVNQmA6G.js";import"./monaco-Bl4zdWCn.js";const ke=5*1024*1024,ye=(t,s)=>{const a=t?.response?.data;if(!a)return s;if(typeof a=="string")try{const r=JSON.parse(a);return r.error??r.message??s}catch{return a||s}if(typeof a=="object"){const r=a;return r.error??r.message??s}return s},R=i.memo(({routePrefix:t,triggerLabel:s,placeholder:a,t:r,onClose:p})=>{const[x,b]=i.useState(""),[f,v]=i.useState(""),[j,g]=i.useState([]),[d,u]=i.useState({}),[h,S]=i.useState(!1),[k,$]=i.useState(!1),D=i.useRef(null),H=n=>{if(!n)return;const l={},m=[];Array.from(n).forEach(o=>{o.size>ke?l[o.name]=r("File size exceeds the 5 MB limit"):m.push(o)}),g(o=>[...o,...m]),Object.keys(l).length&&u(o=>({...o,...l}))},K=n=>g(l=>l.filter((m,o)=>o!==n)),X=async n=>{if(n.preventDefault(),!x.trim()){u({title:r("Title is required")});return}S(!0),u({});const l=new FormData;l.append("title",x.trim()),l.append("description",f.trim()),j.forEach(m=>l.append("files",m));try{await le.post(`${t}/api/feedback`,l),$(!0)}catch(m){const o=ye(m,r("Internal server error"));u({_global:o}),S(!1)}};return i.useEffect(()=>{if(!k)return;const n=setTimeout(p,2e3);return()=>clearTimeout(n)},[k,p]),k?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 py-24 text-center",children:[e.jsx(Y,{size:48,className:"text-green-500 dark:text-green-400"}),e.jsx("p",{className:"text-base font-medium",children:r("Feedback sent successfully")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Q,{className:"mb-4",children:[e.jsx(I,{children:s??r("Feedback")}),a&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:a})]}),e.jsxs("form",{onSubmit:X,className:"space-y-5",noValidate:!0,children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(y,{htmlFor:"fb-title",children:r("Title")}),e.jsx(ee,{id:"fb-title",value:x,onChange:n=>b(n.target.value),disabled:h,placeholder:r("Title"),className:d.title?"border-destructive":""}),d.title&&e.jsx("p",{className:"text-xs text-destructive",children:d.title})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(y,{htmlFor:"fb-desc",children:r("Description")}),e.jsx(se,{id:"fb-desc",value:f,onChange:n=>v(n.target.value),disabled:h,placeholder:r("Description"),rows:5,className:"resize-none"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(y,{children:r("Attach files")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(w,{type:"button",variant:"outline",size:"sm",onClick:()=>D.current?.click(),disabled:h,children:[e.jsx(ae,{size:14,className:"mr-1"}),r("Attach files")]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:r("Max 5 MB per file")})]}),e.jsx("input",{ref:D,type:"file",multiple:!0,className:"hidden",onChange:n=>H(n.target.files),disabled:h}),j.length>0&&e.jsx("ul",{className:"mt-2 space-y-1",children:j.map((n,l)=>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:n.name}),e.jsx("button",{type:"button",onClick:()=>K(l),className:"ml-2 text-muted-foreground hover:text-destructive transition-colors","aria-label":r("Remove file"),disabled:h,children:e.jsx(re,{size:13})})]},l))}),Object.entries(d).filter(([n])=>n!=="title"&&n!=="_global").map(([n,l])=>e.jsx("p",{className:"text-xs text-destructive",children:l},n))]}),d._global&&e.jsx("p",{className:"text-xs text-destructive",children:d._global}),e.jsx(te,{children:e.jsx(w,{type:"submit",disabled:h,children:h?e.jsxs(e.Fragment,{children:[e.jsx(ne,{size:14,className:"mr-1.5 animate-spin"}),r("Sending...")]}):r("Send")})})]})]})});R.displayName="FeedbackForm";function Ce(){const t=B(),{t:s}=q(),a=t.props.routePrefix??window.routePrefix??"",r=t.props.feedbackTriggerLabel??null,p=t.props.feedbackPlaceholder??null,[x,b]=i.useState(!1),[f,v]=i.useState(0),j=i.useCallback(()=>b(!1),[]),g=i.useCallback(d=>{b(d),d||v(u=>u+1)},[]);return e.jsxs(G,{open:x,onOpenChange:g,children:[e.jsx(Z,{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":r??s("Send feedback"),children:[e.jsx(J,{size:13}),r??s("Send feedback")]})}),ve.createPortal(e.jsx(U,{}),document.body),e.jsx(V,{children:e.jsx(W,{children:e.jsx(R,{routePrefix:a,triggerLabel:r,placeholder:p,t:s,onClose:j},f)})})]})}function Te(){const t=B();return e.jsxs(ie,{collapsible:"icon",variant:"inset",children:[e.jsx(ce,{children:e.jsx(C,{children:e.jsxs(M,{children:[e.jsx(oe,{className:"p-0 shadow-none border-none bg-transparent hidden md:block",children:e.jsxs(de,{children:[e.jsx(xe,{asChild:!0,className:"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground rounded-md",children:e.jsx(F,{asChild:!0,children:e.jsx(w,{variant:"ghost",asChild:!0,className:`w-full ${t.props.section?"":"pointer-events-none"}`,children:e.jsxs("div",{children:[e.jsx(c,{name:"rocket_launch",className:"!text-[18px]"}),e.jsx("span",{className:"group-data-[state=collapsed]:hidden",children:t.props.brand}),t.props.section&&e.jsx(pe,{className:"ml-auto group-data-[state=collapsed]:hidden"})]})})})}),t.props.section&&e.jsx(he,{side:"right",className:"z-[1003]",children:t.props.section.map(s=>e.jsx("div",{children:s.subItems?e.jsxs(me,{children:[e.jsxs(ue,{className:"flex gap-2 items-center cursor-pointer",children:[e.jsx(c,{name:s.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:s.title})]}),e.jsx(je,{children:s.subItems.map(a=>e.jsx(_,{children:a.type==="blank"?e.jsxs("a",{href:a.link,target:"_blank",className:"flex gap-2 items-center",children:[a.icon&&e.jsx(c,{name:a.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:a.title})]},a.id):e.jsxs(N,{href:a.link,className:"flex gap-2 items-center",children:[a.icon&&e.jsx(c,{name:a.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:a.title})]},a.id)},a.id))})]}):e.jsx(_,{children:s.type==="blank"?e.jsxs("a",{href:s.link,target:"_blank",className:"flex gap-2 items-center",children:[s.icon&&e.jsx(c,{name:s.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:s.title})]}):e.jsxs(N,{href:s.link,className:"flex gap-2 items-center",children:[s.icon&&e.jsx(c,{name:s.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:s.title})]})})},s.id))})]})}),e.jsx(be,{className:"px-2 py-0 block md:hidden",children:e.jsx(C,{children:e.jsx(T,{asChild:!0,className:"group/collapsible",children:e.jsxs(M,{children:[e.jsx(E,{asChild:!0,children:e.jsxs(F,{children:[e.jsx(c,{name:"rocket_launch",className:"!text-[18px]"}),e.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:t.props.brand}),t.props.section&&e.jsx(z,{className:"ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"})]})}),t.props.section&&e.jsx(L,{children:e.jsx(P,{children:t.props.section&&t.props.section.map(s=>s.subItems?e.jsx(C,{children:e.jsx(T,{asChild:!0,className:"group/collapsible-sub",children:e.jsxs(M,{children:[e.jsx(E,{asChild:!0,children:e.jsxs(F,{children:[e.jsx(c,{name:s.icon,className:"!text-[18px]"}),e.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:s.title}),e.jsx(z,{className:"ml-auto transition-transform duration-200 group-data-[state=open]/collapsible-sub:rotate-90"})]})}),e.jsx(L,{children:e.jsx(P,{children:s.subItems.map(a=>e.jsx(A,{children:e.jsx(O,{asChild:!0,children:a.type==="blank"?e.jsxs("a",{href:a.link,target:"_blank",className:"flex gap-2 items-center",children:[a.icon&&e.jsx(c,{name:a.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:a.title})]}):e.jsxs(N,{href:a.link,className:"flex gap-2 items-center",children:[a.icon&&e.jsx(c,{name:a.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:a.title})]})})},a.id))})})]})})},s.id):e.jsx(A,{children:e.jsx(O,{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(c,{name:s.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:s.title})]}):e.jsxs(N,{href:s.link,className:"flex gap-2 items-center",children:[s.icon&&e.jsx(c,{name:s.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:s.title})]})})},s.id))})})]})})})})]},t.props.brand)})}),e.jsx(fe,{children:e.jsx(Ne,{items:t.props.menu})}),e.jsx(ge,{children:e.jsxs("div",{className:"flex flex-col items-center",children:[t.props.version&&(()=>{const s=t.props.version,a=s.text||"4.7.0",r=new Date("2026-05-23T09:38:30.320Z").toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),p=s.text?`v.${a}`:`v.${a} · ${r}`,x="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:x,children:p}):e.jsx("span",{title:s.hint??void 0,className:x,children:p})})(),t.props.showFeedback&&e.jsx(Ce,{})]})})]})}export{Te as AppSidebar};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ck as z,ci as V,c8 as e,bX as y,af as X,am as q,r as P,i as G,ah as Q,ai as Y,aj as Z,bN as J,bQ as R,an as K,bO as L,cc as W,al as ee,az as B,aA as O,bv as te,c0 as se,bs as ae,au as ie}from"./app.js";import{Breadcrumbs as ne}from"./breadcrumbs-CODaqVkB.js";import{NavUser as re}from"./nav-user-Bj6cWs0a.js";import{ThemeSwitcher as oe}from"./theme-switcher-Dm8EOGzx.js";import{aZ as a,aX as ce}from"./handsontable-BI98OF5R.js";import le from"./material-icon-Bx9pGQiQ.js";const F=a.createContext(void 0),ve=({children:d})=>{const[g,f]=a.useState([]),[b,u]=a.useState([]),[h,m]=a.useState([]),[k,c]=a.useState(!1),[r,p]=a.useState(null),[w,C]=a.useState(""),j=z(),{t:n}=V(),v=ce.useMemo(()=>({"Make read":n("Make read"),"View All":n("View All"),Search:n("Search"),"Make all read":n("Make all read"),Title:n("Title"),Message:n("Message"),Date:n("Date"),Diff:n("Diff"),"No notifications":n("No notifications"),"No notifications found":n("No notifications found"),"The end of the list has been reached":n("The end of the list has been reached")}),[n]),N=[...b,...h],x=async()=>{try{const t=await y.getJson(`${window.routePrefix}/notifications/api`,{params:{unreadOnly:!0,limit:4}});f(t.data)}catch(t){console.error("Error fetching bell notifications:",t)}},l=async()=>{await x()},A=async()=>{try{const t=await y.getJson(`${window.routePrefix}/notifications/api/get-classes`);t.data&&(p(t.data.activeServices),C(t.data.initTab))}catch(t){console.error("Error fetching tabs:",t)}},M=async(t,o)=>{try{if(!t){await E(o);return}const s=await y.postJson(`${window.routePrefix}/notifications/api/search`,{s:t,notificationClass:o});m(s.data)}catch(s){console.error("Error searching notifications:",s)}},E=async t=>{c(!0);try{const o=`${window.routePrefix}/notifications/api/${t}`,s=await y.getJson(o,{params:{limit:20,skip:0,unreadOnly:!1}});return u([]),m(s.data),s.data}catch(o){return console.error("Error fetching all notifications:",o),[]}finally{c(!1)}},$=async(t,o)=>{try{const s=`${window.routePrefix}/notifications/api/${t}`,i=await y.getJson(s,{params:{limit:20,skip:o,unreadOnly:!1}});return m(_=>[..._,...i.data]),i.data}catch(s){return console.error("Error paginating notifications:",s),[]}};a.useEffect(()=>{if(!j.props.notifications)return;x();const t=new EventSource(`${window.routePrefix}/notifications/api/stream`);return t.addEventListener("connected",o=>{A()}),t.addEventListener("notification",o=>{const s=JSON.parse(o.data);u(i=>[s,...i]),f(i=>[s,...i].slice(0,4))}),t.onerror=()=>{console.error("SSE connection error")},()=>t.close()},[]);const I=async(t,o)=>{try{await y.putJson(`${window.routePrefix}/notifications/api/${t}/${o}/read`,{}),u(s=>s.map(i=>i.id===o?{...i,read:!0}:i)),m(s=>s.map(i=>i.id===o?{...i,read:!0}:i)),f([])}catch(s){console.error("Error marking as read:",s)}},T=async()=>{try{await y.putJson(`${window.routePrefix}/notifications/api/read-all`,{}),u(t=>t.map(o=>({...o,read:!0}))),m(t=>t.map(o=>({...o,read:!0}))),await x()}catch(t){console.error("Error marking all as read:",t)}},D=g.filter(t=>!t.read).length;return e.jsx(F.Provider,{value:{bellNotifications:g,allNotifications:N,unreadCount:D,getTabs:A,tabs:r,initTab:w,search:M,markAsRead:I,markAllAsRead:T,messages:v,fetchAllNotifications:E,paginateNotifications:$,loading:k,refreshBellNotifications:l},children:d})},H=()=>{const d=a.useContext(F);if(d===void 0)throw new Error("useNotifications must be used within a NotificationProvider");return d};function de(){const{bellNotifications:d,markAsRead:g,unreadCount:f,refreshBellNotifications:b,messages:u}=H(),[h,m]=a.useState(!1),k=async(r,p)=>{m(!0);try{await g(r,p),await b()}catch(w){console.error("Error marking as read:",w)}finally{m(!1)}},c=r=>{const p=new Date,w=new Date(r),C=p.getTime()-w.getTime(),j=Math.floor(C/1e3),n=new Intl.RelativeTimeFormat("en",{numeric:"auto"});if(j<60)return n.format(-j,"second");const v=Math.floor(j/60);if(v<60)return n.format(-v,"minute");const N=Math.floor(v/60);if(N<24)return n.format(-N,"hour");const x=Math.floor(N/24);if(x<30)return n.format(-x,"day");const l=Math.floor(x/30);if(l<12)return n.format(-l,"month");const A=Math.floor(l/12);return n.format(-A,"year")};return e.jsxs(X,{children:[e.jsx(q,{asChild:!0,className:"cursor-pointer data-[state=open]:bg-sidebar-accent",children:e.jsxs(P,{variant:"ghost",className:"relative",children:[e.jsx(G,{}),f>0&&e.jsx("div",{className:"absolute top-1.5 right-1.5 size-1.5 rounded-full bg-destructive"})]})}),e.jsxs(Q,{className:"z-[1002] p-2",align:"end",onCloseAutoFocus:r=>r.preventDefault(),children:[e.jsx(Y,{className:`${h?"opacity-50 pointer-events-none":""}`,children:d.length===0?e.jsx("div",{className:"p-4 text-center text-muted-foreground",children:u["No notifications"]}):d.map(r=>e.jsxs("div",{children:[e.jsx(Z,{asChild:!0,className:"cursor-pointer",onSelect:p=>{p.preventDefault(),W.visit(`${window.routePrefix}/notifications?type=${r.notificationClass}`)},children:e.jsxs("div",{className:"grid grid-cols-[32px_250px] grid-rows-[auto_1fr] items-start gap-x-4 gap-y-2",children:[r.icon?e.jsx(le,{name:r.icon.icon,style:{color:r.icon.iconColor},className:"!text-[32px]"}):e.jsx("div",{}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium",children:r.title}),e.jsx("span",{className:"truncate",children:r.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:c(r.createdAt)})}),e.jsxs(J,{children:[e.jsx(R,{asChild:!0,children:e.jsx(P,{variant:"ghost",size:"icon",className:"size-4",onClick:p=>{p.stopPropagation(),k(r.notificationClass,r.id)},children:e.jsx(K,{className:"text-primary"})})}),e.jsx(L,{side:"left",className:"z-[1003]",children:e.jsx("p",{children:u["Make read"]})})]})]})]})}),e.jsx(ee,{})]},r.id))}),e.jsx(P,{variant:"secondary",asChild:!0,children:e.jsxs(B,{href:`${window.routePrefix}/notifications`,className:`w-full ${h?"opacity-50 pointer-events-none":""}`,children:[u["View All"],h&&e.jsx(O,{className:"h-4 w-4 animate-spin"})]})})]})]})}const fe=()=>{if(!(typeof window>"u"))return window.__adminizerAiAssistantState__??void 0},ue=d=>{typeof window>"u"||(window.__adminizerAiAssistantState__=d)},U=a.createContext(void 0),Ne=({children:d})=>{const f=z().props.aiAssistant,b=a.useMemo(()=>fe(),[]),[u,h]=a.useState(()=>b?.isOpen??!1),[m,k]=a.useState([]),[c,r]=a.useState(()=>b?.activeModel??f?.defaultModel??void 0),[p,w]=a.useState([]),[C,j]=a.useState(!1),[n,v]=a.useState(!1),[N,x]=a.useState(null),l=f?.enabled??!1,A=a.useCallback(async()=>{if(l)try{j(!0);const{data:s}=await y.getJson(`${window.routePrefix}/api/ai-assistant/models`);k(s),r(i=>i||(f?.defaultModel&&s.some(S=>S.id===f.defaultModel)?f.defaultModel:s[0]?.id))}catch(s){console.error("Failed to load AI assistant models",s),x("Unable to load AI assistant models")}finally{j(!1)}},[f?.defaultModel,l]),M=a.useCallback(async s=>{if(!(!l||!s))try{j(!0);const{data:i}=await y.getJson(`${window.routePrefix}/api/ai-assistant/history/${s}`);w(i.history??[])}catch(i){console.error("Failed to load AI assistant history",i),x("Unable to load AI assistant history")}finally{j(!1)}},[l]);a.useEffect(()=>{if(!l){w([]);return}A()},[A,l]),a.useEffect(()=>{!l||!c||M(c)},[c,M,l]);const E=a.useCallback(s=>{r(s)},[]),$=a.useCallback(()=>h(!0),[]),I=a.useCallback(()=>h(!1),[]),T=a.useCallback(()=>h(s=>!s),[]),D=a.useCallback(async s=>{if(!l||!c)return;const i=s.trim();if(!i)return;const _={id:`tmp-${Date.now()}`,role:"user",content:i,timestamp:new Date().toISOString(),modelId:c};w(S=>[...S,_]),v(!0),x(null);try{const{data:S}=await y.postJson(`${window.routePrefix}/api/ai-assistant/query`,{modelId:c,message:i});w(S.history??[])}catch(S){console.error("Failed to send AI assistant message",S),x("Unable to reach AI assistant"),await M(c)}finally{v(!1)}},[c,M,l]),t=a.useCallback(async()=>{c&&await M(c)},[c,M]);a.useEffect(()=>{l||h(!1)},[l]),a.useEffect(()=>{ue({isOpen:u,activeModel:c})},[c,u]);const o=a.useMemo(()=>({isEnabled:l,isOpen:u,openChat:$,closeChat:I,toggleChat:T,models:m,activeModel:c,setActiveModel:E,messages:p,loading:C,sending:n,error:N,sendMessage:D,refreshHistory:t}),[c,I,N,l,u,C,p,m,$,t,D,n,E,T]);return e.jsx(U.Provider,{value:o,children:d})},me=()=>{const d=a.useContext(U);if(!d)throw new Error("useAiAssistant must be used within an AiAssistantProvider");return d};function he(){const{isEnabled:d,isOpen:g,toggleChat:f,models:b,sending:u,loading:h}=me();if(!d)return null;const m=b.length>0;return e.jsx(e.Fragment,{children:e.jsxs(J,{children:[e.jsx(R,{asChild:!0,children:e.jsx(P,{variant:"ghost",className:se("relative",{"text-primary":g}),onClick:f,"aria-expanded":g,"aria-haspopup":"true","aria-controls":"ai-assistant-panel",disabled:!m&&h,children:u?e.jsx(O,{className:"size-4 animate-spin"}):e.jsx(te,{className:"size-4"})})}),e.jsx(L,{side:"bottom",className:"z-[1002]",children:e.jsx("span",{children:"AI assistant"})})]})})}function pe({breadcrumbs:d=[]}){const{tabs:g}=H(),f=z();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(ae,{className:"-ml-1"}),e.jsx(ne,{breadcrumbs:d})]}),e.jsxs("div",{className:"flex gap-4 items-center",children:[e.jsx(he,{}),f.props.history&&e.jsx(B,{href:`${window.routePrefix}/history/view-all`,children:e.jsx(P,{variant:"ghost",size:"icon",className:"shrink-0",children:e.jsx(ie,{})})}),e.jsx(oe,{}),f.props.notifications&&(g===null?e.jsx("div",{className:"w-[40px] flex-none flex justify-center",children:e.jsx(O,{className:"size-4 animate-spin"})}):g.length?e.jsx(de,{}):null),e.jsx(re,{})]})]})})}const Me=Object.freeze(Object.defineProperty({__proto__:null,AppSidebarHeader:pe},Symbol.toStringTag,{value:"Module"}));export{Ne as A,ve as N,pe as a,Me as b,H as c,me as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c8 as r,l as n,o as i,m as c,p as l,n as m,az as d,q as h}from"./app.js";import{aZ as o}from"./handsontable-BI98OF5R.js";import"./jsoneditor-DVNQmA6G.js";import"./monaco-Bl4zdWCn.js";function B({breadcrumbs:e}){return r.jsx(r.Fragment,{children:e.length>0&&r.jsx(n,{children:r.jsx(i,{children:e.map((a,s)=>{const t=s===e.length-1;return r.jsxs(o.Fragment,{children:[r.jsx(c,{children:t?r.jsx(l,{children:a.title}):r.jsx(m,{asChild:!0,children:r.jsx(d,{href:a.href,children:a.title})})}),!t&&r.jsx(h,{})]},s)})})})})}export{B as Breadcrumbs};
|