@e-llm-studio/instant-learning 1.3.0-alpha.158 → 1.3.0-alpha.159

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 (112) hide show
  1. package/dist/ContinueWithTemplateModal.js +1 -1
  2. package/dist/cjs/ContinueWithTemplateModal.js +1 -1
  3. package/dist/cjs/features/DocumentLearning/DocumentLearning.js +1 -1
  4. package/dist/cjs/features/DocumentLearning/_components/BookLearningForm.js +1 -1
  5. package/dist/cjs/features/DocumentLearning/_components/ChatComponent.js +1 -1
  6. package/dist/cjs/features/IL-OTJ/ILOTJTest.js +1 -1
  7. package/dist/cjs/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.js +1 -1
  8. package/dist/cjs/features/IL-OTJ/_components/ChatComponents/ChatComponent.js +1 -1
  9. package/dist/cjs/features/IL-OTJ/_components/ChatComponents/NormalChat.js +1 -1
  10. package/dist/cjs/features/IL-marketplace/services/guideline.core.api.js +1 -1
  11. package/dist/cjs/features/IL-marketplace/services/instant-learning.api.js +1 -1
  12. package/dist/cjs/features/InstantLearning/_components/ChatComponent.js +1 -1
  13. package/dist/cjs/features/InstantLearning/_components/ContextualChatComponent.js +1 -1
  14. package/dist/cjs/features/InstantLearning/_components/ContextualLearningForm.js +1 -1
  15. package/dist/cjs/features/InstantLearning/_components/LearningDetailsForm.js +1 -1
  16. package/dist/cjs/features/LearningManagement/AuditLog/AuditLog.js +1 -1
  17. package/dist/cjs/features/LearningManagement/LearningManagement.js +1 -1
  18. package/dist/cjs/features/LearningManagement/LearningManagementTest.js +1 -1
  19. package/dist/cjs/features/LearningManagement/LearningTemplateLayout.js +1 -1
  20. package/dist/cjs/features/LearningManagement/RBAC/AccessPanel.js +1 -1
  21. package/dist/cjs/features/LearningManagement/RuleContent/RuleContent.js +1 -1
  22. package/dist/cjs/features/LearningManagement/apis/scopeApis.js +1 -1
  23. package/dist/cjs/features/LearningManagement/components/InstantLearningModal.js +1 -1
  24. package/dist/cjs/features/LearningManagement/components/InstantLearningModalDynamic.js +1 -1
  25. package/dist/cjs/hooks/useAgentFix.js +1 -1
  26. package/dist/cjs/hooks/useAgentSuggestions.js +1 -1
  27. package/dist/cjs/hooks/useAgentValidation.js +1 -1
  28. package/dist/cjs/hooks/useExistingAgentCheck.js +1 -1
  29. package/dist/cjs/hooks/useExistingPromptCheck.js +1 -1
  30. package/dist/cjs/hooks/usePromptFix.js +1 -1
  31. package/dist/cjs/hooks/usePromptSuggestions.js +1 -1
  32. package/dist/cjs/hooks/usePromptValidation.js +1 -1
  33. package/dist/cjs/index.js +1 -1
  34. package/dist/cjs/service/InstantLearningService.js +1 -1
  35. package/dist/cjs/utils/agentGenieAPI.js +1 -1
  36. package/dist/cjs/utils/bookGenieAPI.js +1 -1
  37. package/dist/cjs/utils/instantLearningAPI.js +1 -1
  38. package/dist/features/DocumentLearning/DocumentLearning.js +1 -1
  39. package/dist/features/DocumentLearning/_components/BookLearningForm.js +1 -1
  40. package/dist/features/DocumentLearning/_components/ChatComponent.js +1 -1
  41. package/dist/features/IL-OTJ/ILOTJTest.js +1 -1
  42. package/dist/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.js +1 -1
  43. package/dist/features/IL-OTJ/_components/ChatComponents/ChatComponent.js +1 -1
  44. package/dist/features/IL-OTJ/_components/ChatComponents/NormalChat.js +1 -1
  45. package/dist/features/IL-marketplace/services/guideline.core.api.js +1 -1
  46. package/dist/features/IL-marketplace/services/instant-learning.api.js +1 -1
  47. package/dist/features/InstantLearning/_components/ChatComponent.js +1 -1
  48. package/dist/features/InstantLearning/_components/ContextualChatComponent.js +1 -1
  49. package/dist/features/InstantLearning/_components/ContextualLearningForm.js +1 -1
  50. package/dist/features/InstantLearning/_components/LearningDetailsForm.js +1 -1
  51. package/dist/features/LearningManagement/AuditLog/AuditLog.js +1 -1
  52. package/dist/features/LearningManagement/LearningManagement.js +1 -1
  53. package/dist/features/LearningManagement/LearningManagementTest.js +1 -1
  54. package/dist/features/LearningManagement/LearningTemplateLayout.js +1 -1
  55. package/dist/features/LearningManagement/RBAC/AccessPanel.js +1 -1
  56. package/dist/features/LearningManagement/RuleContent/RuleContent.js +1 -1
  57. package/dist/features/LearningManagement/apis/scopeApis.js +1 -1
  58. package/dist/features/LearningManagement/components/InstantLearningModal.js +1 -1
  59. package/dist/features/LearningManagement/components/InstantLearningModalDynamic.js +1 -1
  60. package/dist/hooks/useAgentFix.js +1 -1
  61. package/dist/hooks/useAgentSuggestions.js +1 -1
  62. package/dist/hooks/useAgentValidation.js +1 -1
  63. package/dist/hooks/useExistingAgentCheck.js +1 -1
  64. package/dist/hooks/useExistingPromptCheck.js +1 -1
  65. package/dist/hooks/usePromptFix.js +1 -1
  66. package/dist/hooks/usePromptSuggestions.js +1 -1
  67. package/dist/hooks/usePromptValidation.js +1 -1
  68. package/dist/index.js +1 -1
  69. package/dist/service/InstantLearningService.js +1 -1
  70. package/dist/types/src/features/DocumentLearning/DocumentLearning.d.ts.map +1 -1
  71. package/dist/types/src/features/DocumentLearning/_components/BookLearningForm.d.ts.map +1 -1
  72. package/dist/types/src/features/DocumentLearning/_components/LearningDetailsForm.d.ts.map +1 -1
  73. package/dist/types/src/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.d.ts.map +1 -1
  74. package/dist/types/src/features/IL-marketplace/services/guideline.core.api.d.ts.map +1 -1
  75. package/dist/types/src/features/IL-marketplace/services/instant-learning.api.d.ts.map +1 -1
  76. package/dist/types/src/features/InstantLearning/_components/ContextualLearningForm.d.ts.map +1 -1
  77. package/dist/types/src/features/InstantLearning/_components/LearningDetailsForm.d.ts.map +1 -1
  78. package/dist/types/src/features/LearningManagement/AuditLog/AuditLog.d.ts.map +1 -1
  79. package/dist/types/src/features/LearningManagement/LearningManagement.d.ts +1 -9
  80. package/dist/types/src/features/LearningManagement/LearningManagement.d.ts.map +1 -1
  81. package/dist/types/src/features/LearningManagement/RBAC/AccessPanel.d.ts.map +1 -1
  82. package/dist/types/src/features/LearningManagement/apis/scopeApis.d.ts.map +1 -1
  83. package/dist/types/src/features/LearningManagement/components/InstantLearningModalDynamic.d.ts.map +1 -1
  84. package/dist/types/src/features/LearningManagement/queries/useApprovalQueries.d.ts +8 -11
  85. package/dist/types/src/features/LearningManagement/queries/useApprovalQueries.d.ts.map +1 -1
  86. package/dist/types/src/features/LearningManagement/queries/useLMSConfigQuery.d.ts +1 -3
  87. package/dist/types/src/features/LearningManagement/queries/useLMSConfigQuery.d.ts.map +1 -1
  88. package/dist/types/src/features/LearningManagement/store/useExternalWorkflowStore.d.ts +4 -4
  89. package/dist/types/src/features/LearningManagement/store/useExternalWorkflowStore.d.ts.map +1 -1
  90. package/dist/types/src/hooks/useAgentFix.d.ts.map +1 -1
  91. package/dist/types/src/hooks/useAgentSuggestions.d.ts.map +1 -1
  92. package/dist/types/src/hooks/useAgentValidation.d.ts.map +1 -1
  93. package/dist/types/src/hooks/useExistingAgentCheck.d.ts.map +1 -1
  94. package/dist/types/src/hooks/useExistingPromptCheck.d.ts.map +1 -1
  95. package/dist/types/src/hooks/usePromptFix.d.ts.map +1 -1
  96. package/dist/types/src/hooks/usePromptSuggestions.d.ts.map +1 -1
  97. package/dist/types/src/hooks/usePromptValidation.d.ts.map +1 -1
  98. package/dist/types/src/index.d.ts +0 -1
  99. package/dist/types/src/index.d.ts.map +1 -1
  100. package/dist/types/src/service/API.d.ts.map +1 -1
  101. package/dist/types/src/service/GoogleFilePickerService.d.ts.map +1 -1
  102. package/dist/types/src/service/InstantLearningService.d.ts +1 -12
  103. package/dist/types/src/service/InstantLearningService.d.ts.map +1 -1
  104. package/dist/types/src/service/ModelService.d.ts.map +1 -1
  105. package/dist/types/src/service/SavedDataSetService.d.ts.map +1 -1
  106. package/dist/types/src/utils/bookGenieAPI.d.ts.map +1 -1
  107. package/dist/types/src/utils/date.d.ts.map +1 -1
  108. package/dist/types/src/utils/instantLearningAPI.d.ts.map +1 -1
  109. package/dist/utils/agentGenieAPI.js +1 -1
  110. package/dist/utils/bookGenieAPI.js +1 -1
  111. package/dist/utils/instantLearningAPI.js +1 -1
  112. package/package.json +9 -10
@@ -1,2 +1,2 @@
1
- import{__assign as e,__awaiter as i,__generator as t}from"tslib";import{jsx as a,jsxs as n}from"react/jsx-runtime";import{useEffect as r,useState as o}from"react";import{Box as l,CircularProgress as d,Dialog as p,DialogTitle as c,Typography as s,IconButton as u,DialogContent as f}from"@mui/material";import m from"@mui/icons-material/Close";import{useLearningTemplateStore as v}from"../../LearningManagement/store/useLearningTemplateStore.js";import{http as g}from"../../../api/transport.js";var h=function(){var i=o(!0),t=i[0],r=i[1];return n(p,e({open:t,onClose:function(){return r(!1)},fullWidth:!0,maxWidth:"lg",PaperProps:{sx:{borderRadius:"16px",minHeight:"70vh",overflow:"hidden"}}},{children:[n(c,e({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid #e0e0e0",px:3,py:2}},{children:[a(s,e({variant:"h6",fontWeight:600},{children:"Teach Me"})),a(u,e({onClick:function(){return r(!1)}},{children:a(m,{})}))]})),a(f,e({dividers:!0,sx:{p:3,backgroundColor:"#fafafa"}},{children:"There is some issue with the selected template. Kindly check steps to resolve."}))]}))},y=function(n){var p=n.templateRegistry,c=void 0===p?{}:p,s=v(function(e){return e.backwardCompatibility}),u=v(function(e){return e.setBackwardCompatibility});r(function(){var e,i,t;(null===(e=n.pluginPayload)||void 0===e?void 0:e.backwardCompatibility)&&u(null!==(t=null===(i=n.pluginPayload)||void 0===i?void 0:i.backwardCompatibility)&&void 0!==t&&t)},[]);var f=v(function(e){return n.app_integration_id?e.templateMap[n.app_integration_id]:void 0}),m=v(function(e){return e.setTemplateData}),y=s?"Radio Traffic Learning":f,_=o(!y),b=_[0],w=_[1],x=o(!1),k=x[0],C=x[1];if(r(function(){var e,a,r;if(n.isOpen){if(null===(e=n.pluginPayload)||void 0===e?void 0:e.backwardCompatibility)return m("","Radio Traffic Learning"),void w(!1);if(!s&&!n.app_integration_id)return console.error("TeachMeWrapper requires an app_integration_id when backward compatibility is disabled."),C(!0),void w(!1);if(null===(r=null===(a=n.pluginPayload)||void 0===a?void 0:a.teachMe)||void 0===r?void 0:r.template)return m(n.app_integration_id,n.pluginPayload.teachMe.template),void w(!1);if(y)w(!1);else{i(void 0,void 0,void 0,function(){var e,a;return t(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,3,4]),w(!0),C(!1),[4,(o=n.app_integration_id,l=n.token,i(void 0,void 0,void 0,function(){var e,i;return t(this,function(t){switch(t.label){case 0:return s?[2,"Radio Traffic Learning"]:[4,g.get("".concat(n.baseURL,"/instant_learning/ilotj/application/getValueType/").concat(o),{headers:{Authorization:"Bearer ".concat(l)}})];case 1:return e=t.sent(),i=e.data,console.log("Fetched value type data:",i),!i||Array.isArray(i.data)&&0===i.data.length?[2,null]:[2,i.data[0].value_type_name||i.valueTypeName||i.templateName]}})}))];case 1:return e=r.sent(),m(n.app_integration_id,e),[3,4];case 2:return a=r.sent(),console.error(a),C(!0),n.app_integration_id&&m(n.app_integration_id,"ERROR"),[3,4];case 3:return w(!1),[7];case 4:return[2]}var o,l})})}}},[n.isOpen,n.app_integration_id,y,n.token,m,s]),b)return a(l,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:a(d,{size:32})}));if(k||!y)return a(h,{});var T=c[y&&c[y]?y:"Default"];return T?a(T,e({},n)):(console.warn("No renderer found for template: ".concat(y)),a(h,{}))};export{y as default};
1
+ import{__assign as e,__awaiter as i,__generator as t}from"tslib";import{jsx as a,jsxs as n}from"react/jsx-runtime";import{useEffect as r,useState as o}from"react";import{Box as l,CircularProgress as d,Dialog as c,DialogTitle as p,Typography as u,IconButton as s,DialogContent as f}from"@mui/material";import m from"@mui/icons-material/Close";import{useLearningTemplateStore as v}from"../../LearningManagement/store/useLearningTemplateStore.js";var h=function(){var i=o(!0),t=i[0],r=i[1];return n(c,e({open:t,onClose:function(){return r(!1)},fullWidth:!0,maxWidth:"lg",PaperProps:{sx:{borderRadius:"16px",minHeight:"70vh",overflow:"hidden"}}},{children:[n(p,e({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid #e0e0e0",px:3,py:2}},{children:[a(u,e({variant:"h6",fontWeight:600},{children:"Teach Me"})),a(s,e({onClick:function(){return r(!1)}},{children:a(m,{})}))]})),a(f,e({dividers:!0,sx:{p:3,backgroundColor:"#fafafa"}},{children:"There is some issue with the selected template. Kindly check steps to resolve."}))]}))},g=function(n){var c=n.templateRegistry,p=void 0===c?{}:c,u=v(function(e){return e.backwardCompatibility}),s=v(function(e){return e.setBackwardCompatibility});r(function(){var e,i,t;(null===(e=n.pluginPayload)||void 0===e?void 0:e.backwardCompatibility)&&s(null!==(t=null===(i=n.pluginPayload)||void 0===i?void 0:i.backwardCompatibility)&&void 0!==t&&t)},[]);var f=v(function(e){return n.app_integration_id?e.templateMap[n.app_integration_id]:void 0}),m=v(function(e){return e.setTemplateData}),g=u?"Radio Traffic Learning":f,y=o(!g),_=y[0],b=y[1],w=o(!1),k=w[0],x=w[1];if(r(function(){var e,a,r;if(n.isOpen){if(null===(e=n.pluginPayload)||void 0===e?void 0:e.backwardCompatibility)return m("","Radio Traffic Learning"),void b(!1);if(!u&&!n.app_integration_id)return console.error("TeachMeWrapper requires an app_integration_id when backward compatibility is disabled."),x(!0),void b(!1);if(null===(r=null===(a=n.pluginPayload)||void 0===a?void 0:a.teachMe)||void 0===r?void 0:r.template)return m(n.app_integration_id,n.pluginPayload.teachMe.template),void b(!1);if(g)b(!1);else{i(void 0,void 0,void 0,function(){var e,a;return t(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,3,4]),b(!0),x(!1),[4,(o=n.app_integration_id,l=n.token,i(void 0,void 0,void 0,function(){var e,i;return t(this,function(t){switch(t.label){case 0:return u?[2,"Radio Traffic Learning"]:[4,fetch("".concat(n.baseURL,"/instant_learning/ilotj/application/getValueType/").concat(o),{headers:{Authorization:"Bearer ".concat(l)}})];case 1:if(!(e=t.sent()).ok)throw new Error("Failed to fetch value type");return[4,e.json()];case 2:return i=t.sent(),console.log("Fetched value type data:",i),!i||Array.isArray(i.data)&&0===i.data.length?[2,null]:[2,i.data[0].value_type_name||i.valueTypeName||i.templateName]}})}))];case 1:return e=r.sent(),m(n.app_integration_id,e),[3,4];case 2:return a=r.sent(),console.error(a),x(!0),n.app_integration_id&&m(n.app_integration_id,"ERROR"),[3,4];case 3:return b(!1),[7];case 4:return[2]}var o,l})})}}},[n.isOpen,n.app_integration_id,g,n.token,m,u]),_)return a(l,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:a(d,{size:32})}));if(k||!g)return a(h,{});var C=p[g&&p[g]?g:"Default"];return C?a(C,e({},n)):(console.warn("No renderer found for template: ".concat(g)),a(h,{}))};export{g as default};
2
2
  //# sourceMappingURL=TeachMeWrapper.js.map
@@ -1,2 +1,2 @@
1
- import{__makeTemplateObject as e,__spreadArray as n,__assign as t,__awaiter as o,__generator as i,__rest as r}from"tslib";import{jsx as a,jsxs as s,Fragment as l}from"react/jsx-runtime";import{useRef as c,useState as d,useMemo as u,useEffect as v,useCallback as m,useLayoutEffect as h}from"react";import{keyframes as p,Dialog as g,Box as f}from"@mui/material";import C from"@mui/material/Tooltip";import y from"react-markdown";import b from"rehype-raw";import{http as S}from"../../../../api/transport.js";import{v4 as w}from"uuid";import{stopStreaming as x,startChatStream as k}from"@e-llm-studio/streaming-response";import{WatchMeWork as I}from"@e-llm-studio/watch-me-work";import T from"./ChatHeader.js";import _ from"../MessageRendering/MessageRendering.js";import{Skeleton as E}from"../atoms/SkeletonLoader/SkeletonLoader.js";import{ActionableButton as M}from"../MessageRendering/ClickableChatComponents.js";import R from"../AudioWaveform.js";import D from"./ChatComponent.module.css.js";import N from"../../InstantLearning.module.css.js";import{ScrollToBottom as q}from"../_svg/ScrollToBottom.js";import{useHeaderObserver as F,extractTextFromChildren as A}from"../../helpers/utils.js";import{SendButton as L}from"../_svg/SendButton.js";import W from"../_svg/SparkleIcon.js";import{UserIcon as P}from"../_svg/UserIcon.js";var z,j=function(e,n){return S.post("".concat(e||"https://devllmstudio.creativeworkspace.ai","/api/chat/chatResponse"),{name:"ilggcautopromptgen",organizationName:"techolution",prompt:n||"Generate a query"},{headers:{"Content-Type":"application/json"},withCredentials:!0}).then(function(e){return e.data}).catch(function(e){throw console.error("Error calling auto-generate API:",e),e})},B=function(j){var B=j.chatAssistantName,O=j.organizationName,H=j.baseUrl,U=j.baseWebsocketUrl,G=j.setIsNewChatClicked;j.ThinkingBulbIconComponent;var Z=j.isFormSaveClicked,K=j.setIsFormSavedClicked,V=j.onResetLearningData,Q=j.sendMessageInChat,J=j.setSendMessageInChat,$=j.isFormValidating,X=j.chatTitle,Y=j.customMetaData,ee=j.headerMessageHandlers;j.aiResponse;var ne=j.setAIResponse,te=j.onResetChat,oe=j.initialChatMessage,ie=void 0===oe?"":oe,re=j.onSave,ae=j.chatSize,se=j.setChatSize,le=j.movingTowards,ce=j.setCitations,de=j.textareaPlaceholder,ue=void 0===de?"Tell me more about this learning...":de,ve=j.setCurrentRequestId,me=j.showSavedMessage,he=void 0!==me&&me,pe=j.savedMessage,ge=j.isError,fe=void 0!==ge&&ge,Ce=j.errorMessage,ye=void 0===Ce?"There was an error saving your changes.":Ce;j.isSaving;var be=j.isHighlighted,Se=void 0!==be&&be,we=j.onStreamingStateChange,xe=j.onViewComparison;j.isCopyEnabled;var ke=j.onComparisonLinkClick,Ie=j.onSubmitFeedback,Te=j.userDetails,_e=j.isGlobalEditActive,Ee=j.socketTimeOutInMilliSeconds,Me=j.initialDraftMessage,Re=void 0===Me?"":Me,De=j.onValidateSession,Ne=j.onCloseSessionModal,qe=B,Fe=c("".concat(qe,"-").concat(O,"-").concat(w())),Ae=c("".concat(w())),Le=H,We=c(null),Pe=c(!0),ze=c(null),je=c(null),Be=d(Re),Oe=Be[0],He=Be[1],Ue=d([]),Ge=Ue[0],Ze=Ue[1],Ke=d(!1),Ve=Ke[0],Qe=Ke[1],Je=d(!1);Je[0];var $e=Je[1],Xe=d(!0),Ye=Xe[0],en=Xe[1],nn=d(!0);nn[0];var tn=nn[1],on=d("");on[0];var rn=on[1],an=d(""),sn=an[0],ln=an[1],cn=d(!1),dn=cn[0],un=cn[1],vn=d(!1),mn=vn[0],hn=vn[1],pn=d(!0),gn=pn[0],fn=pn[1],Cn=d("100%");Cn[0];var yn=Cn[1],bn=d(null),Sn=bn[0],wn=bn[1],xn=d(!1);xn[0];var kn=xn[1],In=d(!1),Tn=In[0],_n=In[1],En=c(null),Mn=c(new Set),Rn=d(null),Dn=Rn[0],Nn=Rn[1],qn=d(!1),Fn=qn[0],An=qn[1],Ln=d(!1);Ln[0],Ln[1];var Wn=d(null);Wn[0],Wn[1],c(null),c(null);var Pn=c(new Map),zn=c(""),jn=c(new Set),Bn=c(new Map),On=c(!1),Hn=c(0),Un=c(new Map),Gn=c(null),Zn=d(!1),Kn=Zn[0],Vn=Zn[1];p(z||(z=e(["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "],["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "])));var Qn=u(function(){return""===(null==Oe?void 0:Oe.trim())||dn},[Oe,dn]),Jn=u(function(){return $},[$]),$n=u(function(){var e;return Ge.length>0&&"user"===(null===(e=Ge[Ge.length-1])||void 0===e?void 0:e.role)},[Ge]),Xn=u(function(){return Qn||$||!!_e||$n},[Qn,$,_e,$n]);v(function(){Re&&!Oe&&(He(Re),hn(!0),setTimeout(function(){if(je.current){je.current.focus();var e=Re.length;je.current.setSelectionRange(e,e)}},400))},[Re]),v(function(){null==we||we(dn)},[dn,we]),v(function(){return function(){Un.current.forEach(function(e){return clearTimeout(e)}),Un.current.clear()}},[]),v(function(){var e=We.current,n=function(){if(e){var n=e.scrollTop,t=e.scrollHeight,o=e.clientHeight;fn(t-n-o<=20)}};return e&&(e.addEventListener("scroll",n),n()),function(){e&&e.removeEventListener("scroll",n)}},[Ge]);var Yn=F({handlers:ee,setResult:ne}).processHeaderMessage;v(function(){he&&_n(!0)},[he]),v(function(){if(Fn){var e=setTimeout(function(){An(!1)},3e3);return function(){return clearTimeout(e)}}},[Fn]),v(function(){Z&&!_e&&(lt(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),K(!1))},[Z]),v(function(){if(Q)try{if(Q.startsWith("__SKELETON__:")){var e=Q.split(":"),o=e[1],i=e.slice(2).join(":"),r={role:"user",content:"",id:o,time:new Date,isSkeleton:!0,skeletonContent:i};return Ze(function(e){return n(n([],e,!0),[r],!1)}),lt(new KeyboardEvent("keydown",{key:"Enter"}),!1,i,!1,o),Nn(o),J&&J(""),void setTimeout(function(){Nn(null)},2e3)}if(Q.startsWith("__SKELETON_END__::")){var a=Q.split("::")[1]||"";return Ze(function(e){return e.map(function(e){return e.isSkeleton?t(t({},e),{isSkeleton:!1,content:e.skeletonContent||a}):e})}),void(J&&J(""))}var s=w();lt(new KeyboardEvent("keydown",{key:"Enter"}),!1,Q,!1,s),Nn(s),J&&J(""),setTimeout(function(){return Nn(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[Q]),v(function(){nt(),tt();var e=function(){var e,n=(null===(e=null==En?void 0:En.current)||void 0===e?void 0:e.clientHeight)||0,t="calc(100% - ".concat(n,"px - 10px)");yn(t)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var et=m(function(e){var n="string"==typeof e?e:"smooth";ze.current&&ze.current.scrollIntoView({behavior:n,block:"end"}),Pe.current&&setTimeout(function(){ze.current&&Pe.current&&ze.current.scrollIntoView({behavior:n,block:"end"})},100)},[]);v(function(){if(!dn){var e="";if(Tn?e=pe||"Thank you teacher for teaching me, your rule has been saved successfully.":fe&&(e=ye||"I'm sorry, I couldn't save your changes. Please try again."),e){var t={role:"assistant",content:e,id:w(),citations:[],time:new Date};Ze(function(e){return n(n([],e,!0),[t],!1)}),_n(!1),setTimeout(function(){return et("smooth")},100)}}},[Tn,fe,dn,pe,ye,et]),v(function(){Pe.current&&et("smooth")},[et]);var nt=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(Le,"/api/chatbot/getChatSettings?name=").concat(qe,"&organizationName=").concat(O),headers:{}};S.request(e).then(function(e){var n,t,o;(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)&&""!==(null===(o=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)||void 0===o?void 0:o.chatInitialMessage)&&tn(!0)}).catch(function(e){console.error(e)})},tt=function(){return o(void 0,void 0,void 0,function(){var e,n;return i(this,function(t){e="".concat(Le,"/api/chat/history?name=").concat(qe,"&organizationName=").concat(O);try{n={method:"GET",params:{guestSessionId:Fe.current},withCredentials:!0},S.get(e,n).then(function(e){var n=e.data;n.length>0?(Ze(n),et()):tn(!0)}).catch(function(e){console.error(e)})}catch(e){Qe(!1),console.error(e)}return[2]})})},ot=function(){var e="".concat(Le,"/api/chat/resetHistory?name=").concat(qe,"&organizationName=").concat(O);try{var n={method:"GET",params:{guestSessionId:Fe.current},withCredentials:!0};S.get(e,n).then(function(){G(!0),rn(""),wn(null),Mn.current.clear(),Bn.current.clear(),Ae.current="".concat(w()),Ze([]),tn(!0),Gn.current=null,null==te||te(),V&&V()}).catch(function(e){console.error(e)}).finally(function(){Fe.current="".concat(qe,"-").concat(O,"-").concat(w())})}catch(e){Qe(!1),console.error(e)}};function it(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var rt=function(e,o,i,r,a,s,l){var c,d,u,v,m,h,p,g,f,C,y,b,S,x,k,I,T,_,E,M,R,D,N,q,F,A,L,W,P,z;if(null===(d=null===(c=null==e?void 0:e.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===d?void 0:d.header_message){var j={header_message:e.chatStream.continueChatResult.header_message,responsedata:null===(m=null===(v=null===(u=null==e?void 0:e.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===v?void 0:v.message)||void 0===m?void 0:m.content};Yn(j)}var B=null===(h=null==e?void 0:e.chatStream)||void 0===h?void 0:h.continueChatResult,O=null==B?void 0:B.isEnd,H=(null===(p=null==B?void 0:B.message)||void 0===p?void 0:p.citations)||[];O&&H.length>0&&ce&&ce(H);var U={role:"assistant",content:"",id:w()};if(null===(y=null===(C=null===(f=null===(g=null==e?void 0:e.chatStream)||void 0===g?void 0:g.continueChatResult)||void 0===f?void 0:f.message)||void 0===C?void 0:C.content)||void 0===y?void 0:y.includes("WaitMessage: "))$e(!0),U.content=function(e){var n="WaitMessage: ",t=e.indexOf(n);if(-1!==t){var o=e.substring(t+13);return null==o?void 0:o.replaceAll("WaitMessage: ","")}return""}((null===(x=null===(S=null===(b=null==e?void 0:e.chatStream)||void 0===b?void 0:b.continueChatResult)||void 0===S?void 0:S.message)||void 0===x?void 0:x.content)+"\n\n"),""!==U.content&&(Qe(!1),Ze(n(n([],Ge,!0),[{role:"user",content:a,time:r,isFirstQuestionSent:s||!1,id:l||(null===(I=null===(k=null==e?void 0:e.chatStream)||void 0===k?void 0:k.continueChatResult)||void 0===I?void 0:I.requestId)||"",reply:""},U],!1)));else{$e(!1);var G=null===(_=null===(T=null==e?void 0:e.chatStream)||void 0===T?void 0:T.continueChatResult)||void 0===_?void 0:_.requestId;"string"==typeof G&&G&&ve&&ve(G);var Z=function(e,o,i,r){var a,s,l,c,d,u,v,m={role:"assistant",content:"",id:w(),time:new Date,citations:[]},h=(null===(a=null==e?void 0:e.chatStream)||void 0===a?void 0:a.continueChatResult)||{},p=null==h?void 0:h.requestId,g=null==h?void 0:h.preserve_message,f=null==h?void 0:h.isEnd,C=(null===(s=null==h?void 0:h.message)||void 0===s?void 0:s.content)||"",y=null==h?void 0:h.is_orchestrator,b=null==h?void 0:h.thinking_break,S=(null===(l=null==h?void 0:h.message)||void 0===l?void 0:l.citations)||[];if(p&&g&&C&&!f){var x=r.current.get(p)||[];x[x.length-1]!==C&&(x.push(C),r.current.set(p,x))}var k=(p&&r.current.get(p)||[]).join("\n\n"),I="";if(f)I=k&&""!==k.trim()?k:C;else if(g)I=k;else{var T=C.replace(/<!--(?![\s\S]*-->)[\s\S]*$/,"").trimEnd(),_=!1===y||b||0!==S.length?"":T;I=k?"".concat(k,"\n\n").concat(_):_}if(m.content=it(I),!0===(null==h?void 0:h.thinking_break)&&!0===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)&&o.push({responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1}),!1===(null==h?void 0:h.thinking_break)&&!1===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)){if(h.explainability_id&&h.responded_by){var E=h.explainability_id,M=h.responded_by;i.has(E)||i.set(E,{responded_by:M,index:o.length})}i.has(h.explainability_id)?o[null==(R=i.get(h.explainability_id))?void 0:R.index]={responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!0,explainability_id:null!==(c=h.explainability_id)&&void 0!==c?c:"",isParallelToolResponse:!0}:o=n(n([],o,!0),[{responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!0,explainability_id:null!==(d=h.explainability_id)&&void 0!==d?d:"",isParallelToolResponse:!1}],!1)}if(!0===(null==h?void 0:h.thinking_break)&&!1===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)){var R;h.explainability_id&&h.responded_by&&(E=h.explainability_id,M=h.responded_by,i.has(E)||i.set(E,{responded_by:M,index:o.length})),i.has(h.explainability_id)?o[null==(R=i.get(h.explainability_id))?void 0:R.index]={responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1,explainability_id:null!==(u=h.explainability_id)&&void 0!==u?u:"",isParallelToolResponse:!0}:o.push({responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1,explainability_id:null!==(v=h.explainability_id)&&void 0!==v?v:"",isParallelToolResponse:!1})}return t({orchestratorAndAgentsMessages:o},m)}(e,i,o,Bn);Z.time=new Date,Z.citations=H,Z.isEnd=null===(M=null===(E=null==e?void 0:e.chatStream)||void 0===E?void 0:E.continueChatResult)||void 0===M?void 0:M.isEnd,Z.requestId=null===(D=null===(R=null==e?void 0:e.chatStream)||void 0===R?void 0:R.continueChatResult)||void 0===D?void 0:D.requestId,Z.sessionId=Fe.current,null===(N=Z.orchestratorAndAgentsMessages)||void 0===N||N.forEach(function(e){e&&e.header_message&&Yn(e)}),(""!==(null==Z?void 0:Z.content)||(null==Z?void 0:Z.orchestratorAndAgentsMessages)&&(null==Z?void 0:Z.orchestratorAndAgentsMessages.length)>0)&&(Qe(!1),Ze(n(n([],Ge,!0),[{role:"user",content:a||"",time:r,isFirstQuestionSent:s||!1,id:l||(null===(F=null===(q=null==e?void 0:e.chatStream)||void 0===q?void 0:q.continueChatResult)||void 0===F?void 0:F.requestId)||"",requestId:null!==(W=null===(L=null===(A=null==e?void 0:e.chatStream)||void 0===A?void 0:A.continueChatResult)||void 0===L?void 0:L.requestId)&&void 0!==W?W:""},Z],!1))),en(null===(z=null===(P=null==e?void 0:e.chatStream)||void 0===P?void 0:P.continueChatResult)||void 0===z?void 0:z.isEnd)}},at=m(function(e,t){void 0===t&&(t="inactivity"),console.error("🛑 Stream failed or timed out due to:reason=".concat(t," requestId=").concat(e," at ").concat((new Date).toISOString()));var o=Un.current.get(e);o&&(clearTimeout(o),Un.current.delete(e)),e&&U&&(x(e,U,!1),Bn.current.delete(e)),e===zn.current?(On.current=!1,en(!0),un(!1),kn(!1),Qe(!1),$e(!1),Ze(function(e){var o=n([],e,!0).reverse().find(function(e){return"user"===e.role}),i=((null==o?void 0:o.content)||"").replace(/"/g,"&quot;"),r=n([],e,!0),a=r[r.length-1];a&&"assistant"===a.role&&!a.isEnd&&r.pop();var s="I ran into an unexpected issue while trying to process this learning.";return"inactivity"===t?s="Something went wrong—teaching is taking longer than expected.":"websocket_error"===t&&(s="I lost connection to the server while working on that."),n(n([],r,!0),[{role:"assistant",content:"".concat(s,' Please try again.\n\n<button class="clickable-button" data-value="').concat(i,'">Retry</button>'),id:w(),time:new Date,isEnd:!0,citations:[]}],!1)})):console.warn("🛑 [handleStreamTimeout] Ignoring stale timeout for superseded requestId=".concat(e,"; active=").concat(zn.current))},[Ee,U]),st=m(function(e){var n=Un.current.get(e);if(n&&clearTimeout(n),Ee&&Ee>0){console.log("⏱️ [Timeout armed] requestId=".concat(e," timeout=").concat(Ee,"ms at ").concat((new Date).toISOString()));var t=setTimeout(function(){console.warn("⏱️ [Timeout FIRED — auto stop] requestId=".concat(e," at ").concat((new Date).toISOString())),at(e,"inactivity")},Ee);Un.current.set(e,t)}},[at,Ee]),lt=function(e,r,a,s,l,c){return o(void 0,void 0,void 0,function(){var o,s,d,u,v,m,h,p,g,f,C,y,b,S,x,I;return i(this,function(i){switch(i.label){case 0:if(o=(void 0!==a?a:Oe||"").trim(),(s="Enter"===(null==e?void 0:e.key)&&!(null==e?void 0:e.shiftKey)&&!_e)&&(null===(C=null==e?void 0:e.preventDefault)||void 0===C||C.call(e)),d="user"===(null===(y=Ge[Ge.length-1])||void 0===y?void 0:y.role),!o||dn||On.current||d||(null==e?void 0:e.key)&&!s)return[2];if(Gn.current||(Gn.current=(new Date).toISOString(),console.log("Session start time set to ".concat(Gn.current))),!De)return[3,5];Qe(!0),ln("Validating session..."),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,De(Gn.current)];case 2:return i.sent()?[3,4]:(Vn(!0),Qe(!1),c&&c(!1),[2]);case 3:return u=i.sent(),console.error("Validation error:",u),Vn(!0),Qe(!1),c&&c(!1),[2];case 4:Qe(!1),i.label=5;case 5:return On.current=!0,"I want to add a rule description"===o?(en(!1),Pe.current=!0,un(!0),!Sn&&o&&wn(a||"manual_entry"),v=new Date,Ze(function(e){return n(n([],e.map(function(e,n){var o;return t(t({},e),{content:null===(o=it(e.content))||void 0===o?void 0:o.replace("WaitMessage: ","")})}),!0),[{role:"user",content:o,time:v,isFirstQuestionSent:!1,id:l||w()}],!1)}),et("smooth"),setTimeout(function(){Ze(function(e){return n(n([],e,!0),[{role:"assistant",content:"I'd be happy to help you set up a new rule! To get started, could you tell me what kind of behavior or logic you would like this rule to follow?",id:w(),citations:[],time:new Date}],!1)}),et("smooth"),setTimeout(function(){un(!1),en(!0)},500)},500),[2]):(en(!1),Pe.current=!0,un(!0),!Sn&&o&&wn(a||"manual_entry"),m=new Date,Ze(function(e){var i=e.map(function(e){var n;return t(t({},e),{content:null===(n=it(e.content))||void 0===n?void 0:n.replace("WaitMessage: ","")})});return l&&i.some(function(e){return e.id===l})?i.map(function(e){return e.id===l?t(t({},e),{content:o}):e}):n(n([],i,!0),[{role:"user",content:o,time:m,isFirstQuestionSent:!1,id:l||w()}],!1)}),et("smooth"),h=new Map,p=[],g=function(e){var n;if(!e)return{};var t=Object.keys(e);return 1===t.length&&"current"===t[0]?null!==(n=e.current)&&void 0!==n?n:{}:e},f={WEBSOCKET_URL:U,organizationName:O,chatAssistantName:qe,selectedAIModel:"gpt-4",replyMessage:"",userName:null!==(b=null==Te?void 0:Te.name)&&void 0!==b?b:"Guest User",userEmailId:null!==(S=null==Te?void 0:Te.email)&&void 0!==S?S:"guestUser@example.com",userId:null!==(x=null==Te?void 0:Te.id)&&void 0!==x?x:"Guest User",query:o,requestId:"requestId-".concat(w()),customPrompt:"",enableForBackend:!1,guestSessionId:Fe.current,chatPreviewId:Ae.current,customMetaData:g(Y),aiModel:"",enableLogs:!0,onStreamEvent:function(e){var n,t,i,a,s,c,d=null===(t=null===(n=null==e?void 0:e.chatStream)||void 0===n?void 0:n.continueChatResult)||void 0===t?void 0:t.requestId,u=null===(a=null===(i=null==e?void 0:e.chatStream)||void 0===i?void 0:i.continueChatResult)||void 0===a?void 0:a.header_message;console.log("📦 [Stream Chunk Received] With RequestID and header_message: ".concat(d,",").concat(u)),st(f.requestId);var v=null===(c=null===(s=null==e?void 0:e.chatStream)||void 0===s?void 0:s.continueChatResult)||void 0===c?void 0:c.error_state;if(Array.isArray(v)&&v.length>0)return console.error("⚠️ Agent returned an error_state during stream:",{requestId:d,errorState:v}),void at(f.requestId,"agent_error");rt(e,h,p,m,o,r,l)},onStreamEnd:function(e){var o,i,r=null===(i=null===(o=null==e?void 0:e.chatStream)||void 0===o?void 0:o.continueChatResult)||void 0===i?void 0:i.requestId;jn.current.add(f.requestId),console.log("✅ [Stream Completed] RequestID: ".concat(r));var a=Un.current.get(f.requestId);a&&(clearTimeout(a),Un.current.delete(f.requestId)),On.current=!1,en(!0),un(!1),kn(!1);var s=Date.now(),l=Pn.current.get(f.requestId);if(l){var c=Math.round((s-l)/1e3).toFixed(1);Ze(function(e){var o=n([],e,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===o)return e;var i=e.length-1-o;return e.map(function(e,n){return n===i?t(t({},e),{finalTimeTaken:c}):e})})}},onError:function(e){var n=Un.current.get(f.requestId);if(n&&(clearTimeout(n),Un.current.delete(f.requestId)),jn.current.has(f.requestId))return console.warn("Ignoring post-completion error for already-finished request:",f.requestId),void jn.current.delete(f.requestId);console.error("Stream error:",e),at(f.requestId,"websocket_error")}},o&&(Qe(!0),null===(I=je.current)||void 0===I||I.blur(),He(""),et(),ln(l?"Just a moment, processing your request...":"Okay, got it. Let me take a moment to work on this and I'll get back to you shortly."),Pn.current.set(f.requestId,Date.now()),zn.current=f.requestId,console.log("Chat Stream Params:",f),st(f.requestId),Hn.current+=1,console.log("🚀 [UI Action] stream started (Total UI invocations: ".concat(Hn.current,") | RequestID: ").concat(f.requestId,' | Query: "').concat(o,'"')),k(f)),c&&c(!1),[2])}})})},ct=c(null);h(function(){ct.current=lt});var dt=m(function(){for(var e,t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return null===(e=ct.current)||void 0===e?void 0:e.call.apply(e,n([ct],t,!1))},[]),ut=u(function(){return{p:function(e){e.node;var n=e.children;return r(e,["node","children"]),a("div",t({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:n}))},button:function(e){e.node;var n=e.className,o=e.children,i=r(e,["node","className","children"]),l=A(o),c=i["data-value"],d="Tester Genie"===l;return a(M,t({},i,{className:n,handleStream:dt,isStreamEnd:Ye,disabled:!!Sn||!!_e,isLastMessage:!0,style:{margin:0},isTesterGenie:d,"data-selected":Sn===l||Sn===c?"true":Sn?"false":void 0},{children:s("span",t({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[o,d&&s("svg",t({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[a("path",{d:"M7.20368 8.94768e-06C7.48895 -0.00208639 7.69331 0.364327 7.83856 0.57465C8.14381 1.01633 8.38012 1.87909 7.71077 2.14118C8.57167 2.21011 9.70406 2.93098 10.1785 3.64699C10.5932 4.27286 10.4559 5.16037 9.80301 5.56007L9.9502 7.16593C9.97671 7.44871 10.0265 7.87092 10.0299 8.14457C10.4213 8.23046 11.0787 8.55391 11.326 8.87592C11.5979 8.75656 11.9189 8.76963 12.1688 8.93469C12.3563 8.67751 12.5598 8.41456 12.7507 8.15787C12.3283 7.45155 12.5047 6.57745 13.2143 6.13784C13.5375 5.9377 13.9264 5.87277 14.2971 5.95705C14.0961 6.30964 13.8775 6.72182 13.6593 7.05857C13.7906 7.2436 13.9184 7.44225 14.044 7.63194L14.8022 7.63198C15.0349 7.30106 15.2515 6.90827 15.4835 6.59349C15.8623 7.0712 15.8156 7.79671 15.4734 8.28241C15.1318 8.76741 14.4886 8.9899 13.9118 8.88251C13.758 9.12108 13.5577 9.39243 13.3941 9.63201C13.7143 9.9316 13.7725 10.364 13.4067 10.6594C13.5231 10.8889 13.5309 11.1613 13.447 11.402C13.1502 12.2523 12.1724 12.5645 11.3474 12.5025C11.1171 12.4852 10.939 12.4698 10.7197 12.3953C10.8724 13.1271 10.7744 14.2031 10.5132 14.9051C10.1688 15.8304 9.43632 16.5569 8.54503 16.9655C7.90465 17.2706 7.21222 17.3607 6.50472 17.4505C5.74445 17.5471 4.75801 17.4362 4.08533 17.825C3.9327 17.9132 3.86566 18.0173 3.82943 18.1792C3.94996 18.5982 4.47858 18.6063 4.78474 18.8897C5.20191 19.2758 4.90716 19.9663 4.36611 19.9908C4.31476 19.9931 4.26867 19.9867 4.23186 19.9493C4.23089 19.8303 4.47587 19.7199 4.49787 19.5262C4.55075 19.0604 3.70014 19.0078 3.37835 18.8374C3.13013 18.706 2.99537 18.6309 2.82242 18.4021C2.63795 18.1579 2.58428 17.835 2.63138 17.5392C2.74868 16.7847 3.47123 16.393 4.12184 16.1497C4.61314 15.9659 5.46304 15.7158 5.52019 15.0793C5.58589 14.348 4.97543 13.5523 4.57739 12.9807C4.44275 12.7875 4.3039 12.579 4.16309 12.3919C4.18987 12.365 4.21049 12.3463 4.23916 12.3212C4.59619 12.6218 5.21209 12.6421 5.55038 12.2979C5.70457 12.144 5.78974 11.9342 5.78642 11.7164C5.78121 11.4493 5.63382 11.2002 5.4454 11.019C5.44704 10.9932 5.44824 10.9676 5.449 10.9419C5.4566 10.6648 5.37505 10.4902 5.1892 10.2943C5.18398 10.2538 5.17776 10.2134 5.17053 10.1732C5.08123 9.69297 4.71708 9.34182 4.23415 9.27108C4.16418 9.26083 3.96108 9.26105 3.92071 9.23344C3.90485 9.1828 3.9059 9.20792 3.91904 9.15527C4.22103 8.90139 4.14407 8.78214 4.31107 8.4846C4.42301 8.28513 4.73047 8.15239 4.95452 8.10701C4.96167 7.51076 5.03684 6.88562 5.10036 6.29144C5.12451 6.0655 5.12531 5.75046 5.1511 5.55257C4.11108 4.86747 4.39091 3.75946 5.25465 3.06391C5.84978 2.58469 6.34496 2.31002 7.10143 2.14517C7.01589 2.10416 6.93842 2.04811 6.87269 1.97972C6.77021 1.87349 6.70248 1.73857 6.67853 1.59293C6.60568 1.12096 7.04104 0.914625 7.18759 0.526392C7.26428 0.323403 7.03925 0.146075 7.20368 8.94768e-06Z",fill:"#475569"}),a("path",{d:"M7.459 4.5C7.48797 4.50312 7.71949 4.61154 7.76205 4.63061C8.27062 4.85835 8.87051 5.09164 9.35658 5.3582C9.36602 6.03495 9.37016 6.56625 8.70573 6.91519C8.6633 6.80883 8.63019 6.72409 8.56332 6.63044C8.43786 6.45568 8.24656 6.33963 8.03354 6.30909C7.8434 6.28211 7.65146 6.3197 7.49586 6.43503C7.21897 6.21256 6.76265 6.28197 6.5229 6.52486C6.39308 6.65639 6.34815 6.75074 6.28902 6.92344C5.59702 6.5957 5.58761 6.04267 5.60583 5.35582C5.89882 5.23844 6.21318 5.0724 6.50153 4.941C6.82145 4.79522 7.14482 4.6574 7.459 4.5Z",fill:"#D1EDFD"}),a("path",{d:"M11.0756 10.6406C11.1037 10.6701 11.1324 10.7706 11.1535 10.8145C11.2818 11.0817 11.4922 11.1945 11.7498 11.2977C11.5607 11.63 11.4567 11.8797 11.1034 12.0466L11.0839 12.0517C10.9262 12.0927 10.7996 12.0968 10.651 12.0135C10.4755 11.915 10.3807 11.6614 10.4792 11.478C10.6388 11.1809 10.8877 10.9272 11.0756 10.6406Z",fill:"#D1EDFD"}),a("path",{d:"M11.6036 9.1377C11.6993 9.11763 11.8391 9.16378 11.9294 9.19593C11.6952 9.50644 11.4706 9.81614 11.2327 10.1261L11.1572 10.2255C10.7581 9.73539 11.0333 9.24481 11.6036 9.1377Z",fill:"#D1EDFD"}),a("path",{d:"M7.49681 0.882812C7.53691 0.925159 7.61244 1.08523 7.63598 1.14156C7.74243 1.39673 7.75769 1.76908 7.38596 1.77504C7.28236 1.75599 7.15628 1.68938 7.13517 1.5783C7.0843 1.3107 7.35609 1.09964 7.48737 0.897583L7.49681 0.882812Z",fill:"#D1EDFD"}),a("path",{d:"M1.68305 6.17249C1.71659 6.1673 1.8134 6.16478 1.84892 6.16432C2.34052 6.15616 2.81496 6.34495 3.16655 6.68866C3.50847 7.01806 3.70349 7.47119 3.70765 7.94596C3.70896 8.42345 3.54045 8.85284 3.20281 9.19025C3.34033 9.28068 3.5321 9.52219 3.6543 9.65748C4.17158 9.39073 4.91447 9.69339 4.79675 10.3444C5.08751 10.5485 5.19656 10.8288 5.0585 11.1674C5.15418 11.2375 5.25595 11.3205 5.32383 11.4186C5.40228 11.5303 5.4309 11.6695 5.40291 11.8031C5.32228 12.1857 4.90085 12.3286 4.57669 12.1236C4.51367 12.0838 4.42258 11.9595 4.35299 11.9431C4.30669 11.9557 4.28453 11.9584 4.23644 11.9644C4.22885 11.9742 4.22118 11.9841 4.21343 11.9938C3.93597 12.3413 3.49234 12.4682 3.06933 12.5157C2.85285 12.518 2.70432 12.5146 2.49066 12.4609C1.80785 12.2892 1.50808 11.6167 1.70723 10.9639C1.829 10.5648 2.11891 10.2506 2.48939 10.0518C2.54655 10.132 2.57559 10.2191 2.64066 10.303C2.73571 10.2223 2.82048 10.1482 2.92363 10.0773C2.81023 9.95313 2.66811 9.7693 2.55817 9.63584C2.38871 9.6878 2.23026 9.72879 2.05298 9.74653C1.54239 9.80228 1.03118 9.64711 0.637735 9.31695C0.269964 9.01018 0.0453493 8.54827 0.00544736 8.07322C-0.0309495 7.60988 0.116099 7.15077 0.414918 6.79478C0.742554 6.41198 1.18728 6.21393 1.68305 6.17249Z",fill:"#475569"}),a("path",{d:"M1.79616 6.5951C2.54894 6.5619 3.18687 7.14364 3.22301 7.8963C3.25915 8.64894 2.67989 9.28913 1.92739 9.3282C1.17073 9.3675 0.526231 8.78435 0.489885 8.02753C0.45354 7.27071 1.03921 6.62849 1.79616 6.5951Z",fill:"#D1EDFD"}),a("path",{d:"M4.93607 11.4844C5.12839 11.6261 5.22049 11.9085 4.91876 11.9419C4.8067 11.8805 4.78491 11.8646 4.71094 11.7561C4.81572 11.6752 4.862 11.5925 4.93607 11.4844Z",fill:"#FEFEFD"}),a("path",{d:"M12.5164 3.58594L12.5715 3.59466C12.6589 3.65863 12.6908 3.94434 12.7882 4.05193C12.8789 4.15216 12.9155 4.17816 13.0326 4.24929C13.1363 4.31224 13.3325 4.34025 13.384 4.43124C13.3643 4.56218 13.0693 4.54857 12.9127 4.69344C12.6903 4.89898 12.7114 5.06971 12.5892 5.28622C12.5669 5.28439 12.5368 5.2868 12.5261 5.27346C12.4336 5.15843 12.4072 4.9308 12.3099 4.81465C12.1627 4.63903 11.9972 4.60054 11.7981 4.51372C11.7544 4.49467 11.7266 4.47099 11.7129 4.42649C11.7867 4.31876 12.0509 4.34309 12.2376 4.14892C12.43 3.94901 12.4155 3.72208 12.5164 3.58594Z",fill:"#475569"}),a("path",{d:"M2.13644 3.72656C2.24401 3.77084 2.29712 4.1268 2.431 4.25226C2.60327 4.41371 2.7311 4.41949 2.93246 4.52449C2.96024 4.53897 2.97173 4.56042 2.97671 4.58878C2.89584 4.6981 2.61854 4.70721 2.4596 4.85659C2.26275 5.04156 2.27341 5.29132 2.17022 5.42088C2.16192 5.41849 2.11671 5.40232 2.1156 5.40043C2.01291 5.21216 1.9836 5.04909 1.84812 4.87273C1.73599 4.72675 1.36534 4.69959 1.32812 4.56939C1.3835 4.47941 1.67823 4.44211 1.82291 4.30563C2.02737 4.11274 2.0042 3.8372 2.13644 3.72656Z",fill:"#475569"})]}))]}))}))}}},[dt,Ye,Sn,_e]),vt=u(function(){return Ge.some(function(e){return e.isSkeleton})},[Ge]),mt=function(e){return o(void 0,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return Ie?[4,Ie(e)]:[3,2];case 1:t.sent(),Ze(function(e){return n(n([],e,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:w(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return et("smooth")},100),t.label=2;case 2:return[2]}})})};return s("div",t({className:"".concat(N.customFont," ").concat(D.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:Se&&!vt?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[s("div",t({ref:We,className:D.scrollWrapper},{children:[a("div",t({ref:En,className:D.stickyHeader},{children:a(T,{resetChatHistory:ot,isStreamEnd:Ye,chatTitle:X,onResize:se,chatSize:ae,movingTowards:le})})),s("div",t({className:D.messagesList},{children:[s("div",t({className:D.initialMessageRow},{children:[a("div",t({className:D.iconWrapper},{children:a(W,{})})),a("div",t({className:D.welcomeTextWrapper},{children:a("div",t({className:D.welcomeMarkdownWrapper},{children:a("span",{children:a(y,t({rehypePlugins:[b],components:ut},{children:ie}))})}))}))]})),Ge.length>0&&Ge.map(function(e,n){var o,i;return s("div",t({className:D.messageRow},{children:["assistant"===e.role?a("div",t({className:D.assistantIconContainer},{children:a(W,{})})):a("div",{className:D.userSpacer}),a("div",t({className:D.messageContent},{children:"assistant"===e.role?s(l,{children:[e.orchestratorAndAgentsMessages&&e.orchestratorAndAgentsMessages.length>0&&a(I,{orchestratorAndAgentsMessages:null==e?void 0:e.orchestratorAndAgentsMessages,isStreamEnd:Ye,finalTimeTaken:null==e?void 0:e.finalTimeTaken},null!==(o=null==e?void 0:e.finalTimeTaken)&&void 0!==o?o:null==e?void 0:e.id),a(_,{index:n,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:Ge,handleStream:lt,isLastMessage:n===Ge.length-1,onSave:re,citations:null==e?void 0:e.citations,setChatSize:se,chatSize:ae,isStreamEnd:Ye,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:xe,onTypeResponseClick:function(){var e;An(!0),null===(e=je.current)||void 0===e||e.focus()},onComparisonLinkClick:ke,baseURL:Le,onFeedbackSubmit:mt,isGlobalEditActive:_e}),e.hasOwnProperty("isEnd")&&!(null==e?void 0:e.isEnd)&&(null===(i=null==e?void 0:e.content)||void 0===i?void 0:i.length)>0&&s(l,{children:[a(E,{variant:"text",width:"50%",height:20}),a("div",{style:{marginTop:"10px"}}),a(E,{variant:"text",width:"100%",height:40})]}),a("div",t({className:D.timestamp},{children:e.time&&!isNaN(new Date(e.time).getTime())?new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}):s("div",t({className:D.userMessageWrapper},{children:[s("div",t({className:D.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:e.isSkeleton||vt||e.id!==Dn?"none":"0 0 15px 3px rgba(37, 99, 235, 0.6)"}},{children:[e.isSkeleton?s("div",t({style:{display:"flex",flexDirection:"column",gap:"12px",minWidth:"280px",padding:"8px 0"}},{children:[a(E,{variant:"text",width:"100%",height:16}),a(E,{variant:"text",width:"80%",height:16})]})):a(_,{index:n,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:Ge,handleStream:lt,isLastMessage:n===Ge.length-1,onSave:re,citations:null==e?void 0:e.citations,isStreamEnd:Ye,isGlobalEditActive:_e,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:xe,onComparisonLinkClick:ke,baseURL:Le,onFeedbackSubmit:mt}),a("div",t({style:{marginTop:"0.5rem"}},{children:a(P,{})}))]})),a("div",t({className:D.userTimestamp},{children:new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),e.id)}),Ve&&s("div",t({className:D.loadingRow},{children:[a("div",t({className:D.iconWrapper,style:{marginTop:"0.2rem"}},{children:a(W,{})})),a("div",t({className:D.loadingTextWrapper},{children:a("span",{children:sn})}))]})),a("div",{ref:ze,style:{float:"left",clear:"both"}})]}))]})),a("div",t({className:D.inputAreaWrapper},{children:a(C,t({title:$?"Please wait for the validation to be completed.":""},{children:s("div",t({className:"".concat(D.inputBoxContainer," ").concat(Jn?D.disabled:""),style:Fn?{boxShadow:"0 0 15px 3px rgba(37, 99, 235, 0.5)",borderColor:"#2563eb",transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}:{transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}},{children:[Ge.length>0&&!gn&&a("div",t({onMouseDown:function(e){e.preventDefault(),et("smooth")},className:D.scrollToBottomBtn},{children:a(q,{})})),s("div",t({style:{width:"100%",display:"flex"}},{children:[a("textarea",{ref:je,placeholder:ue,value:Oe||"",onChange:function(e){He(e.target.value)},onFocus:function(){return hn(!0)},onBlur:function(){return hn(!1)},onKeyDown:function(e){return lt(e)},disabled:Jn,className:"no-scrollbar ".concat(D.chatTextarea),style:{minHeight:mn||Oe&&Oe.length>40?"120px":"50px",height:mn||Oe&&Oe.length>40?"120px":"50px",maxHeight:"120px"}}),a("span",t({className:D.sendButtonWrapper},{children:a("button",t({onClick:function(e){Xn||lt(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:Xn,className:"".concat(D.sendButton," ").concat(Xn?D.disabled:D.active)},{children:a(L,{})}))}))]}))]}))}))})),s("div",t({className:D.footerTools},{children:[a(C,t({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:a("span",t({className:D.footerToolItem},{children:a(R,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),a(C,t({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:a("span",t({className:D.footerToolItem},{children:a(R,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]})),a(g,t({open:Kn,onClose:function(){},PaperProps:{sx:{borderRadius:"12px",padding:"8px",maxWidth:"400px"}}},{children:s(f,t({sx:{p:3,textAlign:"center",fontFamily:"'Plus Jakarta Sans', sans-serif"}},{children:[a("h3",t({style:{fontSize:"18px",fontWeight:600,color:"#0F172A",marginBottom:"10px"}},{children:"Session Expired"})),a("p",t({style:{fontSize:"14px",color:"#64748B",lineHeight:"1.5",marginBottom:"20px"}},{children:"Changes were made to the learnings in this scope while you were editing. To avoid conflicts, concurrent edits aren’t allowed."})),s(f,t({sx:{display:"flex",gap:2,justifyContent:"center"}},{children:[a("button",t({onClick:function(){Vn(!1),ot()},style:{flex:1,padding:"10px 16px",cursor:"pointer",backgroundColor:"white",border:"1px solid #E2E8F0",borderRadius:"8px",fontSize:"14px",fontWeight:500,color:"#475569",transition:"all 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#F8FAFC"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="white"}},{children:"Reset Session"})),a("button",t({onClick:function(){Vn(!1),null==Ne||Ne()},style:{flex:1,padding:"10px 16px",backgroundColor:"#EF4444",color:"white",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:500,cursor:"pointer",transition:"background-color 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#DC2626"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="#EF4444"}},{children:"Discard & Close"}))]}))]}))}))]}))};export{j as autoGeneratePrompt,B as default};
1
+ import{__makeTemplateObject as e,__spreadArray as n,__assign as t,__awaiter as o,__generator as i,__rest as r}from"tslib";import{jsx as a,jsxs as s,Fragment as l}from"react/jsx-runtime";import{useRef as c,useState as d,useMemo as u,useEffect as v,useCallback as m,useLayoutEffect as h}from"react";import{keyframes as p,Dialog as g,Box as f}from"@mui/material";import C from"@mui/material/Tooltip";import y from"react-markdown";import b from"rehype-raw";import S from"axios";import{v4 as w}from"uuid";import{stopStreaming as x,startChatStream as k}from"@e-llm-studio/streaming-response";import{WatchMeWork as I}from"@e-llm-studio/watch-me-work";import T from"./ChatHeader.js";import _ from"../MessageRendering/MessageRendering.js";import{Skeleton as E}from"../atoms/SkeletonLoader/SkeletonLoader.js";import{ActionableButton as M}from"../MessageRendering/ClickableChatComponents.js";import R from"../AudioWaveform.js";import D from"./ChatComponent.module.css.js";import N from"../../InstantLearning.module.css.js";import{ScrollToBottom as q}from"../_svg/ScrollToBottom.js";import{useHeaderObserver as F,extractTextFromChildren as A}from"../../helpers/utils.js";import{SendButton as L}from"../_svg/SendButton.js";import W from"../_svg/SparkleIcon.js";import{UserIcon as P}from"../_svg/UserIcon.js";var z,j=function(e,n){return S.post("".concat(e||"https://devllmstudio.creativeworkspace.ai","/api/chat/chatResponse"),{name:"ilggcautopromptgen",organizationName:"techolution",prompt:n||"Generate a query"},{headers:{"Content-Type":"application/json"},withCredentials:!0}).then(function(e){return e.data}).catch(function(e){throw console.error("Error calling auto-generate API:",e),e})},B=function(j){var B=j.chatAssistantName,O=j.organizationName,H=j.baseUrl,U=j.baseWebsocketUrl,G=j.setIsNewChatClicked;j.ThinkingBulbIconComponent;var Z=j.isFormSaveClicked,K=j.setIsFormSavedClicked,V=j.onResetLearningData,Q=j.sendMessageInChat,J=j.setSendMessageInChat,$=j.isFormValidating,X=j.chatTitle,Y=j.customMetaData,ee=j.headerMessageHandlers;j.aiResponse;var ne=j.setAIResponse,te=j.onResetChat,oe=j.initialChatMessage,ie=void 0===oe?"":oe,re=j.onSave,ae=j.chatSize,se=j.setChatSize,le=j.movingTowards,ce=j.setCitations,de=j.textareaPlaceholder,ue=void 0===de?"Tell me more about this learning...":de,ve=j.setCurrentRequestId,me=j.showSavedMessage,he=void 0!==me&&me,pe=j.savedMessage,ge=j.isError,fe=void 0!==ge&&ge,Ce=j.errorMessage,ye=void 0===Ce?"There was an error saving your changes.":Ce;j.isSaving;var be=j.isHighlighted,Se=void 0!==be&&be,we=j.onStreamingStateChange,xe=j.onViewComparison;j.isCopyEnabled;var ke=j.onComparisonLinkClick,Ie=j.onSubmitFeedback,Te=j.userDetails,_e=j.isGlobalEditActive,Ee=j.socketTimeOutInMilliSeconds,Me=j.initialDraftMessage,Re=void 0===Me?"":Me,De=j.onValidateSession,Ne=j.onCloseSessionModal,qe=B,Fe=c("".concat(qe,"-").concat(O,"-").concat(w())),Ae=c("".concat(w())),Le=H,We=c(null),Pe=c(!0),ze=c(null),je=c(null),Be=d(Re),Oe=Be[0],He=Be[1],Ue=d([]),Ge=Ue[0],Ze=Ue[1],Ke=d(!1),Ve=Ke[0],Qe=Ke[1],Je=d(!1);Je[0];var $e=Je[1],Xe=d(!0),Ye=Xe[0],en=Xe[1],nn=d(!0);nn[0];var tn=nn[1],on=d("");on[0];var rn=on[1],an=d(""),sn=an[0],ln=an[1],cn=d(!1),dn=cn[0],un=cn[1],vn=d(!1),mn=vn[0],hn=vn[1],pn=d(!0),gn=pn[0],fn=pn[1],Cn=d("100%");Cn[0];var yn=Cn[1],bn=d(null),Sn=bn[0],wn=bn[1],xn=d(!1);xn[0];var kn=xn[1],In=d(!1),Tn=In[0],_n=In[1],En=c(null),Mn=c(new Set),Rn=d(null),Dn=Rn[0],Nn=Rn[1],qn=d(!1),Fn=qn[0],An=qn[1],Ln=d(!1);Ln[0],Ln[1];var Wn=d(null);Wn[0],Wn[1],c(null),c(null);var Pn=c(new Map),zn=c(""),jn=c(new Set),Bn=c(new Map),On=c(!1),Hn=c(0),Un=c(new Map),Gn=c(null),Zn=d(!1),Kn=Zn[0],Vn=Zn[1];p(z||(z=e(["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "],["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "])));var Qn=u(function(){return""===(null==Oe?void 0:Oe.trim())||dn},[Oe,dn]),Jn=u(function(){return $},[$]),$n=u(function(){var e;return Ge.length>0&&"user"===(null===(e=Ge[Ge.length-1])||void 0===e?void 0:e.role)},[Ge]),Xn=u(function(){return Qn||$||!!_e||$n},[Qn,$,_e,$n]);v(function(){Re&&!Oe&&(He(Re),hn(!0),setTimeout(function(){if(je.current){je.current.focus();var e=Re.length;je.current.setSelectionRange(e,e)}},400))},[Re]),v(function(){null==we||we(dn)},[dn,we]),v(function(){return function(){Un.current.forEach(function(e){return clearTimeout(e)}),Un.current.clear()}},[]),v(function(){var e=We.current,n=function(){if(e){var n=e.scrollTop,t=e.scrollHeight,o=e.clientHeight;fn(t-n-o<=20)}};return e&&(e.addEventListener("scroll",n),n()),function(){e&&e.removeEventListener("scroll",n)}},[Ge]);var Yn=F({handlers:ee,setResult:ne}).processHeaderMessage;v(function(){he&&_n(!0)},[he]),v(function(){if(Fn){var e=setTimeout(function(){An(!1)},3e3);return function(){return clearTimeout(e)}}},[Fn]),v(function(){Z&&!_e&&(lt(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),K(!1))},[Z]),v(function(){if(Q)try{if(Q.startsWith("__SKELETON__:")){var e=Q.split(":"),o=e[1],i=e.slice(2).join(":"),r={role:"user",content:"",id:o,time:new Date,isSkeleton:!0,skeletonContent:i};return Ze(function(e){return n(n([],e,!0),[r],!1)}),lt(new KeyboardEvent("keydown",{key:"Enter"}),!1,i,!1,o),Nn(o),J&&J(""),void setTimeout(function(){Nn(null)},2e3)}if(Q.startsWith("__SKELETON_END__::")){var a=Q.split("::")[1]||"";return Ze(function(e){return e.map(function(e){return e.isSkeleton?t(t({},e),{isSkeleton:!1,content:e.skeletonContent||a}):e})}),void(J&&J(""))}var s=w();lt(new KeyboardEvent("keydown",{key:"Enter"}),!1,Q,!1,s),Nn(s),J&&J(""),setTimeout(function(){return Nn(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[Q]),v(function(){nt(),tt();var e=function(){var e,n=(null===(e=null==En?void 0:En.current)||void 0===e?void 0:e.clientHeight)||0,t="calc(100% - ".concat(n,"px - 10px)");yn(t)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var et=m(function(e){var n="string"==typeof e?e:"smooth";ze.current&&ze.current.scrollIntoView({behavior:n,block:"end"}),Pe.current&&setTimeout(function(){ze.current&&Pe.current&&ze.current.scrollIntoView({behavior:n,block:"end"})},100)},[]);v(function(){if(!dn){var e="";if(Tn?e=pe||"Thank you teacher for teaching me, your rule has been saved successfully.":fe&&(e=ye||"I'm sorry, I couldn't save your changes. Please try again."),e){var t={role:"assistant",content:e,id:w(),citations:[],time:new Date};Ze(function(e){return n(n([],e,!0),[t],!1)}),_n(!1),setTimeout(function(){return et("smooth")},100)}}},[Tn,fe,dn,pe,ye,et]),v(function(){Pe.current&&et("smooth")},[et]);var nt=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(Le,"/api/chatbot/getChatSettings?name=").concat(qe,"&organizationName=").concat(O),headers:{}};S.request(e).then(function(e){var n,t,o;(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)&&""!==(null===(o=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)||void 0===o?void 0:o.chatInitialMessage)&&tn(!0)}).catch(function(e){console.error(e)})},tt=function(){return o(void 0,void 0,void 0,function(){var e,n;return i(this,function(t){e="".concat(Le,"/api/chat/history?name=").concat(qe,"&organizationName=").concat(O);try{n={method:"GET",params:{guestSessionId:Fe.current},withCredentials:!0},S.get(e,n).then(function(e){var n=e.data;n.length>0?(Ze(n),et()):tn(!0)}).catch(function(e){console.error(e)})}catch(e){Qe(!1),console.error(e)}return[2]})})},ot=function(){var e="".concat(Le,"/api/chat/resetHistory?name=").concat(qe,"&organizationName=").concat(O);try{var n={method:"GET",params:{guestSessionId:Fe.current},withCredentials:!0};S.get(e,n).then(function(){G(!0),rn(""),wn(null),Mn.current.clear(),Bn.current.clear(),Ae.current="".concat(w()),Ze([]),tn(!0),Gn.current=null,null==te||te(),V&&V()}).catch(function(e){console.error(e)}).finally(function(){Fe.current="".concat(qe,"-").concat(O,"-").concat(w())})}catch(e){Qe(!1),console.error(e)}};function it(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var rt=function(e,o,i,r,a,s,l){var c,d,u,v,m,h,p,g,f,C,y,b,S,x,k,I,T,_,E,M,R,D,N,q,F,A,L,W,P,z;if(null===(d=null===(c=null==e?void 0:e.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===d?void 0:d.header_message){var j={header_message:e.chatStream.continueChatResult.header_message,responsedata:null===(m=null===(v=null===(u=null==e?void 0:e.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===v?void 0:v.message)||void 0===m?void 0:m.content};Yn(j)}var B=null===(h=null==e?void 0:e.chatStream)||void 0===h?void 0:h.continueChatResult,O=null==B?void 0:B.isEnd,H=(null===(p=null==B?void 0:B.message)||void 0===p?void 0:p.citations)||[];O&&H.length>0&&ce&&ce(H);var U={role:"assistant",content:"",id:w()};if(null===(y=null===(C=null===(f=null===(g=null==e?void 0:e.chatStream)||void 0===g?void 0:g.continueChatResult)||void 0===f?void 0:f.message)||void 0===C?void 0:C.content)||void 0===y?void 0:y.includes("WaitMessage: "))$e(!0),U.content=function(e){var n="WaitMessage: ",t=e.indexOf(n);if(-1!==t){var o=e.substring(t+13);return null==o?void 0:o.replaceAll("WaitMessage: ","")}return""}((null===(x=null===(S=null===(b=null==e?void 0:e.chatStream)||void 0===b?void 0:b.continueChatResult)||void 0===S?void 0:S.message)||void 0===x?void 0:x.content)+"\n\n"),""!==U.content&&(Qe(!1),Ze(n(n([],Ge,!0),[{role:"user",content:a,time:r,isFirstQuestionSent:s||!1,id:l||(null===(I=null===(k=null==e?void 0:e.chatStream)||void 0===k?void 0:k.continueChatResult)||void 0===I?void 0:I.requestId)||"",reply:""},U],!1)));else{$e(!1);var G=null===(_=null===(T=null==e?void 0:e.chatStream)||void 0===T?void 0:T.continueChatResult)||void 0===_?void 0:_.requestId;"string"==typeof G&&G&&ve&&ve(G);var Z=function(e,o,i,r){var a,s,l,c,d,u,v,m={role:"assistant",content:"",id:w(),time:new Date,citations:[]},h=(null===(a=null==e?void 0:e.chatStream)||void 0===a?void 0:a.continueChatResult)||{},p=null==h?void 0:h.requestId,g=null==h?void 0:h.preserve_message,f=null==h?void 0:h.isEnd,C=(null===(s=null==h?void 0:h.message)||void 0===s?void 0:s.content)||"",y=null==h?void 0:h.is_orchestrator,b=null==h?void 0:h.thinking_break,S=(null===(l=null==h?void 0:h.message)||void 0===l?void 0:l.citations)||[];if(p&&g&&C&&!f){var x=r.current.get(p)||[];x[x.length-1]!==C&&(x.push(C),r.current.set(p,x))}var k=(p&&r.current.get(p)||[]).join("\n\n"),I="";if(f)I=k&&""!==k.trim()?k:C;else if(g)I=k;else{var T=C.replace(/<!--(?![\s\S]*-->)[\s\S]*$/,"").trimEnd(),_=!1===y||b||0!==S.length?"":T;I=k?"".concat(k,"\n\n").concat(_):_}if(m.content=it(I),!0===(null==h?void 0:h.thinking_break)&&!0===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)&&o.push({responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1}),!1===(null==h?void 0:h.thinking_break)&&!1===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)){if(h.explainability_id&&h.responded_by){var E=h.explainability_id,M=h.responded_by;i.has(E)||i.set(E,{responded_by:M,index:o.length})}i.has(h.explainability_id)?o[null==(R=i.get(h.explainability_id))?void 0:R.index]={responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!0,explainability_id:null!==(c=h.explainability_id)&&void 0!==c?c:"",isParallelToolResponse:!0}:o=n(n([],o,!0),[{responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!0,explainability_id:null!==(d=h.explainability_id)&&void 0!==d?d:"",isParallelToolResponse:!1}],!1)}if(!0===(null==h?void 0:h.thinking_break)&&!1===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)){var R;h.explainability_id&&h.responded_by&&(E=h.explainability_id,M=h.responded_by,i.has(E)||i.set(E,{responded_by:M,index:o.length})),i.has(h.explainability_id)?o[null==(R=i.get(h.explainability_id))?void 0:R.index]={responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1,explainability_id:null!==(u=h.explainability_id)&&void 0!==u?u:"",isParallelToolResponse:!0}:o.push({responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1,explainability_id:null!==(v=h.explainability_id)&&void 0!==v?v:"",isParallelToolResponse:!1})}return t({orchestratorAndAgentsMessages:o},m)}(e,i,o,Bn);Z.time=new Date,Z.citations=H,Z.isEnd=null===(M=null===(E=null==e?void 0:e.chatStream)||void 0===E?void 0:E.continueChatResult)||void 0===M?void 0:M.isEnd,Z.requestId=null===(D=null===(R=null==e?void 0:e.chatStream)||void 0===R?void 0:R.continueChatResult)||void 0===D?void 0:D.requestId,Z.sessionId=Fe.current,null===(N=Z.orchestratorAndAgentsMessages)||void 0===N||N.forEach(function(e){e&&e.header_message&&Yn(e)}),(""!==(null==Z?void 0:Z.content)||(null==Z?void 0:Z.orchestratorAndAgentsMessages)&&(null==Z?void 0:Z.orchestratorAndAgentsMessages.length)>0)&&(Qe(!1),Ze(n(n([],Ge,!0),[{role:"user",content:a||"",time:r,isFirstQuestionSent:s||!1,id:l||(null===(F=null===(q=null==e?void 0:e.chatStream)||void 0===q?void 0:q.continueChatResult)||void 0===F?void 0:F.requestId)||"",requestId:null!==(W=null===(L=null===(A=null==e?void 0:e.chatStream)||void 0===A?void 0:A.continueChatResult)||void 0===L?void 0:L.requestId)&&void 0!==W?W:""},Z],!1))),en(null===(z=null===(P=null==e?void 0:e.chatStream)||void 0===P?void 0:P.continueChatResult)||void 0===z?void 0:z.isEnd)}},at=m(function(e,t){void 0===t&&(t="inactivity"),console.error("🛑 Stream failed or timed out due to:reason=".concat(t," requestId=").concat(e," at ").concat((new Date).toISOString()));var o=Un.current.get(e);o&&(clearTimeout(o),Un.current.delete(e)),e&&U&&(x(e,U,!1),Bn.current.delete(e)),e===zn.current?(On.current=!1,en(!0),un(!1),kn(!1),Qe(!1),$e(!1),Ze(function(e){var o=n([],e,!0).reverse().find(function(e){return"user"===e.role}),i=((null==o?void 0:o.content)||"").replace(/"/g,"&quot;"),r=n([],e,!0),a=r[r.length-1];a&&"assistant"===a.role&&!a.isEnd&&r.pop();var s="I ran into an unexpected issue while trying to process this learning.";return"inactivity"===t?s="Something went wrong—teaching is taking longer than expected.":"websocket_error"===t&&(s="I lost connection to the server while working on that."),n(n([],r,!0),[{role:"assistant",content:"".concat(s,' Please try again.\n\n<button class="clickable-button" data-value="').concat(i,'">Retry</button>'),id:w(),time:new Date,isEnd:!0,citations:[]}],!1)})):console.warn("🛑 [handleStreamTimeout] Ignoring stale timeout for superseded requestId=".concat(e,"; active=").concat(zn.current))},[Ee,U]),st=m(function(e){var n=Un.current.get(e);if(n&&clearTimeout(n),Ee&&Ee>0){console.log("⏱️ [Timeout armed] requestId=".concat(e," timeout=").concat(Ee,"ms at ").concat((new Date).toISOString()));var t=setTimeout(function(){console.warn("⏱️ [Timeout FIRED — auto stop] requestId=".concat(e," at ").concat((new Date).toISOString())),at(e,"inactivity")},Ee);Un.current.set(e,t)}},[at,Ee]),lt=function(e,r,a,s,l,c){return o(void 0,void 0,void 0,function(){var o,s,d,u,v,m,h,p,g,f,C,y,b,S,x,I;return i(this,function(i){switch(i.label){case 0:if(o=(void 0!==a?a:Oe||"").trim(),(s="Enter"===(null==e?void 0:e.key)&&!(null==e?void 0:e.shiftKey)&&!_e)&&(null===(C=null==e?void 0:e.preventDefault)||void 0===C||C.call(e)),d="user"===(null===(y=Ge[Ge.length-1])||void 0===y?void 0:y.role),!o||dn||On.current||d||(null==e?void 0:e.key)&&!s)return[2];if(Gn.current||(Gn.current=(new Date).toISOString(),console.log("Session start time set to ".concat(Gn.current))),!De)return[3,5];Qe(!0),ln("Validating session..."),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,De(Gn.current)];case 2:return i.sent()?[3,4]:(Vn(!0),Qe(!1),c&&c(!1),[2]);case 3:return u=i.sent(),console.error("Validation error:",u),Vn(!0),Qe(!1),c&&c(!1),[2];case 4:Qe(!1),i.label=5;case 5:return On.current=!0,"I want to add a rule description"===o?(en(!1),Pe.current=!0,un(!0),!Sn&&o&&wn(a||"manual_entry"),v=new Date,Ze(function(e){return n(n([],e.map(function(e,n){var o;return t(t({},e),{content:null===(o=it(e.content))||void 0===o?void 0:o.replace("WaitMessage: ","")})}),!0),[{role:"user",content:o,time:v,isFirstQuestionSent:!1,id:l||w()}],!1)}),et("smooth"),setTimeout(function(){Ze(function(e){return n(n([],e,!0),[{role:"assistant",content:"I'd be happy to help you set up a new rule! To get started, could you tell me what kind of behavior or logic you would like this rule to follow?",id:w(),citations:[],time:new Date}],!1)}),et("smooth"),setTimeout(function(){un(!1),en(!0)},500)},500),[2]):(en(!1),Pe.current=!0,un(!0),!Sn&&o&&wn(a||"manual_entry"),m=new Date,Ze(function(e){var i=e.map(function(e){var n;return t(t({},e),{content:null===(n=it(e.content))||void 0===n?void 0:n.replace("WaitMessage: ","")})});return l&&i.some(function(e){return e.id===l})?i.map(function(e){return e.id===l?t(t({},e),{content:o}):e}):n(n([],i,!0),[{role:"user",content:o,time:m,isFirstQuestionSent:!1,id:l||w()}],!1)}),et("smooth"),h=new Map,p=[],g=function(e){var n;if(!e)return{};var t=Object.keys(e);return 1===t.length&&"current"===t[0]?null!==(n=e.current)&&void 0!==n?n:{}:e},f={WEBSOCKET_URL:U,organizationName:O,chatAssistantName:qe,selectedAIModel:"gpt-4",replyMessage:"",userName:null!==(b=null==Te?void 0:Te.name)&&void 0!==b?b:"Guest User",userEmailId:null!==(S=null==Te?void 0:Te.email)&&void 0!==S?S:"guestUser@example.com",userId:null!==(x=null==Te?void 0:Te.id)&&void 0!==x?x:"Guest User",query:o,requestId:"requestId-".concat(w()),customPrompt:"",enableForBackend:!1,guestSessionId:Fe.current,chatPreviewId:Ae.current,customMetaData:g(Y),aiModel:"",enableLogs:!0,onStreamEvent:function(e){var n,t,i,a,s,c,d=null===(t=null===(n=null==e?void 0:e.chatStream)||void 0===n?void 0:n.continueChatResult)||void 0===t?void 0:t.requestId,u=null===(a=null===(i=null==e?void 0:e.chatStream)||void 0===i?void 0:i.continueChatResult)||void 0===a?void 0:a.header_message;console.log("📦 [Stream Chunk Received] With RequestID and header_message: ".concat(d,",").concat(u)),st(f.requestId);var v=null===(c=null===(s=null==e?void 0:e.chatStream)||void 0===s?void 0:s.continueChatResult)||void 0===c?void 0:c.error_state;if(Array.isArray(v)&&v.length>0)return console.error("⚠️ Agent returned an error_state during stream:",{requestId:d,errorState:v}),void at(f.requestId,"agent_error");rt(e,h,p,m,o,r,l)},onStreamEnd:function(e){var o,i,r=null===(i=null===(o=null==e?void 0:e.chatStream)||void 0===o?void 0:o.continueChatResult)||void 0===i?void 0:i.requestId;jn.current.add(f.requestId),console.log("✅ [Stream Completed] RequestID: ".concat(r));var a=Un.current.get(f.requestId);a&&(clearTimeout(a),Un.current.delete(f.requestId)),On.current=!1,en(!0),un(!1),kn(!1);var s=Date.now(),l=Pn.current.get(f.requestId);if(l){var c=Math.round((s-l)/1e3).toFixed(1);Ze(function(e){var o=n([],e,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===o)return e;var i=e.length-1-o;return e.map(function(e,n){return n===i?t(t({},e),{finalTimeTaken:c}):e})})}},onError:function(e){var n=Un.current.get(f.requestId);if(n&&(clearTimeout(n),Un.current.delete(f.requestId)),jn.current.has(f.requestId))return console.warn("Ignoring post-completion error for already-finished request:",f.requestId),void jn.current.delete(f.requestId);console.error("Stream error:",e),at(f.requestId,"websocket_error")}},o&&(Qe(!0),null===(I=je.current)||void 0===I||I.blur(),He(""),et(),ln(l?"Just a moment, processing your request...":"Okay, got it. Let me take a moment to work on this and I'll get back to you shortly."),Pn.current.set(f.requestId,Date.now()),zn.current=f.requestId,console.log("Chat Stream Params:",f),st(f.requestId),Hn.current+=1,console.log("🚀 [UI Action] stream started (Total UI invocations: ".concat(Hn.current,") | RequestID: ").concat(f.requestId,' | Query: "').concat(o,'"')),k(f)),c&&c(!1),[2])}})})},ct=c(null);h(function(){ct.current=lt});var dt=m(function(){for(var e,t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return null===(e=ct.current)||void 0===e?void 0:e.call.apply(e,n([ct],t,!1))},[]),ut=u(function(){return{p:function(e){e.node;var n=e.children;return r(e,["node","children"]),a("div",t({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:n}))},button:function(e){e.node;var n=e.className,o=e.children,i=r(e,["node","className","children"]),l=A(o),c=i["data-value"],d="Tester Genie"===l;return a(M,t({},i,{className:n,handleStream:dt,isStreamEnd:Ye,disabled:!!Sn||!!_e,isLastMessage:!0,style:{margin:0},isTesterGenie:d,"data-selected":Sn===l||Sn===c?"true":Sn?"false":void 0},{children:s("span",t({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[o,d&&s("svg",t({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[a("path",{d:"M7.20368 8.94768e-06C7.48895 -0.00208639 7.69331 0.364327 7.83856 0.57465C8.14381 1.01633 8.38012 1.87909 7.71077 2.14118C8.57167 2.21011 9.70406 2.93098 10.1785 3.64699C10.5932 4.27286 10.4559 5.16037 9.80301 5.56007L9.9502 7.16593C9.97671 7.44871 10.0265 7.87092 10.0299 8.14457C10.4213 8.23046 11.0787 8.55391 11.326 8.87592C11.5979 8.75656 11.9189 8.76963 12.1688 8.93469C12.3563 8.67751 12.5598 8.41456 12.7507 8.15787C12.3283 7.45155 12.5047 6.57745 13.2143 6.13784C13.5375 5.9377 13.9264 5.87277 14.2971 5.95705C14.0961 6.30964 13.8775 6.72182 13.6593 7.05857C13.7906 7.2436 13.9184 7.44225 14.044 7.63194L14.8022 7.63198C15.0349 7.30106 15.2515 6.90827 15.4835 6.59349C15.8623 7.0712 15.8156 7.79671 15.4734 8.28241C15.1318 8.76741 14.4886 8.9899 13.9118 8.88251C13.758 9.12108 13.5577 9.39243 13.3941 9.63201C13.7143 9.9316 13.7725 10.364 13.4067 10.6594C13.5231 10.8889 13.5309 11.1613 13.447 11.402C13.1502 12.2523 12.1724 12.5645 11.3474 12.5025C11.1171 12.4852 10.939 12.4698 10.7197 12.3953C10.8724 13.1271 10.7744 14.2031 10.5132 14.9051C10.1688 15.8304 9.43632 16.5569 8.54503 16.9655C7.90465 17.2706 7.21222 17.3607 6.50472 17.4505C5.74445 17.5471 4.75801 17.4362 4.08533 17.825C3.9327 17.9132 3.86566 18.0173 3.82943 18.1792C3.94996 18.5982 4.47858 18.6063 4.78474 18.8897C5.20191 19.2758 4.90716 19.9663 4.36611 19.9908C4.31476 19.9931 4.26867 19.9867 4.23186 19.9493C4.23089 19.8303 4.47587 19.7199 4.49787 19.5262C4.55075 19.0604 3.70014 19.0078 3.37835 18.8374C3.13013 18.706 2.99537 18.6309 2.82242 18.4021C2.63795 18.1579 2.58428 17.835 2.63138 17.5392C2.74868 16.7847 3.47123 16.393 4.12184 16.1497C4.61314 15.9659 5.46304 15.7158 5.52019 15.0793C5.58589 14.348 4.97543 13.5523 4.57739 12.9807C4.44275 12.7875 4.3039 12.579 4.16309 12.3919C4.18987 12.365 4.21049 12.3463 4.23916 12.3212C4.59619 12.6218 5.21209 12.6421 5.55038 12.2979C5.70457 12.144 5.78974 11.9342 5.78642 11.7164C5.78121 11.4493 5.63382 11.2002 5.4454 11.019C5.44704 10.9932 5.44824 10.9676 5.449 10.9419C5.4566 10.6648 5.37505 10.4902 5.1892 10.2943C5.18398 10.2538 5.17776 10.2134 5.17053 10.1732C5.08123 9.69297 4.71708 9.34182 4.23415 9.27108C4.16418 9.26083 3.96108 9.26105 3.92071 9.23344C3.90485 9.1828 3.9059 9.20792 3.91904 9.15527C4.22103 8.90139 4.14407 8.78214 4.31107 8.4846C4.42301 8.28513 4.73047 8.15239 4.95452 8.10701C4.96167 7.51076 5.03684 6.88562 5.10036 6.29144C5.12451 6.0655 5.12531 5.75046 5.1511 5.55257C4.11108 4.86747 4.39091 3.75946 5.25465 3.06391C5.84978 2.58469 6.34496 2.31002 7.10143 2.14517C7.01589 2.10416 6.93842 2.04811 6.87269 1.97972C6.77021 1.87349 6.70248 1.73857 6.67853 1.59293C6.60568 1.12096 7.04104 0.914625 7.18759 0.526392C7.26428 0.323403 7.03925 0.146075 7.20368 8.94768e-06Z",fill:"#475569"}),a("path",{d:"M7.459 4.5C7.48797 4.50312 7.71949 4.61154 7.76205 4.63061C8.27062 4.85835 8.87051 5.09164 9.35658 5.3582C9.36602 6.03495 9.37016 6.56625 8.70573 6.91519C8.6633 6.80883 8.63019 6.72409 8.56332 6.63044C8.43786 6.45568 8.24656 6.33963 8.03354 6.30909C7.8434 6.28211 7.65146 6.3197 7.49586 6.43503C7.21897 6.21256 6.76265 6.28197 6.5229 6.52486C6.39308 6.65639 6.34815 6.75074 6.28902 6.92344C5.59702 6.5957 5.58761 6.04267 5.60583 5.35582C5.89882 5.23844 6.21318 5.0724 6.50153 4.941C6.82145 4.79522 7.14482 4.6574 7.459 4.5Z",fill:"#D1EDFD"}),a("path",{d:"M11.0756 10.6406C11.1037 10.6701 11.1324 10.7706 11.1535 10.8145C11.2818 11.0817 11.4922 11.1945 11.7498 11.2977C11.5607 11.63 11.4567 11.8797 11.1034 12.0466L11.0839 12.0517C10.9262 12.0927 10.7996 12.0968 10.651 12.0135C10.4755 11.915 10.3807 11.6614 10.4792 11.478C10.6388 11.1809 10.8877 10.9272 11.0756 10.6406Z",fill:"#D1EDFD"}),a("path",{d:"M11.6036 9.1377C11.6993 9.11763 11.8391 9.16378 11.9294 9.19593C11.6952 9.50644 11.4706 9.81614 11.2327 10.1261L11.1572 10.2255C10.7581 9.73539 11.0333 9.24481 11.6036 9.1377Z",fill:"#D1EDFD"}),a("path",{d:"M7.49681 0.882812C7.53691 0.925159 7.61244 1.08523 7.63598 1.14156C7.74243 1.39673 7.75769 1.76908 7.38596 1.77504C7.28236 1.75599 7.15628 1.68938 7.13517 1.5783C7.0843 1.3107 7.35609 1.09964 7.48737 0.897583L7.49681 0.882812Z",fill:"#D1EDFD"}),a("path",{d:"M1.68305 6.17249C1.71659 6.1673 1.8134 6.16478 1.84892 6.16432C2.34052 6.15616 2.81496 6.34495 3.16655 6.68866C3.50847 7.01806 3.70349 7.47119 3.70765 7.94596C3.70896 8.42345 3.54045 8.85284 3.20281 9.19025C3.34033 9.28068 3.5321 9.52219 3.6543 9.65748C4.17158 9.39073 4.91447 9.69339 4.79675 10.3444C5.08751 10.5485 5.19656 10.8288 5.0585 11.1674C5.15418 11.2375 5.25595 11.3205 5.32383 11.4186C5.40228 11.5303 5.4309 11.6695 5.40291 11.8031C5.32228 12.1857 4.90085 12.3286 4.57669 12.1236C4.51367 12.0838 4.42258 11.9595 4.35299 11.9431C4.30669 11.9557 4.28453 11.9584 4.23644 11.9644C4.22885 11.9742 4.22118 11.9841 4.21343 11.9938C3.93597 12.3413 3.49234 12.4682 3.06933 12.5157C2.85285 12.518 2.70432 12.5146 2.49066 12.4609C1.80785 12.2892 1.50808 11.6167 1.70723 10.9639C1.829 10.5648 2.11891 10.2506 2.48939 10.0518C2.54655 10.132 2.57559 10.2191 2.64066 10.303C2.73571 10.2223 2.82048 10.1482 2.92363 10.0773C2.81023 9.95313 2.66811 9.7693 2.55817 9.63584C2.38871 9.6878 2.23026 9.72879 2.05298 9.74653C1.54239 9.80228 1.03118 9.64711 0.637735 9.31695C0.269964 9.01018 0.0453493 8.54827 0.00544736 8.07322C-0.0309495 7.60988 0.116099 7.15077 0.414918 6.79478C0.742554 6.41198 1.18728 6.21393 1.68305 6.17249Z",fill:"#475569"}),a("path",{d:"M1.79616 6.5951C2.54894 6.5619 3.18687 7.14364 3.22301 7.8963C3.25915 8.64894 2.67989 9.28913 1.92739 9.3282C1.17073 9.3675 0.526231 8.78435 0.489885 8.02753C0.45354 7.27071 1.03921 6.62849 1.79616 6.5951Z",fill:"#D1EDFD"}),a("path",{d:"M4.93607 11.4844C5.12839 11.6261 5.22049 11.9085 4.91876 11.9419C4.8067 11.8805 4.78491 11.8646 4.71094 11.7561C4.81572 11.6752 4.862 11.5925 4.93607 11.4844Z",fill:"#FEFEFD"}),a("path",{d:"M12.5164 3.58594L12.5715 3.59466C12.6589 3.65863 12.6908 3.94434 12.7882 4.05193C12.8789 4.15216 12.9155 4.17816 13.0326 4.24929C13.1363 4.31224 13.3325 4.34025 13.384 4.43124C13.3643 4.56218 13.0693 4.54857 12.9127 4.69344C12.6903 4.89898 12.7114 5.06971 12.5892 5.28622C12.5669 5.28439 12.5368 5.2868 12.5261 5.27346C12.4336 5.15843 12.4072 4.9308 12.3099 4.81465C12.1627 4.63903 11.9972 4.60054 11.7981 4.51372C11.7544 4.49467 11.7266 4.47099 11.7129 4.42649C11.7867 4.31876 12.0509 4.34309 12.2376 4.14892C12.43 3.94901 12.4155 3.72208 12.5164 3.58594Z",fill:"#475569"}),a("path",{d:"M2.13644 3.72656C2.24401 3.77084 2.29712 4.1268 2.431 4.25226C2.60327 4.41371 2.7311 4.41949 2.93246 4.52449C2.96024 4.53897 2.97173 4.56042 2.97671 4.58878C2.89584 4.6981 2.61854 4.70721 2.4596 4.85659C2.26275 5.04156 2.27341 5.29132 2.17022 5.42088C2.16192 5.41849 2.11671 5.40232 2.1156 5.40043C2.01291 5.21216 1.9836 5.04909 1.84812 4.87273C1.73599 4.72675 1.36534 4.69959 1.32812 4.56939C1.3835 4.47941 1.67823 4.44211 1.82291 4.30563C2.02737 4.11274 2.0042 3.8372 2.13644 3.72656Z",fill:"#475569"})]}))]}))}))}}},[dt,Ye,Sn,_e]),vt=u(function(){return Ge.some(function(e){return e.isSkeleton})},[Ge]),mt=function(e){return o(void 0,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return Ie?[4,Ie(e)]:[3,2];case 1:t.sent(),Ze(function(e){return n(n([],e,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:w(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return et("smooth")},100),t.label=2;case 2:return[2]}})})};return s("div",t({className:"".concat(N.customFont," ").concat(D.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:Se&&!vt?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[s("div",t({ref:We,className:D.scrollWrapper},{children:[a("div",t({ref:En,className:D.stickyHeader},{children:a(T,{resetChatHistory:ot,isStreamEnd:Ye,chatTitle:X,onResize:se,chatSize:ae,movingTowards:le})})),s("div",t({className:D.messagesList},{children:[s("div",t({className:D.initialMessageRow},{children:[a("div",t({className:D.iconWrapper},{children:a(W,{})})),a("div",t({className:D.welcomeTextWrapper},{children:a("div",t({className:D.welcomeMarkdownWrapper},{children:a("span",{children:a(y,t({rehypePlugins:[b],components:ut},{children:ie}))})}))}))]})),Ge.length>0&&Ge.map(function(e,n){var o,i;return s("div",t({className:D.messageRow},{children:["assistant"===e.role?a("div",t({className:D.assistantIconContainer},{children:a(W,{})})):a("div",{className:D.userSpacer}),a("div",t({className:D.messageContent},{children:"assistant"===e.role?s(l,{children:[e.orchestratorAndAgentsMessages&&e.orchestratorAndAgentsMessages.length>0&&a(I,{orchestratorAndAgentsMessages:null==e?void 0:e.orchestratorAndAgentsMessages,isStreamEnd:Ye,finalTimeTaken:null==e?void 0:e.finalTimeTaken},null!==(o=null==e?void 0:e.finalTimeTaken)&&void 0!==o?o:null==e?void 0:e.id),a(_,{index:n,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:Ge,handleStream:lt,isLastMessage:n===Ge.length-1,onSave:re,citations:null==e?void 0:e.citations,setChatSize:se,chatSize:ae,isStreamEnd:Ye,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:xe,onTypeResponseClick:function(){var e;An(!0),null===(e=je.current)||void 0===e||e.focus()},onComparisonLinkClick:ke,baseURL:Le,onFeedbackSubmit:mt,isGlobalEditActive:_e}),e.hasOwnProperty("isEnd")&&!(null==e?void 0:e.isEnd)&&(null===(i=null==e?void 0:e.content)||void 0===i?void 0:i.length)>0&&s(l,{children:[a(E,{variant:"text",width:"50%",height:20}),a("div",{style:{marginTop:"10px"}}),a(E,{variant:"text",width:"100%",height:40})]}),a("div",t({className:D.timestamp},{children:e.time&&!isNaN(new Date(e.time).getTime())?new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}):s("div",t({className:D.userMessageWrapper},{children:[s("div",t({className:D.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:e.isSkeleton||vt||e.id!==Dn?"none":"0 0 15px 3px rgba(37, 99, 235, 0.6)"}},{children:[e.isSkeleton?s("div",t({style:{display:"flex",flexDirection:"column",gap:"12px",minWidth:"280px",padding:"8px 0"}},{children:[a(E,{variant:"text",width:"100%",height:16}),a(E,{variant:"text",width:"80%",height:16})]})):a(_,{index:n,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:Ge,handleStream:lt,isLastMessage:n===Ge.length-1,onSave:re,citations:null==e?void 0:e.citations,isStreamEnd:Ye,isGlobalEditActive:_e,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:xe,onComparisonLinkClick:ke,baseURL:Le,onFeedbackSubmit:mt}),a("div",t({style:{marginTop:"0.5rem"}},{children:a(P,{})}))]})),a("div",t({className:D.userTimestamp},{children:new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),e.id)}),Ve&&s("div",t({className:D.loadingRow},{children:[a("div",t({className:D.iconWrapper,style:{marginTop:"0.2rem"}},{children:a(W,{})})),a("div",t({className:D.loadingTextWrapper},{children:a("span",{children:sn})}))]})),a("div",{ref:ze,style:{float:"left",clear:"both"}})]}))]})),a("div",t({className:D.inputAreaWrapper},{children:a(C,t({title:$?"Please wait for the validation to be completed.":""},{children:s("div",t({className:"".concat(D.inputBoxContainer," ").concat(Jn?D.disabled:""),style:Fn?{boxShadow:"0 0 15px 3px rgba(37, 99, 235, 0.5)",borderColor:"#2563eb",transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}:{transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}},{children:[Ge.length>0&&!gn&&a("div",t({onMouseDown:function(e){e.preventDefault(),et("smooth")},className:D.scrollToBottomBtn},{children:a(q,{})})),s("div",t({style:{width:"100%",display:"flex"}},{children:[a("textarea",{ref:je,placeholder:ue,value:Oe||"",onChange:function(e){He(e.target.value)},onFocus:function(){return hn(!0)},onBlur:function(){return hn(!1)},onKeyDown:function(e){return lt(e)},disabled:Jn,className:"no-scrollbar ".concat(D.chatTextarea),style:{minHeight:mn||Oe&&Oe.length>40?"120px":"50px",height:mn||Oe&&Oe.length>40?"120px":"50px",maxHeight:"120px"}}),a("span",t({className:D.sendButtonWrapper},{children:a("button",t({onClick:function(e){Xn||lt(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:Xn,className:"".concat(D.sendButton," ").concat(Xn?D.disabled:D.active)},{children:a(L,{})}))}))]}))]}))}))})),s("div",t({className:D.footerTools},{children:[a(C,t({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:a("span",t({className:D.footerToolItem},{children:a(R,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),a(C,t({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:a("span",t({className:D.footerToolItem},{children:a(R,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]})),a(g,t({open:Kn,onClose:function(){},PaperProps:{sx:{borderRadius:"12px",padding:"8px",maxWidth:"400px"}}},{children:s(f,t({sx:{p:3,textAlign:"center",fontFamily:"'Plus Jakarta Sans', sans-serif"}},{children:[a("h3",t({style:{fontSize:"18px",fontWeight:600,color:"#0F172A",marginBottom:"10px"}},{children:"Session Expired"})),a("p",t({style:{fontSize:"14px",color:"#64748B",lineHeight:"1.5",marginBottom:"20px"}},{children:"Changes were made to the learnings in this scope while you were editing. To avoid conflicts, concurrent edits aren’t allowed."})),s(f,t({sx:{display:"flex",gap:2,justifyContent:"center"}},{children:[a("button",t({onClick:function(){Vn(!1),ot()},style:{flex:1,padding:"10px 16px",cursor:"pointer",backgroundColor:"white",border:"1px solid #E2E8F0",borderRadius:"8px",fontSize:"14px",fontWeight:500,color:"#475569",transition:"all 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#F8FAFC"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="white"}},{children:"Reset Session"})),a("button",t({onClick:function(){Vn(!1),null==Ne||Ne()},style:{flex:1,padding:"10px 16px",backgroundColor:"#EF4444",color:"white",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:500,cursor:"pointer",transition:"background-color 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#DC2626"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="#EF4444"}},{children:"Discard & Close"}))]}))]}))}))]}))};export{j as autoGeneratePrompt,B as default};
2
2
  //# sourceMappingURL=ChatComponent.js.map
@@ -1,2 +1,2 @@
1
- import{__makeTemplateObject as e,__spreadArray as t,__assign as n,__awaiter as i,__generator as o,__rest as a}from"tslib";import{jsx as r,jsxs as s,Fragment as l}from"react/jsx-runtime";import{useRef as d,useState as c,useMemo as u,useEffect as h,useCallback as m,useLayoutEffect as v}from"react";import{keyframes as p,Box as C}from"@mui/material";import g from"@mui/material/Tooltip";import f from"react-markdown";import S from"rehype-raw";import{http as b}from"../../../../api/transport.js";import{v4 as y}from"uuid";import{startChatStream as x}from"@e-llm-studio/streaming-response";import{WatchMeWork as w}from"@e-llm-studio/watch-me-work";import R from"./ChatHeader.js";import k from"../MessageRendering/MessageRendering.js";import{Skeleton as _}from"../atoms/SkeletonLoader/SkeletonLoader.js";import{ActionableButton as E}from"../MessageRendering/ClickableChatComponents.js";import T from"../AudioWaveform.js";import M from"./ChatComponent.module.css.js";import I from"../../InstantLearning.module.css.js";import{ScrollToBottom as N}from"../_svg/ScrollToBottom.js";import{useHeaderObserver as D,extractTextFromChildren as L}from"../../helpers/utils.js";import{SendButton as F}from"../_svg/SendButton.js";import A from"../_svg/SparkleIcon.js";import{UserIcon as W}from"../_svg/UserIcon.js";var z,j=function(j){var q=j.chatAssistantName,B=j.organizationName,P=j.baseUrl,H=j.baseWebsocketUrl,Z=j.setIsNewChatClicked;j.ThinkingBulbIconComponent;var K=j.isFormSaveClicked,U=j.setIsFormSavedClicked,G=j.onResetLearningData,V=j.sendMessageInChat,O=j.setSendMessageInChat,J=j.isFormValidating,Q=j.chatTitle,X=j.customMetaData,Y=j.headerMessageHandlers;j.aiResponse;var $=j.setAIResponse,ee=j.onResetChat,te=j.initialChatMessage,ne=void 0===te?"":te,ie=j.onSave,oe=j.chatSize,ae=j.setChatSize,re=j.movingTowards,se=j.setCitations,le=j.textareaPlaceholder,de=void 0===le?"Tell me more about this learning...":le,ce=j.setCurrentRequestId,ue=j.showSavedMessage,he=void 0!==ue&&ue,me=j.savedMessage,ve=j.isError,pe=void 0!==ve&&ve,Ce=j.errorMessage,ge=void 0===Ce?"There was an error saving your changes.":Ce;j.isSaving;var fe=j.isHighlighted,Se=void 0!==fe&&fe,be=j.onStreamingStateChange,ye=j.onViewComparison;j.isCopyEnabled;var xe=j.onComparisonLinkClick,we=j.onSubmitFeedback,Re=q,ke=d("".concat(Re,"-").concat(B,"-").concat(y())),_e=d("".concat(y())),Ee=P,Te=d(null),Me=d(!0),Ie=d(null),Ne=d(null),De=c(""),Le=De[0],Fe=De[1],Ae=c([]),We=Ae[0],ze=Ae[1],je=c(!1),qe=je[0],Be=je[1],Pe=c(!1);Pe[0];var He=Pe[1],Ze=c(!0),Ke=Ze[0],Ue=Ze[1],Ge=c(!0);Ge[0];var Ve=Ge[1],Oe=c("");Oe[0];var Je=Oe[1],Qe=c(""),Xe=Qe[0],Ye=Qe[1],$e=c(!1),et=$e[0],tt=$e[1],nt=c(!1),it=nt[0],ot=nt[1],at=c(!0),rt=at[0],st=at[1],lt=c("100%");lt[0];var dt=lt[1],ct=c(null),ut=ct[0],ht=ct[1],mt=c(!1);mt[0];var vt=mt[1],pt=c(!1),Ct=pt[0],gt=pt[1],ft=d(null),St=d(new Set),bt=c(null),yt=bt[0],xt=bt[1],wt=c(!1),Rt=wt[0],kt=wt[1],_t=c(!1);_t[0],_t[1];var Et=c(null);Et[0],Et[1],d(null),d(null);var Tt=d(new Map),Mt=d(""),It=p(z||(z=e(["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "],["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "]))),Nt=u(function(){return""===(null==Le?void 0:Le.trim())||et},[Le,et]),Dt=u(function(){return J},[J]),Lt=u(function(){return Nt||et||J},[Nt,et,J]);h(function(){null==be||be(et)},[et,be]),h(function(){var e=Te.current,t=function(){if(e){var t=e.scrollTop,n=e.scrollHeight,i=e.clientHeight;st(n-t-i<=20)}};return e&&(e.addEventListener("scroll",t),t()),function(){e&&e.removeEventListener("scroll",t)}},[We]);var Ft=D({handlers:Y,setResult:$}).processHeaderMessage;h(function(){he&&gt(!0)},[he]),h(function(){if(Rt){var e=setTimeout(function(){kt(!1)},3e3);return function(){return clearTimeout(e)}}},[Rt]),h(function(){K&&(Bt(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),U(!1))},[K]),h(function(){if(V)try{if(V.startsWith("__SKELETON__:")){var e=V.split(":"),i=e[1],o=e.slice(2).join(":"),a={role:"user",content:"",id:i,time:new Date,isSkeleton:!0,skeletonContent:o};return ze(function(e){return t(t([],e,!0),[a],!1)}),Bt(new KeyboardEvent("keydown",{key:"Enter"}),!1,o,!1,i),xt(i),O&&O(""),void setTimeout(function(){xt(null)},2e3)}if(V.startsWith("__SKELETON_END__::")){var r=V.split("::")[1]||"";return ze(function(e){return e.map(function(e){return e.isSkeleton?n(n({},e),{isSkeleton:!1,content:e.skeletonContent||r}):e})}),void(O&&O(""))}var s=y();Bt(new KeyboardEvent("keydown",{key:"Enter"}),!1,V,!1,s),xt(s),O&&O(""),setTimeout(function(){return xt(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[V]),h(function(){Wt(),zt();var e=function(){var e,t=(null===(e=null==ft?void 0:ft.current)||void 0===e?void 0:e.clientHeight)||0,n="calc(100% - ".concat(t,"px - 10px)");dt(n)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var At=m(function(e){var t="string"==typeof e?e:"smooth";Ie.current&&Ie.current.scrollIntoView({behavior:t,block:"end"}),Me.current&&setTimeout(function(){Ie.current&&Me.current&&Ie.current.scrollIntoView({behavior:t,block:"end"})},100)},[]);h(function(){if(!et){var e="";if(Ct?e=me||"Thank you teacher for teaching me, your rule has been saved successfully.":pe&&(e=ge||"I'm sorry, I couldn't save your changes. Please try again."),e){var n={role:"assistant",content:e,id:y(),citations:[],time:new Date};ze(function(e){return t(t([],e,!0),[n],!1)}),gt(!1),setTimeout(function(){return At("smooth")},100)}}},[Ct,pe,et,me,ge,At]),h(function(){Me.current&&At("smooth")},[At]);var Wt=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(Ee,"/api/chatbot/getChatSettings?name=").concat(Re,"&organizationName=").concat(B),headers:{}};b.request(e).then(function(e){var t,n,i;(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)&&""!==(null===(i=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)||void 0===i?void 0:i.chatInitialMessage)&&Ve(!0)}).catch(function(e){console.error(e)})},zt=function(){return i(void 0,void 0,void 0,function(){var e,t;return o(this,function(n){e="".concat(Ee,"/api/chat/history?name=").concat(Re,"&organizationName=").concat(B);try{t={method:"GET",params:{guestSessionId:ke.current},withCredentials:!0},b.get(e,t).then(function(e){var t=e.data;t.length>0?(ze(t),At()):Ve(!0)}).catch(function(e){console.error(e)})}catch(e){Be(!1),console.error(e)}return[2]})})};function jt(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var qt=function(e,i,o,a,r,s,l){var d,c,u,h,m,v,p,C,g,f,S,b,x,w,R,k,_,E,T,M,I,N,D,L,F,A,W,z,j,q,B,P,H,Z;if(null===(c=null===(d=null==e?void 0:e.chatStream)||void 0===d?void 0:d.continueChatResult)||void 0===c?void 0:c.header_message){var K={header_message:e.chatStream.continueChatResult.header_message,responsedata:null===(m=null===(h=null===(u=null==e?void 0:e.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===h?void 0:h.message)||void 0===m?void 0:m.content};Ft(K)}var U=null===(v=null==e?void 0:e.chatStream)||void 0===v?void 0:v.continueChatResult,G=null==U?void 0:U.isEnd,V=(null===(p=null==U?void 0:U.message)||void 0===p?void 0:p.citations)||[];G&&V.length>0&&se&&se(V);var O={role:"assistant",content:"",id:y()};if(null===(S=null===(f=null===(g=null===(C=null==e?void 0:e.chatStream)||void 0===C?void 0:C.continueChatResult)||void 0===g?void 0:g.message)||void 0===f?void 0:f.content)||void 0===S?void 0:S.includes("WaitMessage: "))He(!0),O.content=function(e){var t="WaitMessage: ",n=e.indexOf(t);if(-1!==n){var i=e.substring(n+13);return null==i?void 0:i.replaceAll("WaitMessage: ","")}return""}((null===(w=null===(x=null===(b=null==e?void 0:e.chatStream)||void 0===b?void 0:b.continueChatResult)||void 0===x?void 0:x.message)||void 0===w?void 0:w.content)+"\n\n"),""!==O.content&&(Be(!1),ze(t(t([],We,!0),[{role:"user",content:r,time:a,isFirstQuestionSent:s||!1,id:l||(null===(k=null===(R=null==e?void 0:e.chatStream)||void 0===R?void 0:R.continueChatResult)||void 0===k?void 0:k.requestId)||"",reply:""},O],!1)));else{He(!1),O.content=null===(M=jt(null===(T=null===(E=null===(_=null==e?void 0:e.chatStream)||void 0===_?void 0:_.continueChatResult)||void 0===E?void 0:E.message)||void 0===T?void 0:T.content))||void 0===M?void 0:M.replaceAll("WaitMessage: ","");var J=null===(N=null===(I=null==e?void 0:e.chatStream)||void 0===I?void 0:I.continueChatResult)||void 0===N?void 0:N.requestId;"string"==typeof J&&J&&ce&&ce(J);var Q=function(e,i,o){var a,r,s,l,d,c,u,h,m,v,p,C,g,f,S,b,x,w,R,k,_,E,T,M,I,N,D,L,F,A,W,z,j,q,B={role:"assistant",content:"",id:y(),time:new Date,citations:[]};if(!1===(null===(r=null===(a=e.chatStream)||void 0===a?void 0:a.continueChatResult)||void 0===r?void 0:r.thinking_break)&&!0===(null===(l=null===(s=e.chatStream)||void 0===s?void 0:s.continueChatResult)||void 0===l?void 0:l.is_orchestrator)&&!1===(null===(c=null===(d=e.chatStream)||void 0===d?void 0:d.continueChatResult)||void 0===c?void 0:c.isEnd)&&(B.content=jt(e.chatStream.continueChatResult.message.content||"")),!0===(null===(h=null===(u=e.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===h?void 0:h.thinking_break)&&!0===(null===(v=null===(m=e.chatStream)||void 0===m?void 0:m.continueChatResult)||void 0===v?void 0:v.is_orchestrator)&&!1===(null===(C=null===(p=e.chatStream)||void 0===p?void 0:p.continueChatResult)||void 0===C?void 0:C.isEnd)&&(B.content="",i.push({responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!1})),!1===(null===(f=null===(g=e.chatStream)||void 0===g?void 0:g.continueChatResult)||void 0===f?void 0:f.thinking_break)&&!0===(null===(b=null===(S=e.chatStream)||void 0===S?void 0:S.continueChatResult)||void 0===b?void 0:b.is_orchestrator)&&!0===(null===(w=null===(x=e.chatStream)||void 0===x?void 0:x.continueChatResult)||void 0===w?void 0:w.isEnd)&&(B.content=jt(e.chatStream.continueChatResult.message.content)),!1===(null===(k=null===(R=e.chatStream)||void 0===R?void 0:R.continueChatResult)||void 0===k?void 0:k.thinking_break)&&!1===(null===(E=null===(_=e.chatStream)||void 0===_?void 0:_.continueChatResult)||void 0===E?void 0:E.is_orchestrator)&&!1===(null===(M=null===(T=e.chatStream)||void 0===T?void 0:T.continueChatResult)||void 0===M?void 0:M.isEnd)){if((Z=e.chatStream.continueChatResult).explainability_id&&Z.responded_by){var P=Z.explainability_id,H=Z.responded_by;o.has(P)||o.set(P,{responded_by:H,index:i.length})}o.has(e.chatStream.continueChatResult.explainability_id)?i[null==(K=o.get(e.chatStream.continueChatResult.explainability_id))?void 0:K.index]={responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!0,explainability_id:null!==(I=e.chatStream.continueChatResult.explainability_id)&&void 0!==I?I:"",isParallelToolResponse:!0}:i=t(t([],i,!0),[{responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!0,explainability_id:null!==(N=e.chatStream.continueChatResult.explainability_id)&&void 0!==N?N:"",isParallelToolResponse:!1}],!1)}if(!0===(null===(L=null===(D=e.chatStream)||void 0===D?void 0:D.continueChatResult)||void 0===L?void 0:L.thinking_break)&&!1===(null===(A=null===(F=e.chatStream)||void 0===F?void 0:F.continueChatResult)||void 0===A?void 0:A.is_orchestrator)&&!1===(null===(z=null===(W=e.chatStream)||void 0===W?void 0:W.continueChatResult)||void 0===z?void 0:z.isEnd)){var Z,K;(Z=e.chatStream.continueChatResult).explainability_id&&Z.responded_by&&(P=Z.explainability_id,H=Z.responded_by,o.has(P)||o.set(P,{responded_by:H,index:i.length})),o.has(e.chatStream.continueChatResult.explainability_id)?i[null==(K=o.get(e.chatStream.continueChatResult.explainability_id))?void 0:K.index]={responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!1,explainability_id:null!==(j=e.chatStream.continueChatResult.explainability_id)&&void 0!==j?j:"",isParallelToolResponse:!0}:i.push({responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!1,explainability_id:null!==(q=e.chatStream.continueChatResult.explainability_id)&&void 0!==q?q:"",isParallelToolResponse:!1})}return n({orchestratorAndAgentsMessages:i},B)}(e,o,i);Q.time=new Date,Q.citations=V,Q.isEnd=null===(L=null===(D=null==e?void 0:e.chatStream)||void 0===D?void 0:D.continueChatResult)||void 0===L?void 0:L.isEnd,Q.requestId=null===(A=null===(F=null==e?void 0:e.chatStream)||void 0===F?void 0:F.continueChatResult)||void 0===A?void 0:A.requestId,Q.sessionId=ke.current,null===(W=Q.orchestratorAndAgentsMessages)||void 0===W||W.forEach(function(e){e&&e.header_message&&Ft(e)}),(""!==(null==Q?void 0:Q.content)||(null==Q?void 0:Q.orchestratorAndAgentsMessages)&&(null==Q?void 0:Q.orchestratorAndAgentsMessages.length)>0)&&(Be(!1),ze(t(t([],We,!0),[{role:"user",content:r||"",time:a,isFirstQuestionSent:s||!1,id:l||(null===(j=null===(z=null==e?void 0:e.chatStream)||void 0===z?void 0:z.continueChatResult)||void 0===j?void 0:j.requestId)||"",requestId:null!==(P=null===(B=null===(q=null==e?void 0:e.chatStream)||void 0===q?void 0:q.continueChatResult)||void 0===B?void 0:B.requestId)&&void 0!==P?P:""},Q],!1))),Ue(null===(Z=null===(H=null==e?void 0:e.chatStream)||void 0===H?void 0:H.continueChatResult)||void 0===Z?void 0:Z.isEnd)}},Bt=function(e,i,o,a,r,s){var l,d,c=(void 0!==o?o:Le||"").trim(),u="Enter"===(null==e?void 0:e.key)&&!(null==e?void 0:e.shiftKey);if(u&&(null===(l=null==e?void 0:e.preventDefault)||void 0===l||l.call(e)),!(!c||et&&!o||(null==e?void 0:e.key)&&!u)){if("I want to add a rule description"===c){Ue(!1),Me.current=!0,tt(!0),!ut&&c&&ht(o||"manual_entry");var h=new Date;return ze(function(e){return t(t([],e.map(function(e,t){var i;return n(n({},e),{content:null===(i=jt(e.content))||void 0===i?void 0:i.replace("WaitMessage: ","")})}),!0),[{role:"user",content:c,time:h,isFirstQuestionSent:!1,id:r||y()}],!1)}),At("smooth"),void setTimeout(function(){ze(function(e){return t(t([],e,!0),[{role:"assistant",content:"I'd be happy to help you set up a new rule! To get started, could you tell me what kind of behavior or logic you would like this rule to follow?",id:y(),citations:[],time:new Date}],!1)}),At("smooth"),setTimeout(function(){tt(!1),Ue(!0)},500)},500)}Ue(!1),Me.current=!0,tt(!0),!ut&&c&&ht(o||"manual_entry");var m=new Date;ze(function(e){var i=e.map(function(e){var t;return n(n({},e),{content:null===(t=jt(e.content))||void 0===t?void 0:t.replace("WaitMessage: ","")})});return r&&i.some(function(e){return e.id===r})?i.map(function(e){return e.id===r?n(n({},e),{content:c}):e}):t(t([],i,!0),[{role:"user",content:c,time:m,isFirstQuestionSent:!1,id:r||y()}],!1)}),At("smooth");var v=new Map,p=[],C={WEBSOCKET_URL:H,organizationName:B,chatAssistantName:Re,selectedAIModel:"gpt-4",replyMessage:"",userName:"Guest User",userEmailId:"guestUser@example.com",userId:"Guest User",query:c,requestId:"requestId-".concat(y()),customPrompt:"",enableForBackend:!1,guestSessionId:ke.current,chatPreviewId:_e.current,customMetaData:X,aiModel:"",onStreamEvent:function(e){return qt(e,v,p,m,c,i,r)},onStreamEnd:function(e){Ue(!0),tt(!1),vt(!1);var i=Date.now(),o=Tt.current.get(Mt.current);if(o){var a=Math.round((i-o)/1e3).toFixed(1);ze(function(e){var i=t([],e,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===i)return e;var o=e.length-1-i;return e.map(function(e,t){return t===o?n(n({},e),{finalTimeTaken:a}):e})})}},onError:function(e){console.error("Stream error:",e),Ue(!0),tt(!1),vt(!1)}};if(c)Be(!0),null===(d=Ne.current)||void 0===d||d.blur(),Fe(""),At(),Ye(r?"Just a moment, processing your request...":"Okay, got it. Let me take a moment to work on this and I'll get back to you shortly."),Tt.current.set(C.requestId,Date.now()),Mt.current=C.requestId,x(C);s&&s(!1)}},Pt=d(null);v(function(){Pt.current=Bt});var Ht=m(function(){for(var e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return null===(e=Pt.current)||void 0===e?void 0:e.call.apply(e,t([Pt],n,!1))},[]),Zt=u(function(){return{p:function(e){e.node;var t=e.children;return a(e,["node","children"]),r("div",n({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:t}))},button:function(e){e.node;var t=e.className,i=e.children,o=a(e,["node","className","children"]),l=L(i),d=o["data-value"],c="Tester Genie"===l;return r(E,n({},o,{className:t,handleStream:Ht,isStreamEnd:Ke,disabled:!!ut,isLastMessage:!0,style:{margin:0},isTesterGenie:c,"data-selected":ut===l||ut===d?"true":ut?"false":void 0},{children:s("span",n({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[i,c&&s("svg",n({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[r("path",{d:"M7.20368 8.94768e-06C7.48895 -0.00208639 7.69331 0.364327 7.83856 0.57465C8.14381 1.01633 8.38012 1.87909 7.71077 2.14118C8.57167 2.21011 9.70406 2.93098 10.1785 3.64699C10.5932 4.27286 10.4559 5.16037 9.80301 5.56007L9.9502 7.16593C9.97671 7.44871 10.0265 7.87092 10.0299 8.14457C10.4213 8.23046 11.0787 8.55391 11.326 8.87592C11.5979 8.75656 11.9189 8.76963 12.1688 8.93469C12.3563 8.67751 12.5598 8.41456 12.7507 8.15787C12.3283 7.45155 12.5047 6.57745 13.2143 6.13784C13.5375 5.9377 13.9264 5.87277 14.2971 5.95705C14.0961 6.30964 13.8775 6.72182 13.6593 7.05857C13.7906 7.2436 13.9184 7.44225 14.044 7.63194L14.8022 7.63198C15.0349 7.30106 15.2515 6.90827 15.4835 6.59349C15.8623 7.0712 15.8156 7.79671 15.4734 8.28241C15.1318 8.76741 14.4886 8.9899 13.9118 8.88251C13.758 9.12108 13.5577 9.39243 13.3941 9.63201C13.7143 9.9316 13.7725 10.364 13.4067 10.6594C13.5231 10.8889 13.5309 11.1613 13.447 11.402C13.1502 12.2523 12.1724 12.5645 11.3474 12.5025C11.1171 12.4852 10.939 12.4698 10.7197 12.3953C10.8724 13.1271 10.7744 14.2031 10.5132 14.9051C10.1688 15.8304 9.43632 16.5569 8.54503 16.9655C7.90465 17.2706 7.21222 17.3607 6.50472 17.4505C5.74445 17.5471 4.75801 17.4362 4.08533 17.825C3.9327 17.9132 3.86566 18.0173 3.82943 18.1792C3.94996 18.5982 4.47858 18.6063 4.78474 18.8897C5.20191 19.2758 4.90716 19.9663 4.36611 19.9908C4.31476 19.9931 4.26867 19.9867 4.23186 19.9493C4.23089 19.8303 4.47587 19.7199 4.49787 19.5262C4.55075 19.0604 3.70014 19.0078 3.37835 18.8374C3.13013 18.706 2.99537 18.6309 2.82242 18.4021C2.63795 18.1579 2.58428 17.835 2.63138 17.5392C2.74868 16.7847 3.47123 16.393 4.12184 16.1497C4.61314 15.9659 5.46304 15.7158 5.52019 15.0793C5.58589 14.348 4.97543 13.5523 4.57739 12.9807C4.44275 12.7875 4.3039 12.579 4.16309 12.3919C4.18987 12.365 4.21049 12.3463 4.23916 12.3212C4.59619 12.6218 5.21209 12.6421 5.55038 12.2979C5.70457 12.144 5.78974 11.9342 5.78642 11.7164C5.78121 11.4493 5.63382 11.2002 5.4454 11.019C5.44704 10.9932 5.44824 10.9676 5.449 10.9419C5.4566 10.6648 5.37505 10.4902 5.1892 10.2943C5.18398 10.2538 5.17776 10.2134 5.17053 10.1732C5.08123 9.69297 4.71708 9.34182 4.23415 9.27108C4.16418 9.26083 3.96108 9.26105 3.92071 9.23344C3.90485 9.1828 3.9059 9.20792 3.91904 9.15527C4.22103 8.90139 4.14407 8.78214 4.31107 8.4846C4.42301 8.28513 4.73047 8.15239 4.95452 8.10701C4.96167 7.51076 5.03684 6.88562 5.10036 6.29144C5.12451 6.0655 5.12531 5.75046 5.1511 5.55257C4.11108 4.86747 4.39091 3.75946 5.25465 3.06391C5.84978 2.58469 6.34496 2.31002 7.10143 2.14517C7.01589 2.10416 6.93842 2.04811 6.87269 1.97972C6.77021 1.87349 6.70248 1.73857 6.67853 1.59293C6.60568 1.12096 7.04104 0.914625 7.18759 0.526392C7.26428 0.323403 7.03925 0.146075 7.20368 8.94768e-06Z",fill:"#475569"}),r("path",{d:"M7.459 4.5C7.48797 4.50312 7.71949 4.61154 7.76205 4.63061C8.27062 4.85835 8.87051 5.09164 9.35658 5.3582C9.36602 6.03495 9.37016 6.56625 8.70573 6.91519C8.6633 6.80883 8.63019 6.72409 8.56332 6.63044C8.43786 6.45568 8.24656 6.33963 8.03354 6.30909C7.8434 6.28211 7.65146 6.3197 7.49586 6.43503C7.21897 6.21256 6.76265 6.28197 6.5229 6.52486C6.39308 6.65639 6.34815 6.75074 6.28902 6.92344C5.59702 6.5957 5.58761 6.04267 5.60583 5.35582C5.89882 5.23844 6.21318 5.0724 6.50153 4.941C6.82145 4.79522 7.14482 4.6574 7.459 4.5Z",fill:"#D1EDFD"}),r("path",{d:"M11.0756 10.6406C11.1037 10.6701 11.1324 10.7706 11.1535 10.8145C11.2818 11.0817 11.4922 11.1945 11.7498 11.2977C11.5607 11.63 11.4567 11.8797 11.1034 12.0466L11.0839 12.0517C10.9262 12.0927 10.7996 12.0968 10.651 12.0135C10.4755 11.915 10.3807 11.6614 10.4792 11.478C10.6388 11.1809 10.8877 10.9272 11.0756 10.6406Z",fill:"#D1EDFD"}),r("path",{d:"M11.6036 9.1377C11.6993 9.11763 11.8391 9.16378 11.9294 9.19593C11.6952 9.50644 11.4706 9.81614 11.2327 10.1261L11.1572 10.2255C10.7581 9.73539 11.0333 9.24481 11.6036 9.1377Z",fill:"#D1EDFD"}),r("path",{d:"M7.49681 0.882812C7.53691 0.925159 7.61244 1.08523 7.63598 1.14156C7.74243 1.39673 7.75769 1.76908 7.38596 1.77504C7.28236 1.75599 7.15628 1.68938 7.13517 1.5783C7.0843 1.3107 7.35609 1.09964 7.48737 0.897583L7.49681 0.882812Z",fill:"#D1EDFD"}),r("path",{d:"M1.68305 6.17249C1.71659 6.1673 1.8134 6.16478 1.84892 6.16432C2.34052 6.15616 2.81496 6.34495 3.16655 6.68866C3.50847 7.01806 3.70349 7.47119 3.70765 7.94596C3.70896 8.42345 3.54045 8.85284 3.20281 9.19025C3.34033 9.28068 3.5321 9.52219 3.6543 9.65748C4.17158 9.39073 4.91447 9.69339 4.79675 10.3444C5.08751 10.5485 5.19656 10.8288 5.0585 11.1674C5.15418 11.2375 5.25595 11.3205 5.32383 11.4186C5.40228 11.5303 5.4309 11.6695 5.40291 11.8031C5.32228 12.1857 4.90085 12.3286 4.57669 12.1236C4.51367 12.0838 4.42258 11.9595 4.35299 11.9431C4.30669 11.9557 4.28453 11.9584 4.23644 11.9644C4.22885 11.9742 4.22118 11.9841 4.21343 11.9938C3.93597 12.3413 3.49234 12.4682 3.06933 12.5157C2.85285 12.518 2.70432 12.5146 2.49066 12.4609C1.80785 12.2892 1.50808 11.6167 1.70723 10.9639C1.829 10.5648 2.11891 10.2506 2.48939 10.0518C2.54655 10.132 2.57559 10.2191 2.64066 10.303C2.73571 10.2223 2.82048 10.1482 2.92363 10.0773C2.81023 9.95313 2.66811 9.7693 2.55817 9.63584C2.38871 9.6878 2.23026 9.72879 2.05298 9.74653C1.54239 9.80228 1.03118 9.64711 0.637735 9.31695C0.269964 9.01018 0.0453493 8.54827 0.00544736 8.07322C-0.0309495 7.60988 0.116099 7.15077 0.414918 6.79478C0.742554 6.41198 1.18728 6.21393 1.68305 6.17249Z",fill:"#475569"}),r("path",{d:"M1.79616 6.5951C2.54894 6.5619 3.18687 7.14364 3.22301 7.8963C3.25915 8.64894 2.67989 9.28913 1.92739 9.3282C1.17073 9.3675 0.526231 8.78435 0.489885 8.02753C0.45354 7.27071 1.03921 6.62849 1.79616 6.5951Z",fill:"#D1EDFD"}),r("path",{d:"M4.93607 11.4844C5.12839 11.6261 5.22049 11.9085 4.91876 11.9419C4.8067 11.8805 4.78491 11.8646 4.71094 11.7561C4.81572 11.6752 4.862 11.5925 4.93607 11.4844Z",fill:"#FEFEFD"}),r("path",{d:"M12.5164 3.58594L12.5715 3.59466C12.6589 3.65863 12.6908 3.94434 12.7882 4.05193C12.8789 4.15216 12.9155 4.17816 13.0326 4.24929C13.1363 4.31224 13.3325 4.34025 13.384 4.43124C13.3643 4.56218 13.0693 4.54857 12.9127 4.69344C12.6903 4.89898 12.7114 5.06971 12.5892 5.28622C12.5669 5.28439 12.5368 5.2868 12.5261 5.27346C12.4336 5.15843 12.4072 4.9308 12.3099 4.81465C12.1627 4.63903 11.9972 4.60054 11.7981 4.51372C11.7544 4.49467 11.7266 4.47099 11.7129 4.42649C11.7867 4.31876 12.0509 4.34309 12.2376 4.14892C12.43 3.94901 12.4155 3.72208 12.5164 3.58594Z",fill:"#475569"}),r("path",{d:"M2.13644 3.72656C2.24401 3.77084 2.29712 4.1268 2.431 4.25226C2.60327 4.41371 2.7311 4.41949 2.93246 4.52449C2.96024 4.53897 2.97173 4.56042 2.97671 4.58878C2.89584 4.6981 2.61854 4.70721 2.4596 4.85659C2.26275 5.04156 2.27341 5.29132 2.17022 5.42088C2.16192 5.41849 2.11671 5.40232 2.1156 5.40043C2.01291 5.21216 1.9836 5.04909 1.84812 4.87273C1.73599 4.72675 1.36534 4.69959 1.32812 4.56939C1.3835 4.47941 1.67823 4.44211 1.82291 4.30563C2.02737 4.11274 2.0042 3.8372 2.13644 3.72656Z",fill:"#475569"})]}))]}))}))}}},[Ht,Ke,ut]),Kt=u(function(){return We.some(function(e){return e.isSkeleton})},[We]),Ut=function(e){return i(void 0,void 0,void 0,function(){return o(this,function(n){switch(n.label){case 0:return we?[4,we(e)]:[3,2];case 1:n.sent(),ze(function(e){return t(t([],e,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:y(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return At("smooth")},100),n.label=2;case 2:return[2]}})})};return console.log(We,"rendering messages"),s("div",n({className:"".concat(I.customFont," ").concat(M.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:Se&&!Kt?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[s("div",n({ref:Te,className:M.scrollWrapper},{children:[r("div",n({ref:ft,className:M.stickyHeader},{children:r(R,{resetChatHistory:function(){var e="".concat(Ee,"/api/chat/resetHistory?name=").concat(Re,"&organizationName=").concat(B);try{var t={method:"GET",params:{guestSessionId:ke.current},withCredentials:!0};b.get(e,t).then(function(){Z(!0),Je(""),ht(null),St.current.clear(),_e.current="".concat(y()),ze([]),Ve(!0),null==ee||ee(),G&&G()}).catch(function(e){console.error(e)}).finally(function(){ke.current="".concat(Re,"-").concat(B,"-").concat(y())})}catch(e){Be(!1),console.error(e)}},isStreamEnd:Ke,chatTitle:Q,onResize:ae,chatSize:oe,movingTowards:re})})),s("div",n({className:M.messagesList},{children:[s("div",n({className:M.initialMessageRow},{children:[r("div",n({className:M.iconWrapper},{children:r(A,{})})),r("div",n({className:M.welcomeTextWrapper},{children:r("div",n({className:M.welcomeMarkdownWrapper},{children:r("span",{children:r(f,n({rehypePlugins:[S],components:Zt},{children:ne}))})}))}))]})),We.length>0&&We.map(function(e,t){return s("div",n({className:M.messageRow},{children:["assistant"===e.role?r("div",n({className:M.assistantIconContainer},{children:r(A,{})})):r("div",{className:M.userSpacer}),r("div",n({className:M.messageContent},{children:"assistant"===e.role?s(l,{children:[e.orchestratorAndAgentsMessages&&e.orchestratorAndAgentsMessages.length>0&&r(w,{orchestratorAndAgentsMessages:null==e?void 0:e.orchestratorAndAgentsMessages,isStreamEnd:Ke,finalTimeTaken:null==e?void 0:e.finalTimeTaken},null==e?void 0:e.id),r(k,{index:t,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:We,handleStream:Bt,isLastMessage:t===We.length-1,onSave:ie,citations:null==e?void 0:e.citations,setChatSize:ae,chatSize:oe,isStreamEnd:Ke,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:ye,onTypeResponseClick:function(){var e;kt(!0),null===(e=Ne.current)||void 0===e||e.focus()},onComparisonLinkClick:xe,baseURL:Ee,onFeedbackSubmit:Ut}),r("div",n({className:M.timestamp},{children:e.time&&!isNaN(new Date(e.time).getTime())?new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}):s("div",n({className:M.userMessageWrapper},{children:[s("div",n({className:M.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:e.isSkeleton||Kt||e.id!==yt?"none":"0 0 15px 3px rgba(37, 99, 235, 0.6)"}},{children:[e.isSkeleton?s("div",n({style:{display:"flex",flexDirection:"column",gap:"12px",minWidth:"280px",padding:"8px 0"}},{children:[r(_,{variant:"text",width:"100%",height:16}),r(_,{variant:"text",width:"80%",height:16})]})):r(k,{index:t,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:We,handleStream:Bt,isLastMessage:t===We.length-1,onSave:ie,citations:null==e?void 0:e.citations,isStreamEnd:Ke,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:ye,onComparisonLinkClick:xe,baseURL:Ee,onFeedbackSubmit:Ut}),r("div",n({style:{marginTop:"0.5rem"}},{children:r(W,{})}))]})),r("div",n({className:M.userTimestamp},{children:new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),e.id)}),qe&&s("div",n({className:M.loadingRow},{children:[r("div",n({className:M.iconWrapper,style:{marginTop:"0.2rem"}},{children:r(A,{})})),r("div",n({className:M.loadingTextWrapper},{children:r("span",{children:Xe})}))]})),r("div",{ref:Ie,style:{float:"left",clear:"both"}})]}))]})),s("div",n({className:M.inputAreaWrapper},{children:[et&&s(C,n({sx:{display:"flex",alignItems:"center",gap:"8px",paddingBottom:"8px",paddingLeft:"4px",fontFamily:'"Plus Jakarta Sans", sans-serif',fontSize:"0.875rem",color:"#6b7280",width:"100%"}},{children:[r("span",{children:"Instant Learning AI is thinking"}),r(C,{sx:{width:"5px",height:"5px",bgcolor:"#6b7280",borderRadius:"50%",animation:"".concat(It," 1.4s infinite ease-in-out both"),animationDelay:"-0.32s"}}),r(C,{sx:{width:"5px",height:"5px",bgcolor:"#6b7280",borderRadius:"50%",animation:"".concat(It," 1.4s infinite ease-in-out both"),animationDelay:"-0.16s"}}),r(C,{sx:{width:"5px",height:"5px",bgcolor:"#6b7280",borderRadius:"50%",animation:"".concat(It," 1.4s infinite ease-in-out both")}})]})),r(g,n({title:J?"Please wait for the validation to be completed.":""},{children:s("div",n({className:"".concat(M.inputBoxContainer," ").concat(Dt?M.disabled:""),style:Rt?{boxShadow:"0 0 15px 3px rgba(37, 99, 235, 0.5)",borderColor:"#2563eb",transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}:{transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}},{children:[We.length>0&&!rt&&r("div",n({onMouseDown:function(e){e.preventDefault(),At("smooth")},className:M.scrollToBottomBtn},{children:r(N,{})})),s("div",n({style:{width:"100%",display:"flex"}},{children:[r("textarea",{ref:Ne,placeholder:de,value:Le||"",onChange:function(e){Fe(e.target.value)},onFocus:function(){return ot(!0)},onBlur:function(){return ot(!1)},onKeyDown:function(e){return Bt(e)},disabled:Dt,className:"no-scrollbar ".concat(M.chatTextarea),style:{minHeight:it?"120px":"50px",height:it?"120px":"50px",maxHeight:"120px"}}),r("span",n({className:M.sendButtonWrapper},{children:r("button",n({onClick:function(e){Bt(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:Lt,className:"".concat(M.sendButton," ").concat(Lt?M.disabled:M.active)},{children:r(F,{})}))}))]}))]}))}))]})),s("div",n({className:M.footerTools},{children:[r(g,n({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:r("span",n({className:M.footerToolItem},{children:r(T,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),r(g,n({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:r("span",n({className:M.footerToolItem},{children:r(T,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]}))]}))};export{j as default};
1
+ import{__makeTemplateObject as e,__spreadArray as t,__assign as n,__awaiter as i,__generator as o,__rest as a}from"tslib";import{jsx as r,jsxs as s,Fragment as l}from"react/jsx-runtime";import{useRef as d,useState as c,useMemo as u,useEffect as h,useCallback as m,useLayoutEffect as v}from"react";import{keyframes as C,Box as p}from"@mui/material";import g from"@mui/material/Tooltip";import f from"react-markdown";import S from"rehype-raw";import b from"axios";import{v4 as y}from"uuid";import{startChatStream as x}from"@e-llm-studio/streaming-response";import{WatchMeWork as w}from"@e-llm-studio/watch-me-work";import R from"./ChatHeader.js";import k from"../MessageRendering/MessageRendering.js";import{Skeleton as _}from"../atoms/SkeletonLoader/SkeletonLoader.js";import{ActionableButton as E}from"../MessageRendering/ClickableChatComponents.js";import T from"../AudioWaveform.js";import M from"./ChatComponent.module.css.js";import I from"../../InstantLearning.module.css.js";import{ScrollToBottom as N}from"../_svg/ScrollToBottom.js";import{useHeaderObserver as D,extractTextFromChildren as L}from"../../helpers/utils.js";import{SendButton as F}from"../_svg/SendButton.js";import A from"../_svg/SparkleIcon.js";import{UserIcon as W}from"../_svg/UserIcon.js";var z,q=function(q){var B=q.chatAssistantName,P=q.organizationName,j=q.baseUrl,H=q.baseWebsocketUrl,Z=q.setIsNewChatClicked;q.ThinkingBulbIconComponent;var K=q.isFormSaveClicked,U=q.setIsFormSavedClicked,G=q.onResetLearningData,V=q.sendMessageInChat,O=q.setSendMessageInChat,J=q.isFormValidating,Q=q.chatTitle,X=q.customMetaData,Y=q.headerMessageHandlers;q.aiResponse;var $=q.setAIResponse,ee=q.onResetChat,te=q.initialChatMessage,ne=void 0===te?"":te,ie=q.onSave,oe=q.chatSize,ae=q.setChatSize,re=q.movingTowards,se=q.setCitations,le=q.textareaPlaceholder,de=void 0===le?"Tell me more about this learning...":le,ce=q.setCurrentRequestId,ue=q.showSavedMessage,he=void 0!==ue&&ue,me=q.savedMessage,ve=q.isError,Ce=void 0!==ve&&ve,pe=q.errorMessage,ge=void 0===pe?"There was an error saving your changes.":pe;q.isSaving;var fe=q.isHighlighted,Se=void 0!==fe&&fe,be=q.onStreamingStateChange,ye=q.onViewComparison;q.isCopyEnabled;var xe=q.onComparisonLinkClick,we=q.onSubmitFeedback,Re=B,ke=d("".concat(Re,"-").concat(P,"-").concat(y())),_e=d("".concat(y())),Ee=j,Te=d(null),Me=d(!0),Ie=d(null),Ne=d(null),De=c(""),Le=De[0],Fe=De[1],Ae=c([]),We=Ae[0],ze=Ae[1],qe=c(!1),Be=qe[0],Pe=qe[1],je=c(!1);je[0];var He=je[1],Ze=c(!0),Ke=Ze[0],Ue=Ze[1],Ge=c(!0);Ge[0];var Ve=Ge[1],Oe=c("");Oe[0];var Je=Oe[1],Qe=c(""),Xe=Qe[0],Ye=Qe[1],$e=c(!1),et=$e[0],tt=$e[1],nt=c(!1),it=nt[0],ot=nt[1],at=c(!0),rt=at[0],st=at[1],lt=c("100%");lt[0];var dt=lt[1],ct=c(null),ut=ct[0],ht=ct[1],mt=c(!1);mt[0];var vt=mt[1],Ct=c(!1),pt=Ct[0],gt=Ct[1],ft=d(null),St=d(new Set),bt=c(null),yt=bt[0],xt=bt[1],wt=c(!1),Rt=wt[0],kt=wt[1],_t=c(!1);_t[0],_t[1];var Et=c(null);Et[0],Et[1],d(null),d(null);var Tt=d(new Map),Mt=d(""),It=C(z||(z=e(["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "],["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "]))),Nt=u(function(){return""===(null==Le?void 0:Le.trim())||et},[Le,et]),Dt=u(function(){return J},[J]),Lt=u(function(){return Nt||et||J},[Nt,et,J]);h(function(){null==be||be(et)},[et,be]),h(function(){var e=Te.current,t=function(){if(e){var t=e.scrollTop,n=e.scrollHeight,i=e.clientHeight;st(n-t-i<=20)}};return e&&(e.addEventListener("scroll",t),t()),function(){e&&e.removeEventListener("scroll",t)}},[We]);var Ft=D({handlers:Y,setResult:$}).processHeaderMessage;h(function(){he&&gt(!0)},[he]),h(function(){if(Rt){var e=setTimeout(function(){kt(!1)},3e3);return function(){return clearTimeout(e)}}},[Rt]),h(function(){K&&(Pt(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),U(!1))},[K]),h(function(){if(V)try{if(V.startsWith("__SKELETON__:")){var e=V.split(":"),i=e[1],o=e.slice(2).join(":"),a={role:"user",content:"",id:i,time:new Date,isSkeleton:!0,skeletonContent:o};return ze(function(e){return t(t([],e,!0),[a],!1)}),Pt(new KeyboardEvent("keydown",{key:"Enter"}),!1,o,!1,i),xt(i),O&&O(""),void setTimeout(function(){xt(null)},2e3)}if(V.startsWith("__SKELETON_END__::")){var r=V.split("::")[1]||"";return ze(function(e){return e.map(function(e){return e.isSkeleton?n(n({},e),{isSkeleton:!1,content:e.skeletonContent||r}):e})}),void(O&&O(""))}var s=y();Pt(new KeyboardEvent("keydown",{key:"Enter"}),!1,V,!1,s),xt(s),O&&O(""),setTimeout(function(){return xt(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[V]),h(function(){Wt(),zt();var e=function(){var e,t=(null===(e=null==ft?void 0:ft.current)||void 0===e?void 0:e.clientHeight)||0,n="calc(100% - ".concat(t,"px - 10px)");dt(n)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var At=m(function(e){var t="string"==typeof e?e:"smooth";Ie.current&&Ie.current.scrollIntoView({behavior:t,block:"end"}),Me.current&&setTimeout(function(){Ie.current&&Me.current&&Ie.current.scrollIntoView({behavior:t,block:"end"})},100)},[]);h(function(){if(!et){var e="";if(pt?e=me||"Thank you teacher for teaching me, your rule has been saved successfully.":Ce&&(e=ge||"I'm sorry, I couldn't save your changes. Please try again."),e){var n={role:"assistant",content:e,id:y(),citations:[],time:new Date};ze(function(e){return t(t([],e,!0),[n],!1)}),gt(!1),setTimeout(function(){return At("smooth")},100)}}},[pt,Ce,et,me,ge,At]),h(function(){Me.current&&At("smooth")},[At]);var Wt=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(Ee,"/api/chatbot/getChatSettings?name=").concat(Re,"&organizationName=").concat(P),headers:{}};b.request(e).then(function(e){var t,n,i;(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)&&""!==(null===(i=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)||void 0===i?void 0:i.chatInitialMessage)&&Ve(!0)}).catch(function(e){console.error(e)})},zt=function(){return i(void 0,void 0,void 0,function(){var e,t;return o(this,function(n){e="".concat(Ee,"/api/chat/history?name=").concat(Re,"&organizationName=").concat(P);try{t={method:"GET",params:{guestSessionId:ke.current},withCredentials:!0},b.get(e,t).then(function(e){var t=e.data;t.length>0?(ze(t),At()):Ve(!0)}).catch(function(e){console.error(e)})}catch(e){Pe(!1),console.error(e)}return[2]})})};function qt(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var Bt=function(e,i,o,a,r,s,l){var d,c,u,h,m,v,C,p,g,f,S,b,x,w,R,k,_,E,T,M,I,N,D,L,F,A,W,z,q,B,P,j,H,Z;if(null===(c=null===(d=null==e?void 0:e.chatStream)||void 0===d?void 0:d.continueChatResult)||void 0===c?void 0:c.header_message){var K={header_message:e.chatStream.continueChatResult.header_message,responsedata:null===(m=null===(h=null===(u=null==e?void 0:e.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===h?void 0:h.message)||void 0===m?void 0:m.content};Ft(K)}var U=null===(v=null==e?void 0:e.chatStream)||void 0===v?void 0:v.continueChatResult,G=null==U?void 0:U.isEnd,V=(null===(C=null==U?void 0:U.message)||void 0===C?void 0:C.citations)||[];G&&V.length>0&&se&&se(V);var O={role:"assistant",content:"",id:y()};if(null===(S=null===(f=null===(g=null===(p=null==e?void 0:e.chatStream)||void 0===p?void 0:p.continueChatResult)||void 0===g?void 0:g.message)||void 0===f?void 0:f.content)||void 0===S?void 0:S.includes("WaitMessage: "))He(!0),O.content=function(e){var t="WaitMessage: ",n=e.indexOf(t);if(-1!==n){var i=e.substring(n+13);return null==i?void 0:i.replaceAll("WaitMessage: ","")}return""}((null===(w=null===(x=null===(b=null==e?void 0:e.chatStream)||void 0===b?void 0:b.continueChatResult)||void 0===x?void 0:x.message)||void 0===w?void 0:w.content)+"\n\n"),""!==O.content&&(Pe(!1),ze(t(t([],We,!0),[{role:"user",content:r,time:a,isFirstQuestionSent:s||!1,id:l||(null===(k=null===(R=null==e?void 0:e.chatStream)||void 0===R?void 0:R.continueChatResult)||void 0===k?void 0:k.requestId)||"",reply:""},O],!1)));else{He(!1),O.content=null===(M=qt(null===(T=null===(E=null===(_=null==e?void 0:e.chatStream)||void 0===_?void 0:_.continueChatResult)||void 0===E?void 0:E.message)||void 0===T?void 0:T.content))||void 0===M?void 0:M.replaceAll("WaitMessage: ","");var J=null===(N=null===(I=null==e?void 0:e.chatStream)||void 0===I?void 0:I.continueChatResult)||void 0===N?void 0:N.requestId;"string"==typeof J&&J&&ce&&ce(J);var Q=function(e,i,o){var a,r,s,l,d,c,u,h,m,v,C,p,g,f,S,b,x,w,R,k,_,E,T,M,I,N,D,L,F,A,W,z,q,B,P={role:"assistant",content:"",id:y(),time:new Date,citations:[]};if(!1===(null===(r=null===(a=e.chatStream)||void 0===a?void 0:a.continueChatResult)||void 0===r?void 0:r.thinking_break)&&!0===(null===(l=null===(s=e.chatStream)||void 0===s?void 0:s.continueChatResult)||void 0===l?void 0:l.is_orchestrator)&&!1===(null===(c=null===(d=e.chatStream)||void 0===d?void 0:d.continueChatResult)||void 0===c?void 0:c.isEnd)&&(P.content=qt(e.chatStream.continueChatResult.message.content||"")),!0===(null===(h=null===(u=e.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===h?void 0:h.thinking_break)&&!0===(null===(v=null===(m=e.chatStream)||void 0===m?void 0:m.continueChatResult)||void 0===v?void 0:v.is_orchestrator)&&!1===(null===(p=null===(C=e.chatStream)||void 0===C?void 0:C.continueChatResult)||void 0===p?void 0:p.isEnd)&&(P.content="",i.push({responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!1})),!1===(null===(f=null===(g=e.chatStream)||void 0===g?void 0:g.continueChatResult)||void 0===f?void 0:f.thinking_break)&&!0===(null===(b=null===(S=e.chatStream)||void 0===S?void 0:S.continueChatResult)||void 0===b?void 0:b.is_orchestrator)&&!0===(null===(w=null===(x=e.chatStream)||void 0===x?void 0:x.continueChatResult)||void 0===w?void 0:w.isEnd)&&(P.content=qt(e.chatStream.continueChatResult.message.content)),!1===(null===(k=null===(R=e.chatStream)||void 0===R?void 0:R.continueChatResult)||void 0===k?void 0:k.thinking_break)&&!1===(null===(E=null===(_=e.chatStream)||void 0===_?void 0:_.continueChatResult)||void 0===E?void 0:E.is_orchestrator)&&!1===(null===(M=null===(T=e.chatStream)||void 0===T?void 0:T.continueChatResult)||void 0===M?void 0:M.isEnd)){if((Z=e.chatStream.continueChatResult).explainability_id&&Z.responded_by){var j=Z.explainability_id,H=Z.responded_by;o.has(j)||o.set(j,{responded_by:H,index:i.length})}o.has(e.chatStream.continueChatResult.explainability_id)?i[null==(K=o.get(e.chatStream.continueChatResult.explainability_id))?void 0:K.index]={responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!0,explainability_id:null!==(I=e.chatStream.continueChatResult.explainability_id)&&void 0!==I?I:"",isParallelToolResponse:!0}:i=t(t([],i,!0),[{responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!0,explainability_id:null!==(N=e.chatStream.continueChatResult.explainability_id)&&void 0!==N?N:"",isParallelToolResponse:!1}],!1)}if(!0===(null===(L=null===(D=e.chatStream)||void 0===D?void 0:D.continueChatResult)||void 0===L?void 0:L.thinking_break)&&!1===(null===(A=null===(F=e.chatStream)||void 0===F?void 0:F.continueChatResult)||void 0===A?void 0:A.is_orchestrator)&&!1===(null===(z=null===(W=e.chatStream)||void 0===W?void 0:W.continueChatResult)||void 0===z?void 0:z.isEnd)){var Z,K;(Z=e.chatStream.continueChatResult).explainability_id&&Z.responded_by&&(j=Z.explainability_id,H=Z.responded_by,o.has(j)||o.set(j,{responded_by:H,index:i.length})),o.has(e.chatStream.continueChatResult.explainability_id)?i[null==(K=o.get(e.chatStream.continueChatResult.explainability_id))?void 0:K.index]={responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!1,explainability_id:null!==(q=e.chatStream.continueChatResult.explainability_id)&&void 0!==q?q:"",isParallelToolResponse:!0}:i.push({responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!1,explainability_id:null!==(B=e.chatStream.continueChatResult.explainability_id)&&void 0!==B?B:"",isParallelToolResponse:!1})}return n({orchestratorAndAgentsMessages:i},P)}(e,o,i);Q.time=new Date,Q.citations=V,Q.isEnd=null===(L=null===(D=null==e?void 0:e.chatStream)||void 0===D?void 0:D.continueChatResult)||void 0===L?void 0:L.isEnd,Q.requestId=null===(A=null===(F=null==e?void 0:e.chatStream)||void 0===F?void 0:F.continueChatResult)||void 0===A?void 0:A.requestId,Q.sessionId=ke.current,null===(W=Q.orchestratorAndAgentsMessages)||void 0===W||W.forEach(function(e){e&&e.header_message&&Ft(e)}),(""!==(null==Q?void 0:Q.content)||(null==Q?void 0:Q.orchestratorAndAgentsMessages)&&(null==Q?void 0:Q.orchestratorAndAgentsMessages.length)>0)&&(Pe(!1),ze(t(t([],We,!0),[{role:"user",content:r||"",time:a,isFirstQuestionSent:s||!1,id:l||(null===(q=null===(z=null==e?void 0:e.chatStream)||void 0===z?void 0:z.continueChatResult)||void 0===q?void 0:q.requestId)||"",requestId:null!==(j=null===(P=null===(B=null==e?void 0:e.chatStream)||void 0===B?void 0:B.continueChatResult)||void 0===P?void 0:P.requestId)&&void 0!==j?j:""},Q],!1))),Ue(null===(Z=null===(H=null==e?void 0:e.chatStream)||void 0===H?void 0:H.continueChatResult)||void 0===Z?void 0:Z.isEnd)}},Pt=function(e,i,o,a,r,s){var l,d,c=(void 0!==o?o:Le||"").trim(),u="Enter"===(null==e?void 0:e.key)&&!(null==e?void 0:e.shiftKey);if(u&&(null===(l=null==e?void 0:e.preventDefault)||void 0===l||l.call(e)),!(!c||et&&!o||(null==e?void 0:e.key)&&!u)){if("I want to add a rule description"===c){Ue(!1),Me.current=!0,tt(!0),!ut&&c&&ht(o||"manual_entry");var h=new Date;return ze(function(e){return t(t([],e.map(function(e,t){var i;return n(n({},e),{content:null===(i=qt(e.content))||void 0===i?void 0:i.replace("WaitMessage: ","")})}),!0),[{role:"user",content:c,time:h,isFirstQuestionSent:!1,id:r||y()}],!1)}),At("smooth"),void setTimeout(function(){ze(function(e){return t(t([],e,!0),[{role:"assistant",content:"I'd be happy to help you set up a new rule! To get started, could you tell me what kind of behavior or logic you would like this rule to follow?",id:y(),citations:[],time:new Date}],!1)}),At("smooth"),setTimeout(function(){tt(!1),Ue(!0)},500)},500)}Ue(!1),Me.current=!0,tt(!0),!ut&&c&&ht(o||"manual_entry");var m=new Date;ze(function(e){var i=e.map(function(e){var t;return n(n({},e),{content:null===(t=qt(e.content))||void 0===t?void 0:t.replace("WaitMessage: ","")})});return r&&i.some(function(e){return e.id===r})?i.map(function(e){return e.id===r?n(n({},e),{content:c}):e}):t(t([],i,!0),[{role:"user",content:c,time:m,isFirstQuestionSent:!1,id:r||y()}],!1)}),At("smooth");var v=new Map,C=[],p={WEBSOCKET_URL:H,organizationName:P,chatAssistantName:Re,selectedAIModel:"gpt-4",replyMessage:"",userName:"Guest User",userEmailId:"guestUser@example.com",userId:"Guest User",query:c,requestId:"requestId-".concat(y()),customPrompt:"",enableForBackend:!1,guestSessionId:ke.current,chatPreviewId:_e.current,customMetaData:X,aiModel:"",onStreamEvent:function(e){return Bt(e,v,C,m,c,i,r)},onStreamEnd:function(e){Ue(!0),tt(!1),vt(!1);var i=Date.now(),o=Tt.current.get(Mt.current);if(o){var a=Math.round((i-o)/1e3).toFixed(1);ze(function(e){var i=t([],e,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===i)return e;var o=e.length-1-i;return e.map(function(e,t){return t===o?n(n({},e),{finalTimeTaken:a}):e})})}},onError:function(e){console.error("Stream error:",e),Ue(!0),tt(!1),vt(!1)}};if(c)Pe(!0),null===(d=Ne.current)||void 0===d||d.blur(),Fe(""),At(),Ye(r?"Just a moment, processing your request...":"Okay, got it. Let me take a moment to work on this and I'll get back to you shortly."),Tt.current.set(p.requestId,Date.now()),Mt.current=p.requestId,x(p);s&&s(!1)}},jt=d(null);v(function(){jt.current=Pt});var Ht=m(function(){for(var e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return null===(e=jt.current)||void 0===e?void 0:e.call.apply(e,t([jt],n,!1))},[]),Zt=u(function(){return{p:function(e){e.node;var t=e.children;return a(e,["node","children"]),r("div",n({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:t}))},button:function(e){e.node;var t=e.className,i=e.children,o=a(e,["node","className","children"]),l=L(i),d=o["data-value"],c="Tester Genie"===l;return r(E,n({},o,{className:t,handleStream:Ht,isStreamEnd:Ke,disabled:!!ut,isLastMessage:!0,style:{margin:0},isTesterGenie:c,"data-selected":ut===l||ut===d?"true":ut?"false":void 0},{children:s("span",n({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[i,c&&s("svg",n({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[r("path",{d:"M7.20368 8.94768e-06C7.48895 -0.00208639 7.69331 0.364327 7.83856 0.57465C8.14381 1.01633 8.38012 1.87909 7.71077 2.14118C8.57167 2.21011 9.70406 2.93098 10.1785 3.64699C10.5932 4.27286 10.4559 5.16037 9.80301 5.56007L9.9502 7.16593C9.97671 7.44871 10.0265 7.87092 10.0299 8.14457C10.4213 8.23046 11.0787 8.55391 11.326 8.87592C11.5979 8.75656 11.9189 8.76963 12.1688 8.93469C12.3563 8.67751 12.5598 8.41456 12.7507 8.15787C12.3283 7.45155 12.5047 6.57745 13.2143 6.13784C13.5375 5.9377 13.9264 5.87277 14.2971 5.95705C14.0961 6.30964 13.8775 6.72182 13.6593 7.05857C13.7906 7.2436 13.9184 7.44225 14.044 7.63194L14.8022 7.63198C15.0349 7.30106 15.2515 6.90827 15.4835 6.59349C15.8623 7.0712 15.8156 7.79671 15.4734 8.28241C15.1318 8.76741 14.4886 8.9899 13.9118 8.88251C13.758 9.12108 13.5577 9.39243 13.3941 9.63201C13.7143 9.9316 13.7725 10.364 13.4067 10.6594C13.5231 10.8889 13.5309 11.1613 13.447 11.402C13.1502 12.2523 12.1724 12.5645 11.3474 12.5025C11.1171 12.4852 10.939 12.4698 10.7197 12.3953C10.8724 13.1271 10.7744 14.2031 10.5132 14.9051C10.1688 15.8304 9.43632 16.5569 8.54503 16.9655C7.90465 17.2706 7.21222 17.3607 6.50472 17.4505C5.74445 17.5471 4.75801 17.4362 4.08533 17.825C3.9327 17.9132 3.86566 18.0173 3.82943 18.1792C3.94996 18.5982 4.47858 18.6063 4.78474 18.8897C5.20191 19.2758 4.90716 19.9663 4.36611 19.9908C4.31476 19.9931 4.26867 19.9867 4.23186 19.9493C4.23089 19.8303 4.47587 19.7199 4.49787 19.5262C4.55075 19.0604 3.70014 19.0078 3.37835 18.8374C3.13013 18.706 2.99537 18.6309 2.82242 18.4021C2.63795 18.1579 2.58428 17.835 2.63138 17.5392C2.74868 16.7847 3.47123 16.393 4.12184 16.1497C4.61314 15.9659 5.46304 15.7158 5.52019 15.0793C5.58589 14.348 4.97543 13.5523 4.57739 12.9807C4.44275 12.7875 4.3039 12.579 4.16309 12.3919C4.18987 12.365 4.21049 12.3463 4.23916 12.3212C4.59619 12.6218 5.21209 12.6421 5.55038 12.2979C5.70457 12.144 5.78974 11.9342 5.78642 11.7164C5.78121 11.4493 5.63382 11.2002 5.4454 11.019C5.44704 10.9932 5.44824 10.9676 5.449 10.9419C5.4566 10.6648 5.37505 10.4902 5.1892 10.2943C5.18398 10.2538 5.17776 10.2134 5.17053 10.1732C5.08123 9.69297 4.71708 9.34182 4.23415 9.27108C4.16418 9.26083 3.96108 9.26105 3.92071 9.23344C3.90485 9.1828 3.9059 9.20792 3.91904 9.15527C4.22103 8.90139 4.14407 8.78214 4.31107 8.4846C4.42301 8.28513 4.73047 8.15239 4.95452 8.10701C4.96167 7.51076 5.03684 6.88562 5.10036 6.29144C5.12451 6.0655 5.12531 5.75046 5.1511 5.55257C4.11108 4.86747 4.39091 3.75946 5.25465 3.06391C5.84978 2.58469 6.34496 2.31002 7.10143 2.14517C7.01589 2.10416 6.93842 2.04811 6.87269 1.97972C6.77021 1.87349 6.70248 1.73857 6.67853 1.59293C6.60568 1.12096 7.04104 0.914625 7.18759 0.526392C7.26428 0.323403 7.03925 0.146075 7.20368 8.94768e-06Z",fill:"#475569"}),r("path",{d:"M7.459 4.5C7.48797 4.50312 7.71949 4.61154 7.76205 4.63061C8.27062 4.85835 8.87051 5.09164 9.35658 5.3582C9.36602 6.03495 9.37016 6.56625 8.70573 6.91519C8.6633 6.80883 8.63019 6.72409 8.56332 6.63044C8.43786 6.45568 8.24656 6.33963 8.03354 6.30909C7.8434 6.28211 7.65146 6.3197 7.49586 6.43503C7.21897 6.21256 6.76265 6.28197 6.5229 6.52486C6.39308 6.65639 6.34815 6.75074 6.28902 6.92344C5.59702 6.5957 5.58761 6.04267 5.60583 5.35582C5.89882 5.23844 6.21318 5.0724 6.50153 4.941C6.82145 4.79522 7.14482 4.6574 7.459 4.5Z",fill:"#D1EDFD"}),r("path",{d:"M11.0756 10.6406C11.1037 10.6701 11.1324 10.7706 11.1535 10.8145C11.2818 11.0817 11.4922 11.1945 11.7498 11.2977C11.5607 11.63 11.4567 11.8797 11.1034 12.0466L11.0839 12.0517C10.9262 12.0927 10.7996 12.0968 10.651 12.0135C10.4755 11.915 10.3807 11.6614 10.4792 11.478C10.6388 11.1809 10.8877 10.9272 11.0756 10.6406Z",fill:"#D1EDFD"}),r("path",{d:"M11.6036 9.1377C11.6993 9.11763 11.8391 9.16378 11.9294 9.19593C11.6952 9.50644 11.4706 9.81614 11.2327 10.1261L11.1572 10.2255C10.7581 9.73539 11.0333 9.24481 11.6036 9.1377Z",fill:"#D1EDFD"}),r("path",{d:"M7.49681 0.882812C7.53691 0.925159 7.61244 1.08523 7.63598 1.14156C7.74243 1.39673 7.75769 1.76908 7.38596 1.77504C7.28236 1.75599 7.15628 1.68938 7.13517 1.5783C7.0843 1.3107 7.35609 1.09964 7.48737 0.897583L7.49681 0.882812Z",fill:"#D1EDFD"}),r("path",{d:"M1.68305 6.17249C1.71659 6.1673 1.8134 6.16478 1.84892 6.16432C2.34052 6.15616 2.81496 6.34495 3.16655 6.68866C3.50847 7.01806 3.70349 7.47119 3.70765 7.94596C3.70896 8.42345 3.54045 8.85284 3.20281 9.19025C3.34033 9.28068 3.5321 9.52219 3.6543 9.65748C4.17158 9.39073 4.91447 9.69339 4.79675 10.3444C5.08751 10.5485 5.19656 10.8288 5.0585 11.1674C5.15418 11.2375 5.25595 11.3205 5.32383 11.4186C5.40228 11.5303 5.4309 11.6695 5.40291 11.8031C5.32228 12.1857 4.90085 12.3286 4.57669 12.1236C4.51367 12.0838 4.42258 11.9595 4.35299 11.9431C4.30669 11.9557 4.28453 11.9584 4.23644 11.9644C4.22885 11.9742 4.22118 11.9841 4.21343 11.9938C3.93597 12.3413 3.49234 12.4682 3.06933 12.5157C2.85285 12.518 2.70432 12.5146 2.49066 12.4609C1.80785 12.2892 1.50808 11.6167 1.70723 10.9639C1.829 10.5648 2.11891 10.2506 2.48939 10.0518C2.54655 10.132 2.57559 10.2191 2.64066 10.303C2.73571 10.2223 2.82048 10.1482 2.92363 10.0773C2.81023 9.95313 2.66811 9.7693 2.55817 9.63584C2.38871 9.6878 2.23026 9.72879 2.05298 9.74653C1.54239 9.80228 1.03118 9.64711 0.637735 9.31695C0.269964 9.01018 0.0453493 8.54827 0.00544736 8.07322C-0.0309495 7.60988 0.116099 7.15077 0.414918 6.79478C0.742554 6.41198 1.18728 6.21393 1.68305 6.17249Z",fill:"#475569"}),r("path",{d:"M1.79616 6.5951C2.54894 6.5619 3.18687 7.14364 3.22301 7.8963C3.25915 8.64894 2.67989 9.28913 1.92739 9.3282C1.17073 9.3675 0.526231 8.78435 0.489885 8.02753C0.45354 7.27071 1.03921 6.62849 1.79616 6.5951Z",fill:"#D1EDFD"}),r("path",{d:"M4.93607 11.4844C5.12839 11.6261 5.22049 11.9085 4.91876 11.9419C4.8067 11.8805 4.78491 11.8646 4.71094 11.7561C4.81572 11.6752 4.862 11.5925 4.93607 11.4844Z",fill:"#FEFEFD"}),r("path",{d:"M12.5164 3.58594L12.5715 3.59466C12.6589 3.65863 12.6908 3.94434 12.7882 4.05193C12.8789 4.15216 12.9155 4.17816 13.0326 4.24929C13.1363 4.31224 13.3325 4.34025 13.384 4.43124C13.3643 4.56218 13.0693 4.54857 12.9127 4.69344C12.6903 4.89898 12.7114 5.06971 12.5892 5.28622C12.5669 5.28439 12.5368 5.2868 12.5261 5.27346C12.4336 5.15843 12.4072 4.9308 12.3099 4.81465C12.1627 4.63903 11.9972 4.60054 11.7981 4.51372C11.7544 4.49467 11.7266 4.47099 11.7129 4.42649C11.7867 4.31876 12.0509 4.34309 12.2376 4.14892C12.43 3.94901 12.4155 3.72208 12.5164 3.58594Z",fill:"#475569"}),r("path",{d:"M2.13644 3.72656C2.24401 3.77084 2.29712 4.1268 2.431 4.25226C2.60327 4.41371 2.7311 4.41949 2.93246 4.52449C2.96024 4.53897 2.97173 4.56042 2.97671 4.58878C2.89584 4.6981 2.61854 4.70721 2.4596 4.85659C2.26275 5.04156 2.27341 5.29132 2.17022 5.42088C2.16192 5.41849 2.11671 5.40232 2.1156 5.40043C2.01291 5.21216 1.9836 5.04909 1.84812 4.87273C1.73599 4.72675 1.36534 4.69959 1.32812 4.56939C1.3835 4.47941 1.67823 4.44211 1.82291 4.30563C2.02737 4.11274 2.0042 3.8372 2.13644 3.72656Z",fill:"#475569"})]}))]}))}))}}},[Ht,Ke,ut]),Kt=u(function(){return We.some(function(e){return e.isSkeleton})},[We]),Ut=function(e){return i(void 0,void 0,void 0,function(){return o(this,function(n){switch(n.label){case 0:return we?[4,we(e)]:[3,2];case 1:n.sent(),ze(function(e){return t(t([],e,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:y(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return At("smooth")},100),n.label=2;case 2:return[2]}})})};return console.log(We,"rendering messages"),s("div",n({className:"".concat(I.customFont," ").concat(M.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:Se&&!Kt?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[s("div",n({ref:Te,className:M.scrollWrapper},{children:[r("div",n({ref:ft,className:M.stickyHeader},{children:r(R,{resetChatHistory:function(){var e="".concat(Ee,"/api/chat/resetHistory?name=").concat(Re,"&organizationName=").concat(P);try{var t={method:"GET",params:{guestSessionId:ke.current},withCredentials:!0};b.get(e,t).then(function(){Z(!0),Je(""),ht(null),St.current.clear(),_e.current="".concat(y()),ze([]),Ve(!0),null==ee||ee(),G&&G()}).catch(function(e){console.error(e)}).finally(function(){ke.current="".concat(Re,"-").concat(P,"-").concat(y())})}catch(e){Pe(!1),console.error(e)}},isStreamEnd:Ke,chatTitle:Q,onResize:ae,chatSize:oe,movingTowards:re})})),s("div",n({className:M.messagesList},{children:[s("div",n({className:M.initialMessageRow},{children:[r("div",n({className:M.iconWrapper},{children:r(A,{})})),r("div",n({className:M.welcomeTextWrapper},{children:r("div",n({className:M.welcomeMarkdownWrapper},{children:r("span",{children:r(f,n({rehypePlugins:[S],components:Zt},{children:ne}))})}))}))]})),We.length>0&&We.map(function(e,t){return s("div",n({className:M.messageRow},{children:["assistant"===e.role?r("div",n({className:M.assistantIconContainer},{children:r(A,{})})):r("div",{className:M.userSpacer}),r("div",n({className:M.messageContent},{children:"assistant"===e.role?s(l,{children:[e.orchestratorAndAgentsMessages&&e.orchestratorAndAgentsMessages.length>0&&r(w,{orchestratorAndAgentsMessages:null==e?void 0:e.orchestratorAndAgentsMessages,isStreamEnd:Ke,finalTimeTaken:null==e?void 0:e.finalTimeTaken},null==e?void 0:e.id),r(k,{index:t,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:We,handleStream:Pt,isLastMessage:t===We.length-1,onSave:ie,citations:null==e?void 0:e.citations,setChatSize:ae,chatSize:oe,isStreamEnd:Ke,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:ye,onTypeResponseClick:function(){var e;kt(!0),null===(e=Ne.current)||void 0===e||e.focus()},onComparisonLinkClick:xe,baseURL:Ee,onFeedbackSubmit:Ut}),r("div",n({className:M.timestamp},{children:e.time&&!isNaN(new Date(e.time).getTime())?new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}):s("div",n({className:M.userMessageWrapper},{children:[s("div",n({className:M.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:e.isSkeleton||Kt||e.id!==yt?"none":"0 0 15px 3px rgba(37, 99, 235, 0.6)"}},{children:[e.isSkeleton?s("div",n({style:{display:"flex",flexDirection:"column",gap:"12px",minWidth:"280px",padding:"8px 0"}},{children:[r(_,{variant:"text",width:"100%",height:16}),r(_,{variant:"text",width:"80%",height:16})]})):r(k,{index:t,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:We,handleStream:Pt,isLastMessage:t===We.length-1,onSave:ie,citations:null==e?void 0:e.citations,isStreamEnd:Ke,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:ye,onComparisonLinkClick:xe,baseURL:Ee,onFeedbackSubmit:Ut}),r("div",n({style:{marginTop:"0.5rem"}},{children:r(W,{})}))]})),r("div",n({className:M.userTimestamp},{children:new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),e.id)}),Be&&s("div",n({className:M.loadingRow},{children:[r("div",n({className:M.iconWrapper,style:{marginTop:"0.2rem"}},{children:r(A,{})})),r("div",n({className:M.loadingTextWrapper},{children:r("span",{children:Xe})}))]})),r("div",{ref:Ie,style:{float:"left",clear:"both"}})]}))]})),s("div",n({className:M.inputAreaWrapper},{children:[et&&s(p,n({sx:{display:"flex",alignItems:"center",gap:"8px",paddingBottom:"8px",paddingLeft:"4px",fontFamily:'"Plus Jakarta Sans", sans-serif',fontSize:"0.875rem",color:"#6b7280",width:"100%"}},{children:[r("span",{children:"Instant Learning AI is thinking"}),r(p,{sx:{width:"5px",height:"5px",bgcolor:"#6b7280",borderRadius:"50%",animation:"".concat(It," 1.4s infinite ease-in-out both"),animationDelay:"-0.32s"}}),r(p,{sx:{width:"5px",height:"5px",bgcolor:"#6b7280",borderRadius:"50%",animation:"".concat(It," 1.4s infinite ease-in-out both"),animationDelay:"-0.16s"}}),r(p,{sx:{width:"5px",height:"5px",bgcolor:"#6b7280",borderRadius:"50%",animation:"".concat(It," 1.4s infinite ease-in-out both")}})]})),r(g,n({title:J?"Please wait for the validation to be completed.":""},{children:s("div",n({className:"".concat(M.inputBoxContainer," ").concat(Dt?M.disabled:""),style:Rt?{boxShadow:"0 0 15px 3px rgba(37, 99, 235, 0.5)",borderColor:"#2563eb",transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}:{transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}},{children:[We.length>0&&!rt&&r("div",n({onMouseDown:function(e){e.preventDefault(),At("smooth")},className:M.scrollToBottomBtn},{children:r(N,{})})),s("div",n({style:{width:"100%",display:"flex"}},{children:[r("textarea",{ref:Ne,placeholder:de,value:Le||"",onChange:function(e){Fe(e.target.value)},onFocus:function(){return ot(!0)},onBlur:function(){return ot(!1)},onKeyDown:function(e){return Pt(e)},disabled:Dt,className:"no-scrollbar ".concat(M.chatTextarea),style:{minHeight:it?"120px":"50px",height:it?"120px":"50px",maxHeight:"120px"}}),r("span",n({className:M.sendButtonWrapper},{children:r("button",n({onClick:function(e){Pt(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:Lt,className:"".concat(M.sendButton," ").concat(Lt?M.disabled:M.active)},{children:r(F,{})}))}))]}))]}))}))]})),s("div",n({className:M.footerTools},{children:[r(g,n({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:r("span",n({className:M.footerToolItem},{children:r(T,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),r(g,n({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:r("span",n({className:M.footerToolItem},{children:r(T,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]}))]}))};export{q as default};
2
2
  //# sourceMappingURL=NormalChat.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{getGuidelineRuntimeConfig as a}from"./guideline.runtime.config.js";import"uuid";import"../../../api/transport.js";var t=function(t,r,o){var i;return a().apiAdapter.makeApiRequest(t,r,e(e({},o),{baseURL:null!==(i=null==o?void 0:o.baseURL)&&void 0!==i?i:a().apiBaseUrls.chatManagement}))},r={"Content-Type":"application/json"},o={"Content-Type":"application/x-www-form-urlencoded"},i=function(e){var a;return t("get","/cw_core/memstore/memstore/user_data_cart",{params:{user_email:e.user_email,limit:null!==(a=e.limit)&&void 0!==a?a:10,status:e.status},errorMessage:"Failed to fetch data cart"})},n=function(e){return t("post","/cw_core/memstore/memstore/handle",{data:e,config:{headers:r},errorMessage:"Failed to update memstore"})},s=function(e,a,r){return t("post","/proposals/chats?chat_id=".concat(e,"&email_id=").concat(encodeURIComponent(a)),{data:{streaming_response:r},errorMessage:"Failed to upload ChatHistory"})},p=function(e,a,r,i){var n=new URLSearchParams;return n.append("email",e),n.append("chat_id",a),n.append("artifact_id",r||""),n.append("project_id",i||""),t("put","/user/appsec/addConversation",{data:n.toString(),config:{headers:o,timeout:3e5},errorMessage:"Failed to add conversation"})};export{p as addConversation,i as getDataCart,n as updateMemstoreArtifacts,s as uploadChatHistory};
1
+ import{__assign as e}from"tslib";import{getGuidelineRuntimeConfig as a}from"./guideline.runtime.config.js";import"uuid";var t=function(t,r,o){var n;return a().apiAdapter.makeApiRequest(t,r,e(e({},o),{baseURL:null!==(n=null==o?void 0:o.baseURL)&&void 0!==n?n:a().apiBaseUrls.chatManagement}))},r={"Content-Type":"application/json"},o={"Content-Type":"application/x-www-form-urlencoded"},n=function(e){var a;return t("get","/cw_core/memstore/memstore/user_data_cart",{params:{user_email:e.user_email,limit:null!==(a=e.limit)&&void 0!==a?a:10,status:e.status},errorMessage:"Failed to fetch data cart"})},i=function(e){return t("post","/cw_core/memstore/memstore/handle",{data:e,config:{headers:r},errorMessage:"Failed to update memstore"})},s=function(e,a,r){return t("post","/proposals/chats?chat_id=".concat(e,"&email_id=").concat(encodeURIComponent(a)),{data:{streaming_response:r},errorMessage:"Failed to upload ChatHistory"})},d=function(e,a,r,n){var i=new URLSearchParams;return i.append("email",e),i.append("chat_id",a),i.append("artifact_id",r||""),i.append("project_id",n||""),t("put","/user/appsec/addConversation",{data:i.toString(),config:{headers:o,timeout:3e5},errorMessage:"Failed to add conversation"})};export{d as addConversation,n as getDataCart,i as updateMemstoreArtifacts,s as uploadChatHistory};
2
2
  //# sourceMappingURL=guideline.core.api.js.map
@@ -1,2 +1,2 @@
1
- import{__awaiter as t,__generator as n}from"tslib";import{getGuidelineRuntimeConfig as a}from"./guideline.runtime.config.js";import{http as e}from"../../../api/transport.js";function i(a,i,o){var r;return t(this,void 0,void 0,function(){var t;return n(this,function(n){switch(n.label){case 0:return[4,e.get("".concat(a,"/instant_learning/ilotj/application/getRBACAuditConfig/").concat(o),{headers:{accept:"application/json, text/plain, */*",authorization:"Bearer ".concat(i)}})];case 1:return t=n.sent(),[2,null===(r=t.data)||void 0===r?void 0:r.data]}})})}var o=function(e){return t(void 0,void 0,void 0,function(){return n(this,function(t){return[2,(n="put",i="/cw_chat_management/cart/guidelines/".concat(encodeURIComponent(e)),o={data:{data:[]},config:{headers:{"Content-Type":"application/json"}},errorMessage:"Failed to remove instant learning guideline from cart",baseURL:a().apiBaseUrls.chatManagement},a().apiAdapter.makeApiRequest(n,i,o))];var n,i,o})})};export{i as fetchRBACConfig,o as removeInstantLearningGuidelinesFromCart};
1
+ import{__awaiter as t,__generator as n}from"tslib";import{getGuidelineRuntimeConfig as e}from"./guideline.runtime.config.js";function a(e,a,i){return t(this,void 0,void 0,function(){var t;return n(this,function(n){switch(n.label){case 0:return[4,fetch("".concat(e,"/instant_learning/ilotj/application/getRBACAuditConfig/").concat(i),{headers:{accept:"application/json, text/plain, */*",authorization:"Bearer ".concat(a)}})];case 1:if(!(t=n.sent()).ok)throw new Error("Failed to fetch RBAC config: ".concat(t.status));return[4,t.json()];case 2:return[2,n.sent().data]}})})}var i=function(a){return t(void 0,void 0,void 0,function(){return n(this,function(t){return[2,(n="put",i="/cw_chat_management/cart/guidelines/".concat(encodeURIComponent(a)),o={data:{data:[]},config:{headers:{"Content-Type":"application/json"}},errorMessage:"Failed to remove instant learning guideline from cart",baseURL:e().apiBaseUrls.chatManagement},e().apiAdapter.makeApiRequest(n,i,o))];var n,i,o})})};export{a as fetchRBACConfig,i as removeInstantLearningGuidelinesFromCart};
2
2
  //# sourceMappingURL=instant-learning.api.js.map