@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.
- package/dist/ContinueWithTemplateModal.js +1 -1
- package/dist/cjs/ContinueWithTemplateModal.js +1 -1
- package/dist/cjs/features/DocumentLearning/DocumentLearning.js +1 -1
- package/dist/cjs/features/DocumentLearning/_components/BookLearningForm.js +1 -1
- package/dist/cjs/features/DocumentLearning/_components/ChatComponent.js +1 -1
- package/dist/cjs/features/IL-OTJ/ILOTJTest.js +1 -1
- package/dist/cjs/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.js +1 -1
- package/dist/cjs/features/IL-OTJ/_components/ChatComponents/ChatComponent.js +1 -1
- package/dist/cjs/features/IL-OTJ/_components/ChatComponents/NormalChat.js +1 -1
- package/dist/cjs/features/IL-marketplace/services/guideline.core.api.js +1 -1
- package/dist/cjs/features/IL-marketplace/services/instant-learning.api.js +1 -1
- package/dist/cjs/features/InstantLearning/_components/ChatComponent.js +1 -1
- package/dist/cjs/features/InstantLearning/_components/ContextualChatComponent.js +1 -1
- package/dist/cjs/features/InstantLearning/_components/ContextualLearningForm.js +1 -1
- package/dist/cjs/features/InstantLearning/_components/LearningDetailsForm.js +1 -1
- package/dist/cjs/features/LearningManagement/AuditLog/AuditLog.js +1 -1
- package/dist/cjs/features/LearningManagement/LearningManagement.js +1 -1
- package/dist/cjs/features/LearningManagement/LearningManagementTest.js +1 -1
- package/dist/cjs/features/LearningManagement/LearningTemplateLayout.js +1 -1
- package/dist/cjs/features/LearningManagement/RBAC/AccessPanel.js +1 -1
- package/dist/cjs/features/LearningManagement/RuleContent/RuleContent.js +1 -1
- package/dist/cjs/features/LearningManagement/apis/scopeApis.js +1 -1
- package/dist/cjs/features/LearningManagement/components/InstantLearningModal.js +1 -1
- package/dist/cjs/features/LearningManagement/components/InstantLearningModalDynamic.js +1 -1
- package/dist/cjs/hooks/useAgentFix.js +1 -1
- package/dist/cjs/hooks/useAgentSuggestions.js +1 -1
- package/dist/cjs/hooks/useAgentValidation.js +1 -1
- package/dist/cjs/hooks/useExistingAgentCheck.js +1 -1
- package/dist/cjs/hooks/useExistingPromptCheck.js +1 -1
- package/dist/cjs/hooks/usePromptFix.js +1 -1
- package/dist/cjs/hooks/usePromptSuggestions.js +1 -1
- package/dist/cjs/hooks/usePromptValidation.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/service/InstantLearningService.js +1 -1
- package/dist/cjs/utils/agentGenieAPI.js +1 -1
- package/dist/cjs/utils/bookGenieAPI.js +1 -1
- package/dist/cjs/utils/instantLearningAPI.js +1 -1
- package/dist/features/DocumentLearning/DocumentLearning.js +1 -1
- package/dist/features/DocumentLearning/_components/BookLearningForm.js +1 -1
- package/dist/features/DocumentLearning/_components/ChatComponent.js +1 -1
- package/dist/features/IL-OTJ/ILOTJTest.js +1 -1
- package/dist/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.js +1 -1
- package/dist/features/IL-OTJ/_components/ChatComponents/ChatComponent.js +1 -1
- package/dist/features/IL-OTJ/_components/ChatComponents/NormalChat.js +1 -1
- package/dist/features/IL-marketplace/services/guideline.core.api.js +1 -1
- package/dist/features/IL-marketplace/services/instant-learning.api.js +1 -1
- package/dist/features/InstantLearning/_components/ChatComponent.js +1 -1
- package/dist/features/InstantLearning/_components/ContextualChatComponent.js +1 -1
- package/dist/features/InstantLearning/_components/ContextualLearningForm.js +1 -1
- package/dist/features/InstantLearning/_components/LearningDetailsForm.js +1 -1
- package/dist/features/LearningManagement/AuditLog/AuditLog.js +1 -1
- package/dist/features/LearningManagement/LearningManagement.js +1 -1
- package/dist/features/LearningManagement/LearningManagementTest.js +1 -1
- package/dist/features/LearningManagement/LearningTemplateLayout.js +1 -1
- package/dist/features/LearningManagement/RBAC/AccessPanel.js +1 -1
- package/dist/features/LearningManagement/RuleContent/RuleContent.js +1 -1
- package/dist/features/LearningManagement/apis/scopeApis.js +1 -1
- package/dist/features/LearningManagement/components/InstantLearningModal.js +1 -1
- package/dist/features/LearningManagement/components/InstantLearningModalDynamic.js +1 -1
- package/dist/hooks/useAgentFix.js +1 -1
- package/dist/hooks/useAgentSuggestions.js +1 -1
- package/dist/hooks/useAgentValidation.js +1 -1
- package/dist/hooks/useExistingAgentCheck.js +1 -1
- package/dist/hooks/useExistingPromptCheck.js +1 -1
- package/dist/hooks/usePromptFix.js +1 -1
- package/dist/hooks/usePromptSuggestions.js +1 -1
- package/dist/hooks/usePromptValidation.js +1 -1
- package/dist/index.js +1 -1
- package/dist/service/InstantLearningService.js +1 -1
- package/dist/types/src/features/DocumentLearning/DocumentLearning.d.ts.map +1 -1
- package/dist/types/src/features/DocumentLearning/_components/BookLearningForm.d.ts.map +1 -1
- package/dist/types/src/features/DocumentLearning/_components/LearningDetailsForm.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/services/guideline.core.api.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/services/instant-learning.api.d.ts.map +1 -1
- package/dist/types/src/features/InstantLearning/_components/ContextualLearningForm.d.ts.map +1 -1
- package/dist/types/src/features/InstantLearning/_components/LearningDetailsForm.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/AuditLog/AuditLog.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/LearningManagement.d.ts +1 -9
- package/dist/types/src/features/LearningManagement/LearningManagement.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/RBAC/AccessPanel.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/apis/scopeApis.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/components/InstantLearningModalDynamic.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/queries/useApprovalQueries.d.ts +8 -11
- package/dist/types/src/features/LearningManagement/queries/useApprovalQueries.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/queries/useLMSConfigQuery.d.ts +1 -3
- package/dist/types/src/features/LearningManagement/queries/useLMSConfigQuery.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/store/useExternalWorkflowStore.d.ts +4 -4
- package/dist/types/src/features/LearningManagement/store/useExternalWorkflowStore.d.ts.map +1 -1
- package/dist/types/src/hooks/useAgentFix.d.ts.map +1 -1
- package/dist/types/src/hooks/useAgentSuggestions.d.ts.map +1 -1
- package/dist/types/src/hooks/useAgentValidation.d.ts.map +1 -1
- package/dist/types/src/hooks/useExistingAgentCheck.d.ts.map +1 -1
- package/dist/types/src/hooks/useExistingPromptCheck.d.ts.map +1 -1
- package/dist/types/src/hooks/usePromptFix.d.ts.map +1 -1
- package/dist/types/src/hooks/usePromptSuggestions.d.ts.map +1 -1
- package/dist/types/src/hooks/usePromptValidation.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/service/API.d.ts.map +1 -1
- package/dist/types/src/service/GoogleFilePickerService.d.ts.map +1 -1
- package/dist/types/src/service/InstantLearningService.d.ts +1 -12
- package/dist/types/src/service/InstantLearningService.d.ts.map +1 -1
- package/dist/types/src/service/ModelService.d.ts.map +1 -1
- package/dist/types/src/service/SavedDataSetService.d.ts.map +1 -1
- package/dist/types/src/utils/bookGenieAPI.d.ts.map +1 -1
- package/dist/types/src/utils/date.d.ts.map +1 -1
- package/dist/types/src/utils/instantLearningAPI.d.ts.map +1 -1
- package/dist/utils/agentGenieAPI.js +1 -1
- package/dist/utils/bookGenieAPI.js +1 -1
- package/dist/utils/instantLearningAPI.js +1 -1
- package/package.json +9 -10
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as e,__spreadArray as n,__rest as t,__awaiter as o,__generator as i,__assign as r}from"tslib";import{jsxs as a,jsx as l,Fragment as s}from"react/jsx-runtime";import{useState as c,useRef as u,useEffect as d,useMemo as p,useCallback as f}from"react";import h from"../../../hooks/useDebounce.js";import{searchAssistants as g,fetchUserByEmail as m,fetchExistingTopicsAPI as x,fetchScopes as v,fetchAllCustomScopes as y}from"../../../utils/agentGenieAPI.js";import w from"./ContextualConflictDBCard.js";import b from"@mui/icons-material/Delete";import C from"@mui/icons-material/Edit";import S from"@mui/icons-material/Add";import k from"@mui/icons-material/CheckCircleOutline";import T from"@mui/icons-material/Cancel";import L from"@mui/icons-material/Save";import I from"./ConflictingLearningWarnCard.js";import{keyframes as F,Box as P,Typography as R,Tooltip as z,TextField as A,FormControl as _,CircularProgress as J,MenuItem as M,Chip as W,Select as j,Button as O,Autocomplete as q,IconButton as E,InputAdornment as D,Accordion as H,AccordionSummary as N,AccordionDetails as B}from"@mui/material";import{fetchInstantLearningTagsAPI as V,fetchSuggestedCategories as U}from"../../../utils/instantLearningAPI.js";import{Info as $,ChevronDown as G,X as Y,Sparkles as Q,Lightbulb as Z}from"lucide-react";import K from"../InstantLearning.module.css.js";import X from"./GeneralizationAccordion.js";import{http as ee}from"../../../api/transport.js";var ne,te,oe=function(t){var s=t.label,u=t.required,d=void 0!==u&&u,p=t.tooltipText,f=t.conditions,h=t.onConditionsChange,g=t.isLoading,m=t.isValidating,x=t.onLock,v=t.onValidationFailure,y=t.children,w=c(!1),k=w[0],T=w[1],I=F(ne||(ne=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 "])));return a(P,r({sx:{display:"flex",flexDirection:"column",height:"100%"}},{children:[a(R,r({sx:{fontSize:"1rem",fontWeight:600,marginBottom:"8px",fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center"}},{children:[s,d&&l(P,r({component:"span",sx:{color:"red"}},{children:"*"})),p&&l(z,r({title:p,placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l($,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),a(P,r({sx:{border:"1px solid #ccc",borderRadius:"8px",padding:2,display:"flex",flexDirection:"column",flexGrow:1,height:"calc(100% - 32px)",bgcolor:"white",boxShadow:g?"0 0 12px 3px rgba(34, 197, 94, 0.6)":"none",transition:"box-shadow 0.3s ease-in-out"}},{children:[l(P,r({display:"flex",alignItems:"center",justifyContent:"space-between",sx:{mb:"8px"}},{children:a("div",r({style:{width:"100%",display:"flex",gap:"0.25rem",justifyContent:"space-between",alignItems:"center"}},{children:[a("div",r({style:{display:"flex",gap:"0.25rem",alignItems:"center"}},{children:[a("svg",r({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[l("g",r({id:"bi:stars",clipPath:"url(#clip0_6004_60631)"},{children:l("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),l("defs",{children:l("clipPath",r({id:"clip0_6004_60631"},{children:l("rect",{width:"24",height:"24",fill:"white"})}))})]})),l(R,r({variant:"body1",sx:{fontWeight:"600",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Suggestions"}))]})),a(P,{children:[l(z,r({title:"Add New Condition",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l(E,r({onClick:function(){h(n(n([],f,!0),[""],!1)),T(!0)},size:"small",sx:{color:"gray","&:hover":{color:"black"}}},{children:l(S,{fontSize:"small"})}))})),f.length>0&&l(z,r({title:k?"Save & Lock":"Edit",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:a("span",{children:[" ",l(E,r({onClick:function(){return o(void 0,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return k&&x?(console.log("Calling onLock (validation)..."),[4,x()]):[3,2];case 1:return e=n.sent(),console.log("Validation finished. Result (isValid):",e),T(!1),!e&&v?(console.log("Validation failed. Calling onValidationFailure..."),v()):e&&console.log("Validation succeeded."),[3,3];case 2:console.log("Toggling isEditable state (Edit clicked or no onLock)."),T(!k),n.label=3;case 3:return[2]}})})},size:"small",disabled:k&&f.some(function(e){return""===e.trim()})||m,sx:{color:"gray","&:hover":{color:"black"},opacity:m?.5:1,cursor:m?"wait":"pointer"}},{children:m?l(J,{size:20,sx:{color:"#5928ed"}}):l(k?L:C,{fontSize:"small"})}))]})}))]})]}))})),l(P,r({sx:{height:"calc(100% - 38px)",overflow:"auto"}},{children:f.length>0?a(P,r({sx:{pt:"16px"}},{children:[l("ol",r({style:{paddingLeft:"0rem",margin:0,fontFamily:"Plus Jakarta Sans"}},{children:f.map(function(e,t){return a(P,r({component:"li",sx:{display:"flex",alignItems:"flex-start",gap:1,mb:t<f.length-1?2:0,fontFamily:"Plus Jakarta Sans"}},{children:[l(A,{variant:"outlined",disabled:!k,fullWidth:!0,multiline:!0,value:e,onChange:function(e){return function(e,t){var o=n([],f,!0);o[e]=t,h(o)}(t,e.target.value)},sx:{backgroundColor:"#f9fafb",borderRadius:1,"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputBase-input.Mui-disabled":{color:"#000",WebkitTextFillColor:"#000"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root.Mui-disabled":{color:"rgba(0, 0, 0, 0.6)"}},InputProps:{startAdornment:a(D,r({position:"start",sx:{color:"#000",alignSelf:"flex-start",paddingTop:"12px"}},{children:[t+1,"."]}))}}),k&&l(E,r({onClick:function(){return function(e){h(f.filter(function(n,t){return t!==e}))}(t)},sx:{mt:1},size:"large"},{children:l(b,{})}))]}),t)})})),m&&a(P,r({sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px",mt:3,mb:2,fontFamily:'"Plus Jakarta Sans", sans-serif',color:"#5a28ed"}},{children:[l(R,r({variant:"body2",sx:{color:"#5a28ed"}},{children:"Validating your conditions"})),l(P,{sx:{width:"8px",height:"8px",bgcolor:"#5a28ed",borderRadius:"50%",animation:"".concat(I," 1.4s infinite ease-in-out both"),animationDelay:"-0.32s"}}),l(P,{sx:{width:"8px",height:"8px",bgcolor:"#5a28ed",borderRadius:"50%",animation:"".concat(I," 1.4s infinite ease-in-out both"),animationDelay:"-0.16s"}}),l(P,{sx:{width:"8px",height:"8px",bgcolor:"#5a28ed",borderRadius:"50%",animation:"".concat(I," 1.4s infinite ease-in-out both")}})]})),y]})):l("div",r({style:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},{children:a("div",r({style:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"0.5rem",paddingTop:"1rem",paddingBottom:"1rem"}},{children:[l("div",r({style:{fontWeight:"700",color:"#6b7280"}},{children:"No suggestions found"})),a("div",r({style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"0.25rem",fontSize:"1rem",flexFlow:"wrap"}},{children:[l("div",r({style:{}},{children:"Tell us about your learning in "})),l("span",r({style:{color:"#5928ED",fontWeight:"700"}},{children:"InstantLearning.AI"}))," ",l("span",{children:"Chat"})]}))]}))}))}))]}))]}))},ie=function(b){var C,S,L,D,ne,ie,re,ae=b.question;b.categoryOptions;var le=b.onSubmit,se=b.formData,ce=b.setFormData,ue=b.extractedHowToRespond,de=b.extractedTopic,pe=b.organizationName,fe=b.iLAssistantName,he=b.validationWtaResponse,ge=b.setValidationWtaResponse,me=b.baseUrl,xe=b.extractedCategories,ve=b.learningWtaResponse,ye=b.setSendMessageInChat,we=b.editConflictingLearningTrigger,be=b.editSimilarLearningTrigger,Ce=b.onSetOperationStatus,Se=b.onDeleted,ke=b.onMergeMessage,Te=b.chatAssistantName,Le=b.validationRecommendations,Ie=b.resetLearningTrigger,Fe=b.save,Pe=b.setIsFormSavedClicked,Re=b.assistantId,ze=b.isFromDashboard,Ae=c(!1),_e=Ae[0],Je=Ae[1],Me=c(""),We=Me[0],je=Me[1],Oe=c(!1),qe=Oe[0],Ee=Oe[1],De=u(null),He=h(We,300),Ne=c([]),Be=Ne[0],Ve=Ne[1],Ue=c(!0),$e=Ue[0],Ge=Ue[1],Ye=c(""),Qe=Ye[0],Ze=Ye[1],Ke=u(null),Xe=c([]),en=Xe[0],nn=Xe[1],tn=c([]),on=tn[0],rn=tn[1],an=c(!1),ln=an[0],sn=an[1],cn=c(!1),un=cn[0],dn=cn[1],pn=c(!1),fn=pn[0],hn=pn[1],gn=u(!1),mn=u(!1),xn=c(!1),vn=xn[0],yn=xn[1],wn=c([]),bn=wn[0],Cn=wn[1],Sn=c([]),kn=Sn[0],Tn=Sn[1],Ln=c(""),In=Ln[0],Fn=Ln[1],Pn=c(!1),Rn=Pn[0],zn=Pn[1],An=c(""),_n=An[0],Jn=An[1],Mn=c(!1),Wn=Mn[0],jn=Mn[1],On=c(null),qn=On[0],En=On[1],Dn=c([]),Hn=Dn[0],Nn=Dn[1],Bn=c(!1),Vn=Bn[0],Un=Bn[1],$n=h(se.howToRespond,2500),Gn=c(!1),Yn=Gn[0],Qn=Gn[1],Zn=c(null),Kn=Zn[0],Xn=Zn[1],et=c(null),nt=et[0],tt=et[1],ot=c(new Set),it=ot[0],rt=ot[1],at=c(84),lt=at[0],st=at[1],ct=u(null),ut=c(56),dt=ut[0],pt=ut[1],ft=u(null),ht=c([]),gt=ht[0],mt=ht[1],xt=c([]),vt=xt[0],yt=xt[1],wt=c({}),bt=wt[0],Ct=wt[1],St=c({}),kt=St[0],Tt=St[1],Lt=c(null),It=Lt[0],Ft=Lt[1],Pt=c(null),Rt=Pt[0],zt=Pt[1],At=c(!1),_t=At[0],Jt=At[1],Mt=c(!1),Wt=Mt[0],jt=Mt[1],Ot=h(se.howToRespond,1500),qt=h(se.question,1500),Et=u(!1),Dt=u(null),Ht=c(""),Nt=Ht[0],Bt=Ht[1],Vt=c([]),Ut=Vt[0],$t=Vt[1],Gt=c(!1),Yt=Gt[0],Qt=Gt[1],Zt=h(Nt,400);d(function(){if(ze&&Zt){o(void 0,void 0,void 0,function(){var e,n;return i(this,function(t){switch(t.label){case 0:Qt(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,g(Zt,me||"")];case 2:return e=t.sent(),$t(e),[3,5];case 3:return n=t.sent(),console.error("Failed to search assistants",n),$t([]),[3,5];case 4:return Qt(!1),[7];case 5:return[2]}})})}},[Zt,ze,me]),F(te||(te=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 Kt=function(e){var n=e.color,t=void 0===n?"#fff":n,o=e.size,i=void 0===o?12:o;return a("svg",r({width:i,height:i,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[l("path",{d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.3188 23.8989 12.0012 24.0019 11.7759 23.9658L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.37668 16.8492 4.37668 16.1502 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021Z",fill:t}),l("path",{d:"M5.69218 1.72171C5.8106 1.52009 6.19176 1.52009 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.4808 5.75512 10.4808 6.24724 10.2792 6.31018L8.53618 6.88921C7.75918 7.15018 7.15018 7.75918 6.89068 8.53618L6.31018 10.2777C6.19176 10.4793 5.8106 10.4793 5.69218 10.2777L5.11168 8.53471C4.85071 7.75918 4.24171 7.15018 3.46618 6.88921L1.72318 6.30871C1.52156 6.24576 1.52156 5.75512 1.72318 5.69071L3.46618 5.11021C4.24171 4.85071 4.85071 4.24171 5.11168 3.46471L5.69218 1.72171Z",fill:t}),l("path",{d:"M16.2957 0.148207C16.4119 0.016038 16.5905 0.016038 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.4848 2.83676 19.4848 3.16265 19.3527 3.20521L18.1917 3.59221C17.6727 3.76521 17.2662 4.17171 17.0937 4.69021L16.7067 5.85121C16.5905 5.98338 16.4119 5.98338 16.2957 5.85121L15.9087 4.69021C15.7377 4.17171 15.3312 3.76521 14.8122 3.59221L13.6512 3.20521C13.519 3.16265 13.519 2.83676 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:t})]}))},Xt=function(e){var n=e.score;return a(P,r({sx:{display:"inline-flex",alignItems:"center",gap:.5,px:1.5,py:.5,borderRadius:"16px",backgroundColor:"#10B981",color:"white",fontSize:"0.8rem",fontWeight:600,fontFamily:"Plus Jakarta Sans"}},{children:[l(Kt,{}),a(R,r({sx:{fontSize:"0.8rem",fontWeight:600,fontFamily:"inherit"}},{children:[n,"%"]}))]}))},eo=function(e){var n=e.reason,t=e.title;return a(H,r({elevation:0,sx:{backgroundColor:"#f3f0ff",border:"1px solid #dcd6f7",borderRadius:2,mb:2,"&::before":{display:"none"}}},{children:[l(N,r({expandIcon:l(G,{style:{color:"#5928ed"}}),sx:{minHeight:"auto","& .MuiAccordionSummary-content":{margin:"12px 0"}}},{children:a(P,r({sx:{display:"flex",alignItems:"center",gap:1}},{children:[l(Z,{size:16,color:"#5928ed"}),l(R,r({sx:{fontSize:"0.85rem",fontWeight:600,color:"#5928ed",fontFamily:"Plus Jakarta Sans"}},{children:t}))]}))})),l(B,r({sx:{pt:0,pb:1.5,backgroundColor:"#faf9ff"}},{children:l(R,r({sx:{fontSize:"0.9rem",color:"#4A4458",fontFamily:"Plus Jakarta Sans"}},{children:n}))}))]}))},no=function(e){var n=e.condition,t=e.onAccept,o=e.onReject;return a(P,r({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:1,mb:1,backgroundColor:"#f0f4f8",border:"1px solid #d1d9e6",borderRadius:"4px"}},{children:[l(R,r({sx:{flex:1,fontFamily:"Plus Jakarta Sans",mr:1}},{children:n})),a(P,r({sx:{flexShrink:0}},{children:[l(E,r({onClick:t,size:"small",sx:{color:"green"}},{children:l(k,{})})),l(E,r({onClick:o,size:"small",sx:{color:"red"}},{children:l(T,{})}))]}))]}))},to=c({wta:!1,wnta:!1}),oo=to[0],io=to[1],ro=c({wta:!1,wnta:!1}),ao=ro[0],lo=ro[1],so=function(){console.log("handleValidationFailure triggered in parent form."),ye("Validation Failed. Do you have any recommendations for me?")},co=function(e,n){ce(function(t){var o;return r(r({},t),((o={})[e]=n,o))})},uo=function(){return o(void 0,void 0,void 0,function(){var e,t,o,a;return i(this,function(i){switch(i.label){case 0:if(!In.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/))return Jn("Invalid email format"),[2];if((e=Array.isArray(se.scope.value)?se.scope.value:[]).some(function(e){return e.email===In}))return Jn("This email is already added."),[2];zn(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,m(In,me)];case 2:return t=i.sent(),o={email:In,userId:t.id,name:t.name},ce(function(t){return r(r({},t),{scope:r(r({},t.scope),{value:n(n([],e,!0),[o],!1)})})}),Fn(""),Jn(""),[3,5];case 3:return a=i.sent(),console.error("Error adding email:",a),Jn("Invalid email. Please enter a valid email."),[3,5];case 4:return zn(!1),[7];case 5:return[2]}})})};d(function(){console.log("ContextualForm: validationWtaResponse changed:",he),he&&!1===he.is_valid?(jn(!0),En(he.conflictingConditions),console.log("ContextualForm: Showing conflict card with data:",he.conflictingConditions)):(jn(!1),En(null),console.log("ContextualForm: Hiding conflict card."))},[he]),d(function(){Le&&(console.log("ContextualForm: Received new validationRecommendations:",Le),Xn(Le.wta),tt(Le.wnta),io({wta:!!Le.wta,wnta:!!Le.wnta}),lo({wta:!1,wnta:!1}),jn(!1),En(null))},[Le]),d(function(){Ie&&(console.log("[ContextualLearningForm] 🔄 Reset Trigger Received - Clearing form state."),nn([]),rn([]),jn(!1),En(null),Xn(null),tt(null),io({wta:!1,wnta:!1}),lo({wta:!1,wnta:!1}),Qn(!1),Fn(""),Jn(""),je(""),Ze(""),Nn([]),rt(new Set),mt([]),yt([]),Ct({}),Tt({}),Ft(null),zt(null),ce(function(e){return{question:ze?"":e.question,howToRespond:"",whenToApply:"",whenNotToApply:"",topic:{id:null,value:""},categories:[],scope:{name:"",value:null}}}),console.log("[ContextualLearningForm] ✅ Form state reset."))},[Ie,ce,ae]),d(function(){if($n&&se.question&&me){o(void 0,void 0,void 0,function(){var e,n,t;return i(this,function(o){switch(o.label){case 0:Un(!0),o.label=1;case 1:return o.trys.push([1,3,4,5]),[4,U(se.howToRespond||"",me)];case 2:return e=o.sent(),n=e.map(function(e){return{id:null,label:e.label||e.value,value:e.value,isCustom:!1}}),Nn(n),[3,5];case 3:return t=o.sent(),console.error("Failed to fetch categories:",t),Nn([]),[3,5];case 4:return Un(!1),[7];case 5:return[2]}})})}},[$n,se.question,me]),d(function(){if(Array.isArray(xe)){var e=xe.map(function(e){return{id:null,label:e,value:e,isCustom:!1}});co("categories",e)}},[xe]),d(function(){var e;if("string"==typeof de&&de!==(null===(e=se.topic)||void 0===e?void 0:e.value)){var n=Be.find(function(e){return e.label===de}),t=n?{id:n.id,value:n.label}:{id:null,value:de};co("topic",t),console.log("📌 Topic Set from Chat:",{extractedTopic:de,topicToSet:t}),yn(!0);var o=setTimeout(function(){yn(!1)},500);return function(){return clearTimeout(o)}}},[de,Be]),d(function(){if("string"==typeof ue&&ue!==se.howToRespond){co("howToRespond",ue),sn(!0);var e=setTimeout(function(){sn(!1)},500);return function(){return clearTimeout(e)}}},[ue]),d(function(){var e=[],n=!1;if(Array.isArray(se.whenToApply))e=se.whenToApply,n=!0;else if("string"==typeof se.whenToApply){var t=se.whenToApply.split(" OR ");e=1===t.length&&""===t[0]?[]:t}e.join("|||")!==en.join("|||")&&(gn.current=!0,nn(e),n&&e.length>0&&(dn(!0),setTimeout(function(){return dn(!1)},500)))},[se.whenToApply]),d(function(){var e=[],n=!1;if(Array.isArray(se.whenNotToApply))e=se.whenNotToApply,n=!0;else if("string"==typeof se.whenNotToApply){var t=se.whenNotToApply.split(" OR ");e=1===t.length&&""===t[0]?[]:t}e.join("|||")!==on.join("|||")&&(mn.current=!0,rn(e),n&&e.length>0&&(hn(!0),setTimeout(function(){return hn(!1)},500)))},[se.whenNotToApply]),d(function(){gn.current?gn.current=!1:co("whenToApply",en.join(" OR "))},[en]),d(function(){mn.current?mn.current=!1:co("whenNotToApply",on.join(" OR "))},[on]);var po=function(e,t,o){"wta"===t?(jn(!1),En(null),ao.wta?nn(function(t){return Array.from(new Set(n(n([],t,!0),[e],!1)))}):(nn([e]),lo(function(e){return r(r({},e),{wta:!0})})),Xn(function(e){if(!e||!e.when_to_apply)return e;var n=r({},e.when_to_apply);return delete n[o],0===Object.keys(n).length?null:r(r({},e),{when_to_apply:n})})):(jn(!1),En(null),ao.wnta?rn(function(t){return Array.from(new Set(n(n([],t,!0),[e],!1)))}):(rn([e]),lo(function(e){return r(r({},e),{wnta:!0})})),tt(function(e){if(!e||!e.when_not_to_apply)return e;var n=r({},e.when_not_to_apply);return delete n[o],0===Object.keys(n).length?null:r(r({},e),{when_not_to_apply:n})}))},fo=function(e,n,t){"wta"===n?Xn(function(e){if(!e||!e.when_to_apply)return e;var n=r({},e.when_to_apply);return delete n[t],0===Object.keys(n).length?null:r(r({},e),{when_to_apply:n})}):tt(function(e){if(!e||!e.when_not_to_apply)return e;var n=r({},e.when_not_to_apply);return delete n[t],0===Object.keys(n).length?null:r(r({},e),{when_not_to_apply:n})})},ho=p(function(){var e=se.scope;if(!e||!e.name)return!1;switch(e.name){case"User":return Array.isArray(e.value)&&e.value.length>0;case"Custom":return!(!e.value||!e.value.scopeId);case"Assistant":return!(!e.value||!e.value.assistantName);default:return!0}},[se.scope]),go=p(function(){var e;return se.question&&se.howToRespond&&(null===(e=se.topic)||void 0===e?void 0:e.value)&&ho},[se.question,se.howToRespond,se.topic,ho]),mo=p(function(){return se.categories||[]},[se.categories]),xo=p(function(){return!(!ve||!0===ve.is_valid_db)&&Object.keys((null==ve?void 0:ve.conflicting_learnings)||{}).length+Object.keys((null==ve?void 0:ve.similar_learnings)||{}).length>0},[ve]),vo=p(function(){var e=new Set(mo.map(function(e){return e.value.toLowerCase()}));return Hn.filter(function(n){return!e.has(n.value.toLowerCase())})},[Hn,mo]),yo=p(function(){if(!ve||!0===ve.is_valid_db)return!1;var e=Object.values((null==ve?void 0:ve.conflicting_learnings)||{}),t=Object.values((null==ve?void 0:ve.similar_learnings)||{}),o=n(n([],e.map(function(e){return e.id}),!0),t.map(function(e){return e.id}),!0);return 0!==o.length&&!o.every(function(e){return it.has(e)})},[ve,it]);d(function(){if(Fe){console.log("ContextualLearningForm: 'save: true' received. Forcibly clearing all conflict UI states."),jn(!1),En(null),Pe(!0);o(void 0,void 0,void 0,function(){return i(this,function(e){return yo?(console.error("Save action triggered via prop, but is blocked due to unresolved conflicts."),[2]):(console.log("ContextualLearningForm: Submitting this formData:",se),function(){console.log("Contextual form submitting...");var e=gt&>.length>0||vt&&vt.length>0,n=se.question||"",t=Po(n,gt),o=r(r({},se),{howToRespond:se.howToRespond,isInstantLearningPlus:e,parameterizedQuestion:n,originalQuestion:t,appliedTagsForQ:gt,appliedTagsIL:vt,tagMappingInfoQ:bt,tagMappingInfoIL:kt});console.log("Final Payload with Generalization:",o),Je(!0),le(o,function(){return Je(!1)})}(),[2])})})}},[Fe,yo]);var wo=function(){return o(void 0,void 0,void 0,function(){var e,n,t,o,r,a,l,s,c,u;return i(this,function(i){switch(i.label){case 0:if(console.log("handleLockValidation started."),!me||!ge)return console.error("❌ ERROR: Missing baseUrl or setValidationWtaResponse for validation."),[2,!1];if(Yn)return console.log("❕ Validation already in progress. Aborting."),[2,!1];if(Qn(!0),ge(null),jn(!1),En(null),e=en.filter(function(e){return""!==e.trim()}),n=on.filter(function(e){return""!==e.trim()}),0===e.length)return console.warn("⚠️ Validation Aborted: 'When To Apply' cannot be empty."),ge({is_valid:!1,reason:"'When To Apply' conditions cannot be empty.",conflictingConditions:[]}),jn(!0),En([{conflictType:"validation_error",reason:"'When To Apply' conditions cannot be empty."}]),Qn(!1),[2,!1];t="".concat(me,"/instant_learning/validate-wta"),o={whenToApply:e,whenNotToApply:n},i.label=1;case 1:return i.trys.push([1,3,,4]),console.log("📡 Firing fetch request to:",t),[4,ee.post(t,o,{headers:{"Content-Type":"application/json"},validateStatus:function(){return!0}})];case 2:if(r=i.sent(),console.log("✅ Request initiated. Status Code:",r.status),r.status<200||r.status>=300){a="Could not read error body.";try{a="string"==typeof r.data?r.data:JSON.stringify(r.data)}catch(e){}throw console.error("❌ API Error Response (".concat(r.status,"):"),a),new Error("API Error: ".concat(r.status))}return l=r.data,console.log("✅ Validation API response data:",l),ge(l.response),Qn(!1),s=!0===(null===(u=null==l?void 0:l.response)||void 0===u?void 0:u.is_valid),console.log("handleLockValidation returning:",s),[2,s];case 3:return c=i.sent(),console.error("❌ Validation API fetch FAILED:",c.message,c),ge({is_valid:!1,reason:"API call failed: ".concat(c.message),conflictingConditions:[]}),jn(!0),En([{conflictType:"api_error",reason:"Failed to connect to validation service: ".concat(c.message)}]),Qn(!1),console.log("handleLockValidation returning false due to error."),[2,!1];case 4:return[2]}})})};d(function(){o(void 0,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return Ge(!0),[4,x(me)];case 1:return e=n.sent(),Ve(e),Ge(!1),[2]}})})},[]),d(function(){o(void 0,void 0,void 0,function(){var e,n,t,o,r;return i(this,function(i){switch(i.label){case 0:return i.trys.push([0,5,,6]),ze?[4,y(me)]:[3,2];case 1:return e=i.sent(),Tn(e),Cn([{scope:"Global",value:"Global"},{scope:"User",value:"User"},{scope:"Assistant",value:"Assistant"},{scope:"Custom",value:"Custom"}]),console.log("[Dashboard] Loaded custom scopes:",e.length),[3,4];case 2:return[4,v(fe||"",pe||"",me)];case 3:n=i.sent(),t=n.scopeOptions,o=n.customScopeOptions,Cn(t),Tn(o),i.label=4;case 4:return[3,6];case 5:return r=i.sent(),console.error("Failed to load scopes:",r),[3,6];case 6:return[2]}})})},[fe,pe,me,ze]),d(function(){se._contextualUpdate&&(console.log("ContextualForm: Clearing recommendations due to new direct/contextual suggestions."),Xn(null),tt(null),jn(!1),En(null),ce(function(e){return e._contextualUpdate,t(e,["_contextualUpdate"])}))},[se._contextualUpdate]),d(function(){var e=function(e){De.current&&!De.current.contains(e.target)&&Ee(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[]),d(function(){var e;(null===(e=se.topic)||void 0===e?void 0:e.value)?je(se.topic.value):je("")},[se.topic]);var bo=p(function(){return He?Be.filter(function(e){return e.label.toLowerCase().includes(He.toLowerCase())}):Be},[He,Be]),Co=function(e,n){co("topic",{id:e,value:n}),Ee(!1),je(n),console.log("📌 Topic Selected:",{id:e,value:n})},So=f(function(e,n){return o(void 0,void 0,void 0,function(){var t,o;return i(this,function(i){switch(i.label){case 0:if(Et.current)return console.log("API call skipped: Apply/Undo in progress."),[2];"question"===n&&Jt(!0),"howToRespond"===n&&jt(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,V(null!=me?me:"",e)];case 2:return t=i.sent(),"question"===n?Ct(t):Tt(t),[3,5];case 3:return o=i.sent(),console.error("Error fetching instant learning tags:",o),"question"===n&&Ct({}),"howToRespond"===n&&Tt({}),[3,5];case 4:return"question"===n&&Jt(!1),"howToRespond"===n&&jt(!1),[7];case 5:return[2]}})})},[me]);d(function(){qt&&!Et.current&&(console.log("ContextualLearningForm: Firing API for 'Question'",qt),So(qt,"question"))},[qt,So]),d(function(){Ot&&!Et.current&&So(Ot,"howToRespond")},[Ot,So]);var ko=function(e){var t=[],o=("question"===e?se.question:se.howToRespond)||"",i="question"===e?gt:vt,a="question"===e?bt:kt,s=new Set(n(n(n([],i.map(function(e){return e.original}),!0),i.map(function(e){return e.replacement}),!0),Object.keys(a),!0));if(0===s.size)return o;var c=Array.from(s).filter(Boolean).map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(0===c.length)return o;for(var u=new RegExp("(".concat(c.join("|"),")"),"gi"),d=o.split(u),p=function(e){var n=d[e];if(!n)return"continue";var o=i.find(function(e){return e.replacement.toLowerCase()===n.toLowerCase()}),s=o?void 0:Object.keys(a).find(function(e){return e.toLowerCase()===n.toLowerCase()}),c=!1;if(o){var u=It===o.original,p=Rt===o.replacement,f=u?o.original:o.replacement;t.push(l("span",r({onMouseEnter:function(){Ft(o.original),zt(o.replacement)},onMouseLeave:function(){Ft(null),zt(null)},style:{backgroundColor:u||p?"#eef2ff":"transparent",borderRadius:"3px",padding:"1px 2px",color:"inherit",fontWeight:500}},{children:f}),e)),c=!0}else if(s){var h=a[s],g=Rt===h;f=g?h:n;t.push(l("span",r({onMouseEnter:function(){Ft(s),zt(h)},onMouseLeave:function(){Ft(null),zt(null)},style:{backgroundColor:g||It===s?"#eef2ff":"transparent",borderRadius:"3px",padding:"1px 2px",cursor:"pointer"}},{children:f}),e)),c=!0}c||t.push(l("span",{children:n},e))},f=0;f<d.length;f++)p(f);return t},To=function(e,t,o){!function(e,t,o){var i;Dt.current&&clearTimeout(Dt.current),Et.current=!0;var a=new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi"),l=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=new RegExp(l,"gi");if("question"===o){var c=null===(i=se.question)||void 0===i?void 0:i.replace(a,t);if(ce(function(e){return r(r({},e),{question:c})}),mt(function(o){return n(n([],o,!0),[{original:e,replacement:t}],!1)}),se.howToRespond.match(a)&&!se.howToRespond.match(s)){var u=se.howToRespond.replace(a,t);ce(function(e){return r(r({},e),{howToRespond:u})}),yt(function(o){return n(n([],o,!0),[{original:e,replacement:t}],!1)})}}else{var d=se.howToRespond.replace(a,t);ce(function(e){return r(r({},e),{howToRespond:d})}),yt(function(o){return n(n([],o,!0),[{original:e,replacement:t}],!1)})}Dt.current=setTimeout(function(){console.log("Releasing API lock"),Et.current=!1},2e3)}(e,t,o)},Lo=function(e,t,o){!function(e,t,o){var i;Dt.current&&clearTimeout(Dt.current),Et.current=!0;var a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=new RegExp(a,"i");if("question"===o){var s=null===(i=se.question)||void 0===i?void 0:i.replace(l,e);if(ce(function(e){return r(r({},e),{question:s})}),mt(function(o){var i=o.findIndex(function(n){return n.original===e&&n.replacement===t});return i>-1?n(n([],o.slice(0,i),!0),o.slice(i+1),!0):o}),se.howToRespond.match(l)){var c=se.howToRespond.replace(l,e);ce(function(e){return r(r({},e),{howToRespond:c})}),yt(function(o){var i=o.findIndex(function(n){return n.original===e&&n.replacement===t});return i>-1?n(n([],o.slice(0,i),!0),o.slice(i+1),!0):o})}}else{var u=se.howToRespond.replace(l,e);ce(function(e){return r(r({},e),{howToRespond:u})}),yt(function(o){var i=o.findIndex(function(n){return n.original===e&&n.replacement===t});return i>-1?n(n([],o.slice(0,i),!0),o.slice(i+1),!0):o})}Dt.current=setTimeout(function(){console.log("Releasing API lock"),Et.current=!1},2e3)}(e,t,o)},Io=function(e,n,t,o){var i="question"===o?bt:kt,a="question"===o?Ct:Tt,l=("question"===o?se.question:se.howToRespond)||"";return new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"i").test(l)?e!==n&&i.hasOwnProperty(n)?{success:!1,error:"This phrase (key) already exists as a suggestion."}:(a(function(o){var i=r({},o);return e!==n&&i.hasOwnProperty(e)&&delete i[e],i[n]=t,i}),{success:!0}):{success:!1,error:"This phrase (key) does not exist in the text."}},Fo=function(e,n,t){var o="question"===t?bt:kt,i="question"===t?Ct:Tt,a=("question"===t?se.question:se.howToRespond)||"";return new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"i").test(a)?o.hasOwnProperty(e)?{success:!1,error:"This phrase (key) already exists as a suggestion."}:(i(function(t){var o;return r(r({},t),((o={})[e]=n,o))}),{success:!0}):{success:!1,error:"This phrase (key) does not exist in the text."}},Po=function(e,t){if(!t||0===t.length)return e;var o=n([],t,!0).sort(function(e,n){return n.replacement.length-e.replacement.length}),i=e;return o.forEach(function(e){var n=e.replacement.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),t=new RegExp(n,"g");i=i.replace(t,e.original)}),i},Ro={fontFamily:"Plus Jakarta Sans, sans-serif",fontSize:"1rem",whiteSpace:"pre-wrap",wordWrap:"break-word",lineHeight:"1.4375em",minHeight:"56px",maxHeight:"200px",overflowY:"auto",boxSizing:"border-box",padding:"16.5px 14px",borderRadius:"4px",border:"1px solid #ccc",transition:"box-shadow 0.3s ease-in-out"},zo={fontFamily:"Plus Jakarta Sans, sans-serif",fontSize:"1rem",whiteSpace:"pre-wrap",wordWrap:"break-word",lineHeight:"1.4375em",minHeight:"84px",maxHeight:"204px",overflowY:"auto",boxSizing:"border-box",boxShadow:ln?"0 0 12px 3px rgba(34, 197, 94, 0.6)":"none",transition:"box-shadow 0.3s ease-in-out",padding:"16.5px 14px",borderRadius:"4px",border:"1px solid #ccc"};return a(P,r({p:0,className:K.customFont,sx:{display:"flex",flexDirection:"column",height:"100%",width:"95%",ml:2}},{children:[l(P,{children:l(R,r({sx:{fontSize:20,fontWeight:600,fontFamily:"Plus Jakarta Sans"}},{children:"Instant Learning"}))}),a(P,r({sx:{fontFamily:"Plus Jakarta Sans",display:"flex",flexDirection:"column",gap:2,justifyContent:"space-between",flexGrow:1,paddingTop:"20px",height:"calc(100% - 30px)",overflow:"auto"}},{children:[a(P,r({sx:{display:"flex",flexDirection:"column",gap:"20px",height:"calc(100% - 90px)",overflow:"auto",position:"relative"}},{children:[a(P,{children:[a(R,r({sx:{fontFamily:"Plus Jakarta Sans",fontSize:"1rem",fontWeight:600,display:"flex",alignItems:"center",marginBottom:"8px"}},{children:["Question",l(P,r({component:"span",sx:{color:"red"}},{children:"*"})),l(z,r({title:"The key phrase or user query that should utilise this learning",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l($,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),ze?It?l(P,r({sx:r(r({},Ro),{height:"".concat(Math.max(56,dt),"px"),backgroundColor:"#fff","&:hover":{borderColor:"#000"},cursor:"text"}),onClick:function(){Ft(null),zt(null),setTimeout(function(){var e;null===(e=ft.current)||void 0===e||e.focus()},0)}},{children:ko("question")})):l(A,{value:se.question,onChange:function(e){if(co("question",e.target.value),ft.current){ft.current.style.height="auto";var n=ft.current.scrollHeight,t=Math.max(56,Math.min(n,200));ft.current.style.height="".concat(t,"px"),pt(t)}},multiline:!0,placeholder:"Enter your question...",fullWidth:!0,inputRef:ft,InputProps:{sx:{"& .MuiInputBase-input":{fontFamily:Ro.fontFamily,fontSize:Ro.fontSize,lineHeight:Ro.lineHeight,whiteSpace:Ro.whiteSpace,wordWrap:Ro.wordWrap,boxSizing:Ro.boxSizing,height:"".concat(Math.max(56,dt),"px !important"),padding:"".concat(Ro.padding," !important"),overflowY:"".concat(Ro.overflowY," !important"),resize:"none"}}},sx:{borderRadius:Ro.borderRadius,transition:Ro.transition,"& .MuiOutlinedInput-root":{padding:0,height:"auto","& .MuiOutlinedInput-notchedOutline":{borderColor:"#ccc"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#000"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#5928ed",borderWidth:"1px"}}}}):l(P,r({sx:r(r({},Ro),{bgcolor:"#fafafa",cursor:"default",height:"auto"})},{children:ko("question")}))]}),l(P,{children:l(X,{title:"Question Generalization",description:"Instant Learning Plus broadens instant learning across similar contexts.",tags:bt,appliedTags:gt,hoveredWord:It,isLoading:_t,onApply:function(e,n){return To(e,n,"question")},onUndo:function(e,n){return Lo(e,n,"question")},onEditSave:function(e,n,t){return Io(e,n,t,"question")},onAddSave:function(e,n){return Fo(e,n,"question")},setHoveredText:Ft,setHoveredTag:zt})}),a(P,{children:[a(R,r({sx:{fontSize:"1rem",fontWeight:600,fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center",marginBottom:"8px"}},{children:["How to respond",l(P,r({component:"span",sx:{color:"red"}},{children:"*"})),l(z,r({title:"The guidance AI should follow when answering the user's question",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l($,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),It?l(P,r({sx:r(r({},zo),{height:"".concat(Math.max(84,lt),"px"),backgroundColor:"#fff","&:hover":{borderColor:"#000"},cursor:"text"}),onClick:function(){Ft(null),zt(null),setTimeout(function(){var e;null===(e=ct.current)||void 0===e||e.focus()},0)}},{children:ko("howToRespond")})):l(A,{name:"howToRespond",value:se.howToRespond,onChange:function(e){if(ce(function(n){return r(r({},n),{howToRespond:e.target.value})}),ct.current){ct.current.style.height="auto";var n=ct.current.scrollHeight,t=Math.max(84,Math.min(n,204));ct.current.style.height="".concat(t,"px"),st(t)}},multiline:!0,placeholder:"Type your response...",fullWidth:!0,inputRef:ct,InputProps:{sx:{"& .MuiInputBase-input":{fontFamily:zo.fontFamily,fontSize:zo.fontSize,lineHeight:zo.lineHeight,whiteSpace:zo.whiteSpace,wordWrap:zo.wordWrap,boxSizing:zo.boxSizing,height:"".concat(Math.max(84,lt),"px !important"),padding:"".concat(zo.padding," !important"),overflowY:"".concat(zo.overflowY," !important"),maxHeight:"".concat(zo.maxHeight," !important"),minHeight:"".concat(zo.minHeight," !imporant"),resize:"none"}}},sx:{borderRadius:zo.borderRadius,boxShadow:zo.boxShadow,transition:zo.transition,"& .MuiOutlinedInput-root":{padding:0,height:"auto","& .MuiOutlinedInput-notchedOutline":{borderColor:"#ccc"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#5928ed",borderWidth:"1px"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#000"}}}})]}),l(P,{children:l(X,{title:"Instant Learning Generalization",description:"Instant Learning Plus broadens instant learning across similar contexts.",tags:kt,appliedTags:vt,hoveredWord:It,isLoading:Wt,onApply:function(e,n){return To(e,n,"howToRespond")},onUndo:function(e,n){return Lo(e,n,"howToRespond")},onEditSave:function(e,n,t){return Io(e,n,t,"howToRespond")},onAddSave:function(e,n){return Fo(e,n,"howToRespond")},setHoveredText:Ft,setHoveredTag:zt})}),a(P,r({sx:{display:"flex",gap:2,minHeight:"380px",flexShrink:0}},{children:[l(P,r({sx:{flex:1,height:"100%"}},{children:l(oe,r({label:"When to Apply",required:!0,tooltipText:"Specific situations or conditions where this learning should be applied.",conditions:en,onConditionsChange:nn,isLoading:un,isValidating:Yn,onLock:wo,onValidationFailure:so},{children:Kn&&Kn.when_to_apply&&Object.keys(Kn.when_to_apply).length>0&&a(P,r({mt:en.length>0?3:0,sx:{borderTop:en.length>0?"1px dashed #ccc":"none",pt:en.length>0?2:0}},{children:[oo.wta&&a(P,r({sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1.5}},{children:[l(R,r({variant:"subtitle2",sx:{fontWeight:"bold",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Recommended Fix:"})),l(Xt,{score:Kn.confidence_score})]})),oo.wta&&Kn.reason&&l(eo,{reason:Kn.reason,title:"Why these suggestions?"}),Object.entries(Kn.when_to_apply).map(function(e){var n=e[0],t=e[1];return l(no,{condition:"".concat(n,". ").concat(t),onAccept:function(){return po(t,"wta",n)},onReject:function(){return fo(0,"wta",n)}},"rec-wta-".concat(n))})]}))}))})),l(P,r({sx:{flex:1,height:"100%"}},{children:l(oe,r({label:"When NOT to Apply",tooltipText:"Cases where this learning should not be applied to avoid incorrect responses.",conditions:on,onConditionsChange:rn,isLoading:fn,isValidating:Yn,onLock:wo,onValidationFailure:so},{children:nt&&nt.when_not_to_apply&&Object.keys(nt.when_not_to_apply).length>0&&a(P,r({mt:on.length>0?3:0,sx:{borderTop:on.length>0?"1px dashed #ccc":"none",pt:on.length>0?2:0}},{children:[oo.wnta&&a(P,r({sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1.5}},{children:[l(R,r({variant:"subtitle2",sx:{fontWeight:"bold",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Recommended Fix:"})),l(Xt,{score:nt.confidence_score})]})),oo.wnta&&nt.reason&&l(eo,{reason:nt.reason,title:"Why these suggestions?"}),Object.entries(nt.when_not_to_apply).map(function(e){var n=e[0],t=e[1];return l(no,{condition:"".concat(n,". ").concat(t),onAccept:function(){return po(t,"wnta",n)},onReject:function(){return fo(0,"wnta",n)}},"rec-wnta-".concat(n))})]}))}))}))]})),Wn&&qn&&l(I,{conflictingConditions:qn}),xo&&l(w,{conflictingConditions:[Object.values((null==ve?void 0:ve.conflicting_learnings)||{}),Object.values((null==ve?void 0:ve.similar_learnings)||{})],baseUrl:me,organizationName:pe,chatAssistantName:Te,setSendMessageInChat:ye,editConflictingLearningTrigger:we,editSimilarLearningTrigger:be,onSetOperationStatus:Ce,onDeleted:Se,onMergeMessage:ke,onEdited:function(e){console.log("ContextualForm: Marking learning as edited from card callback:",e),rt(function(n){return new Set(n).add(e)})},isFromDashboard:ze}),a(_,r({fullWidth:!0,ref:De},{children:[a(R,r({sx:{fontSize:"1rem",fontWeight:600,fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center",marginBottom:"8px"}},{children:["Topic",l(P,r({component:"span",sx:{color:"red"}},{children:"*"})),l(z,r({title:"Specific key subjects or concepts covered by this learning. Helps organize and trigger relavant responses from AI",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l($,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),a(P,r({sx:{position:"relative"}},{children:[l(A,{fullWidth:!0,placeholder:"Select or type a topic",value:We,onChange:function(e){je(e.target.value),qe||Ee(!0),""===e.target.value&&co("topic",{id:null,value:""})},onKeyDown:function(e){if("Enter"===e.key){e.preventDefault();var n=We.trim();if(!n)return;var t=Be.find(function(e){return e.label.toLowerCase()===n.toLowerCase()});t?(Co(t.id,t.label),console.log("📌 Existing Topic Selected:",t)):(Co(null,n),console.log("📌 New Topic Created:",{id:null,value:n}))}},onClick:function(){return Ee(!0)},InputProps:{endAdornment:l(G,{size:20,color:"#667085"}),sx:{fontFamily:"Plus Jakarta Sans, sans-serif"}},sx:{"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},boxShadow:vn?"0 0 12px 3px rgba(34, 197, 94, 0.6)":"none",transition:"box-shadow 0.3s ease-in-out"}}),qe&&l(P,r({sx:{position:"absolute",zIndex:1300,width:"90%",mt:1,bgcolor:"background.paper",border:"1px solid #ccc",borderRadius:"8px",boxShadow:3,maxHeight:200,overflowY:"auto"}},{children:$e?l(P,r({sx:{display:"flex",justifyContent:"center",p:2}},{children:l(J,{size:24})})):a(s,{children:[bo.map(function(e){return l(M,r({onMouseDown:function(){return Co(e.id,e.label)},sx:{fontSize:"1rem",fontFamily:"Plus Jakarta Sans"}},{children:e.label}),e.id)}),0===bo.length&&l(M,r({disabled:!0,sx:{fontSize:"1rem",fontFamily:"Plus Jakarta Sans"}},{children:"No results found."}))]})}))]}))]})),a(_,r({fullWidth:!0},{children:[a(R,r({sx:{fontSize:"1rem",fontWeight:600,fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center",marginBottom:"8px"}},{children:["Categories",l(z,r({title:"Additional tags or classifications for organizing this learning",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l($,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),a(P,r({sx:{display:"flex",flexWrap:"wrap",gap:1,p:1.5,border:"1px solid #ccc",borderRadius:"8px",alignItems:"center",bgcolor:"white",cursor:"text",minHeight:"56px"},onClick:function(){var e;return null===(e=Ke.current)||void 0===e?void 0:e.focus()}},{children:[mo.map(function(e){return l(W,{label:e.label,onDelete:function(){return n=e,t=mo.filter(function(e){return e.value!==n.value}),void co("categories",t);var n,t},deleteIcon:l(Y,{size:16}),sx:{bgcolor:e.isCustom?"#e0e7ff":"#f5f5f5",fontSize:"1rem",height:"36px",fontFamily:"Plus Jakarta Sans","& .MuiChip-deleteIcon":{color:"#666","&:hover":{color:"#333"}}}},e.value)}),l(A,{variant:"standard",inputRef:Ke,value:Qe,onChange:function(e){return Ze(e.target.value)},onKeyDown:function(e){if("Enter"===e.key){e.preventDefault();var t=Qe.trim();if(t&&!mo.some(function(e){return e.value===t})){var o={id:null,label:t,value:t,isCustom:!0};co("categories",n(n([],mo,!0),[o],!1))}Ze("")}},placeholder:0===mo.length?"Add or select categories":"",sx:{flex:1,minWidth:"180px","& .MuiInput-underline:before":{borderBottom:"none"},"& .MuiInput-underline:after":{borderBottom:"none"},"& .MuiInput-underline:hover:not(.Mui-disabled):before":{borderBottom:"none"},"& .MuiInputBase-input":{fontSize:"1rem",padding:"4px 0",fontFamily:"Plus Jakarta Sans"}}})]})),Vn?a(P,r({sx:{display:"flex",alignItems:"center",gap:1,mt:2,color:"#5928ED"}},{children:[l(J,{size:16,color:"inherit"}),l(R,r({variant:"caption",sx:{fontSize:"0.95rem",fontFamily:"Plus Jakarta Sans"}},{children:"Getting AI suggestions..."}))]})):vo.length>0?l(P,r({sx:{display:"flex",flexWrap:"wrap",gap:1.5,mt:2}},{children:vo.map(function(e){return l(W,{label:e.label,icon:l(Q,{size:16,style:{marginLeft:"8px"}}),onClick:function(){return t=e,void(new Set(mo.map(function(e){return e.value.toLowerCase()})).has(t.value.toLowerCase())||co("categories",n(n([],mo,!0),[t],!1)));var t},sx:{bgcolor:"#f5f5f5",fontSize:"1rem",height:"36px",fontFamily:"Plus Jakarta Sans",cursor:"pointer","&:hover":{bgcolor:"#e0e0e0"}}},e.value)})})):!Vn&&Hn.length>0&&l(R,r({variant:"caption",sx:{color:"#666",mt:2,fontSize:"0.95rem",fontFamily:"Plus Jakarta Sans"}},{children:"All suggested categories have been added."})),l(R,r({variant:"caption",sx:{color:"#666",mt:2,mb:2,fontSize:"0.95rem",fontFamily:"Plus Jakarta Sans"}},{children:Vn?"":vo.length>0?"Choose from the suggested categories based on your Instant Learning.":mo.length>0&&0===Hn.length&&!Vn?"You can add more categories by typing and pressing Enter.":"Type and press Enter to add a category. AI suggestions will appear based on your 'How to respond' text."}))]})),l(_,r({sx:{width:"100%"}},{children:a(P,r({sx:{display:"flex",gap:2,alignItems:"flex-start"}},{children:[a(P,r({sx:{flexShrink:0}},{children:[a(R,r({sx:{fontSize:"1rem",fontWeight:600,fontFamily:"Plus Jakarta Sans"},gutterBottom:!0},{children:["Scope",l(P,r({component:"span",sx:{color:"red"}},{children:"*"})),l(z,r({title:"Defines at what scope this learning applies",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l($,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),l(_,r({sx:{width:"auto",minWidth:"200px",fontFamily:"Plus Jakarta Sans"},variant:"outlined"},{children:a(j,r({value:se.scope.name,onChange:function(e){var n=e.target.value,t=null;"User"===n?t=[]:"Assistant"===n&&(t={assistantName:fe||"",conciergeId:Re||""}),ce(function(e){return r(r({},e),{scope:{name:n,value:t}})})},displayEmpty:!0,sx:{fontFamily:"Plus Jakarta Sans"},fullWidth:!0,renderValue:function(e){return e||l("em",r({style:{fontFamily:"Plus Jakarta Sans",color:"#6c757d"}},{children:"Select scope"}))}},{children:[l(M,r({value:"",disabled:!0,sx:{fontFamily:"Plus Jakarta Sans"}},{children:l("em",r({style:{fontFamily:"Plus Jakarta Sans",color:"#6c757d"}},{children:"Select scope"}))})),bn.map(function(e){return l(M,r({value:e.scope,sx:{fontFamily:"Plus Jakarta Sans"}},{children:e.scope}),e.value)})]}))}))]})),a(P,r({sx:{flex:1}},{children:["User"===se.scope.name&&a(P,{children:[a(R,r({sx:{fontSize:"1rem",fontWeight:600,fontFamily:"Plus Jakarta Sans"},gutterBottom:!0},{children:["User Details",l(P,r({component:"span",sx:{color:"red"}},{children:"*"})),l(z,r({title:"Select the user for whom this learning applies",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l($,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),Array.isArray(null===(C=null==se?void 0:se.scope)||void 0===C?void 0:C.value)&&(null===(S=null==se?void 0:se.scope)||void 0===S?void 0:S.value.length)>0?a(P,r({sx:{display:"flex",alignItems:"center",gap:1,p:1,bgcolor:"#ecf0f8",borderRadius:"20px",width:"fit-content"}},{children:[l(P,r({sx:{width:20,height:20,borderRadius:"50%",bgcolor:"#385390",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:"0.75rem"}},{children:null===(L=se.scope.value[0].email[0])||void 0===L?void 0:L.toUpperCase()})),l(R,r({sx:{color:"#385390",fontFamily:"Plus Jakarta Sans"}},{children:se.scope.value[0].name})),l("button",r({style:{color:"#aabef2",cursor:"pointer",background:"transparent",border:"none",padding:0,fontSize:"1.25rem"},type:"button",onMouseOver:function(e){return e.currentTarget.style.color="#385390"},onMouseOut:function(e){return e.currentTarget.style.color="#aabef2"},onClick:function(){ce(function(e){return r(r({},e),{scope:r(r({},e.scope),{value:[]})})}),Fn("")}},{children:"×"}))]})):a(P,r({sx:{display:"flex",alignItems:"flex-start"}},{children:[l(A,{fullWidth:!0,type:"email",value:In,onChange:function(e){return Fn(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&uo()},placeholder:"Enter email",error:!!_n,helperText:_n,InputProps:{sx:{fontFamily:"Plus Jakarta Sans, sans-serif"}},sx:{"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"}}}),l(O,r({variant:"contained",onClick:uo,disabled:Rn||!In||Array.isArray(null===(D=null==se?void 0:se.scope)||void 0===D?void 0:D.value)&&(null===(ne=null==se?void 0:se.scope)||void 0===ne?void 0:ne.value.length)>0,sx:{fontFamily:"Plus Jakarta Sans",bgcolor:"#DEE6FB",color:"#385390",textTransform:"none",minWidth:"120px",height:"56px",ml:1,flexShrink:0,"&:hover":{bgcolor:"#c9d9f7"},"&.Mui-disabled":{bgcolor:"#f5f5f5",color:"#9e9e9e"}}},{children:Rn?l(J,{size:16,sx:{color:"#385390"}}):"Add email"}))]}))]}),"Custom"===se.scope.name&&a(P,r({sx:{flexShrink:0}},{children:[a(R,r({sx:{fontFamily:"Plus Jakarta Sans",fontSize:"1rem",fontWeight:600,display:"flex",alignItems:"center"},gutterBottom:!0},{children:["Custom Filter",l(P,r({component:"span",sx:{color:"red"}},{children:"*"})),l(z,r({title:"Select a custom scope filter for this learning",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l($,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),l(_,r({sx:{width:"auto",minWidth:"200px",fontFamily:"Plus Jakarta Sans"},variant:"outlined"},{children:a(j,r({value:(null===(re=null===(ie=null==se?void 0:se.scope)||void 0===ie?void 0:ie.value)||void 0===re?void 0:re.scopeId)||"",onChange:function(e){var n=kn.find(function(n){return n.scopeId===e.target.value});ce(function(e){return r(r({},e),{scope:r(r({},e.scope),{value:n?{scopeName:n.scopeName,scopeId:n.scopeId}:null})})})},displayEmpty:!0,sx:{fontFamily:"Plus Jakarta Sans"},fullWidth:!0},{children:[l(M,r({value:"",disabled:!0,sx:{fontFamily:"Plus Jakarta Sans"}},{children:"Select Custom Filter"})),kn.map(function(e){return l(M,r({value:e.scopeId,sx:{fontFamily:"Plus Jakarta Sans"}},{children:e.scopeName}),e.scopeId)})]}))})),l(R,r({sx:{fontSize:"0.75rem",color:"text.secondary",mt:1}},{children:0===kn.length?"No scopes available.":"".concat(kn.length," scopes available.")}))]})),"Assistant"===se.scope.name&&a(P,{children:[a(R,r({sx:{fontFamily:"Plus Jakarta Sans",fontSize:"1rem",fontWeight:600,display:"flex",alignItems:"center"},gutterBottom:!0},{children:["Assistant",l(P,r({component:"span",sx:{color:"red"}},{children:"*"})),l(z,r({title:"The assistant for which this learning applies",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l($,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),ze?l(q,{options:Ut,loading:Yt,getOptionLabel:function(e){return e.name||""},inputValue:Nt,onInputChange:function(e,n){Bt(n)},onChange:function(e,n){ce(function(e){return r(r({},e),{scope:r(r({},e.scope),{value:n?{assistantName:n.name,conciergeId:n.id}:null})})})},renderInput:function(e){return l(A,r({},e,{placeholder:"Search for an assistant",InputProps:r(r({},e.InputProps),{endAdornment:a(s,{children:[Yt?l(J,{color:"inherit",size:20}):null,e.InputProps.endAdornment]}),sx:{fontFamily:"Plus Jakarta Sans, sans-serif"}})}))}}):a(s,{children:[l(A,{fullWidth:!0,value:fe||"",InputProps:{readOnly:!0,sx:{fontFamily:"Plus Jakarta Sans, sans-serif",bgcolor:"#fafafa"}},sx:{"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"}}}),l("input",{type:"hidden",value:fe||"",onChange:function(e){ce(function(n){return r(r({},n),{scope:r(r({},n.scope),{value:{assistantName:fe||"",conciergeId:e.target.value||""}})})})}})]})]})]}))]}))}))]})),l(P,r({sx:{display:"flex",gap:2}},{children:l(P,r({sx:{flex:1,display:"flex",alignItems:"flex-end",justifyContent:"flex-end"}},{children:a(O,r({variant:"contained",onClick:function(){return o(void 0,void 0,void 0,function(){return i(this,function(e){return yo?(console.warn("Save blocked by button click: Unresolved conflicts are present."),[2]):(Pe(!0),[2])})})},disabled:!go||_e||yo,sx:{width:"30%",height:"56px",fontFamily:"Plus Jakarta Sans",backgroundColor:"green",textTransform:"capitalize","&:hover":{backgroundColor:"#006400"},pointerEvents:_e?"none":"auto"}},{children:[_e&&l(J,{sx:{marginRight:"8px",color:"#fff"},size:16}),_e?"Saving":"Save"]}))}))}))]}))]}))};export{ie as default};
|
|
1
|
+
import{__makeTemplateObject as e,__spreadArray as n,__rest as t,__awaiter as o,__generator as i,__assign as r}from"tslib";import{jsxs as a,jsx as l,Fragment as s}from"react/jsx-runtime";import{useState as c,useRef as u,useEffect as d,useMemo as p,useCallback as f}from"react";import h from"../../../hooks/useDebounce.js";import{searchAssistants as g,fetchUserByEmail as m,fetchExistingTopicsAPI as x,fetchScopes as v,fetchAllCustomScopes as y}from"../../../utils/agentGenieAPI.js";import w from"./ContextualConflictDBCard.js";import b from"@mui/icons-material/Delete";import C from"@mui/icons-material/Edit";import S from"@mui/icons-material/Add";import k from"@mui/icons-material/CheckCircleOutline";import T from"@mui/icons-material/Cancel";import L from"@mui/icons-material/Save";import I from"./ConflictingLearningWarnCard.js";import{keyframes as F,Box as P,Typography as R,Tooltip as z,TextField as A,FormControl as _,CircularProgress as J,MenuItem as M,Chip as W,Select as O,Button as j,Autocomplete as q,IconButton as E,InputAdornment as D,Accordion as H,AccordionSummary as N,AccordionDetails as B}from"@mui/material";import{fetchInstantLearningTagsAPI as V,fetchSuggestedCategories as U}from"../../../utils/instantLearningAPI.js";import{Info as $,ChevronDown as G,X as Y,Sparkles as Q,Lightbulb as Z}from"lucide-react";import K from"../InstantLearning.module.css.js";import X from"./GeneralizationAccordion.js";var ee,ne,te=function(t){var s=t.label,u=t.required,d=void 0!==u&&u,p=t.tooltipText,f=t.conditions,h=t.onConditionsChange,g=t.isLoading,m=t.isValidating,x=t.onLock,v=t.onValidationFailure,y=t.children,w=c(!1),k=w[0],T=w[1],I=F(ee||(ee=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 "])));return a(P,r({sx:{display:"flex",flexDirection:"column",height:"100%"}},{children:[a(R,r({sx:{fontSize:"1rem",fontWeight:600,marginBottom:"8px",fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center"}},{children:[s,d&&l(P,r({component:"span",sx:{color:"red"}},{children:"*"})),p&&l(z,r({title:p,placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l($,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),a(P,r({sx:{border:"1px solid #ccc",borderRadius:"8px",padding:2,display:"flex",flexDirection:"column",flexGrow:1,height:"calc(100% - 32px)",bgcolor:"white",boxShadow:g?"0 0 12px 3px rgba(34, 197, 94, 0.6)":"none",transition:"box-shadow 0.3s ease-in-out"}},{children:[l(P,r({display:"flex",alignItems:"center",justifyContent:"space-between",sx:{mb:"8px"}},{children:a("div",r({style:{width:"100%",display:"flex",gap:"0.25rem",justifyContent:"space-between",alignItems:"center"}},{children:[a("div",r({style:{display:"flex",gap:"0.25rem",alignItems:"center"}},{children:[a("svg",r({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[l("g",r({id:"bi:stars",clipPath:"url(#clip0_6004_60631)"},{children:l("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),l("defs",{children:l("clipPath",r({id:"clip0_6004_60631"},{children:l("rect",{width:"24",height:"24",fill:"white"})}))})]})),l(R,r({variant:"body1",sx:{fontWeight:"600",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Suggestions"}))]})),a(P,{children:[l(z,r({title:"Add New Condition",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l(E,r({onClick:function(){h(n(n([],f,!0),[""],!1)),T(!0)},size:"small",sx:{color:"gray","&:hover":{color:"black"}}},{children:l(S,{fontSize:"small"})}))})),f.length>0&&l(z,r({title:k?"Save & Lock":"Edit",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:a("span",{children:[" ",l(E,r({onClick:function(){return o(void 0,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return k&&x?(console.log("Calling onLock (validation)..."),[4,x()]):[3,2];case 1:return e=n.sent(),console.log("Validation finished. Result (isValid):",e),T(!1),!e&&v?(console.log("Validation failed. Calling onValidationFailure..."),v()):e&&console.log("Validation succeeded."),[3,3];case 2:console.log("Toggling isEditable state (Edit clicked or no onLock)."),T(!k),n.label=3;case 3:return[2]}})})},size:"small",disabled:k&&f.some(function(e){return""===e.trim()})||m,sx:{color:"gray","&:hover":{color:"black"},opacity:m?.5:1,cursor:m?"wait":"pointer"}},{children:m?l(J,{size:20,sx:{color:"#5928ed"}}):l(k?L:C,{fontSize:"small"})}))]})}))]})]}))})),l(P,r({sx:{height:"calc(100% - 38px)",overflow:"auto"}},{children:f.length>0?a(P,r({sx:{pt:"16px"}},{children:[l("ol",r({style:{paddingLeft:"0rem",margin:0,fontFamily:"Plus Jakarta Sans"}},{children:f.map(function(e,t){return a(P,r({component:"li",sx:{display:"flex",alignItems:"flex-start",gap:1,mb:t<f.length-1?2:0,fontFamily:"Plus Jakarta Sans"}},{children:[l(A,{variant:"outlined",disabled:!k,fullWidth:!0,multiline:!0,value:e,onChange:function(e){return function(e,t){var o=n([],f,!0);o[e]=t,h(o)}(t,e.target.value)},sx:{backgroundColor:"#f9fafb",borderRadius:1,"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputBase-input.Mui-disabled":{color:"#000",WebkitTextFillColor:"#000"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root.Mui-disabled":{color:"rgba(0, 0, 0, 0.6)"}},InputProps:{startAdornment:a(D,r({position:"start",sx:{color:"#000",alignSelf:"flex-start",paddingTop:"12px"}},{children:[t+1,"."]}))}}),k&&l(E,r({onClick:function(){return function(e){h(f.filter(function(n,t){return t!==e}))}(t)},sx:{mt:1},size:"large"},{children:l(b,{})}))]}),t)})})),m&&a(P,r({sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px",mt:3,mb:2,fontFamily:'"Plus Jakarta Sans", sans-serif',color:"#5a28ed"}},{children:[l(R,r({variant:"body2",sx:{color:"#5a28ed"}},{children:"Validating your conditions"})),l(P,{sx:{width:"8px",height:"8px",bgcolor:"#5a28ed",borderRadius:"50%",animation:"".concat(I," 1.4s infinite ease-in-out both"),animationDelay:"-0.32s"}}),l(P,{sx:{width:"8px",height:"8px",bgcolor:"#5a28ed",borderRadius:"50%",animation:"".concat(I," 1.4s infinite ease-in-out both"),animationDelay:"-0.16s"}}),l(P,{sx:{width:"8px",height:"8px",bgcolor:"#5a28ed",borderRadius:"50%",animation:"".concat(I," 1.4s infinite ease-in-out both")}})]})),y]})):l("div",r({style:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},{children:a("div",r({style:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"0.5rem",paddingTop:"1rem",paddingBottom:"1rem"}},{children:[l("div",r({style:{fontWeight:"700",color:"#6b7280"}},{children:"No suggestions found"})),a("div",r({style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"0.25rem",fontSize:"1rem",flexFlow:"wrap"}},{children:[l("div",r({style:{}},{children:"Tell us about your learning in "})),l("span",r({style:{color:"#5928ED",fontWeight:"700"}},{children:"InstantLearning.AI"}))," ",l("span",{children:"Chat"})]}))]}))}))}))]}))]}))},oe=function(b){var C,S,L,D,ee,oe,ie,re=b.question;b.categoryOptions;var ae=b.onSubmit,le=b.formData,se=b.setFormData,ce=b.extractedHowToRespond,ue=b.extractedTopic,de=b.organizationName,pe=b.iLAssistantName,fe=b.validationWtaResponse,he=b.setValidationWtaResponse,ge=b.baseUrl,me=b.extractedCategories,xe=b.learningWtaResponse,ve=b.setSendMessageInChat,ye=b.editConflictingLearningTrigger,we=b.editSimilarLearningTrigger,be=b.onSetOperationStatus,Ce=b.onDeleted,Se=b.onMergeMessage,ke=b.chatAssistantName,Te=b.validationRecommendations,Le=b.resetLearningTrigger,Ie=b.save,Fe=b.setIsFormSavedClicked,Pe=b.assistantId,Re=b.isFromDashboard,ze=c(!1),Ae=ze[0],_e=ze[1],Je=c(""),Me=Je[0],We=Je[1],Oe=c(!1),je=Oe[0],qe=Oe[1],Ee=u(null),De=h(Me,300),He=c([]),Ne=He[0],Be=He[1],Ve=c(!0),Ue=Ve[0],$e=Ve[1],Ge=c(""),Ye=Ge[0],Qe=Ge[1],Ze=u(null),Ke=c([]),Xe=Ke[0],en=Ke[1],nn=c([]),tn=nn[0],on=nn[1],rn=c(!1),an=rn[0],ln=rn[1],sn=c(!1),cn=sn[0],un=sn[1],dn=c(!1),pn=dn[0],fn=dn[1],hn=u(!1),gn=u(!1),mn=c(!1),xn=mn[0],vn=mn[1],yn=c([]),wn=yn[0],bn=yn[1],Cn=c([]),Sn=Cn[0],kn=Cn[1],Tn=c(""),Ln=Tn[0],In=Tn[1],Fn=c(!1),Pn=Fn[0],Rn=Fn[1],zn=c(""),An=zn[0],_n=zn[1],Jn=c(!1),Mn=Jn[0],Wn=Jn[1],On=c(null),jn=On[0],qn=On[1],En=c([]),Dn=En[0],Hn=En[1],Nn=c(!1),Bn=Nn[0],Vn=Nn[1],Un=h(le.howToRespond,2500),$n=c(!1),Gn=$n[0],Yn=$n[1],Qn=c(null),Zn=Qn[0],Kn=Qn[1],Xn=c(null),et=Xn[0],nt=Xn[1],tt=c(new Set),ot=tt[0],it=tt[1],rt=c(84),at=rt[0],lt=rt[1],st=u(null),ct=c(56),ut=ct[0],dt=ct[1],pt=u(null),ft=c([]),ht=ft[0],gt=ft[1],mt=c([]),xt=mt[0],vt=mt[1],yt=c({}),wt=yt[0],bt=yt[1],Ct=c({}),St=Ct[0],kt=Ct[1],Tt=c(null),Lt=Tt[0],It=Tt[1],Ft=c(null),Pt=Ft[0],Rt=Ft[1],zt=c(!1),At=zt[0],_t=zt[1],Jt=c(!1),Mt=Jt[0],Wt=Jt[1],Ot=h(le.howToRespond,1500),jt=h(le.question,1500),qt=u(!1),Et=u(null),Dt=c(""),Ht=Dt[0],Nt=Dt[1],Bt=c([]),Vt=Bt[0],Ut=Bt[1],$t=c(!1),Gt=$t[0],Yt=$t[1],Qt=h(Ht,400);d(function(){if(Re&&Qt){o(void 0,void 0,void 0,function(){var e,n;return i(this,function(t){switch(t.label){case 0:Yt(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,g(Qt,ge||"")];case 2:return e=t.sent(),Ut(e),[3,5];case 3:return n=t.sent(),console.error("Failed to search assistants",n),Ut([]),[3,5];case 4:return Yt(!1),[7];case 5:return[2]}})})}},[Qt,Re,ge]),F(ne||(ne=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 Zt=function(e){var n=e.color,t=void 0===n?"#fff":n,o=e.size,i=void 0===o?12:o;return a("svg",r({width:i,height:i,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[l("path",{d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.3188 23.8989 12.0012 24.0019 11.7759 23.9658L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.37668 16.8492 4.37668 16.1502 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021Z",fill:t}),l("path",{d:"M5.69218 1.72171C5.8106 1.52009 6.19176 1.52009 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.4808 5.75512 10.4808 6.24724 10.2792 6.31018L8.53618 6.88921C7.75918 7.15018 7.15018 7.75918 6.89068 8.53618L6.31018 10.2777C6.19176 10.4793 5.8106 10.4793 5.69218 10.2777L5.11168 8.53471C4.85071 7.75918 4.24171 7.15018 3.46618 6.88921L1.72318 6.30871C1.52156 6.24576 1.52156 5.75512 1.72318 5.69071L3.46618 5.11021C4.24171 4.85071 4.85071 4.24171 5.11168 3.46471L5.69218 1.72171Z",fill:t}),l("path",{d:"M16.2957 0.148207C16.4119 0.016038 16.5905 0.016038 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.4848 2.83676 19.4848 3.16265 19.3527 3.20521L18.1917 3.59221C17.6727 3.76521 17.2662 4.17171 17.0937 4.69021L16.7067 5.85121C16.5905 5.98338 16.4119 5.98338 16.2957 5.85121L15.9087 4.69021C15.7377 4.17171 15.3312 3.76521 14.8122 3.59221L13.6512 3.20521C13.519 3.16265 13.519 2.83676 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:t})]}))},Kt=function(e){var n=e.score;return a(P,r({sx:{display:"inline-flex",alignItems:"center",gap:.5,px:1.5,py:.5,borderRadius:"16px",backgroundColor:"#10B981",color:"white",fontSize:"0.8rem",fontWeight:600,fontFamily:"Plus Jakarta Sans"}},{children:[l(Zt,{}),a(R,r({sx:{fontSize:"0.8rem",fontWeight:600,fontFamily:"inherit"}},{children:[n,"%"]}))]}))},Xt=function(e){var n=e.reason,t=e.title;return a(H,r({elevation:0,sx:{backgroundColor:"#f3f0ff",border:"1px solid #dcd6f7",borderRadius:2,mb:2,"&::before":{display:"none"}}},{children:[l(N,r({expandIcon:l(G,{style:{color:"#5928ed"}}),sx:{minHeight:"auto","& .MuiAccordionSummary-content":{margin:"12px 0"}}},{children:a(P,r({sx:{display:"flex",alignItems:"center",gap:1}},{children:[l(Z,{size:16,color:"#5928ed"}),l(R,r({sx:{fontSize:"0.85rem",fontWeight:600,color:"#5928ed",fontFamily:"Plus Jakarta Sans"}},{children:t}))]}))})),l(B,r({sx:{pt:0,pb:1.5,backgroundColor:"#faf9ff"}},{children:l(R,r({sx:{fontSize:"0.9rem",color:"#4A4458",fontFamily:"Plus Jakarta Sans"}},{children:n}))}))]}))},eo=function(e){var n=e.condition,t=e.onAccept,o=e.onReject;return a(P,r({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:1,mb:1,backgroundColor:"#f0f4f8",border:"1px solid #d1d9e6",borderRadius:"4px"}},{children:[l(R,r({sx:{flex:1,fontFamily:"Plus Jakarta Sans",mr:1}},{children:n})),a(P,r({sx:{flexShrink:0}},{children:[l(E,r({onClick:t,size:"small",sx:{color:"green"}},{children:l(k,{})})),l(E,r({onClick:o,size:"small",sx:{color:"red"}},{children:l(T,{})}))]}))]}))},no=c({wta:!1,wnta:!1}),to=no[0],oo=no[1],io=c({wta:!1,wnta:!1}),ro=io[0],ao=io[1],lo=function(){console.log("handleValidationFailure triggered in parent form."),ve("Validation Failed. Do you have any recommendations for me?")},so=function(e,n){se(function(t){var o;return r(r({},t),((o={})[e]=n,o))})},co=function(){return o(void 0,void 0,void 0,function(){var e,t,o,a;return i(this,function(i){switch(i.label){case 0:if(!Ln.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/))return _n("Invalid email format"),[2];if((e=Array.isArray(le.scope.value)?le.scope.value:[]).some(function(e){return e.email===Ln}))return _n("This email is already added."),[2];Rn(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,m(Ln,ge)];case 2:return t=i.sent(),o={email:Ln,userId:t.id,name:t.name},se(function(t){return r(r({},t),{scope:r(r({},t.scope),{value:n(n([],e,!0),[o],!1)})})}),In(""),_n(""),[3,5];case 3:return a=i.sent(),console.error("Error adding email:",a),_n("Invalid email. Please enter a valid email."),[3,5];case 4:return Rn(!1),[7];case 5:return[2]}})})};d(function(){console.log("ContextualForm: validationWtaResponse changed:",fe),fe&&!1===fe.is_valid?(Wn(!0),qn(fe.conflictingConditions),console.log("ContextualForm: Showing conflict card with data:",fe.conflictingConditions)):(Wn(!1),qn(null),console.log("ContextualForm: Hiding conflict card."))},[fe]),d(function(){Te&&(console.log("ContextualForm: Received new validationRecommendations:",Te),Kn(Te.wta),nt(Te.wnta),oo({wta:!!Te.wta,wnta:!!Te.wnta}),ao({wta:!1,wnta:!1}),Wn(!1),qn(null))},[Te]),d(function(){Le&&(console.log("[ContextualLearningForm] 🔄 Reset Trigger Received - Clearing form state."),en([]),on([]),Wn(!1),qn(null),Kn(null),nt(null),oo({wta:!1,wnta:!1}),ao({wta:!1,wnta:!1}),Yn(!1),In(""),_n(""),We(""),Qe(""),Hn([]),it(new Set),gt([]),vt([]),bt({}),kt({}),It(null),Rt(null),se(function(e){return{question:Re?"":e.question,howToRespond:"",whenToApply:"",whenNotToApply:"",topic:{id:null,value:""},categories:[],scope:{name:"",value:null}}}),console.log("[ContextualLearningForm] ✅ Form state reset."))},[Le,se,re]),d(function(){if(Un&&le.question&&ge){o(void 0,void 0,void 0,function(){var e,n,t;return i(this,function(o){switch(o.label){case 0:Vn(!0),o.label=1;case 1:return o.trys.push([1,3,4,5]),[4,U(le.howToRespond||"",ge)];case 2:return e=o.sent(),n=e.map(function(e){return{id:null,label:e.label||e.value,value:e.value,isCustom:!1}}),Hn(n),[3,5];case 3:return t=o.sent(),console.error("Failed to fetch categories:",t),Hn([]),[3,5];case 4:return Vn(!1),[7];case 5:return[2]}})})}},[Un,le.question,ge]),d(function(){if(Array.isArray(me)){var e=me.map(function(e){return{id:null,label:e,value:e,isCustom:!1}});so("categories",e)}},[me]),d(function(){var e;if("string"==typeof ue&&ue!==(null===(e=le.topic)||void 0===e?void 0:e.value)){var n=Ne.find(function(e){return e.label===ue}),t=n?{id:n.id,value:n.label}:{id:null,value:ue};so("topic",t),console.log("📌 Topic Set from Chat:",{extractedTopic:ue,topicToSet:t}),vn(!0);var o=setTimeout(function(){vn(!1)},500);return function(){return clearTimeout(o)}}},[ue,Ne]),d(function(){if("string"==typeof ce&&ce!==le.howToRespond){so("howToRespond",ce),ln(!0);var e=setTimeout(function(){ln(!1)},500);return function(){return clearTimeout(e)}}},[ce]),d(function(){var e=[],n=!1;if(Array.isArray(le.whenToApply))e=le.whenToApply,n=!0;else if("string"==typeof le.whenToApply){var t=le.whenToApply.split(" OR ");e=1===t.length&&""===t[0]?[]:t}e.join("|||")!==Xe.join("|||")&&(hn.current=!0,en(e),n&&e.length>0&&(un(!0),setTimeout(function(){return un(!1)},500)))},[le.whenToApply]),d(function(){var e=[],n=!1;if(Array.isArray(le.whenNotToApply))e=le.whenNotToApply,n=!0;else if("string"==typeof le.whenNotToApply){var t=le.whenNotToApply.split(" OR ");e=1===t.length&&""===t[0]?[]:t}e.join("|||")!==tn.join("|||")&&(gn.current=!0,on(e),n&&e.length>0&&(fn(!0),setTimeout(function(){return fn(!1)},500)))},[le.whenNotToApply]),d(function(){hn.current?hn.current=!1:so("whenToApply",Xe.join(" OR "))},[Xe]),d(function(){gn.current?gn.current=!1:so("whenNotToApply",tn.join(" OR "))},[tn]);var uo=function(e,t,o){"wta"===t?(Wn(!1),qn(null),ro.wta?en(function(t){return Array.from(new Set(n(n([],t,!0),[e],!1)))}):(en([e]),ao(function(e){return r(r({},e),{wta:!0})})),Kn(function(e){if(!e||!e.when_to_apply)return e;var n=r({},e.when_to_apply);return delete n[o],0===Object.keys(n).length?null:r(r({},e),{when_to_apply:n})})):(Wn(!1),qn(null),ro.wnta?on(function(t){return Array.from(new Set(n(n([],t,!0),[e],!1)))}):(on([e]),ao(function(e){return r(r({},e),{wnta:!0})})),nt(function(e){if(!e||!e.when_not_to_apply)return e;var n=r({},e.when_not_to_apply);return delete n[o],0===Object.keys(n).length?null:r(r({},e),{when_not_to_apply:n})}))},po=function(e,n,t){"wta"===n?Kn(function(e){if(!e||!e.when_to_apply)return e;var n=r({},e.when_to_apply);return delete n[t],0===Object.keys(n).length?null:r(r({},e),{when_to_apply:n})}):nt(function(e){if(!e||!e.when_not_to_apply)return e;var n=r({},e.when_not_to_apply);return delete n[t],0===Object.keys(n).length?null:r(r({},e),{when_not_to_apply:n})})},fo=p(function(){var e=le.scope;if(!e||!e.name)return!1;switch(e.name){case"User":return Array.isArray(e.value)&&e.value.length>0;case"Custom":return!(!e.value||!e.value.scopeId);case"Assistant":return!(!e.value||!e.value.assistantName);default:return!0}},[le.scope]),ho=p(function(){var e;return le.question&&le.howToRespond&&(null===(e=le.topic)||void 0===e?void 0:e.value)&&fo},[le.question,le.howToRespond,le.topic,fo]),go=p(function(){return le.categories||[]},[le.categories]),mo=p(function(){return!(!xe||!0===xe.is_valid_db)&&Object.keys((null==xe?void 0:xe.conflicting_learnings)||{}).length+Object.keys((null==xe?void 0:xe.similar_learnings)||{}).length>0},[xe]),xo=p(function(){var e=new Set(go.map(function(e){return e.value.toLowerCase()}));return Dn.filter(function(n){return!e.has(n.value.toLowerCase())})},[Dn,go]),vo=p(function(){if(!xe||!0===xe.is_valid_db)return!1;var e=Object.values((null==xe?void 0:xe.conflicting_learnings)||{}),t=Object.values((null==xe?void 0:xe.similar_learnings)||{}),o=n(n([],e.map(function(e){return e.id}),!0),t.map(function(e){return e.id}),!0);return 0!==o.length&&!o.every(function(e){return ot.has(e)})},[xe,ot]);d(function(){if(Ie){console.log("ContextualLearningForm: 'save: true' received. Forcibly clearing all conflict UI states."),Wn(!1),qn(null),Fe(!0);o(void 0,void 0,void 0,function(){return i(this,function(e){return vo?(console.error("Save action triggered via prop, but is blocked due to unresolved conflicts."),[2]):(console.log("ContextualLearningForm: Submitting this formData:",le),function(){console.log("Contextual form submitting...");var e=ht&&ht.length>0||xt&&xt.length>0,n=le.question||"",t=Fo(n,ht),o=r(r({},le),{howToRespond:le.howToRespond,isInstantLearningPlus:e,parameterizedQuestion:n,originalQuestion:t,appliedTagsForQ:ht,appliedTagsIL:xt,tagMappingInfoQ:wt,tagMappingInfoIL:St});console.log("Final Payload with Generalization:",o),_e(!0),ae(o,function(){return _e(!1)})}(),[2])})})}},[Ie,vo]);var yo=function(){return o(void 0,void 0,void 0,function(){var e,n,t,o,r,a,l,s,c,u;return i(this,function(i){switch(i.label){case 0:if(console.log("handleLockValidation started."),!ge||!he)return console.error("❌ ERROR: Missing baseUrl or setValidationWtaResponse for validation."),[2,!1];if(Gn)return console.log("❕ Validation already in progress. Aborting."),[2,!1];if(Yn(!0),he(null),Wn(!1),qn(null),e=Xe.filter(function(e){return""!==e.trim()}),n=tn.filter(function(e){return""!==e.trim()}),0===e.length)return console.warn("⚠️ Validation Aborted: 'When To Apply' cannot be empty."),he({is_valid:!1,reason:"'When To Apply' conditions cannot be empty.",conflictingConditions:[]}),Wn(!0),qn([{conflictType:"validation_error",reason:"'When To Apply' conditions cannot be empty."}]),Yn(!1),[2,!1];t="".concat(ge,"/instant_learning/validate-wta"),o={whenToApply:e,whenNotToApply:n},i.label=1;case 1:return i.trys.push([1,9,,10]),console.log("📡 Firing fetch request to:",t),[4,fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})];case 2:if(r=i.sent(),console.log("✅ Fetch request initiated. Status Code:",r.status),r.ok)return[3,7];a="Could not read error body.",i.label=3;case 3:return i.trys.push([3,5,,6]),[4,r.text()];case 4:return a=i.sent(),[3,6];case 5:return i.sent(),[3,6];case 6:throw console.error("❌ API Error Response (".concat(r.status,"):"),a),new Error("API Error: ".concat(r.status));case 7:return[4,r.json()];case 8:return l=i.sent(),console.log("✅ Validation API response data:",l),he(l.response),Yn(!1),s=!0===(null===(u=null==l?void 0:l.response)||void 0===u?void 0:u.is_valid),console.log("handleLockValidation returning:",s),[2,s];case 9:return c=i.sent(),console.error("❌ Validation API fetch FAILED:",c.message,c),he({is_valid:!1,reason:"API call failed: ".concat(c.message),conflictingConditions:[]}),Wn(!0),qn([{conflictType:"api_error",reason:"Failed to connect to validation service: ".concat(c.message)}]),Yn(!1),console.log("handleLockValidation returning false due to error."),[2,!1];case 10:return[2]}})})};d(function(){o(void 0,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return $e(!0),[4,x(ge)];case 1:return e=n.sent(),Be(e),$e(!1),[2]}})})},[]),d(function(){o(void 0,void 0,void 0,function(){var e,n,t,o,r;return i(this,function(i){switch(i.label){case 0:return i.trys.push([0,5,,6]),Re?[4,y(ge)]:[3,2];case 1:return e=i.sent(),kn(e),bn([{scope:"Global",value:"Global"},{scope:"User",value:"User"},{scope:"Assistant",value:"Assistant"},{scope:"Custom",value:"Custom"}]),console.log("[Dashboard] Loaded custom scopes:",e.length),[3,4];case 2:return[4,v(pe||"",de||"",ge)];case 3:n=i.sent(),t=n.scopeOptions,o=n.customScopeOptions,bn(t),kn(o),i.label=4;case 4:return[3,6];case 5:return r=i.sent(),console.error("Failed to load scopes:",r),[3,6];case 6:return[2]}})})},[pe,de,ge,Re]),d(function(){le._contextualUpdate&&(console.log("ContextualForm: Clearing recommendations due to new direct/contextual suggestions."),Kn(null),nt(null),Wn(!1),qn(null),se(function(e){return e._contextualUpdate,t(e,["_contextualUpdate"])}))},[le._contextualUpdate]),d(function(){var e=function(e){Ee.current&&!Ee.current.contains(e.target)&&qe(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[]),d(function(){var e;(null===(e=le.topic)||void 0===e?void 0:e.value)?We(le.topic.value):We("")},[le.topic]);var wo=p(function(){return De?Ne.filter(function(e){return e.label.toLowerCase().includes(De.toLowerCase())}):Ne},[De,Ne]),bo=function(e,n){so("topic",{id:e,value:n}),qe(!1),We(n),console.log("📌 Topic Selected:",{id:e,value:n})},Co=f(function(e,n){return o(void 0,void 0,void 0,function(){var t,o;return i(this,function(i){switch(i.label){case 0:if(qt.current)return console.log("API call skipped: Apply/Undo in progress."),[2];"question"===n&&_t(!0),"howToRespond"===n&&Wt(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,V(null!=ge?ge:"",e)];case 2:return t=i.sent(),"question"===n?bt(t):kt(t),[3,5];case 3:return o=i.sent(),console.error("Error fetching instant learning tags:",o),"question"===n&&bt({}),"howToRespond"===n&&kt({}),[3,5];case 4:return"question"===n&&_t(!1),"howToRespond"===n&&Wt(!1),[7];case 5:return[2]}})})},[ge]);d(function(){jt&&!qt.current&&(console.log("ContextualLearningForm: Firing API for 'Question'",jt),Co(jt,"question"))},[jt,Co]),d(function(){Ot&&!qt.current&&Co(Ot,"howToRespond")},[Ot,Co]);var So=function(e){var t=[],o=("question"===e?le.question:le.howToRespond)||"",i="question"===e?ht:xt,a="question"===e?wt:St,s=new Set(n(n(n([],i.map(function(e){return e.original}),!0),i.map(function(e){return e.replacement}),!0),Object.keys(a),!0));if(0===s.size)return o;var c=Array.from(s).filter(Boolean).map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(0===c.length)return o;for(var u=new RegExp("(".concat(c.join("|"),")"),"gi"),d=o.split(u),p=function(e){var n=d[e];if(!n)return"continue";var o=i.find(function(e){return e.replacement.toLowerCase()===n.toLowerCase()}),s=o?void 0:Object.keys(a).find(function(e){return e.toLowerCase()===n.toLowerCase()}),c=!1;if(o){var u=Lt===o.original,p=Pt===o.replacement,f=u?o.original:o.replacement;t.push(l("span",r({onMouseEnter:function(){It(o.original),Rt(o.replacement)},onMouseLeave:function(){It(null),Rt(null)},style:{backgroundColor:u||p?"#eef2ff":"transparent",borderRadius:"3px",padding:"1px 2px",color:"inherit",fontWeight:500}},{children:f}),e)),c=!0}else if(s){var h=a[s],g=Pt===h;f=g?h:n;t.push(l("span",r({onMouseEnter:function(){It(s),Rt(h)},onMouseLeave:function(){It(null),Rt(null)},style:{backgroundColor:g||Lt===s?"#eef2ff":"transparent",borderRadius:"3px",padding:"1px 2px",cursor:"pointer"}},{children:f}),e)),c=!0}c||t.push(l("span",{children:n},e))},f=0;f<d.length;f++)p(f);return t},ko=function(e,t,o){!function(e,t,o){var i;Et.current&&clearTimeout(Et.current),qt.current=!0;var a=new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi"),l=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=new RegExp(l,"gi");if("question"===o){var c=null===(i=le.question)||void 0===i?void 0:i.replace(a,t);if(se(function(e){return r(r({},e),{question:c})}),gt(function(o){return n(n([],o,!0),[{original:e,replacement:t}],!1)}),le.howToRespond.match(a)&&!le.howToRespond.match(s)){var u=le.howToRespond.replace(a,t);se(function(e){return r(r({},e),{howToRespond:u})}),vt(function(o){return n(n([],o,!0),[{original:e,replacement:t}],!1)})}}else{var d=le.howToRespond.replace(a,t);se(function(e){return r(r({},e),{howToRespond:d})}),vt(function(o){return n(n([],o,!0),[{original:e,replacement:t}],!1)})}Et.current=setTimeout(function(){console.log("Releasing API lock"),qt.current=!1},2e3)}(e,t,o)},To=function(e,t,o){!function(e,t,o){var i;Et.current&&clearTimeout(Et.current),qt.current=!0;var a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=new RegExp(a,"i");if("question"===o){var s=null===(i=le.question)||void 0===i?void 0:i.replace(l,e);if(se(function(e){return r(r({},e),{question:s})}),gt(function(o){var i=o.findIndex(function(n){return n.original===e&&n.replacement===t});return i>-1?n(n([],o.slice(0,i),!0),o.slice(i+1),!0):o}),le.howToRespond.match(l)){var c=le.howToRespond.replace(l,e);se(function(e){return r(r({},e),{howToRespond:c})}),vt(function(o){var i=o.findIndex(function(n){return n.original===e&&n.replacement===t});return i>-1?n(n([],o.slice(0,i),!0),o.slice(i+1),!0):o})}}else{var u=le.howToRespond.replace(l,e);se(function(e){return r(r({},e),{howToRespond:u})}),vt(function(o){var i=o.findIndex(function(n){return n.original===e&&n.replacement===t});return i>-1?n(n([],o.slice(0,i),!0),o.slice(i+1),!0):o})}Et.current=setTimeout(function(){console.log("Releasing API lock"),qt.current=!1},2e3)}(e,t,o)},Lo=function(e,n,t,o){var i="question"===o?wt:St,a="question"===o?bt:kt,l=("question"===o?le.question:le.howToRespond)||"";return new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"i").test(l)?e!==n&&i.hasOwnProperty(n)?{success:!1,error:"This phrase (key) already exists as a suggestion."}:(a(function(o){var i=r({},o);return e!==n&&i.hasOwnProperty(e)&&delete i[e],i[n]=t,i}),{success:!0}):{success:!1,error:"This phrase (key) does not exist in the text."}},Io=function(e,n,t){var o="question"===t?wt:St,i="question"===t?bt:kt,a=("question"===t?le.question:le.howToRespond)||"";return new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"i").test(a)?o.hasOwnProperty(e)?{success:!1,error:"This phrase (key) already exists as a suggestion."}:(i(function(t){var o;return r(r({},t),((o={})[e]=n,o))}),{success:!0}):{success:!1,error:"This phrase (key) does not exist in the text."}},Fo=function(e,t){if(!t||0===t.length)return e;var o=n([],t,!0).sort(function(e,n){return n.replacement.length-e.replacement.length}),i=e;return o.forEach(function(e){var n=e.replacement.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),t=new RegExp(n,"g");i=i.replace(t,e.original)}),i},Po={fontFamily:"Plus Jakarta Sans, sans-serif",fontSize:"1rem",whiteSpace:"pre-wrap",wordWrap:"break-word",lineHeight:"1.4375em",minHeight:"56px",maxHeight:"200px",overflowY:"auto",boxSizing:"border-box",padding:"16.5px 14px",borderRadius:"4px",border:"1px solid #ccc",transition:"box-shadow 0.3s ease-in-out"},Ro={fontFamily:"Plus Jakarta Sans, sans-serif",fontSize:"1rem",whiteSpace:"pre-wrap",wordWrap:"break-word",lineHeight:"1.4375em",minHeight:"84px",maxHeight:"204px",overflowY:"auto",boxSizing:"border-box",boxShadow:an?"0 0 12px 3px rgba(34, 197, 94, 0.6)":"none",transition:"box-shadow 0.3s ease-in-out",padding:"16.5px 14px",borderRadius:"4px",border:"1px solid #ccc"};return a(P,r({p:0,className:K.customFont,sx:{display:"flex",flexDirection:"column",height:"100%",width:"95%",ml:2}},{children:[l(P,{children:l(R,r({sx:{fontSize:20,fontWeight:600,fontFamily:"Plus Jakarta Sans"}},{children:"Instant Learning"}))}),a(P,r({sx:{fontFamily:"Plus Jakarta Sans",display:"flex",flexDirection:"column",gap:2,justifyContent:"space-between",flexGrow:1,paddingTop:"20px",height:"calc(100% - 30px)",overflow:"auto"}},{children:[a(P,r({sx:{display:"flex",flexDirection:"column",gap:"20px",height:"calc(100% - 90px)",overflow:"auto",position:"relative"}},{children:[a(P,{children:[a(R,r({sx:{fontFamily:"Plus Jakarta Sans",fontSize:"1rem",fontWeight:600,display:"flex",alignItems:"center",marginBottom:"8px"}},{children:["Question",l(P,r({component:"span",sx:{color:"red"}},{children:"*"})),l(z,r({title:"The key phrase or user query that should utilise this learning",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l($,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),Re?Lt?l(P,r({sx:r(r({},Po),{height:"".concat(Math.max(56,ut),"px"),backgroundColor:"#fff","&:hover":{borderColor:"#000"},cursor:"text"}),onClick:function(){It(null),Rt(null),setTimeout(function(){var e;null===(e=pt.current)||void 0===e||e.focus()},0)}},{children:So("question")})):l(A,{value:le.question,onChange:function(e){if(so("question",e.target.value),pt.current){pt.current.style.height="auto";var n=pt.current.scrollHeight,t=Math.max(56,Math.min(n,200));pt.current.style.height="".concat(t,"px"),dt(t)}},multiline:!0,placeholder:"Enter your question...",fullWidth:!0,inputRef:pt,InputProps:{sx:{"& .MuiInputBase-input":{fontFamily:Po.fontFamily,fontSize:Po.fontSize,lineHeight:Po.lineHeight,whiteSpace:Po.whiteSpace,wordWrap:Po.wordWrap,boxSizing:Po.boxSizing,height:"".concat(Math.max(56,ut),"px !important"),padding:"".concat(Po.padding," !important"),overflowY:"".concat(Po.overflowY," !important"),resize:"none"}}},sx:{borderRadius:Po.borderRadius,transition:Po.transition,"& .MuiOutlinedInput-root":{padding:0,height:"auto","& .MuiOutlinedInput-notchedOutline":{borderColor:"#ccc"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#000"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#5928ed",borderWidth:"1px"}}}}):l(P,r({sx:r(r({},Po),{bgcolor:"#fafafa",cursor:"default",height:"auto"})},{children:So("question")}))]}),l(P,{children:l(X,{title:"Question Generalization",description:"Instant Learning Plus broadens instant learning across similar contexts.",tags:wt,appliedTags:ht,hoveredWord:Lt,isLoading:At,onApply:function(e,n){return ko(e,n,"question")},onUndo:function(e,n){return To(e,n,"question")},onEditSave:function(e,n,t){return Lo(e,n,t,"question")},onAddSave:function(e,n){return Io(e,n,"question")},setHoveredText:It,setHoveredTag:Rt})}),a(P,{children:[a(R,r({sx:{fontSize:"1rem",fontWeight:600,fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center",marginBottom:"8px"}},{children:["How to respond",l(P,r({component:"span",sx:{color:"red"}},{children:"*"})),l(z,r({title:"The guidance AI should follow when answering the user's question",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l($,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),Lt?l(P,r({sx:r(r({},Ro),{height:"".concat(Math.max(84,at),"px"),backgroundColor:"#fff","&:hover":{borderColor:"#000"},cursor:"text"}),onClick:function(){It(null),Rt(null),setTimeout(function(){var e;null===(e=st.current)||void 0===e||e.focus()},0)}},{children:So("howToRespond")})):l(A,{name:"howToRespond",value:le.howToRespond,onChange:function(e){if(se(function(n){return r(r({},n),{howToRespond:e.target.value})}),st.current){st.current.style.height="auto";var n=st.current.scrollHeight,t=Math.max(84,Math.min(n,204));st.current.style.height="".concat(t,"px"),lt(t)}},multiline:!0,placeholder:"Type your response...",fullWidth:!0,inputRef:st,InputProps:{sx:{"& .MuiInputBase-input":{fontFamily:Ro.fontFamily,fontSize:Ro.fontSize,lineHeight:Ro.lineHeight,whiteSpace:Ro.whiteSpace,wordWrap:Ro.wordWrap,boxSizing:Ro.boxSizing,height:"".concat(Math.max(84,at),"px !important"),padding:"".concat(Ro.padding," !important"),overflowY:"".concat(Ro.overflowY," !important"),maxHeight:"".concat(Ro.maxHeight," !important"),minHeight:"".concat(Ro.minHeight," !imporant"),resize:"none"}}},sx:{borderRadius:Ro.borderRadius,boxShadow:Ro.boxShadow,transition:Ro.transition,"& .MuiOutlinedInput-root":{padding:0,height:"auto","& .MuiOutlinedInput-notchedOutline":{borderColor:"#ccc"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#5928ed",borderWidth:"1px"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#000"}}}})]}),l(P,{children:l(X,{title:"Instant Learning Generalization",description:"Instant Learning Plus broadens instant learning across similar contexts.",tags:St,appliedTags:xt,hoveredWord:Lt,isLoading:Mt,onApply:function(e,n){return ko(e,n,"howToRespond")},onUndo:function(e,n){return To(e,n,"howToRespond")},onEditSave:function(e,n,t){return Lo(e,n,t,"howToRespond")},onAddSave:function(e,n){return Io(e,n,"howToRespond")},setHoveredText:It,setHoveredTag:Rt})}),a(P,r({sx:{display:"flex",gap:2,minHeight:"380px",flexShrink:0}},{children:[l(P,r({sx:{flex:1,height:"100%"}},{children:l(te,r({label:"When to Apply",required:!0,tooltipText:"Specific situations or conditions where this learning should be applied.",conditions:Xe,onConditionsChange:en,isLoading:cn,isValidating:Gn,onLock:yo,onValidationFailure:lo},{children:Zn&&Zn.when_to_apply&&Object.keys(Zn.when_to_apply).length>0&&a(P,r({mt:Xe.length>0?3:0,sx:{borderTop:Xe.length>0?"1px dashed #ccc":"none",pt:Xe.length>0?2:0}},{children:[to.wta&&a(P,r({sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1.5}},{children:[l(R,r({variant:"subtitle2",sx:{fontWeight:"bold",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Recommended Fix:"})),l(Kt,{score:Zn.confidence_score})]})),to.wta&&Zn.reason&&l(Xt,{reason:Zn.reason,title:"Why these suggestions?"}),Object.entries(Zn.when_to_apply).map(function(e){var n=e[0],t=e[1];return l(eo,{condition:"".concat(n,". ").concat(t),onAccept:function(){return uo(t,"wta",n)},onReject:function(){return po(0,"wta",n)}},"rec-wta-".concat(n))})]}))}))})),l(P,r({sx:{flex:1,height:"100%"}},{children:l(te,r({label:"When NOT to Apply",tooltipText:"Cases where this learning should not be applied to avoid incorrect responses.",conditions:tn,onConditionsChange:on,isLoading:pn,isValidating:Gn,onLock:yo,onValidationFailure:lo},{children:et&&et.when_not_to_apply&&Object.keys(et.when_not_to_apply).length>0&&a(P,r({mt:tn.length>0?3:0,sx:{borderTop:tn.length>0?"1px dashed #ccc":"none",pt:tn.length>0?2:0}},{children:[to.wnta&&a(P,r({sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1.5}},{children:[l(R,r({variant:"subtitle2",sx:{fontWeight:"bold",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Recommended Fix:"})),l(Kt,{score:et.confidence_score})]})),to.wnta&&et.reason&&l(Xt,{reason:et.reason,title:"Why these suggestions?"}),Object.entries(et.when_not_to_apply).map(function(e){var n=e[0],t=e[1];return l(eo,{condition:"".concat(n,". ").concat(t),onAccept:function(){return uo(t,"wnta",n)},onReject:function(){return po(0,"wnta",n)}},"rec-wnta-".concat(n))})]}))}))}))]})),Mn&&jn&&l(I,{conflictingConditions:jn}),mo&&l(w,{conflictingConditions:[Object.values((null==xe?void 0:xe.conflicting_learnings)||{}),Object.values((null==xe?void 0:xe.similar_learnings)||{})],baseUrl:ge,organizationName:de,chatAssistantName:ke,setSendMessageInChat:ve,editConflictingLearningTrigger:ye,editSimilarLearningTrigger:we,onSetOperationStatus:be,onDeleted:Ce,onMergeMessage:Se,onEdited:function(e){console.log("ContextualForm: Marking learning as edited from card callback:",e),it(function(n){return new Set(n).add(e)})},isFromDashboard:Re}),a(_,r({fullWidth:!0,ref:Ee},{children:[a(R,r({sx:{fontSize:"1rem",fontWeight:600,fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center",marginBottom:"8px"}},{children:["Topic",l(P,r({component:"span",sx:{color:"red"}},{children:"*"})),l(z,r({title:"Specific key subjects or concepts covered by this learning. Helps organize and trigger relavant responses from AI",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l($,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),a(P,r({sx:{position:"relative"}},{children:[l(A,{fullWidth:!0,placeholder:"Select or type a topic",value:Me,onChange:function(e){We(e.target.value),je||qe(!0),""===e.target.value&&so("topic",{id:null,value:""})},onKeyDown:function(e){if("Enter"===e.key){e.preventDefault();var n=Me.trim();if(!n)return;var t=Ne.find(function(e){return e.label.toLowerCase()===n.toLowerCase()});t?(bo(t.id,t.label),console.log("📌 Existing Topic Selected:",t)):(bo(null,n),console.log("📌 New Topic Created:",{id:null,value:n}))}},onClick:function(){return qe(!0)},InputProps:{endAdornment:l(G,{size:20,color:"#667085"}),sx:{fontFamily:"Plus Jakarta Sans, sans-serif"}},sx:{"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},boxShadow:xn?"0 0 12px 3px rgba(34, 197, 94, 0.6)":"none",transition:"box-shadow 0.3s ease-in-out"}}),je&&l(P,r({sx:{position:"absolute",zIndex:1300,width:"90%",mt:1,bgcolor:"background.paper",border:"1px solid #ccc",borderRadius:"8px",boxShadow:3,maxHeight:200,overflowY:"auto"}},{children:Ue?l(P,r({sx:{display:"flex",justifyContent:"center",p:2}},{children:l(J,{size:24})})):a(s,{children:[wo.map(function(e){return l(M,r({onMouseDown:function(){return bo(e.id,e.label)},sx:{fontSize:"1rem",fontFamily:"Plus Jakarta Sans"}},{children:e.label}),e.id)}),0===wo.length&&l(M,r({disabled:!0,sx:{fontSize:"1rem",fontFamily:"Plus Jakarta Sans"}},{children:"No results found."}))]})}))]}))]})),a(_,r({fullWidth:!0},{children:[a(R,r({sx:{fontSize:"1rem",fontWeight:600,fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center",marginBottom:"8px"}},{children:["Categories",l(z,r({title:"Additional tags or classifications for organizing this learning",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l($,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),a(P,r({sx:{display:"flex",flexWrap:"wrap",gap:1,p:1.5,border:"1px solid #ccc",borderRadius:"8px",alignItems:"center",bgcolor:"white",cursor:"text",minHeight:"56px"},onClick:function(){var e;return null===(e=Ze.current)||void 0===e?void 0:e.focus()}},{children:[go.map(function(e){return l(W,{label:e.label,onDelete:function(){return n=e,t=go.filter(function(e){return e.value!==n.value}),void so("categories",t);var n,t},deleteIcon:l(Y,{size:16}),sx:{bgcolor:e.isCustom?"#e0e7ff":"#f5f5f5",fontSize:"1rem",height:"36px",fontFamily:"Plus Jakarta Sans","& .MuiChip-deleteIcon":{color:"#666","&:hover":{color:"#333"}}}},e.value)}),l(A,{variant:"standard",inputRef:Ze,value:Ye,onChange:function(e){return Qe(e.target.value)},onKeyDown:function(e){if("Enter"===e.key){e.preventDefault();var t=Ye.trim();if(t&&!go.some(function(e){return e.value===t})){var o={id:null,label:t,value:t,isCustom:!0};so("categories",n(n([],go,!0),[o],!1))}Qe("")}},placeholder:0===go.length?"Add or select categories":"",sx:{flex:1,minWidth:"180px","& .MuiInput-underline:before":{borderBottom:"none"},"& .MuiInput-underline:after":{borderBottom:"none"},"& .MuiInput-underline:hover:not(.Mui-disabled):before":{borderBottom:"none"},"& .MuiInputBase-input":{fontSize:"1rem",padding:"4px 0",fontFamily:"Plus Jakarta Sans"}}})]})),Bn?a(P,r({sx:{display:"flex",alignItems:"center",gap:1,mt:2,color:"#5928ED"}},{children:[l(J,{size:16,color:"inherit"}),l(R,r({variant:"caption",sx:{fontSize:"0.95rem",fontFamily:"Plus Jakarta Sans"}},{children:"Getting AI suggestions..."}))]})):xo.length>0?l(P,r({sx:{display:"flex",flexWrap:"wrap",gap:1.5,mt:2}},{children:xo.map(function(e){return l(W,{label:e.label,icon:l(Q,{size:16,style:{marginLeft:"8px"}}),onClick:function(){return t=e,void(new Set(go.map(function(e){return e.value.toLowerCase()})).has(t.value.toLowerCase())||so("categories",n(n([],go,!0),[t],!1)));var t},sx:{bgcolor:"#f5f5f5",fontSize:"1rem",height:"36px",fontFamily:"Plus Jakarta Sans",cursor:"pointer","&:hover":{bgcolor:"#e0e0e0"}}},e.value)})})):!Bn&&Dn.length>0&&l(R,r({variant:"caption",sx:{color:"#666",mt:2,fontSize:"0.95rem",fontFamily:"Plus Jakarta Sans"}},{children:"All suggested categories have been added."})),l(R,r({variant:"caption",sx:{color:"#666",mt:2,mb:2,fontSize:"0.95rem",fontFamily:"Plus Jakarta Sans"}},{children:Bn?"":xo.length>0?"Choose from the suggested categories based on your Instant Learning.":go.length>0&&0===Dn.length&&!Bn?"You can add more categories by typing and pressing Enter.":"Type and press Enter to add a category. AI suggestions will appear based on your 'How to respond' text."}))]})),l(_,r({sx:{width:"100%"}},{children:a(P,r({sx:{display:"flex",gap:2,alignItems:"flex-start"}},{children:[a(P,r({sx:{flexShrink:0}},{children:[a(R,r({sx:{fontSize:"1rem",fontWeight:600,fontFamily:"Plus Jakarta Sans"},gutterBottom:!0},{children:["Scope",l(P,r({component:"span",sx:{color:"red"}},{children:"*"})),l(z,r({title:"Defines at what scope this learning applies",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l($,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),l(_,r({sx:{width:"auto",minWidth:"200px",fontFamily:"Plus Jakarta Sans"},variant:"outlined"},{children:a(O,r({value:le.scope.name,onChange:function(e){var n=e.target.value,t=null;"User"===n?t=[]:"Assistant"===n&&(t={assistantName:pe||"",conciergeId:Pe||""}),se(function(e){return r(r({},e),{scope:{name:n,value:t}})})},displayEmpty:!0,sx:{fontFamily:"Plus Jakarta Sans"},fullWidth:!0,renderValue:function(e){return e||l("em",r({style:{fontFamily:"Plus Jakarta Sans",color:"#6c757d"}},{children:"Select scope"}))}},{children:[l(M,r({value:"",disabled:!0,sx:{fontFamily:"Plus Jakarta Sans"}},{children:l("em",r({style:{fontFamily:"Plus Jakarta Sans",color:"#6c757d"}},{children:"Select scope"}))})),wn.map(function(e){return l(M,r({value:e.scope,sx:{fontFamily:"Plus Jakarta Sans"}},{children:e.scope}),e.value)})]}))}))]})),a(P,r({sx:{flex:1}},{children:["User"===le.scope.name&&a(P,{children:[a(R,r({sx:{fontSize:"1rem",fontWeight:600,fontFamily:"Plus Jakarta Sans"},gutterBottom:!0},{children:["User Details",l(P,r({component:"span",sx:{color:"red"}},{children:"*"})),l(z,r({title:"Select the user for whom this learning applies",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l($,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),Array.isArray(null===(C=null==le?void 0:le.scope)||void 0===C?void 0:C.value)&&(null===(S=null==le?void 0:le.scope)||void 0===S?void 0:S.value.length)>0?a(P,r({sx:{display:"flex",alignItems:"center",gap:1,p:1,bgcolor:"#ecf0f8",borderRadius:"20px",width:"fit-content"}},{children:[l(P,r({sx:{width:20,height:20,borderRadius:"50%",bgcolor:"#385390",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:"0.75rem"}},{children:null===(L=le.scope.value[0].email[0])||void 0===L?void 0:L.toUpperCase()})),l(R,r({sx:{color:"#385390",fontFamily:"Plus Jakarta Sans"}},{children:le.scope.value[0].name})),l("button",r({style:{color:"#aabef2",cursor:"pointer",background:"transparent",border:"none",padding:0,fontSize:"1.25rem"},type:"button",onMouseOver:function(e){return e.currentTarget.style.color="#385390"},onMouseOut:function(e){return e.currentTarget.style.color="#aabef2"},onClick:function(){se(function(e){return r(r({},e),{scope:r(r({},e.scope),{value:[]})})}),In("")}},{children:"×"}))]})):a(P,r({sx:{display:"flex",alignItems:"flex-start"}},{children:[l(A,{fullWidth:!0,type:"email",value:Ln,onChange:function(e){return In(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&co()},placeholder:"Enter email",error:!!An,helperText:An,InputProps:{sx:{fontFamily:"Plus Jakarta Sans, sans-serif"}},sx:{"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"}}}),l(j,r({variant:"contained",onClick:co,disabled:Pn||!Ln||Array.isArray(null===(D=null==le?void 0:le.scope)||void 0===D?void 0:D.value)&&(null===(ee=null==le?void 0:le.scope)||void 0===ee?void 0:ee.value.length)>0,sx:{fontFamily:"Plus Jakarta Sans",bgcolor:"#DEE6FB",color:"#385390",textTransform:"none",minWidth:"120px",height:"56px",ml:1,flexShrink:0,"&:hover":{bgcolor:"#c9d9f7"},"&.Mui-disabled":{bgcolor:"#f5f5f5",color:"#9e9e9e"}}},{children:Pn?l(J,{size:16,sx:{color:"#385390"}}):"Add email"}))]}))]}),"Custom"===le.scope.name&&a(P,r({sx:{flexShrink:0}},{children:[a(R,r({sx:{fontFamily:"Plus Jakarta Sans",fontSize:"1rem",fontWeight:600,display:"flex",alignItems:"center"},gutterBottom:!0},{children:["Custom Filter",l(P,r({component:"span",sx:{color:"red"}},{children:"*"})),l(z,r({title:"Select a custom scope filter for this learning",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l($,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),l(_,r({sx:{width:"auto",minWidth:"200px",fontFamily:"Plus Jakarta Sans"},variant:"outlined"},{children:a(O,r({value:(null===(ie=null===(oe=null==le?void 0:le.scope)||void 0===oe?void 0:oe.value)||void 0===ie?void 0:ie.scopeId)||"",onChange:function(e){var n=Sn.find(function(n){return n.scopeId===e.target.value});se(function(e){return r(r({},e),{scope:r(r({},e.scope),{value:n?{scopeName:n.scopeName,scopeId:n.scopeId}:null})})})},displayEmpty:!0,sx:{fontFamily:"Plus Jakarta Sans"},fullWidth:!0},{children:[l(M,r({value:"",disabled:!0,sx:{fontFamily:"Plus Jakarta Sans"}},{children:"Select Custom Filter"})),Sn.map(function(e){return l(M,r({value:e.scopeId,sx:{fontFamily:"Plus Jakarta Sans"}},{children:e.scopeName}),e.scopeId)})]}))})),l(R,r({sx:{fontSize:"0.75rem",color:"text.secondary",mt:1}},{children:0===Sn.length?"No scopes available.":"".concat(Sn.length," scopes available.")}))]})),"Assistant"===le.scope.name&&a(P,{children:[a(R,r({sx:{fontFamily:"Plus Jakarta Sans",fontSize:"1rem",fontWeight:600,display:"flex",alignItems:"center"},gutterBottom:!0},{children:["Assistant",l(P,r({component:"span",sx:{color:"red"}},{children:"*"})),l(z,r({title:"The assistant for which this learning applies",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:l($,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),Re?l(q,{options:Vt,loading:Gt,getOptionLabel:function(e){return e.name||""},inputValue:Ht,onInputChange:function(e,n){Nt(n)},onChange:function(e,n){se(function(e){return r(r({},e),{scope:r(r({},e.scope),{value:n?{assistantName:n.name,conciergeId:n.id}:null})})})},renderInput:function(e){return l(A,r({},e,{placeholder:"Search for an assistant",InputProps:r(r({},e.InputProps),{endAdornment:a(s,{children:[Gt?l(J,{color:"inherit",size:20}):null,e.InputProps.endAdornment]}),sx:{fontFamily:"Plus Jakarta Sans, sans-serif"}})}))}}):a(s,{children:[l(A,{fullWidth:!0,value:pe||"",InputProps:{readOnly:!0,sx:{fontFamily:"Plus Jakarta Sans, sans-serif",bgcolor:"#fafafa"}},sx:{"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"}}}),l("input",{type:"hidden",value:pe||"",onChange:function(e){se(function(n){return r(r({},n),{scope:r(r({},n.scope),{value:{assistantName:pe||"",conciergeId:e.target.value||""}})})})}})]})]})]}))]}))}))]})),l(P,r({sx:{display:"flex",gap:2}},{children:l(P,r({sx:{flex:1,display:"flex",alignItems:"flex-end",justifyContent:"flex-end"}},{children:a(j,r({variant:"contained",onClick:function(){return o(void 0,void 0,void 0,function(){return i(this,function(e){return vo?(console.warn("Save blocked by button click: Unresolved conflicts are present."),[2]):(Fe(!0),[2])})})},disabled:!ho||Ae||vo,sx:{width:"30%",height:"56px",fontFamily:"Plus Jakarta Sans",backgroundColor:"green",textTransform:"capitalize","&:hover":{backgroundColor:"#006400"},pointerEvents:Ae?"none":"auto"}},{children:[Ae&&l(J,{sx:{marginRight:"8px",color:"#fff"},size:16}),Ae?"Saving":"Save"]}))}))}))]}))]}))};export{oe as default};
|
|
2
2
|
//# sourceMappingURL=ContextualLearningForm.js.map
|