diff --git a/2224.35aff2e2.iframe.bundle.js b/2224.35aff2e2.iframe.bundle.js new file mode 100644 index 00000000..6bf8895c --- /dev/null +++ b/2224.35aff2e2.iframe.bundle.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[2224],{"./src/components/Chat/Chat.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_helpers_utils__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/helpers/utils.ts"),_helpers_media__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("./src/helpers/media.ts"),_ChatBubble_ChatBubble__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/ChatBubble/ChatBubble.tsx"),_MediaWidget_MediaWidget__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/MediaWidget/MediaWidget.tsx"),_ui_Button__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./src/components/ui/Button.tsx"),_ChatInputs_ChatInputs__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./src/components/ChatInputs/ChatInputs.tsx"),_Typing_Typing__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./src/components/Typing/Typing.tsx"),_helpers_constants__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./src/helpers/constants.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Chat=({memori,tenant,sessionID,baseUrl,apiUrl,translateTo,memoriTyping,typingText,showTypingText=!1,history=[],authToken,dialogState,simulateUserPrompt,showDates=!1,showContextPerLine=!1,showAIicon=!0,showWhyThisAnswer=!0,showCopyButton=!0,showTranslationOriginal=!1,selectReceiverTag,preview=!1,instruct=!1,showInputs=!0,showMicrophone=!1,microphoneMode="HOLD_TO_TALK",sendOnEnter,setSendOnEnter,attachmentsMenuOpen,setAttachmentsMenuOpen,userMessage="",onChangeUserMessage,sendMessage,listening,setEnableFocusChatInput,isPlayingAudio,stopAudio,startListening,stopListening,resetTranscript,customMediaRenderer,user,userAvatar,experts,useMathFormatting=!1})=>{const scrollToBottom=()=>{setTimeout((()=>{document.querySelector(".memori-chat--content")?.scrollTo(0,document.querySelector(".memori-chat--content")?.scrollHeight??0)}),200)};(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{!preview&&scrollToBottom()}),[history,preview]);return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-chat--wrapper",{"memori-chat-wrapper--translate":translateTo}),id:"chat-wrapper",lang:translateTo?.toUpperCase(),"data-memori-lang":memori.culture?.split("-")?.[0]?.toUpperCase()??"EN",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-chat--history",{"memori-chat--history-touch":(0,_helpers_utils__WEBPACK_IMPORTED_MODULE_2__.xZ)()}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-chat--content",{"memori-chat--content-touch":(0,_helpers_utils__WEBPACK_IMPORTED_MODULE_2__.xZ)()}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-chat--cover"),style:{backgroundImage:`url("${(0,_helpers_media__WEBPACK_IMPORTED_MODULE_10__.v)({type:"cover",tenantID:tenant?.id,resourceURI:memori.coverURL,baseURL:baseUrl,apiURL:apiUrl})}"), url("${(0,_helpers_media__WEBPACK_IMPORTED_MODULE_10__.v)({type:"cover",tenantID:tenant?.id,baseURL:baseUrl||"https://www.aisuru.com",apiURL:apiUrl})}")`}}),history.map(((message,index)=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_ChatBubble_ChatBubble__WEBPACK_IMPORTED_MODULE_3__.Z,{isFirst:0===index,message,memori,tenant,baseUrl,apiUrl,sessionID,simulateUserPrompt,showAIicon,showWhyThisAnswer,showTranslationOriginal,showFeedback:index===history.length-1&&!message.fromUser&&dialogState?.acceptsFeedback,user,userAvatar,experts,showCopyButton,useMathFormatting}),showDates&&!!message.timestamp&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("small",{className:"memori-chat--timestamp "+(message.fromUser?"text-right":"text-left"),children:new Intl.DateTimeFormat("it",{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(message.timestamp.endsWith("Z")?message.timestamp:`${message.timestamp}Z`))}),showContextPerLine&&!!Object.keys(message.contextVars??{}).length&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div",{className:"memori-chat--context-vars",children:Object.keys(message.contextVars??{}).map((key=>"-"===message.contextVars?.[key]?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div",{className:"memori-chat--context-tag memori-chat--context-tag-canceled",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("span",{className:"memori-chat--context-tag-text",children:key})},key):"✔️"===message.contextVars?.[key]?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div",{className:"memori-chat--context-tag",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("span",{className:"memori-chat--context-tag-text",children:key})},key):(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div",{className:"memori-chat--context-tag",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("span",{className:"memori-chat--context-tag-text",children:[key,": ",message.contextVars?.[key]]})},key)))}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_MediaWidget_MediaWidget__WEBPACK_IMPORTED_MODULE_4__.Z,{simulateUserPrompt,media:message?.media?.filter((m=>"text/html"!==m.mimeType&&"text/plain"!==m.mimeType)),links:message?.media?.filter((m=>"text/html"===m.mimeType)),sessionID,baseUrl,apiUrl,translateTo,customMediaRenderer})]},index))),dialogState?.hints&&dialogState.hints.length>0&&!memoriTyping&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_MediaWidget_MediaWidget__WEBPACK_IMPORTED_MODULE_4__.Z,{simulateUserPrompt,hints:dialogState.translatedHints?dialogState.translatedHints:dialogState.hints.map((h=>({text:h,originalText:h})))}),!!memoriTyping&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_Typing_Typing__WEBPACK_IMPORTED_MODULE_7__.Z,{useDefaultSentences:showTypingText,lang:translateTo?"it"===translateTo.toLowerCase()?"it":"en":"it"===memori.culture?.split("-")?.[0]?.toLowerCase()?"it":"en",sentence:typingText,sentences:memori.enableBoardOfExperts?_helpers_constants__WEBPACK_IMPORTED_MODULE_8__.DZ:void 0},typingText),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div",{id:"end-messages-ref"})]})}),"X3"===dialogState?.state&&sessionID&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div",{className:"memori-chat--known-tags",children:Object.keys(dialogState.knownTags??{}).filter((t=>t!==memori.giverTag)).map((tag=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_5__.Z,{icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("span",{className:"memori-chat--known-tag-icon",children:tag}),className:"memori-chat--known-tag",onClick:()=>selectReceiverTag(tag),children:dialogState.knownTags?.[tag]},tag)))}),showInputs&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_ChatInputs_ChatInputs__WEBPACK_IMPORTED_MODULE_6__.Z,{userMessage,onChangeUserMessage,dialogState,instruct,authToken,sendMessage,microphoneMode,sendOnEnter,setSendOnEnter,attachmentsMenuOpen,setAttachmentsMenuOpen,onTextareaPressEnter:()=>{"keypress"===sendOnEnter&&userMessage?.length>0&&(stopListening(),sendMessage(userMessage),onChangeUserMessage(""),resetTranscript())},onTextareaFocus:()=>{stopListening();const hasTouch=(0,_helpers_utils__WEBPACK_IMPORTED_MODULE_2__.xZ)();hasTouch&&setEnableFocusChatInput(!0),hasTouch&&window.innerWidth<=768&&(document.getElementById("chat-wrapper")?.classList?.add("chat-focused"),document.querySelector(".memori.memori-widget")?.classList?.add("chat-focused"),setTimeout((()=>{scrollToBottom()}),300))},onTextareaBlur:()=>{document.getElementById("chat-wrapper")?.classList?.contains("chat-focused")&&(document.getElementById("chat-wrapper")?.classList.remove("chat-focused"),document.querySelector(".memori.memori-widget")?.classList?.remove("chat-focused"),scrollToBottom())},startListening,stopListening,stopAudio,listening,isPlayingAudio,showMicrophone})]})};Chat.displayName="Chat";const __WEBPACK_DEFAULT_EXPORT__=(0,react__WEBPACK_IMPORTED_MODULE_0__.memo)(Chat);try{Chat.displayName="Chat",Chat.__docgenInfo={description:"",displayName:"Chat",props:{memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},sessionID:{defaultValue:null,description:"",name:"sessionID",required:!0,type:{name:"string"}},translateTo:{defaultValue:null,description:"",name:"translateTo",required:!1,type:{name:"string"}},baseUrl:{defaultValue:null,description:"",name:"baseUrl",required:!1,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!1,type:{name:"string"}},memoriTyping:{defaultValue:null,description:"",name:"memoriTyping",required:!1,type:{name:"boolean"}},typingText:{defaultValue:null,description:"",name:"typingText",required:!1,type:{name:"string"}},showTypingText:{defaultValue:{value:"false"},description:"",name:"showTypingText",required:!1,type:{name:"boolean"}},history:{defaultValue:{value:"[]"},description:"",name:"history",required:!1,type:{name:"Message[]"}},authToken:{defaultValue:null,description:"",name:"authToken",required:!1,type:{name:"string"}},dialogState:{defaultValue:null,description:"",name:"dialogState",required:!1,type:{name:"DialogState"}},setDialogState:{defaultValue:null,description:"",name:"setDialogState",required:!0,type:{name:"(dialogState: DialogState) => void"}},pushMessage:{defaultValue:null,description:"",name:"pushMessage",required:!0,type:{name:"(message: Message) => void"}},simulateUserPrompt:{defaultValue:null,description:"",name:"simulateUserPrompt",required:!0,type:{name:"(text: string, translatedText?: string | undefined) => void"}},showDates:{defaultValue:{value:"false"},description:"",name:"showDates",required:!1,type:{name:"boolean"}},showContextPerLine:{defaultValue:{value:"false"},description:"",name:"showContextPerLine",required:!1,type:{name:"boolean"}},showAIicon:{defaultValue:{value:"true"},description:"",name:"showAIicon",required:!1,type:{name:"boolean"}},showTranslationOriginal:{defaultValue:{value:"false"},description:"",name:"showTranslationOriginal",required:!1,type:{name:"boolean"}},showWhyThisAnswer:{defaultValue:{value:"true"},description:"",name:"showWhyThisAnswer",required:!1,type:{name:"boolean"}},client:{defaultValue:null,description:"",name:"client",required:!0,type:{name:'{ constants: { BACKEND_URL: string; ENGINE_URL: string; allowedMediaTypes: string[]; anonTag: "👤"; }; asset: { getResourceUrl: ({ type, resourceURI, sessionID, baseURL, }: ResourceURLParams) => string; }; getAllFunctions: (sessionId: string) => Promise<...>; ... 125 more ...; backend: { ...; }; }'}},selectReceiverTag:{defaultValue:null,description:"",name:"selectReceiverTag",required:!0,type:{name:"(tag: string) => Promise"}},preview:{defaultValue:{value:"false"},description:"",name:"preview",required:!1,type:{name:"boolean"}},microphoneMode:{defaultValue:{value:"HOLD_TO_TALK"},description:"",name:"microphoneMode",required:!1,type:{name:"enum",value:[{value:'"HOLD_TO_TALK"'},{value:'"CONTINUOUS"'}]}},sendOnEnter:{defaultValue:null,description:"",name:"sendOnEnter",required:!1,type:{name:"enum",value:[{value:'"keypress"'},{value:'"click"'}]}},setSendOnEnter:{defaultValue:null,description:"",name:"setSendOnEnter",required:!0,type:{name:'(sendOnEnter: "keypress" | "click") => void'}},attachmentsMenuOpen:{defaultValue:null,description:"",name:"attachmentsMenuOpen",required:!1,type:{name:"enum",value:[{value:'"link"'},{value:'"media"'}]}},setAttachmentsMenuOpen:{defaultValue:null,description:"",name:"setAttachmentsMenuOpen",required:!0,type:{name:'(attachmentsMenuOpen: "link" | "media") => void'}},instruct:{defaultValue:{value:"false"},description:"",name:"instruct",required:!1,type:{name:"boolean"}},showCopyButton:{defaultValue:{value:"true"},description:"",name:"showCopyButton",required:!1,type:{name:"boolean"}},showInputs:{defaultValue:{value:"true"},description:"",name:"showInputs",required:!1,type:{name:"boolean"}},showMicrophone:{defaultValue:{value:"false"},description:"",name:"showMicrophone",required:!1,type:{name:"boolean"}},userMessage:{defaultValue:{value:""},description:"",name:"userMessage",required:!1,type:{name:"string"}},onChangeUserMessage:{defaultValue:null,description:"",name:"onChangeUserMessage",required:!0,type:{name:"(userMessage: string) => void"}},sendMessage:{defaultValue:null,description:"",name:"sendMessage",required:!0,type:{name:"(msg: string) => void"}},listening:{defaultValue:null,description:"",name:"listening",required:!1,type:{name:"boolean"}},setEnableFocusChatInput:{defaultValue:null,description:"",name:"setEnableFocusChatInput",required:!0,type:{name:"(enableFocusChatInput: boolean) => void"}},isPlayingAudio:{defaultValue:null,description:"",name:"isPlayingAudio",required:!1,type:{name:"boolean"}},stopAudio:{defaultValue:null,description:"",name:"stopAudio",required:!0,type:{name:"() => void"}},startListening:{defaultValue:null,description:"",name:"startListening",required:!0,type:{name:"() => void"}},stopListening:{defaultValue:null,description:"",name:"stopListening",required:!0,type:{name:"() => void"}},resetTranscript:{defaultValue:null,description:"",name:"resetTranscript",required:!0,type:{name:"() => void"}},customMediaRenderer:{defaultValue:null,description:"",name:"customMediaRenderer",required:!1,type:{name:"((mimeType: string) => Element | null)"}},layout:{defaultValue:null,description:"",name:"layout",required:!0,type:{name:"enum",value:[{value:"undefined"},{value:'"DEFAULT"'},{value:'"FULLPAGE"'},{value:'"TOTEM"'},{value:'"CHAT"'},{value:'"WEBSITE_ASSISTANT"'},{value:'"HIDDEN_CHAT"'},{value:'"ZOOMED_FULL_BODY"'}]}},userAvatar:{defaultValue:null,description:"",name:"userAvatar",required:!1,type:{name:"string | Element"}},user:{defaultValue:null,description:"",name:"user",required:!1,type:{name:"User"}},experts:{defaultValue:null,description:"",name:"experts",required:!1,type:{name:"ExpertReference[]"}},useMathFormatting:{defaultValue:{value:"false"},description:"",name:"useMathFormatting",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Chat/Chat.tsx#Chat"]={docgenInfo:Chat.__docgenInfo,name:"Chat",path:"src/components/Chat/Chat.tsx#Chat"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ChatInputs/ChatInputs.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var _ChatTextArea_ChatTextArea__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ChatTextArea/ChatTextArea.tsx"),_ui_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_icons_Send__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Send.tsx"),_MicrophoneButton_MicrophoneButton__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/MicrophoneButton/MicrophoneButton.tsx"),classnames__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_5___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_5__),_icons_Microphone__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./src/components/icons/Microphone.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChatInputs=({dialogState,userMessage="",onChangeUserMessage,sendMessage,onTextareaFocus,onTextareaBlur,onTextareaPressEnter,showMicrophone=!1,microphoneMode="HOLD_TO_TALK",listening=!1,stopAudio,startListening,stopListening})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_8__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("fieldset",{id:"chat-fieldset",className:"memori-chat-inputs",disabled:"X2a"===dialogState?.state||"X3"===dialogState?.state,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ChatTextArea_ChatTextArea__WEBPACK_IMPORTED_MODULE_1__.Z,{value:userMessage,onChange:onChangeUserMessage,onPressEnter:onTextareaPressEnter,onFocus:onTextareaFocus,onBlur:onTextareaBlur,disabled:["R2","R3","R4","R5","G3","X3"].includes(dialogState?.state||"")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",primary:!!userMessage?.length,disabled:!userMessage||0===userMessage.length,className:"memori-chat-inputs--send",onClick:()=>{sendMessage(userMessage),stopAudio(),speechSynthesis.speak(new SpeechSynthesisUtterance(""))},title:t("send")||"Send",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_icons_Send__WEBPACK_IMPORTED_MODULE_3__.default,{})}),showMicrophone&&"HOLD_TO_TALK"===microphoneMode&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_MicrophoneButton_MicrophoneButton__WEBPACK_IMPORTED_MODULE_4__.Z,{listening,startListening,stopListening:()=>{stopListening(),userMessage?.length&&sendMessage(userMessage)},stopAudio}),showMicrophone&&"CONTINUOUS"===microphoneMode&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,className:classnames__WEBPACK_IMPORTED_MODULE_5___default()("memori-chat-inputs--mic",{"memori-chat-inputs--mic--listening":listening}),title:listening?t("write_and_speak.micButtonPopoverListening")||"Listening":t("write_and_speak.micButtonPopover")||"Start listening",onClick:()=>{listening?stopListening():(stopAudio(),startListening())},shape:"circle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_icons_Microphone__WEBPACK_IMPORTED_MODULE_6__.default,{})})]})};ChatInputs.displayName="ChatInputs";const __WEBPACK_DEFAULT_EXPORT__=ChatInputs;try{ChatInputs.displayName="ChatInputs",ChatInputs.__docgenInfo={description:"",displayName:"ChatInputs",props:{dialogState:{defaultValue:null,description:"",name:"dialogState",required:!1,type:{name:"DialogState"}},instruct:{defaultValue:null,description:"",name:"instruct",required:!1,type:{name:"boolean"}},sendOnEnter:{defaultValue:null,description:"",name:"sendOnEnter",required:!1,type:{name:"enum",value:[{value:'"keypress"'},{value:'"click"'}]}},setSendOnEnter:{defaultValue:null,description:"",name:"setSendOnEnter",required:!0,type:{name:'(sendOnEnter: "keypress" | "click") => void'}},attachmentsMenuOpen:{defaultValue:null,description:"",name:"attachmentsMenuOpen",required:!1,type:{name:"enum",value:[{value:'"link"'},{value:'"media"'}]}},setAttachmentsMenuOpen:{defaultValue:null,description:"",name:"setAttachmentsMenuOpen",required:!0,type:{name:'(attachmentsMenuOpen: "link" | "media") => void'}},userMessage:{defaultValue:{value:""},description:"",name:"userMessage",required:!1,type:{name:"string"}},onChangeUserMessage:{defaultValue:null,description:"",name:"onChangeUserMessage",required:!0,type:{name:"(userMessage: string) => void"}},sendMessage:{defaultValue:null,description:"",name:"sendMessage",required:!0,type:{name:"(msg: string) => void"}},onTextareaFocus:{defaultValue:null,description:"",name:"onTextareaFocus",required:!0,type:{name:"() => void"}},onTextareaBlur:{defaultValue:null,description:"",name:"onTextareaBlur",required:!0,type:{name:"() => void"}},onTextareaPressEnter:{defaultValue:null,description:"",name:"onTextareaPressEnter",required:!0,type:{name:"(e: KeyboardEvent) => void"}},listening:{defaultValue:{value:"false"},description:"",name:"listening",required:!1,type:{name:"boolean"}},isPlayingAudio:{defaultValue:null,description:"",name:"isPlayingAudio",required:!1,type:{name:"boolean"}},stopAudio:{defaultValue:null,description:"",name:"stopAudio",required:!0,type:{name:"() => void"}},startListening:{defaultValue:null,description:"",name:"startListening",required:!0,type:{name:"() => void"}},stopListening:{defaultValue:null,description:"",name:"stopListening",required:!0,type:{name:"() => void"}},showMicrophone:{defaultValue:{value:"false"},description:"",name:"showMicrophone",required:!1,type:{name:"boolean"}},microphoneMode:{defaultValue:{value:"HOLD_TO_TALK"},description:"",name:"microphoneMode",required:!1,type:{name:"enum",value:[{value:'"HOLD_TO_TALK"'},{value:'"CONTINUOUS"'}]}},authToken:{defaultValue:null,description:"",name:"authToken",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ChatInputs/ChatInputs.tsx#ChatInputs"]={docgenInfo:ChatInputs.__docgenInfo,name:"ChatInputs",path:"src/components/ChatInputs/ChatInputs.tsx#ChatInputs"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ChatTextArea/ChatTextArea.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_ui_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Expand__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Expand.tsx"),_icons_FullscreenExit__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/icons/FullscreenExit.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChatTextArea=({disabled=!1,value,onChange,onPressEnter,onFocus,onBlur})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_6__.$)(),[expanded,setExpanded]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1);return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{"data-testid":"chat-textarea",className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-chat-textarea",{"memori-chat-textarea--expanded":expanded,"memori-chat-textarea--disabled":disabled}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("div",{className:"memori-chat-textarea--inner",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("textarea",{className:"memori-chat-textarea--input",disabled,value,onChange:e=>{onChange(e.target.value)},onKeyDownCapture:e=>{"Enter"===e.key&&!e.shiftKey&&onPressEnter&&onPressEnter(e)},onFocus,onBlur}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-chat-textarea--expand",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-chat-textarea--expand-button"),onClick:()=>setExpanded(!expanded),padded:!1,ghost:!0,title:expanded?t("collapse")||"Collapse":t("expand")||"Expand",icon:expanded?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_FullscreenExit__WEBPACK_IMPORTED_MODULE_4__.default,{}):(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_Expand__WEBPACK_IMPORTED_MODULE_3__.default,{})})})]})})};ChatTextArea.displayName="ChatTextArea";const __WEBPACK_DEFAULT_EXPORT__=ChatTextArea;try{ChatTextArea.displayName="ChatTextArea",ChatTextArea.__docgenInfo={description:"",displayName:"ChatTextArea",props:{disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},value:{defaultValue:null,description:"",name:"value",required:!0,type:{name:"string"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!0,type:{name:"(value: string) => void"}},onPressEnter:{defaultValue:null,description:"",name:"onPressEnter",required:!1,type:{name:"((e: KeyboardEvent) => void)"}},onFocus:{defaultValue:null,description:"",name:"onFocus",required:!1,type:{name:"((e: FocusEvent) => void)"}},onBlur:{defaultValue:null,description:"",name:"onBlur",required:!1,type:{name:"((e: FocusEvent) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ChatTextArea/ChatTextArea.tsx#ChatTextArea"]={docgenInfo:ChatTextArea.__docgenInfo,name:"ChatTextArea",path:"src/components/ChatTextArea/ChatTextArea.tsx#ChatTextArea"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/MicrophoneButton/MicrophoneButton.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_icons_Microphone__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/icons/Microphone.tsx"),_ui_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Tooltip__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/ui/Tooltip.tsx"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),react_i18next__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const MicrophoneButton=({listening,stopAudio,startListening,stopListening})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_6__.$)(),[micBtnTooltip,setMicBtnTooltip]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(),intervalRef=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null),startHold=e=>{e.preventDefault(),setMicBtnTooltip(t("write_and_speak.holdToSpeak")||"Hold to record"),intervalRef.current||(intervalRef.current=setTimeout((()=>{stopAudio(),setMicBtnTooltip(t("write_and_speak.releaseToEndListening")||"Release to end listening"),startListening()}),300))},stopHold=()=>{intervalRef.current&&(clearTimeout(intervalRef.current),intervalRef.current=null),stopListening(),setMicBtnTooltip(void 0)};return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>()=>stopHold()),[]),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_3__.Z,{visible:!!micBtnTooltip,content:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("span",{children:micBtnTooltip||t("write_and_speak.pressAndHoldToSpeak")||"Press and hold to speak"}),align:"topLeft",className:"memori-mic-btn-tooltip",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-chat-inputs--mic",{"memori-chat-inputs--mic--listening":listening}),title:listening?t("write_and_speak.micButtonPopoverListening")||"Listening":t("write_and_speak.micButtonPopover")||"Start listening",onMouseDown:startHold,onTouchStart:startHold,onMouseUp:stopHold,onTouchEnd:stopHold,shape:"circle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_Microphone__WEBPACK_IMPORTED_MODULE_1__.default,{})})})};MicrophoneButton.displayName="MicrophoneButton";const __WEBPACK_DEFAULT_EXPORT__=MicrophoneButton;try{MicrophoneButton.displayName="MicrophoneButton",MicrophoneButton.__docgenInfo={description:"",displayName:"MicrophoneButton",props:{listening:{defaultValue:null,description:"",name:"listening",required:!1,type:{name:"boolean"}},stopAudio:{defaultValue:null,description:"",name:"stopAudio",required:!0,type:{name:"() => void"}},startListening:{defaultValue:null,description:"",name:"startListening",required:!0,type:{name:"() => void"}},stopListening:{defaultValue:null,description:"",name:"stopListening",required:!0,type:{name:"() => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/MicrophoneButton/MicrophoneButton.tsx#MicrophoneButton"]={docgenInfo:MicrophoneButton.__docgenInfo,name:"MicrophoneButton",path:"src/components/MicrophoneButton/MicrophoneButton.tsx#MicrophoneButton"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/Typing/Typing.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const defaultSentences={en:[{delayAfter:3,text:"Generating an accurate and fancy response..."},{delayAfter:3,text:"Generating a response that will blow your mind..."},{delayAfter:3,text:"Generating a response that will make you smile..."},{delayAfter:3,text:"Thinking of a response..."},{delayAfter:3,text:"Thinking of a response that will make you smile..."},{delayAfter:3,text:"Gathering my thoughts..."},{delayAfter:3,text:"Gathering my thoughts to give you a response..."}],it:[{delayAfter:3,text:"Sto generando una risposta accurata e fantasiosa..."},{delayAfter:3,text:"Sto generando una risposta che ti farà impazzire..."},{delayAfter:3,text:"Sto generando una risposta che ti farà sorridere..."},{delayAfter:3,text:"Sto pensando ad una risposta..."},{delayAfter:3,text:"Sto pensando ad una risposta che ti farà sorridere..."},{delayAfter:3,text:"Sto raccogliendo i miei pensieri..."},{delayAfter:3,text:"Sto raccogliendo i miei pensieri per darti una risposta..."}]},getSeparatorString=(seconds=3)=>new Array(20*seconds).fill(" ").join(""),Typing=({useDefaultSentences=!1,lang="en",sentence,sentences})=>{const[index,setIndex]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(0),[text,setText]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(sentences?.[lang]?.length?`${sentences[lang][0].text.endsWith("...")||!sentences[lang][0].text.length?sentences[lang][0].text:`${sentences[lang][0].text}...`}${getSeparatorString(sentences[lang][0].delayAfter)}`:sentence?`${sentence.endsWith("...")||!sentence.length?sentence:`${sentence}...`}${getSeparatorString()}`:""),[shownText,setShownText]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)("");return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{const interval=setInterval((()=>{const letter=text[shownText.length];if(void 0!==letter&&text.length>0)setShownText((prev=>prev+letter));else if(sentences?.[lang]?.length&&indexclearInterval(interval)})),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("div",{className:"memori-chat--bubble",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("div",{className:"memori-chat--bubble-typing",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("div",{id:"wave",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("span",{className:"dot"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("span",{className:"dot"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("span",{className:"dot"})]}),text.length>0&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("p",{children:shownText})]})})};Typing.displayName="Typing";const __WEBPACK_DEFAULT_EXPORT__=Typing;try{Typing.displayName="Typing",Typing.__docgenInfo={description:"",displayName:"Typing",props:{useDefaultSentences:{defaultValue:{value:"false"},description:"",name:"useDefaultSentences",required:!1,type:{name:"boolean"}},lang:{defaultValue:{value:"en"},description:"",name:"lang",required:!1,type:{name:"enum",value:[{value:'"en"'},{value:'"it"'}]}},sentence:{defaultValue:null,description:"",name:"sentence",required:!1,type:{name:"string"}},sentences:{defaultValue:null,description:"",name:"sentences",required:!1,type:{name:"{ [lang: string]: { text: string; delayAfter: number; }[]; }"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Typing/Typing.tsx#Typing"]={docgenInfo:Typing.__docgenInfo,name:"Typing",path:"src/components/Typing/Typing.tsx#Typing"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Expand.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Expand=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M855 160.1l-189.2 23.5c-6.6.8-9.3 8.8-4.7 13.5l54.7 54.7-153.5 153.5a8.03 8.03 0 0 0 0 11.3l45.1 45.1c3.1 3.1 8.2 3.1 11.3 0l153.6-153.6 54.7 54.7a7.94 7.94 0 0 0 13.5-4.7L863.9 169a7.9 7.9 0 0 0-8.9-8.9zM416.6 562.3a8.03 8.03 0 0 0-11.3 0L251.8 715.9l-54.7-54.7a7.94 7.94 0 0 0-13.5 4.7L160.1 855c-.6 5.2 3.7 9.5 8.9 8.9l189.2-23.5c6.6-.8 9.3-8.8 4.7-13.5l-54.7-54.7 153.6-153.6c3.1-3.1 3.1-8.2 0-11.3l-45.2-45z"})});Expand.displayName="Expand";const __WEBPACK_DEFAULT_EXPORT__=Expand;try{Expand.displayName="Expand",Expand.__docgenInfo={description:"",displayName:"Expand",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Expand.tsx#Expand"]={docgenInfo:Expand.__docgenInfo,name:"Expand",path:"src/components/icons/Expand.tsx#Expand"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Microphone.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Microphone=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M842 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254S258 594.3 258 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 168.7 126.6 307.9 290 327.6V884H326.7c-13.7 0-24.7 14.3-24.7 32v36c0 4.4 2.8 8 6.2 8h407.6c3.4 0 6.2-3.6 6.2-8v-36c0-17.7-11-32-24.7-32H548V782.1c165.3-18 294-158 294-328.1zM512 624c93.9 0 170-75.2 170-168V232c0-92.8-76.1-168-170-168s-170 75.2-170 168v224c0 92.8 76.1 168 170 168zm-94-392c0-50.6 41.9-92 94-92s94 41.4 94 92v224c0 50.6-41.9 92-94 92s-94-41.4-94-92V232z"})});Microphone.displayName="Microphone";const __WEBPACK_DEFAULT_EXPORT__=Microphone;try{Microphone.displayName="Microphone",Microphone.__docgenInfo={description:"",displayName:"Microphone",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Microphone.tsx#Microphone"]={docgenInfo:Microphone.__docgenInfo,name:"Microphone",path:"src/components/icons/Microphone.tsx#Microphone"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Send.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Send=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2-8.5 2.1-13.8 10.7-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z"})});Send.displayName="Send";const __WEBPACK_DEFAULT_EXPORT__=Send;try{Send.displayName="Send",Send.__docgenInfo={description:"",displayName:"Send",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Send.tsx#Send"]={docgenInfo:Send.__docgenInfo,name:"Send",path:"src/components/icons/Send.tsx#Send"})}catch(__react_docgen_typescript_loader_error){}}}]); \ No newline at end of file diff --git a/2224.bd322947.iframe.bundle.js b/2224.bd322947.iframe.bundle.js deleted file mode 100644 index 7b04db4b..00000000 --- a/2224.bd322947.iframe.bundle.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[2224],{"./src/components/Chat/Chat.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_helpers_utils__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/helpers/utils.ts"),_helpers_media__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("./src/helpers/media.ts"),_ChatBubble_ChatBubble__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/ChatBubble/ChatBubble.tsx"),_MediaWidget_MediaWidget__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/MediaWidget/MediaWidget.tsx"),_ui_Button__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./src/components/ui/Button.tsx"),_ChatInputs_ChatInputs__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./src/components/ChatInputs/ChatInputs.tsx"),_Typing_Typing__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./src/components/Typing/Typing.tsx"),_helpers_constants__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./src/helpers/constants.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Chat=({memori,tenant,sessionID,baseUrl,apiUrl,translateTo,memoriTyping,typingText,showTypingText=!1,history=[],authToken,dialogState,simulateUserPrompt,showDates=!1,showContextPerLine=!1,showAIicon=!0,showWhyThisAnswer=!0,showCopyButton=!0,showTranslationOriginal=!1,selectReceiverTag,preview=!1,instruct=!1,showInputs=!0,showMicrophone=!1,microphoneMode="HOLD_TO_TALK",sendOnEnter,setSendOnEnter,attachmentsMenuOpen,setAttachmentsMenuOpen,userMessage="",onChangeUserMessage,sendMessage,listening,setEnableFocusChatInput,isPlayingAudio,stopAudio,startListening,stopListening,resetTranscript,customMediaRenderer,user,userAvatar,experts})=>{const scrollToBottom=()=>{setTimeout((()=>{document.querySelector(".memori-chat--content")?.scrollTo(0,document.querySelector(".memori-chat--content")?.scrollHeight??0)}),200)};(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{!preview&&scrollToBottom()}),[history,preview]);return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-chat--wrapper",{"memori-chat-wrapper--translate":translateTo}),id:"chat-wrapper",lang:translateTo?.toUpperCase(),"data-memori-lang":memori.culture?.split("-")?.[0]?.toUpperCase()??"EN",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-chat--history",{"memori-chat--history-touch":(0,_helpers_utils__WEBPACK_IMPORTED_MODULE_2__.xZ)()}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-chat--content",{"memori-chat--content-touch":(0,_helpers_utils__WEBPACK_IMPORTED_MODULE_2__.xZ)()}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-chat--cover"),style:{backgroundImage:`url("${(0,_helpers_media__WEBPACK_IMPORTED_MODULE_10__.v)({type:"cover",tenantID:tenant?.id,resourceURI:memori.coverURL,baseURL:baseUrl,apiURL:apiUrl})}"), url("${(0,_helpers_media__WEBPACK_IMPORTED_MODULE_10__.v)({type:"cover",tenantID:tenant?.id,baseURL:baseUrl||"https://www.aisuru.com",apiURL:apiUrl})}")`}}),history.map(((message,index)=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_ChatBubble_ChatBubble__WEBPACK_IMPORTED_MODULE_3__.Z,{isFirst:0===index,message,memori,tenant,baseUrl,apiUrl,sessionID,simulateUserPrompt,showAIicon,showWhyThisAnswer,showTranslationOriginal,showFeedback:index===history.length-1&&!message.fromUser&&dialogState?.acceptsFeedback,user,userAvatar,experts,showCopyButton}),showDates&&!!message.timestamp&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("small",{className:"memori-chat--timestamp "+(message.fromUser?"text-right":"text-left"),children:new Intl.DateTimeFormat("it",{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(message.timestamp.endsWith("Z")?message.timestamp:`${message.timestamp}Z`))}),showContextPerLine&&!!Object.keys(message.contextVars??{}).length&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div",{className:"memori-chat--context-vars",children:Object.keys(message.contextVars??{}).map((key=>"-"===message.contextVars?.[key]?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div",{className:"memori-chat--context-tag memori-chat--context-tag-canceled",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("span",{className:"memori-chat--context-tag-text",children:key})},key):"✔️"===message.contextVars?.[key]?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div",{className:"memori-chat--context-tag",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("span",{className:"memori-chat--context-tag-text",children:key})},key):(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div",{className:"memori-chat--context-tag",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("span",{className:"memori-chat--context-tag-text",children:[key,": ",message.contextVars?.[key]]})},key)))}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_MediaWidget_MediaWidget__WEBPACK_IMPORTED_MODULE_4__.Z,{simulateUserPrompt,media:message?.media?.filter((m=>"text/html"!==m.mimeType&&"text/plain"!==m.mimeType)),links:message?.media?.filter((m=>"text/html"===m.mimeType)),sessionID,baseUrl,apiUrl,translateTo,customMediaRenderer})]},index))),dialogState?.hints&&dialogState.hints.length>0&&!memoriTyping&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_MediaWidget_MediaWidget__WEBPACK_IMPORTED_MODULE_4__.Z,{simulateUserPrompt,hints:dialogState.translatedHints?dialogState.translatedHints:dialogState.hints.map((h=>({text:h,originalText:h})))}),!!memoriTyping&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_Typing_Typing__WEBPACK_IMPORTED_MODULE_7__.Z,{useDefaultSentences:showTypingText,lang:translateTo?"it"===translateTo.toLowerCase()?"it":"en":"it"===memori.culture?.split("-")?.[0]?.toLowerCase()?"it":"en",sentence:typingText,sentences:memori.enableBoardOfExperts?_helpers_constants__WEBPACK_IMPORTED_MODULE_8__.DZ:void 0},typingText),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div",{id:"end-messages-ref"})]})}),"X3"===dialogState?.state&&sessionID&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div",{className:"memori-chat--known-tags",children:Object.keys(dialogState.knownTags??{}).filter((t=>t!==memori.giverTag)).map((tag=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_5__.Z,{icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("span",{className:"memori-chat--known-tag-icon",children:tag}),className:"memori-chat--known-tag",onClick:()=>selectReceiverTag(tag),children:dialogState.knownTags?.[tag]},tag)))}),showInputs&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_ChatInputs_ChatInputs__WEBPACK_IMPORTED_MODULE_6__.Z,{userMessage,onChangeUserMessage,dialogState,instruct,authToken,sendMessage,microphoneMode,sendOnEnter,setSendOnEnter,attachmentsMenuOpen,setAttachmentsMenuOpen,onTextareaPressEnter:()=>{"keypress"===sendOnEnter&&userMessage?.length>0&&(stopListening(),sendMessage(userMessage),onChangeUserMessage(""),resetTranscript())},onTextareaFocus:()=>{stopListening();const hasTouch=(0,_helpers_utils__WEBPACK_IMPORTED_MODULE_2__.xZ)();hasTouch&&setEnableFocusChatInput(!0),hasTouch&&window.innerWidth<=768&&(document.getElementById("chat-wrapper")?.classList?.add("chat-focused"),document.querySelector(".memori.memori-widget")?.classList?.add("chat-focused"),setTimeout((()=>{scrollToBottom()}),300))},onTextareaBlur:()=>{document.getElementById("chat-wrapper")?.classList?.contains("chat-focused")&&(document.getElementById("chat-wrapper")?.classList.remove("chat-focused"),document.querySelector(".memori.memori-widget")?.classList?.remove("chat-focused"),scrollToBottom())},startListening,stopListening,stopAudio,listening,isPlayingAudio,showMicrophone})]})};Chat.displayName="Chat";const __WEBPACK_DEFAULT_EXPORT__=(0,react__WEBPACK_IMPORTED_MODULE_0__.memo)(Chat);try{Chat.displayName="Chat",Chat.__docgenInfo={description:"",displayName:"Chat",props:{memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},sessionID:{defaultValue:null,description:"",name:"sessionID",required:!0,type:{name:"string"}},translateTo:{defaultValue:null,description:"",name:"translateTo",required:!1,type:{name:"string"}},baseUrl:{defaultValue:null,description:"",name:"baseUrl",required:!1,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!1,type:{name:"string"}},memoriTyping:{defaultValue:null,description:"",name:"memoriTyping",required:!1,type:{name:"boolean"}},typingText:{defaultValue:null,description:"",name:"typingText",required:!1,type:{name:"string"}},showTypingText:{defaultValue:{value:"false"},description:"",name:"showTypingText",required:!1,type:{name:"boolean"}},history:{defaultValue:{value:"[]"},description:"",name:"history",required:!1,type:{name:"Message[]"}},authToken:{defaultValue:null,description:"",name:"authToken",required:!1,type:{name:"string"}},dialogState:{defaultValue:null,description:"",name:"dialogState",required:!1,type:{name:"DialogState"}},setDialogState:{defaultValue:null,description:"",name:"setDialogState",required:!0,type:{name:"(dialogState: DialogState) => void"}},pushMessage:{defaultValue:null,description:"",name:"pushMessage",required:!0,type:{name:"(message: Message) => void"}},simulateUserPrompt:{defaultValue:null,description:"",name:"simulateUserPrompt",required:!0,type:{name:"(text: string, translatedText?: string | undefined) => void"}},showDates:{defaultValue:{value:"false"},description:"",name:"showDates",required:!1,type:{name:"boolean"}},showContextPerLine:{defaultValue:{value:"false"},description:"",name:"showContextPerLine",required:!1,type:{name:"boolean"}},showAIicon:{defaultValue:{value:"true"},description:"",name:"showAIicon",required:!1,type:{name:"boolean"}},showTranslationOriginal:{defaultValue:{value:"false"},description:"",name:"showTranslationOriginal",required:!1,type:{name:"boolean"}},showWhyThisAnswer:{defaultValue:{value:"true"},description:"",name:"showWhyThisAnswer",required:!1,type:{name:"boolean"}},client:{defaultValue:null,description:"",name:"client",required:!0,type:{name:'{ constants: { BACKEND_URL: string; ENGINE_URL: string; allowedMediaTypes: string[]; anonTag: "👤"; }; asset: { getResourceUrl: ({ type, resourceURI, sessionID, baseURL, }: ResourceURLParams) => string; }; getAllFunctions: (sessionId: string) => Promise<...>; ... 125 more ...; backend: { ...; }; }'}},selectReceiverTag:{defaultValue:null,description:"",name:"selectReceiverTag",required:!0,type:{name:"(tag: string) => Promise"}},preview:{defaultValue:{value:"false"},description:"",name:"preview",required:!1,type:{name:"boolean"}},microphoneMode:{defaultValue:{value:"HOLD_TO_TALK"},description:"",name:"microphoneMode",required:!1,type:{name:"enum",value:[{value:'"HOLD_TO_TALK"'},{value:'"CONTINUOUS"'}]}},sendOnEnter:{defaultValue:null,description:"",name:"sendOnEnter",required:!1,type:{name:"enum",value:[{value:'"keypress"'},{value:'"click"'}]}},setSendOnEnter:{defaultValue:null,description:"",name:"setSendOnEnter",required:!0,type:{name:'(sendOnEnter: "keypress" | "click") => void'}},attachmentsMenuOpen:{defaultValue:null,description:"",name:"attachmentsMenuOpen",required:!1,type:{name:"enum",value:[{value:'"link"'},{value:'"media"'}]}},setAttachmentsMenuOpen:{defaultValue:null,description:"",name:"setAttachmentsMenuOpen",required:!0,type:{name:'(attachmentsMenuOpen: "link" | "media") => void'}},instruct:{defaultValue:{value:"false"},description:"",name:"instruct",required:!1,type:{name:"boolean"}},showCopyButton:{defaultValue:{value:"true"},description:"",name:"showCopyButton",required:!1,type:{name:"boolean"}},showInputs:{defaultValue:{value:"true"},description:"",name:"showInputs",required:!1,type:{name:"boolean"}},showMicrophone:{defaultValue:{value:"false"},description:"",name:"showMicrophone",required:!1,type:{name:"boolean"}},userMessage:{defaultValue:{value:""},description:"",name:"userMessage",required:!1,type:{name:"string"}},onChangeUserMessage:{defaultValue:null,description:"",name:"onChangeUserMessage",required:!0,type:{name:"(userMessage: string) => void"}},sendMessage:{defaultValue:null,description:"",name:"sendMessage",required:!0,type:{name:"(msg: string) => void"}},listening:{defaultValue:null,description:"",name:"listening",required:!1,type:{name:"boolean"}},setEnableFocusChatInput:{defaultValue:null,description:"",name:"setEnableFocusChatInput",required:!0,type:{name:"(enableFocusChatInput: boolean) => void"}},isPlayingAudio:{defaultValue:null,description:"",name:"isPlayingAudio",required:!1,type:{name:"boolean"}},stopAudio:{defaultValue:null,description:"",name:"stopAudio",required:!0,type:{name:"() => void"}},startListening:{defaultValue:null,description:"",name:"startListening",required:!0,type:{name:"() => void"}},stopListening:{defaultValue:null,description:"",name:"stopListening",required:!0,type:{name:"() => void"}},resetTranscript:{defaultValue:null,description:"",name:"resetTranscript",required:!0,type:{name:"() => void"}},customMediaRenderer:{defaultValue:null,description:"",name:"customMediaRenderer",required:!1,type:{name:"((mimeType: string) => Element | null)"}},layout:{defaultValue:null,description:"",name:"layout",required:!0,type:{name:"enum",value:[{value:"undefined"},{value:'"DEFAULT"'},{value:'"FULLPAGE"'},{value:'"TOTEM"'},{value:'"CHAT"'},{value:'"WEBSITE_ASSISTANT"'},{value:'"HIDDEN_CHAT"'},{value:'"ZOOMED_FULL_BODY"'}]}},userAvatar:{defaultValue:null,description:"",name:"userAvatar",required:!1,type:{name:"string | Element"}},user:{defaultValue:null,description:"",name:"user",required:!1,type:{name:"User"}},experts:{defaultValue:null,description:"",name:"experts",required:!1,type:{name:"ExpertReference[]"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Chat/Chat.tsx#Chat"]={docgenInfo:Chat.__docgenInfo,name:"Chat",path:"src/components/Chat/Chat.tsx#Chat"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ChatInputs/ChatInputs.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var _ChatTextArea_ChatTextArea__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ChatTextArea/ChatTextArea.tsx"),_ui_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_icons_Send__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Send.tsx"),_MicrophoneButton_MicrophoneButton__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/MicrophoneButton/MicrophoneButton.tsx"),classnames__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_5___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_5__),_icons_Microphone__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./src/components/icons/Microphone.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChatInputs=({dialogState,userMessage="",onChangeUserMessage,sendMessage,onTextareaFocus,onTextareaBlur,onTextareaPressEnter,showMicrophone=!1,microphoneMode="HOLD_TO_TALK",listening=!1,stopAudio,startListening,stopListening})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_8__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("fieldset",{id:"chat-fieldset",className:"memori-chat-inputs",disabled:"X2a"===dialogState?.state||"X3"===dialogState?.state,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ChatTextArea_ChatTextArea__WEBPACK_IMPORTED_MODULE_1__.Z,{value:userMessage,onChange:onChangeUserMessage,onPressEnter:onTextareaPressEnter,onFocus:onTextareaFocus,onBlur:onTextareaBlur,disabled:["R2","R3","R4","R5","G3","X3"].includes(dialogState?.state||"")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",primary:!!userMessage?.length,disabled:!userMessage||0===userMessage.length,className:"memori-chat-inputs--send",onClick:()=>{sendMessage(userMessage),stopAudio(),speechSynthesis.speak(new SpeechSynthesisUtterance(""))},title:t("send")||"Send",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_icons_Send__WEBPACK_IMPORTED_MODULE_3__.default,{})}),showMicrophone&&"HOLD_TO_TALK"===microphoneMode&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_MicrophoneButton_MicrophoneButton__WEBPACK_IMPORTED_MODULE_4__.Z,{listening,startListening,stopListening:()=>{stopListening(),userMessage?.length&&sendMessage(userMessage)},stopAudio}),showMicrophone&&"CONTINUOUS"===microphoneMode&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,className:classnames__WEBPACK_IMPORTED_MODULE_5___default()("memori-chat-inputs--mic",{"memori-chat-inputs--mic--listening":listening}),title:listening?t("write_and_speak.micButtonPopoverListening")||"Listening":t("write_and_speak.micButtonPopover")||"Start listening",onClick:()=>{listening?stopListening():(stopAudio(),startListening())},shape:"circle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_icons_Microphone__WEBPACK_IMPORTED_MODULE_6__.default,{})})]})};ChatInputs.displayName="ChatInputs";const __WEBPACK_DEFAULT_EXPORT__=ChatInputs;try{ChatInputs.displayName="ChatInputs",ChatInputs.__docgenInfo={description:"",displayName:"ChatInputs",props:{dialogState:{defaultValue:null,description:"",name:"dialogState",required:!1,type:{name:"DialogState"}},instruct:{defaultValue:null,description:"",name:"instruct",required:!1,type:{name:"boolean"}},sendOnEnter:{defaultValue:null,description:"",name:"sendOnEnter",required:!1,type:{name:"enum",value:[{value:'"keypress"'},{value:'"click"'}]}},setSendOnEnter:{defaultValue:null,description:"",name:"setSendOnEnter",required:!0,type:{name:'(sendOnEnter: "keypress" | "click") => void'}},attachmentsMenuOpen:{defaultValue:null,description:"",name:"attachmentsMenuOpen",required:!1,type:{name:"enum",value:[{value:'"link"'},{value:'"media"'}]}},setAttachmentsMenuOpen:{defaultValue:null,description:"",name:"setAttachmentsMenuOpen",required:!0,type:{name:'(attachmentsMenuOpen: "link" | "media") => void'}},userMessage:{defaultValue:{value:""},description:"",name:"userMessage",required:!1,type:{name:"string"}},onChangeUserMessage:{defaultValue:null,description:"",name:"onChangeUserMessage",required:!0,type:{name:"(userMessage: string) => void"}},sendMessage:{defaultValue:null,description:"",name:"sendMessage",required:!0,type:{name:"(msg: string) => void"}},onTextareaFocus:{defaultValue:null,description:"",name:"onTextareaFocus",required:!0,type:{name:"() => void"}},onTextareaBlur:{defaultValue:null,description:"",name:"onTextareaBlur",required:!0,type:{name:"() => void"}},onTextareaPressEnter:{defaultValue:null,description:"",name:"onTextareaPressEnter",required:!0,type:{name:"(e: KeyboardEvent) => void"}},listening:{defaultValue:{value:"false"},description:"",name:"listening",required:!1,type:{name:"boolean"}},isPlayingAudio:{defaultValue:null,description:"",name:"isPlayingAudio",required:!1,type:{name:"boolean"}},stopAudio:{defaultValue:null,description:"",name:"stopAudio",required:!0,type:{name:"() => void"}},startListening:{defaultValue:null,description:"",name:"startListening",required:!0,type:{name:"() => void"}},stopListening:{defaultValue:null,description:"",name:"stopListening",required:!0,type:{name:"() => void"}},showMicrophone:{defaultValue:{value:"false"},description:"",name:"showMicrophone",required:!1,type:{name:"boolean"}},microphoneMode:{defaultValue:{value:"HOLD_TO_TALK"},description:"",name:"microphoneMode",required:!1,type:{name:"enum",value:[{value:'"HOLD_TO_TALK"'},{value:'"CONTINUOUS"'}]}},authToken:{defaultValue:null,description:"",name:"authToken",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ChatInputs/ChatInputs.tsx#ChatInputs"]={docgenInfo:ChatInputs.__docgenInfo,name:"ChatInputs",path:"src/components/ChatInputs/ChatInputs.tsx#ChatInputs"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ChatTextArea/ChatTextArea.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_ui_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Expand__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Expand.tsx"),_icons_FullscreenExit__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/icons/FullscreenExit.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChatTextArea=({disabled=!1,value,onChange,onPressEnter,onFocus,onBlur})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_6__.$)(),[expanded,setExpanded]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1);return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{"data-testid":"chat-textarea",className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-chat-textarea",{"memori-chat-textarea--expanded":expanded,"memori-chat-textarea--disabled":disabled}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("div",{className:"memori-chat-textarea--inner",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("textarea",{className:"memori-chat-textarea--input",disabled,value,onChange:e=>{onChange(e.target.value)},onKeyDownCapture:e=>{"Enter"===e.key&&!e.shiftKey&&onPressEnter&&onPressEnter(e)},onFocus,onBlur}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-chat-textarea--expand",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-chat-textarea--expand-button"),onClick:()=>setExpanded(!expanded),padded:!1,ghost:!0,title:expanded?t("collapse")||"Collapse":t("expand")||"Expand",icon:expanded?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_FullscreenExit__WEBPACK_IMPORTED_MODULE_4__.default,{}):(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_Expand__WEBPACK_IMPORTED_MODULE_3__.default,{})})})]})})};ChatTextArea.displayName="ChatTextArea";const __WEBPACK_DEFAULT_EXPORT__=ChatTextArea;try{ChatTextArea.displayName="ChatTextArea",ChatTextArea.__docgenInfo={description:"",displayName:"ChatTextArea",props:{disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},value:{defaultValue:null,description:"",name:"value",required:!0,type:{name:"string"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!0,type:{name:"(value: string) => void"}},onPressEnter:{defaultValue:null,description:"",name:"onPressEnter",required:!1,type:{name:"((e: KeyboardEvent) => void)"}},onFocus:{defaultValue:null,description:"",name:"onFocus",required:!1,type:{name:"((e: FocusEvent) => void)"}},onBlur:{defaultValue:null,description:"",name:"onBlur",required:!1,type:{name:"((e: FocusEvent) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ChatTextArea/ChatTextArea.tsx#ChatTextArea"]={docgenInfo:ChatTextArea.__docgenInfo,name:"ChatTextArea",path:"src/components/ChatTextArea/ChatTextArea.tsx#ChatTextArea"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/MicrophoneButton/MicrophoneButton.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_icons_Microphone__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/icons/Microphone.tsx"),_ui_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Tooltip__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/ui/Tooltip.tsx"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),react_i18next__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const MicrophoneButton=({listening,stopAudio,startListening,stopListening})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_6__.$)(),[micBtnTooltip,setMicBtnTooltip]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(),intervalRef=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null),startHold=e=>{e.preventDefault(),setMicBtnTooltip(t("write_and_speak.holdToSpeak")||"Hold to record"),intervalRef.current||(intervalRef.current=setTimeout((()=>{stopAudio(),setMicBtnTooltip(t("write_and_speak.releaseToEndListening")||"Release to end listening"),startListening()}),300))},stopHold=()=>{intervalRef.current&&(clearTimeout(intervalRef.current),intervalRef.current=null),stopListening(),setMicBtnTooltip(void 0)};return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>()=>stopHold()),[]),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_3__.Z,{visible:!!micBtnTooltip,content:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("span",{children:micBtnTooltip||t("write_and_speak.pressAndHoldToSpeak")||"Press and hold to speak"}),align:"topLeft",className:"memori-mic-btn-tooltip",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-chat-inputs--mic",{"memori-chat-inputs--mic--listening":listening}),title:listening?t("write_and_speak.micButtonPopoverListening")||"Listening":t("write_and_speak.micButtonPopover")||"Start listening",onMouseDown:startHold,onTouchStart:startHold,onMouseUp:stopHold,onTouchEnd:stopHold,shape:"circle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_Microphone__WEBPACK_IMPORTED_MODULE_1__.default,{})})})};MicrophoneButton.displayName="MicrophoneButton";const __WEBPACK_DEFAULT_EXPORT__=MicrophoneButton;try{MicrophoneButton.displayName="MicrophoneButton",MicrophoneButton.__docgenInfo={description:"",displayName:"MicrophoneButton",props:{listening:{defaultValue:null,description:"",name:"listening",required:!1,type:{name:"boolean"}},stopAudio:{defaultValue:null,description:"",name:"stopAudio",required:!0,type:{name:"() => void"}},startListening:{defaultValue:null,description:"",name:"startListening",required:!0,type:{name:"() => void"}},stopListening:{defaultValue:null,description:"",name:"stopListening",required:!0,type:{name:"() => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/MicrophoneButton/MicrophoneButton.tsx#MicrophoneButton"]={docgenInfo:MicrophoneButton.__docgenInfo,name:"MicrophoneButton",path:"src/components/MicrophoneButton/MicrophoneButton.tsx#MicrophoneButton"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/Typing/Typing.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const defaultSentences={en:[{delayAfter:3,text:"Generating an accurate and fancy response..."},{delayAfter:3,text:"Generating a response that will blow your mind..."},{delayAfter:3,text:"Generating a response that will make you smile..."},{delayAfter:3,text:"Thinking of a response..."},{delayAfter:3,text:"Thinking of a response that will make you smile..."},{delayAfter:3,text:"Gathering my thoughts..."},{delayAfter:3,text:"Gathering my thoughts to give you a response..."}],it:[{delayAfter:3,text:"Sto generando una risposta accurata e fantasiosa..."},{delayAfter:3,text:"Sto generando una risposta che ti farà impazzire..."},{delayAfter:3,text:"Sto generando una risposta che ti farà sorridere..."},{delayAfter:3,text:"Sto pensando ad una risposta..."},{delayAfter:3,text:"Sto pensando ad una risposta che ti farà sorridere..."},{delayAfter:3,text:"Sto raccogliendo i miei pensieri..."},{delayAfter:3,text:"Sto raccogliendo i miei pensieri per darti una risposta..."}]},getSeparatorString=(seconds=3)=>new Array(20*seconds).fill(" ").join(""),Typing=({useDefaultSentences=!1,lang="en",sentence,sentences})=>{const[index,setIndex]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(0),[text,setText]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(sentences?.[lang]?.length?`${sentences[lang][0].text.endsWith("...")||!sentences[lang][0].text.length?sentences[lang][0].text:`${sentences[lang][0].text}...`}${getSeparatorString(sentences[lang][0].delayAfter)}`:sentence?`${sentence.endsWith("...")||!sentence.length?sentence:`${sentence}...`}${getSeparatorString()}`:""),[shownText,setShownText]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)("");return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{const interval=setInterval((()=>{const letter=text[shownText.length];if(void 0!==letter&&text.length>0)setShownText((prev=>prev+letter));else if(sentences?.[lang]?.length&&indexclearInterval(interval)})),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("div",{className:"memori-chat--bubble",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("div",{className:"memori-chat--bubble-typing",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("div",{id:"wave",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("span",{className:"dot"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("span",{className:"dot"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("span",{className:"dot"})]}),text.length>0&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("p",{children:shownText})]})})};Typing.displayName="Typing";const __WEBPACK_DEFAULT_EXPORT__=Typing;try{Typing.displayName="Typing",Typing.__docgenInfo={description:"",displayName:"Typing",props:{useDefaultSentences:{defaultValue:{value:"false"},description:"",name:"useDefaultSentences",required:!1,type:{name:"boolean"}},lang:{defaultValue:{value:"en"},description:"",name:"lang",required:!1,type:{name:"enum",value:[{value:'"en"'},{value:'"it"'}]}},sentence:{defaultValue:null,description:"",name:"sentence",required:!1,type:{name:"string"}},sentences:{defaultValue:null,description:"",name:"sentences",required:!1,type:{name:"{ [lang: string]: { text: string; delayAfter: number; }[]; }"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Typing/Typing.tsx#Typing"]={docgenInfo:Typing.__docgenInfo,name:"Typing",path:"src/components/Typing/Typing.tsx#Typing"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Expand.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Expand=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M855 160.1l-189.2 23.5c-6.6.8-9.3 8.8-4.7 13.5l54.7 54.7-153.5 153.5a8.03 8.03 0 0 0 0 11.3l45.1 45.1c3.1 3.1 8.2 3.1 11.3 0l153.6-153.6 54.7 54.7a7.94 7.94 0 0 0 13.5-4.7L863.9 169a7.9 7.9 0 0 0-8.9-8.9zM416.6 562.3a8.03 8.03 0 0 0-11.3 0L251.8 715.9l-54.7-54.7a7.94 7.94 0 0 0-13.5 4.7L160.1 855c-.6 5.2 3.7 9.5 8.9 8.9l189.2-23.5c6.6-.8 9.3-8.8 4.7-13.5l-54.7-54.7 153.6-153.6c3.1-3.1 3.1-8.2 0-11.3l-45.2-45z"})});Expand.displayName="Expand";const __WEBPACK_DEFAULT_EXPORT__=Expand;try{Expand.displayName="Expand",Expand.__docgenInfo={description:"",displayName:"Expand",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Expand.tsx#Expand"]={docgenInfo:Expand.__docgenInfo,name:"Expand",path:"src/components/icons/Expand.tsx#Expand"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Microphone.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Microphone=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M842 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254S258 594.3 258 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 168.7 126.6 307.9 290 327.6V884H326.7c-13.7 0-24.7 14.3-24.7 32v36c0 4.4 2.8 8 6.2 8h407.6c3.4 0 6.2-3.6 6.2-8v-36c0-17.7-11-32-24.7-32H548V782.1c165.3-18 294-158 294-328.1zM512 624c93.9 0 170-75.2 170-168V232c0-92.8-76.1-168-170-168s-170 75.2-170 168v224c0 92.8 76.1 168 170 168zm-94-392c0-50.6 41.9-92 94-92s94 41.4 94 92v224c0 50.6-41.9 92-94 92s-94-41.4-94-92V232z"})});Microphone.displayName="Microphone";const __WEBPACK_DEFAULT_EXPORT__=Microphone;try{Microphone.displayName="Microphone",Microphone.__docgenInfo={description:"",displayName:"Microphone",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Microphone.tsx#Microphone"]={docgenInfo:Microphone.__docgenInfo,name:"Microphone",path:"src/components/icons/Microphone.tsx#Microphone"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Send.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Send=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2-8.5 2.1-13.8 10.7-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z"})});Send.displayName="Send";const __WEBPACK_DEFAULT_EXPORT__=Send;try{Send.displayName="Send",Send.__docgenInfo={description:"",displayName:"Send",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Send.tsx#Send"]={docgenInfo:Send.__docgenInfo,name:"Send",path:"src/components/icons/Send.tsx#Send"})}catch(__react_docgen_typescript_loader_error){}}}]); \ No newline at end of file diff --git a/8693.2bc505f4.iframe.bundle.js b/8693.2bc505f4.iframe.bundle.js deleted file mode 100644 index 1564abfb..00000000 --- a/8693.2bc505f4.iframe.bundle.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[8693],{"./src/components/AgeVerificationModal/AgeVerificationModal.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react_i18next__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),react_hot_toast__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),_ui_Button__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Modal__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Modal.tsx"),luxon__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/luxon/src/luxon.js"),_DateSelector_DateSelector__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/DateSelector/DateSelector.tsx"),react__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/index.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react/jsx-runtime.js");const AgeVerificationModal=({visible=!1,onClose,minAge})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_7__.$)(),[birthDate,setBirthDate]=(0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(),[error,setError]=(0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(),[submitting,setSubmitting]=(0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(!1),onSubmit=(0,react__WEBPACK_IMPORTED_MODULE_5__.useCallback)((()=>{if(setSubmitting(!0),!birthDate)return react_hot_toast__WEBPACK_IMPORTED_MODULE_0__.ZP.error(t("requiredField")),setError(t("requiredField")||"Required field"),void setSubmitting(!1);if(luxon__WEBPACK_IMPORTED_MODULE_3__.ou.now().diff(birthDate,"years").yearsonClose(),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("p",{children:t("ageVerificationText",{minAge})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("form",{className:"age-verification-form",onSubmit:e=>{e.preventDefault(),onSubmit()},children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div",{className:"form-item",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("fieldset",{name:"birthDate",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("legend",{className:"sr-only",children:t("birthDate")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_DateSelector_DateSelector__WEBPACK_IMPORTED_MODULE_4__.Z,{defaultDate:new Date(Date.now()),onChange:date=>{setBirthDate(date)}}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("p",{className:"form-item-help",children:t("birthDateHelper")}),error&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("p",{className:"form-item-error",children:error})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div",{className:"form-item form-submit",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:!0,htmlType:"submit",className:"age-verification-submit",loading:submitting,disabled:!birthDate,children:t("confirm")})})]})]})};AgeVerificationModal.displayName="AgeVerificationModal";const __WEBPACK_DEFAULT_EXPORT__=AgeVerificationModal;try{AgeVerificationModal.displayName="AgeVerificationModal",AgeVerificationModal.__docgenInfo={description:"",displayName:"AgeVerificationModal",props:{visible:{defaultValue:{value:"false"},description:"",name:"visible",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(birthDate?: string | undefined) => void"}},minAge:{defaultValue:null,description:"",name:"minAge",required:!0,type:{name:"number"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AgeVerificationModal/AgeVerificationModal.tsx#AgeVerificationModal"]={docgenInfo:AgeVerificationModal.__docgenInfo,name:"AgeVerificationModal",path:"src/components/AgeVerificationModal/AgeVerificationModal.tsx#AgeVerificationModal"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/Auth/Auth.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),react_i18next__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_ui_Button__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Modal__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Modal.tsx"),react_hook_form__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react-hook-form/dist/index.esm.mjs"),_icons_Plus__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Plus.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react/jsx-runtime.js");const AuthWidget=({pwdOrTokens,setPwdOrTokens,onFinish,minimumNumberOfRecoveryTokens=1,showTokens=!0,openModal=!1,withModal=!1})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_5__.$)(),{register,handleSubmit,formState:{errors},setError}=(0,react_hook_form__WEBPACK_IMPORTED_MODULE_6__.cI)(),[numTokens,setNumTokens]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(1),[showModal,setShowModal]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!!pwdOrTokens),form=(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("form",{name:"memoriAuth",onSubmit:handleSubmit((data=>{"password"===pwdOrTokens&&!data.password?.length||"tokens"===pwdOrTokens&&((data?.tokens?.length||0)t.length)))?setError("tokens",{type:"minLength",message:"Tokens"}):onFinish&&onFinish(data).then((()=>{setShowModal(!1)}))})),className:"memori-auth-widget--form",children:[("password"===pwdOrTokens||!showTokens)&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("fieldset",{className:"memori-auth-widget--password-fieldset",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("label",{children:["Password:"," ",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("input",{className:"memori-auth-widget--input",required:!0,type:"password",placeholder:"Password",...register("password",{required:!0})})]}),showTokens&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("hr",{}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{outlined:!0,onClick:()=>setPwdOrTokens("tokens"),children:t("auth.useRecoveryTokens")||"Recovery tokens"})]})]}),"tokens"===pwdOrTokens&&showTokens&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("fieldset",{className:"memori-auth-widget--tokens-fieldset",name:"tokens",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("legend",{children:[t("auth.tokens"),": "]}),(length=numTokens,Array.from({length},((_,i)=>i))).map((idx=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("label",{className:"memori-auth-widget--token",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("input",{type:"password",className:"memori-auth-widget--input",placeholder:"Recovery token",required:!0,autoComplete:"off",...register(`tokens.${idx}`,{required:!0})})},idx))),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{onClick:()=>setNumTokens((t=>t+1)),className:"memori-auth-widget--token-add",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_icons_Plus__WEBPACK_IMPORTED_MODULE_3__.default,{}),children:t("auth.addToken")||"Add token"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("hr",{}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{outlined:!0,onClick:()=>setPwdOrTokens("password"),children:t("auth.usePassword")||"Password"})]}),"minLength"===errors.tokens?.type&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div",{className:"memori-auth-widget--error",children:[t("auth.atLeast")||"At least"," ",minimumNumberOfRecoveryTokens]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{htmlType:"submit",primary:!0,className:"memori-auth-widget--submit",children:t("confirm")||"Submit"})]});var length;return withModal?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_2__.Z,{open:openModal||showModal,title:t("auth.title")||"Authentication",onClose:()=>setPwdOrTokens(null),closable:!1,children:form}):form},__WEBPACK_DEFAULT_EXPORT__=AuthWidget;try{AuthWidget.displayName="AuthWidget",AuthWidget.__docgenInfo={description:"",displayName:"AuthWidget",props:{pwdOrTokens:{defaultValue:null,description:"",name:"pwdOrTokens",required:!0,type:{name:'"password" | "tokens" | null'}},setPwdOrTokens:{defaultValue:null,description:"",name:"setPwdOrTokens",required:!0,type:{name:'(state: "password" | "tokens" | null) => void'}},onFinish:{defaultValue:null,description:"",name:"onFinish",required:!1,type:{name:"((values: AuthInputs) => Promise)"}},minimumNumberOfRecoveryTokens:{defaultValue:{value:"1"},description:"",name:"minimumNumberOfRecoveryTokens",required:!1,type:{name:"number"}},showTokens:{defaultValue:{value:"true"},description:"",name:"showTokens",required:!1,type:{name:"boolean"}},withModal:{defaultValue:{value:"false"},description:"",name:"withModal",required:!1,type:{name:"boolean"}},openModal:{defaultValue:{value:"false"},description:"",name:"openModal",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Auth/Auth.tsx#AuthWidget"]={docgenInfo:AuthWidget.__docgenInfo,name:"AuthWidget",path:"src/components/Auth/Auth.tsx#AuthWidget"})}catch(__react_docgen_typescript_loader_error){}try{Auth.displayName="Auth",Auth.__docgenInfo={description:"",displayName:"Auth",props:{pwdOrTokens:{defaultValue:null,description:"",name:"pwdOrTokens",required:!0,type:{name:'"password" | "tokens" | null'}},setPwdOrTokens:{defaultValue:null,description:"",name:"setPwdOrTokens",required:!0,type:{name:'(state: "password" | "tokens" | null) => void'}},onFinish:{defaultValue:null,description:"",name:"onFinish",required:!1,type:{name:"((values: AuthInputs) => Promise)"}},minimumNumberOfRecoveryTokens:{defaultValue:{value:"1"},description:"",name:"minimumNumberOfRecoveryTokens",required:!1,type:{name:"number"}},showTokens:{defaultValue:{value:"true"},description:"",name:"showTokens",required:!1,type:{name:"boolean"}},withModal:{defaultValue:{value:"false"},description:"",name:"withModal",required:!1,type:{name:"boolean"}},openModal:{defaultValue:{value:"false"},description:"",name:"openModal",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Auth/Auth.tsx#Auth"]={docgenInfo:Auth.__docgenInfo,name:"Auth",path:"src/components/Auth/Auth.tsx#Auth"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/Avatar/Avatar.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>Avatar_Avatar});var react=__webpack_require__("./node_modules/react/index.js"),Button=__webpack_require__("./src/components/ui/Button.tsx"),withTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/withTranslation.js"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");class ErrorBoundary extends react.Component{state={hasError:!1};static getDerivedStateFromError(_){return{hasError:!0}}componentDidCatch(error,errorInfo){console.error("Uncaught error:",error,errorInfo)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,jsx_runtime.jsxs)("div",{style:{background:"rgba(255, 255, 255, 0.4)",color:"#000",padding:"2rem",borderRadius:"10px"},children:[(0,jsx_runtime.jsx)("h2",{children:this.props.t("error.generic")}),(0,jsx_runtime.jsx)(Button.Z,{primary:!0,onClick:()=>this.setState({hasError:!1}),children:this.props.t("error.tryAgain")||"Try again"})]}):this.props.children}}ErrorBoundary.displayName="ErrorBoundary";const ErrorBoundary_ErrorBoundary=(0,withTranslation.Z)(["common"])(ErrorBoundary);var Tooltip=__webpack_require__("./src/components/ui/Tooltip.tsx"),media=__webpack_require__("./src/helpers/media.ts"),Blob=__webpack_require__("./src/components/Blob/Blob.tsx"),ModelViewer=__webpack_require__("./src/components/CustomGLBModelViewer/ModelViewer.tsx"),useTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),Eye=__webpack_require__("./src/components/icons/Eye.tsx"),EyeInvisible=__webpack_require__("./src/components/icons/EyeInvisible.tsx"),Edit=__webpack_require__("./src/components/icons/Edit.tsx"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),AvatarView=__webpack_require__("./src/components/Avatar/AvatarView/index.tsx"),visemeContext=__webpack_require__("./src/context/visemeContext.tsx");const Avatar=({memori,integration,integrationConfig,tenant,instruct=!1,avatar3dVisible=!1,setAvatar3dVisible,hasUserActivatedSpeak=!1,isPlayingAudio=!1,loading=!1,baseUrl,apiUrl,animation,isZoomed=!1,chatProps,avatarType=null,enablePositionControls,setEnablePositionControls,isTotem=!1})=>{const{t}=(0,useTranslation.$)(),[isClient,setIsClient]=(0,react.useState)(!1),{stopProcessing,updateCurrentViseme,resetVisemeQueue}=(0,visemeContext.LG)();(0,react.useEffect)((()=>{setIsClient(!0)}),[]);const getAvatarUrl=()=>{if("userAvatar"===integrationConfig?.avatar&&memori.avatarURL&&memori.avatarURL.length>0)return(0,media.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl})},renderAvatarContent=()=>isClient?"readyplayerme"===integrationConfig?.avatar||"readyplayerme-full"===integrationConfig?.avatar||"customrpm"===integrationConfig?.avatar?(0,jsx_runtime.jsx)(ErrorBoundary_ErrorBoundary,{fallback:(0,jsx_runtime.jsx)("div",{className:"memori--blob-container",children:isClient&&(0,jsx_runtime.jsx)(Blob.Z,{speaking:isPlayingAudio,avatar:getAvatarUrl()})}),children:(0,jsx_runtime.jsx)(AvatarView.Z,{enablePositionControls,updateCurrentViseme,url:integrationConfig.avatarURL,sex:"FEMALE"===memori.voiceType?"FEMALE":"MALE",fallbackImg:getAvatarUrl(),headMovement:!0,eyeBlink:!0,animation,halfBody:"readyplayerme"===integrationConfig.avatar,speaking:isPlayingAudio,loading,style:getAvatarStyle(),stopProcessing,resetVisemeQueue,isZoomed,isTotem,chatEmission:chatProps?.dialogState?.emission,setEnablePositionControls})}):"customglb"===integrationConfig?.avatar?(0,jsx_runtime.jsx)(ModelViewer.Z,{poster:getAvatarUrl()||"",src:integrationConfig.avatarURL,alt:""}):null:null,renderAvatarToggle=()=>(0,jsx_runtime.jsx)("div",{className:"memori--avatar-toggle",children:(0,jsx_runtime.jsx)(Button.Z,{ghost:!0,onClick:()=>setAvatar3dVisible(!avatar3dVisible),icon:avatar3dVisible?(0,jsx_runtime.jsx)(EyeInvisible.default,{}):(0,jsx_runtime.jsx)(Eye.default,{}),children:(0,jsx_runtime.jsx)("span",{className:"memori--avatar-toggle-text",children:t(avatar3dVisible?"hide":"show")})})}),getAvatarStyle=()=>"readyplayerme"===integrationConfig?.avatar?{width:"100%",height:"100%",backgroundColor:"none",boxShadow:"none"}:{width:"100%",height:"100%",backgroundColor:"none"};return(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[("readyplayerme"===integrationConfig?.avatar||"readyplayerme-full"===integrationConfig?.avatar||"customglb"===integrationConfig?.avatar||"customrpm"===integrationConfig?.avatar)&&integrationConfig?.avatarURL&&avatarType&&"blob"!==avatarType?(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)("div",{className:classnames_default()("memori--avatar-wrapper",`memori--avatar-${integrationConfig?.avatar||"default"}`,{hidden:!avatar3dVisible}),children:renderAvatarContent()}),renderAvatarToggle()]}):(0,jsx_runtime.jsx)("div",{className:"memori--blob-container",children:isClient&&(0,jsx_runtime.jsx)(Blob.Z,{speaking:isPlayingAudio,avatar:getAvatarUrl()})}),(()=>{if(!instruct||hasUserActivatedSpeak||!memori.isGiver||!tenant?.id)return null;const href=`https://${tenant.id}/${"it-IT"===memori.culture?"it":"en"}/${memori.ownerUserName}/${memori.name}/integrations${integration?.integrationID?`?integration=${integration.integrationID}&openAvatarModal=true`:""}`;return(0,jsx_runtime.jsx)("div",{className:"memori--avatar-link-to-integrations",children:(0,jsx_runtime.jsx)("a",{className:"memori-button memori-button--circle memori-button--outlined",href,children:(0,jsx_runtime.jsx)(Tooltip.Z,{content:t("widgetgoToIntegrationsToCustomizeAvatar"),children:(0,jsx_runtime.jsx)("span",{className:"memori-button--icon",children:(0,jsx_runtime.jsx)(Edit.default,{})})})})})})()]})},Avatar_Avatar=(0,react.memo)(Avatar,((prevProps,nextProps)=>JSON.stringify(prevProps)===JSON.stringify(nextProps)));try{Avatar.displayName="Avatar",Avatar.__docgenInfo={description:"",displayName:"Avatar",props:{memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},integration:{defaultValue:null,description:"",name:"integration",required:!1,type:{name:"Integration"}},integrationConfig:{defaultValue:null,description:"",name:"integrationConfig",required:!1,type:{name:"{ [key: string]: any; }"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},instruct:{defaultValue:{value:"false"},description:"",name:"instruct",required:!1,type:{name:"boolean"}},hasUserActivatedSpeak:{defaultValue:{value:"false"},description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},avatar3dVisible:{defaultValue:{value:"false"},description:"",name:"avatar3dVisible",required:!1,type:{name:"boolean"}},setAvatar3dVisible:{defaultValue:null,description:"",name:"setAvatar3dVisible",required:!0,type:{name:"(visible: boolean) => void"}},isPlayingAudio:{defaultValue:{value:"false"},description:"",name:"isPlayingAudio",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},baseUrl:{defaultValue:null,description:"",name:"baseUrl",required:!1,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!1,type:{name:"string"}},animation:{defaultValue:null,description:"",name:"animation",required:!1,type:{name:"string"}},isZoomed:{defaultValue:{value:"false"},description:"",name:"isZoomed",required:!1,type:{name:"boolean"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"any"}},enablePositionControls:{defaultValue:null,description:"",name:"enablePositionControls",required:!1,type:{name:"boolean"}},setEnablePositionControls:{defaultValue:null,description:"",name:"setEnablePositionControls",required:!0,type:{name:"(value: boolean) => void"}},avatarType:{defaultValue:{value:"null"},description:"",name:"avatarType",required:!1,type:{name:'"blob" | "avatar3d" | null'}},isTotem:{defaultValue:{value:"false"},description:"",name:"isTotem",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Avatar/Avatar.tsx#Avatar"]={docgenInfo:Avatar.__docgenInfo,name:"Avatar",path:"src/components/Avatar/Avatar.tsx#Avatar"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/Blob/Blob.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ExperienceBlob=({avatar,speaking=!1})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-blob",{"memori-blob--speaking":speaking}),children:[avatar&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("figure",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("img",{src:avatar,alt:"",role:"presentation"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"})]});ExperienceBlob.displayName="ExperienceBlob";const __WEBPACK_DEFAULT_EXPORT__=ExperienceBlob;try{Blob.displayName="Blob",Blob.__docgenInfo={description:"",displayName:"Blob",props:{avatar:{defaultValue:null,description:"",name:"avatar",required:!1,type:{name:"string"}},speaking:{defaultValue:{value:"false"},description:"",name:"speaking",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Blob/Blob.tsx#Blob"]={docgenInfo:Blob.__docgenInfo,name:"Blob",path:"src/components/Blob/Blob.tsx#Blob"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/BlockedMemoriBadge/BlockedMemoriBadge.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var _ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Tooltip.tsx"),_icons_Warning__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Warning.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const BlockedMemoriBadge=({memoriName,blockedUntil,notEnoughCredits=!1,showGiverInfo=!1,showTitle=!1,marginLeft=!1})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)(),blockedUntilDate=new Date(blockedUntil||Date.now());return notEnoughCredits||blockedUntilDate>new Date(Date.now())?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{className:"blocked-memori-badge--tooltip",content:notEnoughCredits?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.Fragment,{children:t("notEnoughCredits")}):(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.Fragment,{children:[!showGiverInfo&&t("memoriBlockedAnon",{name:memoriName,date:new Intl.DateTimeFormat("it",{day:"numeric",month:"long",year:"numeric"}).format(blockedUntilDate)}),showGiverInfo&&t("memoriBlockedUntil",{date:new Intl.DateTimeFormat("it",{day:"numeric",month:"long",year:"numeric"}).format(blockedUntilDate)}),showGiverInfo&&` ${t("memoriBlockedReasonExceedChats")}`,showGiverInfo&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("br",{}),showGiverInfo&&`\n${t("memoriBlockedGiverHelper")}`]}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:"blocked-memori-badge--wrapper",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"blocked-memori-badge "+(marginLeft?" margin-left":""),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Warning__WEBPACK_IMPORTED_MODULE_2__.default,{className:"blocked-memori-badge--icon"})}),showTitle&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"blocked-memori-badge--title",children:t("memoriBlockedTitle")})]})}):null},__WEBPACK_DEFAULT_EXPORT__=BlockedMemoriBadge;try{BlockedMemoriBadge.displayName="BlockedMemoriBadge",BlockedMemoriBadge.__docgenInfo={description:"",displayName:"BlockedMemoriBadge",props:{memoriName:{defaultValue:null,description:"",name:"memoriName",required:!0,type:{name:"string"}},blockedUntil:{defaultValue:null,description:"",name:"blockedUntil",required:!1,type:{name:"string"}},notEnoughCredits:{defaultValue:{value:"false"},description:"",name:"notEnoughCredits",required:!1,type:{name:"boolean"}},showGiverInfo:{defaultValue:{value:"false"},description:"",name:"showGiverInfo",required:!1,type:{name:"boolean"}},showTitle:{defaultValue:{value:"false"},description:"",name:"showTitle",required:!1,type:{name:"boolean"}},marginLeft:{defaultValue:{value:"false"},description:"",name:"marginLeft",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/BlockedMemoriBadge/BlockedMemoriBadge.tsx#BlockedMemoriBadge"]={docgenInfo:BlockedMemoriBadge.__docgenInfo,name:"BlockedMemoriBadge",path:"src/components/BlockedMemoriBadge/BlockedMemoriBadge.tsx#BlockedMemoriBadge"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ChangeMode/ChangeMode.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var _headlessui_react__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/@headlessui/react/dist/components/radio-group/radio-group.js"),react_i18next__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_ui_Button__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Button.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChangeMode=({instruct,canInstruct,onChangeMode})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_3__.$)();return canInstruct?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"memori--changeMode-instruct",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.E,{name:"instruct",value:instruct?"instruct":"test",defaultValue:instruct?"instruct":"test",className:"memori--changeMode-instruct-radio",onChange:onChangeMode,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.E.Option,{value:"instruct",className:"memori--changeMode-instruct-radio-button",children:({checked})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:checked,children:t("widget.instruct")||"Instruct"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.E.Option,{value:"test",className:"memori--changeMode-instruct-radio-button",children:({checked})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:checked,children:t("widget.test")||"Test"})})]})}):null},__WEBPACK_DEFAULT_EXPORT__=ChangeMode;try{ChangeMode.displayName="ChangeMode",ChangeMode.__docgenInfo={description:"",displayName:"ChangeMode",props:{instruct:{defaultValue:null,description:"",name:"instruct",required:!1,type:{name:"boolean"}},onChangeMode:{defaultValue:null,description:"",name:"onChangeMode",required:!0,type:{name:'(mode: "instruct" | "test") => void'}},canInstruct:{defaultValue:null,description:"",name:"canInstruct",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ChangeMode/ChangeMode.tsx#ChangeMode"]={docgenInfo:ChangeMode.__docgenInfo,name:"ChangeMode",path:"src/components/ChangeMode/ChangeMode.tsx#ChangeMode"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/CompletionProviderStatus/CompletionProviderStatus.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Tooltip.tsx"),_icons_Warning__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Warning.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const CompletionProviderStatus=({forceStatus,provider="OpenAI"})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)(),[status,setStatus]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(forceStatus??"operational"),providerStatus=(provider=>{switch(provider){case"OpenAI":return{getStatus:async()=>{const res=await fetch("https://status.openai.com/api/v2/summary.json"),data=await res.json(),status=data.components.find((component=>"API"===component.name))?.status;return status??"operational"},statusPage:"https://status.openai.com/"};case"Mistral":return{getStatus:async()=>{const res=await fetch("https://status.mistral-data.com/api/v2/summary.json"),data=await res.json(),status=data.components.find((component=>"API"===component.name))?.status;return status??"operational"},statusPage:"https://status.mistral-data.com/"};case"Anthropic":return{getStatus:async()=>{const res=await fetch("https://status.anthropic.com/api/v2/summary.json"),data=await res.json(),status=data.components.find((component=>"API"===component.name))?.status;return status??"operational"},statusPage:"https://status.anthropic.com/"};default:return{getStatus:async()=>"operational",statusPage:""}}})(provider);return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{forceStatus||providerStatus.getStatus().then((status=>setStatus(status))).catch(console.log)}),[forceStatus,providerStatus]),"operational"!==status?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{className:"memori--completion-provider-status--tooltip",align:"topLeft",content:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("p",{children:t("completionProviderDown",{provider:provider??t("completionProviderFallbackName")})}),!!providerStatus.statusPage?.length&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("p",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("a",{href:providerStatus.statusPage,rel:"noopener noreferrer",target:"_blank",children:t("completionProviderCheckStatusPage")})})]}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Warning__WEBPACK_IMPORTED_MODULE_2__.default,{className:"memori--completion-provider-status--icon"})}):null},__WEBPACK_DEFAULT_EXPORT__=CompletionProviderStatus;try{CompletionProviderStatus.displayName="CompletionProviderStatus",CompletionProviderStatus.__docgenInfo={description:"",displayName:"CompletionProviderStatus",props:{forceStatus:{defaultValue:null,description:"",name:"forceStatus",required:!1,type:{name:"enum",value:[{value:'"operational"'},{value:'"degraded_performance"'},{value:'"partial_outage"'},{value:'"major_outage"'}]}},provider:{defaultValue:{value:"OpenAI"},description:"",name:"provider",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/CompletionProviderStatus/CompletionProviderStatus.tsx#CompletionProviderStatus"]={docgenInfo:CompletionProviderStatus.__docgenInfo,name:"CompletionProviderStatus",path:"src/components/CompletionProviderStatus/CompletionProviderStatus.tsx#CompletionProviderStatus"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/DateSelector/DateSelector.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/@headlessui/react/dist/components/listbox/listbox.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),luxon__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/luxon/src/luxon.js"),react_i18next__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/SelectIcon.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const months={en:["January","February","March","April","May","June","July","August","September","October","November","December"],it:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]},DateSelector=(0,react__WEBPACK_IMPORTED_MODULE_0__.memo)((({defaultDate,onChange,disabled=!1})=>{const{t,i18n}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)(),[date,setDate]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(defaultDate?"string"==typeof defaultDate?luxon__WEBPACK_IMPORTED_MODULE_1__.ou.fromISO(defaultDate):luxon__WEBPACK_IMPORTED_MODULE_1__.ou.fromJSDate(defaultDate):luxon__WEBPACK_IMPORTED_MODULE_1__.ou.now());return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{onChange(date)}),[date,onChange]),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:"memori--date-selector",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori--date-selector__select",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R,{value:date,onChange:value=>{setDate(value)},disabled,name:"day",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Label,{className:"memori--date-selector__select-label",children:[t("day"),":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Button,{"aria-label":t("day"),className:"memori--date-selector__select-button",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--value",children:date.day}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__.default,{})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Options,{className:"memori--date-selector__select-options",children:[...Array(31).keys()].map((day=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Option,{value:date.set({day:day+1}),className:"memori--date-selector__select-option",children:day+1},day)))})})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori--date-selector__select",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R,{value:date,onChange:value=>{setDate(value)},disabled,name:"month",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Label,{className:"memori--date-selector__select-label",children:[t("month"),":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Button,{"aria-label":t("month"),className:"memori--date-selector__select-button",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--value",children:months["it"===i18n.language?"it":"en"][date.month-1]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__.default,{})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Options,{className:"memori--date-selector__select-options",children:months["it"===i18n.language?"it":"en"].map((month=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Option,{className:"memori--date-selector__select-option",value:date.set({month:months["it"===i18n.language?"it":"en"].findIndex((m=>m===month))+1}),children:month},month)))})})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori--date-selector__select",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R,{value:date,onChange:value=>{setDate(value)},disabled,name:"year",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Label,{className:"memori--date-selector__select-label",children:[t("year"),":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Button,{"aria-label":t("year"),className:"memori--date-selector__select-button",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--value",children:date.year}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__.default,{})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Options,{className:"memori--date-selector__select-options",children:[...Array(luxon__WEBPACK_IMPORTED_MODULE_1__.ou.now().year-1899).keys()].sort(((a,b)=>b-a)).map((year=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Option,{value:date.set({year:year+1900}),className:"memori--date-selector__select-option",children:year+1900},year)))})})]})})]})}));DateSelector.displayName="DateSelector";const __WEBPACK_DEFAULT_EXPORT__=DateSelector},"./src/components/ExpertsDrawer/ExpertsDrawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var _ui_Drawer__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./src/components/ui/Drawer.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_helpers_media__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/helpers/media.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ExpertsDrawer=({open=!1,baseUrl,apiUrl,tenant,experts,onClose})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_2__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_0__.Z,{open,onClose,className:"memori--experts-drawer",title:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("h2",{className:"memori--experts-drawer--title",children:t("widget.expertsInTheBoard")}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("ul",{className:"memori--experts-drawer--list",children:experts.map((expert=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("li",{className:"memori--experts-drawer--item",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("figure",{className:"memori--experts-drawer--avatar",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("img",{src:`${apiUrl}/api/v1/memoriai/memori/avatar/${expert.expertMemoriID}`,alt:expert.name,onError:e=>{e.currentTarget.src=(0,_helpers_media__WEBPACK_IMPORTED_MODULE_3__.v)({tenantID:tenant?.id,type:"avatar",baseURL:baseUrl}),e.currentTarget.onerror=null}})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("div",{className:"memori--experts-drawer--content",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("h3",{className:"memori--experts-drawer--name",children:expert.name}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("p",{className:"memori--experts-drawer--description",children:expert.description})]})]},expert.expertID)))})})};ExpertsDrawer.displayName="ExpertsDrawer";const __WEBPACK_DEFAULT_EXPORT__=ExpertsDrawer;try{ExpertsDrawer.displayName="ExpertsDrawer",ExpertsDrawer.__docgenInfo={description:"",displayName:"ExpertsDrawer",props:{experts:{defaultValue:null,description:"",name:"experts",required:!0,type:{name:"ExpertReference[]"}},baseUrl:{defaultValue:null,description:"",name:"baseUrl",required:!0,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!0,type:{name:"string"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"() => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ExpertsDrawer/ExpertsDrawer.tsx#ExpertsDrawer"]={docgenInfo:ExpertsDrawer.__docgenInfo,name:"ExpertsDrawer",path:"src/components/ExpertsDrawer/ExpertsDrawer.tsx#ExpertsDrawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/KnownFacts/KnownFacts.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_ui_Button__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Drawer__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Drawer.tsx"),_ui_Spin__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/ui/Spin.tsx"),_ui_Modal__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/ui/Modal.tsx"),react_hot_toast__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),_helpers_error__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./src/helpers/error.ts"),react_i18next__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_icons_Delete__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./src/components/icons/Delete.tsx"),_ui_Checkbox__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./src/components/ui/Checkbox.tsx"),_ui_Select__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./src/components/ui/Select.tsx"),_icons_ChevronLeft__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("./src/components/icons/ChevronLeft.tsx"),_icons_ChevronRight__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__("./src/components/icons/ChevronRight.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__("./node_modules/react/jsx-runtime.js");const KnownFacts=({apiClient,sessionID,memori,visible=!0,initialKnownFacts=[],closeDrawer})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_13__.$)(),{getKnownFactsPaginated,deleteKnownFact}=apiClient.knownFacts,[knownFacts,setKnownFacts]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialKnownFacts),[numberOfResults,setNumberOfResults]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(25),[pageIndex,setPageIndex]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(0),[knownFactsCount,setKnownFactsCount]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialKnownFacts?.length??0),[loading,setLoading]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),fetchKnownFacts=async(sessionId,from,howMany)=>{if(sessionID||sessionId){setLoading(!0);try{const{knownFacts,count,...response}=await getKnownFactsPaginated(sessionId??sessionID,from??pageIndex,howMany??numberOfResults);setKnownFacts(knownFacts??[]),setKnownFactsCount(count??0),0!==response.resultCode&&(console.error(response),react_hot_toast__WEBPACK_IMPORTED_MODULE_5__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_6__.r)(response.resultCode))))}catch(err){console.error("KNOWN_FACTS/FETCH",err),setKnownFacts(initialKnownFacts??[])}setLoading(!1)}};(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{fetchKnownFacts()}),[]);const[bulkDeleteModalVisible,setBulkDeleteModalVisible]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),[deleteModalVisibleFor,setDeleteModalVisibleFor]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(),[selectedRowKeys,setSelectedRowKeys]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]);return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_2__.Z,{open:visible,width:"80%",className:"memori-known-facts-drawer",onClose:()=>closeDrawer(),title:t("knownFacts.title"),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("p",{children:t("knownFacts.description",{memoriName:memori.name})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(_ui_Spin__WEBPACK_IMPORTED_MODULE_3__.Z,{spinning:loading,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("div",{className:"memori-known-facts-actions",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:!0,danger:!0,onClick:()=>{setBulkDeleteModalVisible(!0)},className:"memori-known-facts-delete-selected",disabled:0===selectedRowKeys?.length,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_icons_Delete__WEBPACK_IMPORTED_MODULE_7__.default,{}),loading,children:[t("selected")," (",selectedRowKeys?.length,")"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_4__.Z,{className:"memori-known-facts-modal",open:bulkDeleteModalVisible,closable:!0,title:selectedRowKeys.length>1?t("knownFacts.deleteSelectedConfirmTitle"):t("knownFacts.deleteConfirmTitle"),description:selectedRowKeys.length>1?t("knownFacts.deleteSelectedConfirmMessage",{number:selectedRowKeys.length}):t("knownFacts.deleteConfirmMessage"),onClose:()=>{setBulkDeleteModalVisible(!1)},footer:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{ghost:!0,onClick:()=>{setBulkDeleteModalVisible(!1)},children:t("cancel")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:!0,danger:!0,onClick:async()=>{try{const mutations=selectedRowKeys.map((key=>deleteKnownFact(sessionID,key)));Promise.all(mutations).then((responses=>{if(responses.every((r=>0===r.resultCode)))react_hot_toast__WEBPACK_IMPORTED_MODULE_5__.ZP.success(t("knownFacts.deleteSuccess")),setSelectedRowKeys([]),fetchKnownFacts(),setBulkDeleteModalVisible(!1);else{let errored=responses.find((r=>0!==r.resultCode));console.error(errored),void 0!==errored?.resultCode&&react_hot_toast__WEBPACK_IMPORTED_MODULE_5__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_6__.r)(errored?.resultCode)))}}))}catch(_e){let error=_e;react_hot_toast__WEBPACK_IMPORTED_MODULE_5__.ZP.error(t("Error")+error.message)}},children:t("confirm")})]})})]}),knownFactsCount>25&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("nav",{className:"memori--table--pagination",children:[knownFactsCount>numberOfResults&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("div",{className:"memori--table--pagination--pages",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{shape:"circle",disabled:0===pageIndex||pageIndex{let from=(pageIndex/numberOfResults-1)*numberOfResults;setPageIndex(from),fetchKnownFacts(void 0,from,numberOfResults)}}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("span",{className:"memori--table--pagination--pages--current",children:[Math.ceil(pageIndex/numberOfResults)+1," /"," ",Math.ceil(knownFactsCount/numberOfResults)]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{shape:"circle",padded:!1,title:t("next")||"Next",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_icons_ChevronRight__WEBPACK_IMPORTED_MODULE_11__.default,{}),disabled:(pageIndex/numberOfResults+1)*numberOfResults>=knownFactsCount,onClick:()=>{let from=(pageIndex/numberOfResults+1)*numberOfResults;setPageIndex(from),fetchKnownFacts(void 0,from,numberOfResults)}})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Select__WEBPACK_IMPORTED_MODULE_9__.Z,{options:[{label:`25 / ${t("page")||"page"}`,value:25},{label:`50 / ${t("page")||"page"}`,value:50},{label:`100 / ${t("page")||"page"}`,value:100}],value:numberOfResults,displayValue:`${numberOfResults} / ${t("page")||"page"}`,onChange:value=>{setNumberOfResults(value),setPageIndex(0),fetchKnownFacts(void 0,0,value)}})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("table",{className:"memori--table",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("thead",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("tr",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("th",{className:"memori--table--column-centered",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Checkbox__WEBPACK_IMPORTED_MODULE_8__.Z,{checked:!!knownFacts?.length&&selectedRowKeys?.length===knownFacts.length,indeterminate:!!knownFacts?.length&&!!selectedRowKeys?.length&&selectedRowKeys?.length!==knownFacts?.length,onChange:e=>{e.target.checked?setSelectedRowKeys(knownFacts.map((kf=>kf.knownFactID))):setSelectedRowKeys([])}})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("th",{children:t("knownFacts.text")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("th",{className:"mobile-hidden",children:t("createdAt")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("th",{className:"memori--table--column-right",children:t("actions")})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("tbody",{children:knownFacts.map((kf=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("tr",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("th",{className:"memori--table--column-centered",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Checkbox__WEBPACK_IMPORTED_MODULE_8__.Z,{checked:selectedRowKeys?.includes(kf.knownFactID),onChange:e=>{e.target.checked?setSelectedRowKeys((srk=>[...new Set([...srk,kf.knownFactID])])):setSelectedRowKeys((srk=>srk.filter((key=>key!==kf.knownFactID))))}})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("td",{children:kf.text}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("td",{className:"mobile-hidden",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("span",{className:"memori--table--date",children:kf.creationTimestamp?new Intl.DateTimeFormat("it",{dateStyle:"short",timeStyle:"short"}).format(new Date(kf.creationTimestamp)):"-"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("td",{className:"memori--table--column-right",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("div",{className:"memori--table--action-column",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{danger:!0,ghost:!0,shape:"circle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_icons_Delete__WEBPACK_IMPORTED_MODULE_7__.default,{}),disabled:selectedRowKeys?.length>0,title:t("delete")||"Delete",onClick:()=>setDeleteModalVisibleFor(kf.knownFactID)}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_4__.Z,{className:"memori-known-facts-modal",open:deleteModalVisibleFor===kf.knownFactID,closable:!0,title:t("knownFacts.deleteConfirmTitle"),description:t("knownFacts.deleteConfirmMessage"),onClose:()=>{setDeleteModalVisibleFor(void 0)},footer:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{ghost:!0,onClick:()=>{setDeleteModalVisibleFor(void 0)},children:t("cancel")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:!0,danger:!0,onClick:async()=>{try{const response=await deleteKnownFact(sessionID,kf.knownFactID);0===response.resultCode?(react_hot_toast__WEBPACK_IMPORTED_MODULE_5__.ZP.success(t("knownFacts.deleteSuccess")),setSelectedRowKeys([]),fetchKnownFacts(),setDeleteModalVisibleFor(void 0)):(console.error(response),react_hot_toast__WEBPACK_IMPORTED_MODULE_5__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_6__.r)(response.resultCode),{ns:"common"})))}catch(_e){let error=_e;react_hot_toast__WEBPACK_IMPORTED_MODULE_5__.ZP.error(t("Error")+error.message)}},children:t("confirm")})]})})]})})]},kf.knownFactID)))})]})]})]})};KnownFacts.displayName="KnownFacts";const __WEBPACK_DEFAULT_EXPORT__=KnownFacts;try{KnownFacts.displayName="KnownFacts",KnownFacts.__docgenInfo={description:"",displayName:"KnownFacts",props:{apiClient:{defaultValue:null,description:"",name:"apiClient",required:!0,type:{name:'{ constants: { BACKEND_URL: string; ENGINE_URL: string; allowedMediaTypes: string[]; anonTag: "👤"; }; asset: { getResourceUrl: ({ type, resourceURI, sessionID, baseURL, }: ResourceURLParams) => string; }; getAllFunctions: (sessionId: string) => Promise<...>; ... 125 more ...; backend: { ...; }; }'}},sessionID:{defaultValue:null,description:"",name:"sessionID",required:!0,type:{name:"string"}},memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},initialKnownFacts:{defaultValue:{value:"[]"},description:"",name:"initialKnownFacts",required:!1,type:{name:"KnownFact[]"}},visible:{defaultValue:{value:"true"},description:"",name:"visible",required:!1,type:{name:"boolean"}},closeDrawer:{defaultValue:null,description:"",name:"closeDrawer",required:!0,type:{name:"() => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/KnownFacts/KnownFacts.tsx#KnownFacts"]={docgenInfo:KnownFacts.__docgenInfo,name:"KnownFacts",path:"src/components/KnownFacts/KnownFacts.tsx#KnownFacts"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/MemoriWidget/MemoriWidget.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>MemoriWidget_MemoriWidget});var react=__webpack_require__("./node_modules/react/index.js"),useTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),esm=__webpack_require__("./node_modules/@memori.ai/memori-api-client/esm/index.js"),es2019_module=__webpack_require__("./node_modules/standardized-audio-context/build/es2019/module.js"),microsoft_cognitiveservices_speech_sdk=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/microsoft.cognitiveservices.speech.sdk.js"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),luxon=__webpack_require__("./node_modules/luxon/src/luxon.js"),dist=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),PositionDrawer=__webpack_require__("./src/components/PositionDrawer/PositionDrawer.tsx"),Auth=__webpack_require__("./src/components/Auth/Auth.tsx"),Chat_Chat=__webpack_require__("./src/components/Chat/Chat.tsx"),StartPanel=__webpack_require__("./src/components/StartPanel/StartPanel.tsx"),Avatar=__webpack_require__("./src/components/Avatar/Avatar.tsx"),ChangeMode=__webpack_require__("./src/components/ChangeMode/ChangeMode.tsx"),Header=__webpack_require__("./src/components/Header/Header.tsx"),PoweredBy=__webpack_require__("./src/components/PoweredBy/PoweredBy.tsx"),AgeVerificationModal=__webpack_require__("./src/components/AgeVerificationModal/AgeVerificationModal.tsx"),SettingsDrawer=__webpack_require__("./src/components/SettingsDrawer/SettingsDrawer.tsx"),KnownFacts=__webpack_require__("./src/components/KnownFacts/KnownFacts.tsx"),ExpertsDrawer=__webpack_require__("./src/components/ExpertsDrawer/ExpertsDrawer.tsx"),LoginDrawer=__webpack_require__("./src/components/LoginDrawer/LoginDrawer.tsx"),Spin=__webpack_require__("./src/components/ui/Spin.tsx"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const layouts_FullPage=({Header,headerProps,Avatar,avatarProps,Chat,chatProps,StartPanel,startPanelProps,integrationStyle,integrationBackground,ChangeMode,changeModeProps,sessionId,hasUserActivatedSpeak,showInstruct=!1,loading=!1,poweredBy})=>(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[integrationStyle,integrationBackground,(0,jsx_runtime.jsxs)(Spin.Z,{spinning:loading,children:[showInstruct&&ChangeMode&&changeModeProps&&(0,jsx_runtime.jsx)(ChangeMode,{...changeModeProps}),Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{...headerProps}),(0,jsx_runtime.jsxs)("div",{className:"memori--grid",children:[(0,jsx_runtime.jsxs)("div",{className:"memori--grid-column memori--grid-column-left",children:[Avatar&&avatarProps&&(0,jsx_runtime.jsx)(Avatar,{...avatarProps}),(0,jsx_runtime.jsx)("div",{id:"extension"})]}),(0,jsx_runtime.jsx)("div",{className:"memori--grid-column memori--grid-column-right",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):startPanelProps?(0,jsx_runtime.jsx)(StartPanel,{...startPanelProps}):null}),poweredBy]})]})]});try{FullPage.displayName="FullPage",FullPage.__docgenInfo={description:"",displayName:"FullPage",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/FullPage.tsx#FullPage"]={docgenInfo:FullPage.__docgenInfo,name:"FullPage",path:"src/components/layouts/FullPage.tsx#FullPage"})}catch(__react_docgen_typescript_loader_error){}const layouts_Totem=({Header,headerProps,Avatar,avatarProps,Chat,chatProps,StartPanel,startPanelProps,integrationStyle,integrationBackground,ChangeMode,changeModeProps,sessionId,hasUserActivatedSpeak,showInstruct=!1,loading=!1,poweredBy})=>(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[integrationStyle,integrationBackground,(0,jsx_runtime.jsxs)(Spin.Z,{spinning:loading,className:"memori-totem-layout",children:[poweredBy,showInstruct&&ChangeMode&&changeModeProps&&(0,jsx_runtime.jsx)(ChangeMode,{...changeModeProps}),(0,jsx_runtime.jsx)("div",{className:"memori-totem-layout--header",children:Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{...headerProps})}),(0,jsx_runtime.jsx)("div",{className:"memori-totem-layout--avatar",children:Avatar&&avatarProps&&(0,jsx_runtime.jsx)(Avatar,{...avatarProps,isTotem:!0})}),(0,jsx_runtime.jsx)("div",{id:"extension"}),(0,jsx_runtime.jsx)("div",{className:"memori-totem-layout--controls",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):startPanelProps?(0,jsx_runtime.jsx)(StartPanel,{...startPanelProps}):null})]})]});try{Totem.displayName="Totem",Totem.__docgenInfo={description:"",displayName:"Totem",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/Totem.tsx#Totem"]={docgenInfo:Totem.__docgenInfo,name:"Totem",path:"src/components/layouts/Totem.tsx#Totem"})}catch(__react_docgen_typescript_loader_error){}const layouts_Chat=({Header,headerProps,Chat,chatProps,StartPanel,startPanelProps,integrationStyle,integrationBackground,ChangeMode,changeModeProps,sessionId,hasUserActivatedSpeak,showInstruct=!1,loading=!1,poweredBy})=>(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[integrationStyle,integrationBackground,(0,jsx_runtime.jsxs)(Spin.Z,{spinning:loading,className:"memori-chat-layout",children:[poweredBy,showInstruct&&ChangeMode&&changeModeProps&&(0,jsx_runtime.jsx)(ChangeMode,{...changeModeProps}),(0,jsx_runtime.jsx)("div",{className:"memori-chat-layout--header",children:Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{...headerProps})}),(0,jsx_runtime.jsx)("div",{id:"extension"}),(0,jsx_runtime.jsx)("div",{className:"memori-chat-layout--controls",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):startPanelProps?(0,jsx_runtime.jsx)(StartPanel,{...startPanelProps}):null})]})]});try{Chat.displayName="Chat",Chat.__docgenInfo={description:"",displayName:"Chat",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/Chat.tsx#Chat"]={docgenInfo:Chat.__docgenInfo,name:"Chat",path:"src/components/layouts/Chat.tsx#Chat"})}catch(__react_docgen_typescript_loader_error){}var Button=__webpack_require__("./src/components/ui/Button.tsx"),Blob=__webpack_require__("./src/components/Blob/Blob.tsx"),Close=__webpack_require__("./src/components/icons/Close.tsx");const WebsiteAssistantLayout=({Header,headerProps,Avatar,avatarProps,Chat,chatProps,StartPanel,startPanelProps,integrationStyle,ChangeMode,changeModeProps,sessionId,hasUserActivatedSpeak,showInstruct=!1,loading=!1,poweredBy})=>{const{t}=(0,useTranslation.$)(),[collapsed,_setCollapsed]=(0,react.useState)(!0),[expandedKey,setExpandedKey]=(0,react.useState)(),stopAudio=(0,react.useMemo)((()=>chatProps?.stopAudio),[chatProps?.stopAudio]),setCollapsed=collapsed=>{_setCollapsed(collapsed),setExpandedKey(collapsed?void 0:(new Date).toISOString());try{stopAudio?.()}catch(e){console.log(e)}};return(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant--"+(collapsed?"collapsed":"expanded"),children:collapsed?(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant--trigger",children:(0,jsx_runtime.jsx)(Button.Z,{className:"memori-website_assistant--trigger-button",ghost:!0,shape:"circle",onClick:()=>setCollapsed(!1),title:t("expand")||"Expand",children:(0,jsx_runtime.jsx)(Blob.Z,{avatar:avatarProps?.memori.avatarURL})})}):(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[integrationStyle,(0,jsx_runtime.jsxs)(Spin.Z,{spinning:loading,className:"memori-website_assistant-layout",children:[poweredBy,(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant--close-button-wrapper",children:(0,jsx_runtime.jsx)(Button.Z,{className:"memori-website_assistant--close-button",primary:!0,shape:"circle",onClick:()=>setCollapsed(!0),icon:(0,jsx_runtime.jsx)(Close.default,{}),title:t("close")||"Close"})}),showInstruct&&ChangeMode&&changeModeProps&&(0,jsx_runtime.jsx)(ChangeMode,{...changeModeProps}),(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant-layout--header",children:Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{...headerProps,showSettings:!1,showReload:!1})}),(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant-layout--avatar",children:Avatar&&avatarProps&&(0,react.createElement)(Avatar,{...avatarProps,integrationConfig:avatarProps.integrationConfig?{...avatarProps.integrationConfig,avatarURL:avatarProps.integrationConfig?.avatarURL?`${avatarProps.integrationConfig?.avatarURL.split("#")[0]}#${expandedKey}`:void 0}:{},key:expandedKey})}),(0,jsx_runtime.jsx)("div",{id:"extension"}),(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant-layout--controls",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):startPanelProps?(0,jsx_runtime.jsx)(StartPanel,{...startPanelProps}):null})]})]})})};WebsiteAssistantLayout.displayName="WebsiteAssistantLayout";const layouts_WebsiteAssistant=WebsiteAssistantLayout;try{WebsiteAssistant.displayName="WebsiteAssistant",WebsiteAssistant.__docgenInfo={description:"",displayName:"WebsiteAssistant",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/WebsiteAssistant.tsx#WebsiteAssistant"]={docgenInfo:WebsiteAssistant.__docgenInfo,name:"WebsiteAssistant",path:"src/components/layouts/WebsiteAssistant.tsx#WebsiteAssistant"})}catch(__react_docgen_typescript_loader_error){}var translations=__webpack_require__("./src/helpers/translations.ts"),configuration=__webpack_require__("./src/helpers/configuration.ts"),utils=__webpack_require__("./src/helpers/utils.ts"),constants=__webpack_require__("./src/helpers/constants.ts"),error=__webpack_require__("./src/helpers/error.ts");var QuestionHelp=__webpack_require__("./src/components/icons/QuestionHelp.tsx");const layouts_HiddenChat=({Header,headerProps,Chat,chatProps,startPanelProps,sessionId,hasUserActivatedSpeak})=>{const{t}=(0,useTranslation.$)(),[isOpen,setIsOpen]=(0,react.useState)(!1);(0,react.useEffect)((()=>{const mainDiv=document.body;mainDiv&&(isOpen?(mainDiv.style.width="calc(100% - 350px)",mainDiv.style.marginRight="300px",mainDiv.style.transition="all 0.5s"):(mainDiv.style.width="100%",mainDiv.style.marginLeft="0"))}),[isOpen]);return(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)("input",{type:"checkbox",id:"memori-sidebar-toggle",className:"memori-sidebar-toggle",checked:isOpen,onChange:()=>{setIsOpen(!isOpen),(()=>{try{window.speechSynthesis.speak(new SpeechSynthesisUtterance(""))}catch(e){console.error(e)}startPanelProps&&startPanelProps?.initializeTTS&&startPanelProps?.initializeTTS(),startPanelProps&&startPanelProps?.onClickStart&&startPanelProps?.onClickStart()})()}}),(0,jsx_runtime.jsxs)("div",{className:"memori-sidebar-container",children:[(0,jsx_runtime.jsx)("label",{htmlFor:"memori-sidebar-toggle",className:"memori-sidebar-toggle-label memori-open-label",children:(0,jsx_runtime.jsx)(QuestionHelp.default,{className:"memori-icon","aria-label":t("expand")})}),(0,jsx_runtime.jsxs)("aside",{className:"memori-sidebar",children:[(0,jsx_runtime.jsx)("label",{htmlFor:"memori-sidebar-toggle",className:"memori-sidebar-toggle-label memori-close-label",children:(0,jsx_runtime.jsx)("span",{children:(0,jsx_runtime.jsx)(Close.default,{className:"memori-icon-close","aria-label":t("collapse")})})}),(0,jsx_runtime.jsx)("div",{className:"memori-sidebar-content",children:(0,jsx_runtime.jsx)("div",{className:"memori-hidden-chat-layout--header",children:Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{position:{latitude:0,longitude:0,placeName:""},...headerProps,className:"memori-hidden-chat-layout-header--layout"})})}),(0,jsx_runtime.jsx)("div",{id:"extension"}),(0,jsx_runtime.jsx)("div",{className:"memori-hidden-chat-layout--controls",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):(0,jsx_runtime.jsx)("div",{className:"memori-loading",children:(0,jsx_runtime.jsx)(Spin.Z,{})})})]})]})]})};try{HiddenChat.displayName="HiddenChat",HiddenChat.__docgenInfo={description:"",displayName:"HiddenChat",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:null,description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:null,description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/HiddenChat.tsx#HiddenChat"]={docgenInfo:HiddenChat.__docgenInfo,name:"HiddenChat",path:"src/components/layouts/HiddenChat.tsx#HiddenChat"})}catch(__react_docgen_typescript_loader_error){}const layouts_ZoomedFullBody=({Header,headerProps,Avatar,avatarProps,Chat,chatProps,StartPanel,startPanelProps,integrationStyle,integrationBackground,ChangeMode,changeModeProps,sessionId,hasUserActivatedSpeak,showInstruct=!1,loading=!1,poweredBy})=>((0,react.useEffect)((()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow=""})),[]),(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[integrationStyle,integrationBackground,(0,jsx_runtime.jsxs)(Spin.Z,{className:"memori-spin--zoomed-full-body",spinning:loading,children:[showInstruct&&ChangeMode&&changeModeProps&&(0,jsx_runtime.jsx)(ChangeMode,{...changeModeProps}),Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{...headerProps}),(0,jsx_runtime.jsxs)("div",{className:"memori--grid",children:[(0,jsx_runtime.jsxs)("div",{className:"memori--grid-column memori--grid-column-left",children:[Avatar&&avatarProps&&(0,jsx_runtime.jsx)(Avatar,{chatProps,isZoomed:!0,...avatarProps}),(0,jsx_runtime.jsx)("div",{id:"extension"})]}),(0,jsx_runtime.jsx)("div",{className:"memori--grid-column memori--grid-column--zoomed-full-body memori--grid-column-right",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):startPanelProps?(0,jsx_runtime.jsx)(StartPanel,{...startPanelProps}):null}),(0,jsx_runtime.jsx)("div",{className:"memori--powered-by-custom",children:poweredBy})]})]})]}));try{ZoomedFullBody.displayName="ZoomedFullBody",ZoomedFullBody.__docgenInfo={description:"",displayName:"ZoomedFullBody",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/ZoomedFullBody.tsx#ZoomedFullBody"]={docgenInfo:ZoomedFullBody.__docgenInfo,name:"ZoomedFullBody",path:"src/components/layouts/ZoomedFullBody.tsx#ZoomedFullBody"})}catch(__react_docgen_typescript_loader_error){}var visemeContext=__webpack_require__("./src/context/visemeContext.tsx");const typeMessage=(message,waitForPrevious=!0,hidden=!1,typingText,useLoaderTextAsMsg=!1,hasBatchQueued=!1)=>{const e=new CustomEvent("MemoriTextEntered",{detail:{text:message,waitForPrevious,hidden,typingText,useLoaderTextAsMsg,hasBatchQueued}});document.dispatchEvent(e);window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&setTimeout((()=>{document.dispatchEvent(new CustomEvent("MemoriEndSpeak"))}),300)};let recognizer,speechConfig,speechSynthesizer,audioDestination,audioContext,memoriPassword;window.getMemoriState=integrationId=>{let widget=integrationId?document.querySelector(`.memori-widget[data-memori-integration="${integrationId}"]`)||document.querySelector("memori-client")?.shadowRoot?.querySelector(".memori-widget[data-memori-integration]"):document.querySelector(".memori-widget")||document.querySelector("memori-client")?.shadowRoot?.querySelector(".memori-widget");if(!widget)return null;let engineState=widget.dataset?.memoriEngineState;return engineState?JSON.parse(engineState):null},window.typeMessage=typeMessage,window.typeMessageHidden=(message,waitForPrevious=!0,typingText,useLoaderTextAsMsg=!1,hasBatchQueued=!1)=>typeMessage(message,waitForPrevious,!0,typingText,useLoaderTextAsMsg,hasBatchQueued),window.typeBatchMessages=messages=>{function disableInputs(){document.querySelector("fieldset#chat-fieldset")?.setAttribute("disabled","");const styles="opacity: 0.5; touch-action: none; pointer-events: none;";document.querySelector("textarea.memori-chat-textarea--input")?.setAttribute("style",styles),document.querySelector("button.memori-chat-inputs--send")?.setAttribute("style",styles),document.querySelector("button.memori-chat-inputs--mic")?.setAttribute("style",styles)}function reEnableInputs(){document.querySelector("fieldset#chat-fieldset")?.removeAttribute("disabled"),document.querySelector("textarea.memori-chat-textarea--input")?.removeAttribute("style"),document.querySelector("button.memori-chat-inputs--send")?.removeAttribute("style"),document.querySelector("button.memori-chat-inputs--mic")?.removeAttribute("style")}function areInputsDisabled(){return!!document.querySelector("fieldset#chat-fieldset")?.hasAttribute("disabled")}const isSafariIOS=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")&&/iPad|iPhone|iPod/.test(navigator.userAgent),stepsGenerator=function*(){yield*messages}();disableInputs();const submitNewMessage=()=>{const next=stepsGenerator.next(),step=next.value;if(step){areInputsDisabled()||disableInputs();let waitForPrevious=step.waitForPrevious;isSafariIOS&&(waitForPrevious=!1),typeMessage(step.message,waitForPrevious,step.hidden,step.typingText,step.useLoaderTextAsMsg,!next.done),isSafariIOS&&setTimeout((()=>{document.dispatchEvent(new CustomEvent("MemoriEndSpeak")),reEnableInputs()}),3e3)}else areInputsDisabled()&&reEnableInputs();if(next.done)return document.removeEventListener("MemoriEndSpeak",submitNewMessage),void(areInputsDisabled()&&reEnableInputs())};document.addEventListener("MemoriEndSpeak",submitNewMessage),submitNewMessage()};let userToken,speakerMuted=!1,memoriSpeaking=!1;const MemoriWidget=({memori,memoriConfigs,ownerUserID,ownerUserName,tenantID,memoriLang,multilingual,integration,layout="DEFAULT",customLayout,showInstruct=!1,showShare,preview=!1,embed=!1,showCopyButton=!0,showTranslationOriginal=!1,showInputs=!0,showDates=!1,showContextPerLine=!1,showSettings=!0,showTypingText=!1,showClear=!1,showLogin=!1,showOnlyLastMessages,height="100vh",secret,baseUrl="https://aisuru.com",apiURL="https://backend.memori.ai",engineURL="https://engine.memori.ai",initialContextVars,initialQuestion,ogImage,sessionID:initialSessionID,tenant,personification,authToken,AZURE_COGNITIVE_SERVICES_TTS_KEY,enableAudio,defaultSpeakerActive=!0,disableTextEnteredEvents=!1,onStateChange,additionalInfo,additionalSettings,customMediaRenderer,userAvatar})=>{const{t,i18n}=(0,useTranslation.$)(),[isClient,setIsClient]=(0,react.useState)(!1);(0,react.useEffect)((()=>{setIsClient(!0)}),[]);const client=(0,esm.Z)(apiURL,engineURL),{initSession,postTextEnteredEvent,postPlaceChangedEvent,postDateChangedEvent,postTimeoutEvent,postTagChangedEvent,getSession,getExpertReferences,getSessionChatLogs}=client,[instruct,setInstruct]=(0,react.useState)(!1),[enableFocusChatInput,setEnableFocusChatInput]=(0,react.useState)(!0),[loginToken,setLoginToken]=(0,react.useState)(additionalInfo?.loginToken??authToken),[user,setUser]=(0,react.useState)({avatarURL:"string"==typeof userAvatar?userAvatar:void 0});(0,react.useEffect)((()=>{loginToken&&!user?.userID&&showLogin&&client.backend.getCurrentUser(loginToken).then((({user,resultCode})=>{user&&0===resultCode?(setUser(user),(0,configuration.A2)("loginToken",loginToken),user.birthDate&&(setBirthDate(user.birthDate),(0,configuration.A2)("birthDate",user.birthDate))):(0,configuration.gj)("loginToken")}))}),[loginToken,user?.userID]);const[showLoginDrawer,setShowLoginDrawer]=(0,react.useState)(!1),[clickedStart,setClickedStart]=(0,react.useState)(!1),[gotErrorInOpening,setGotErrorInOpening]=(0,react.useState)(!1),language=memori.culture?.split("-")?.[0]?.toUpperCase()||memoriConfigs?.find((c=>c.memoriConfigID===memori.memoriConfigurationID))?.culture?.split("-")?.[0]?.toUpperCase(),integrationConfig=integration?.customData?JSON.parse(integration.customData):null,isMultilanguageEnabled=void 0!==multilingual?multilingual:!!integrationConfig?.multilanguage,forcedTimeout=integrationConfig?.forcedTimeout,[userLang,setUserLang]=(0,react.useState)(memoriLang??integrationConfig?.lang??language??integrationConfig?.uiLang??i18n.language??"IT");(0,react.useEffect)((()=>{isMultilanguageEnabled&&userLang&&constants.vq.includes(userLang.toLowerCase())&&i18n.changeLanguage(userLang.toLowerCase())}),[userLang]);const[loading,setLoading]=(0,react.useState)(!1),[memoriTyping,setMemoriTyping]=(0,react.useState)(!1),[typingText,setTypingText]=(0,react.useState)(),selectedLayout=layout||integrationConfig?.layout||"DEFAULT",defaultEnableAudio=enableAudio??integrationConfig?.enableAudio??!1,[hasUserActivatedSpeak,setHasUserActivatedSpeak]=(0,react.useState)(!1),[hasUserActivatedListening,setHasUserActivatedListening]=(0,react.useState)(!1),[showPositionDrawer,setShowPositionDrawer]=(0,react.useState)(!1),[showSettingsDrawer,setShowSettingsDrawer]=(0,react.useState)(!1),[showKnownFactsDrawer,setShowKnownFactsDrawer]=(0,react.useState)(!1),[showExpertsDrawer,setShowExpertsDrawer]=(0,react.useState)(!1),[muteSpeaker,setMuteSpeaker]=(0,react.useState)(!defaultEnableAudio||!defaultSpeakerActive),[continuousSpeech,setContinuousSpeech]=(0,react.useState)(!1),[continuousSpeechTimeout,setContinuousSpeechTimeout]=(0,react.useState)(2),[isPlayingAudio,setIsPlayingAudio]=(0,react.useState)(!1),[controlsPosition,setControlsPosition]=(0,react.useState)("center"),[enablePositionControls,setEnablePositionControls]=(0,react.useState)(!1),[avatarType,setAvatarType]=(0,react.useState)(null),[hideEmissions,setHideEmissions]=(0,react.useState)(!1),{startProcessing,setAudioContext,addViseme,stopProcessing,resetVisemeQueue}=(0,visemeContext.LG)();(0,react.useEffect)((()=>{setIsPlayingAudio(!!speechSynthesizer),memoriSpeaking=!!speechSynthesizer}),[speechSynthesizer]),(0,react.useEffect)((()=>{let defaultControlsPosition="bottom",microphoneMode=(0,configuration.wm)("microphoneMode","HOLD_TO_TALK");window.innerWidth<=768?(defaultControlsPosition="bottom",microphoneMode="HOLD_TO_TALK"):defaultControlsPosition=window.matchMedia("(orientation: portrait)").matches||window.innerHeight>window.innerWidth?"center":"bottom",setMuteSpeaker((0,configuration.wm)("muteSpeaker",!defaultEnableAudio||!defaultSpeakerActive)),speakerMuted=(0,configuration.wm)("muteSpeaker",!defaultEnableAudio||!defaultSpeakerActive),setContinuousSpeech("CONTINUOUS"===microphoneMode),setContinuousSpeechTimeout((0,configuration.wm)("continuousSpeechTimeout",2)),setControlsPosition((0,configuration.wm)("controlsPosition",defaultControlsPosition)),setAvatarType((0,configuration.wm)("avatarType","avatar3d")),setHideEmissions((0,configuration.wm)("hideEmissions",!1)),additionalInfo?.loginToken||authToken||(setLoginToken((0,configuration.wm)("loginToken",void 0)),userToken=(0,configuration.wm)("loginToken",void 0),setBirthDate((0,configuration.wm)("birthDate",void 0)))}),[]);const[memoriPwd,setMemoriPwd]=(0,react.useState)(secret),[memoriTokens,setMemoriTokens]=(0,react.useState)(),[authModalState,setAuthModalState]=(0,react.useState)(null),[position,_setPosition]=(0,react.useState)(),applyPosition=async(venue,sessionID)=>{const session=sessionID??sessionId;if(venue&&session){const{currentState,...response}=await postPlaceChangedEvent({sessionId:session,placeName:venue.placeName,latitude:venue.latitude,longitude:venue.longitude,uncertaintyKm:venue.uncertainty??0});currentState&&0===response.resultCode&&_setCurrentDialogState((cds=>({...cds,...currentState,hints:currentState.hints?.length?currentState.hints:cds?.hints})))}};(0,react.useEffect)((()=>{const position=(0,configuration.wm)("position",void 0);position&&_setPosition(position)}),[]);const[userMessage,setUserMessage]=(0,react.useState)(""),[listening,setListening]=(0,react.useState)(!1),[history,setHistory]=(0,react.useState)([]),pushMessage=message=>{setHistory((history=>[...history,{...message,media:message.media?.filter((m=>!("text/javascript"===m.mimeType&&m.properties?.executable)))??[]}]))},sendMessage=async(text,media,newSessionId,translate=!0,translatedText,hidden=!1,typingText,useLoaderTextAsMsg=!1,hasBatchQueued=!1)=>{const sessionID=newSessionId||sessionId||window.getMemoriState()?.sessionID;if(!sessionID||!text?.length)return;hidden||pushMessage({text,translatedText,fromUser:!0,media:media??[],initial:sessionId?!!newSessionId&&newSessionId!==sessionId:!!newSessionId}),setMemoriTyping(!0),setTypingText(typingText);let msg=text,gotError=!1;try{if(!hidden&&translate&&!instruct&&isMultilanguageEnabled&&userLang.toUpperCase()!==language.toUpperCase()){msg=(await(0,translations.i)(text,language,userLang,baseUrl)).text}const{currentState,...response}=await postTextEnteredEvent({sessionId:sessionID,text:msg});if(0===response.resultCode&¤tState){const emission=useLoaderTextAsMsg&&typingText?typingText:currentState.emission??currentDialogState?.emission;if("X4"===currentState.state&&memori.giverTag){const{currentState,...resp}=await postTagChangedEvent(sessionID,memori.giverTag);0===resp.resultCode?(setCurrentDialogState(currentState),emission&&(pushMessage({text:emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,questionAnswered:msg,contextVars:currentState.contextVars,date:currentState.currentDate,placeName:currentState.currentPlaceName,placeLatitude:currentState.currentLatitude,placeLongitude:currentState.currentLongitude,placeUncertaintyKm:currentState.currentUncertaintyKm,tag:currentState.currentTag,memoryTags:currentState.memoryTags}),speak(emission))):(console.error(response,resp),dist.ZP.error(t((0,error.r)(resp.resultCode))),gotError=!0)}else if("X2d"===currentState.state&&memori.giverTag){const{currentState,...resp}=await postTextEnteredEvent({sessionId:sessionID,text:Math.random().toString().substring(2,8)});if(0===resp.resultCode){const{currentState,...resp}=await postTagChangedEvent(sessionID,memori.giverTag);0===resp.resultCode?(setCurrentDialogState(currentState),emission&&(pushMessage({text:emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,questionAnswered:msg,contextVars:currentState.contextVars,date:currentState.currentDate,placeName:currentState.currentPlaceName,placeLatitude:currentState.currentLatitude,placeLongitude:currentState.currentLongitude,placeUncertaintyKm:currentState.currentUncertaintyKm,tag:currentState.currentTag,memoryTags:currentState.memoryTags}),speak(emission))):(console.error(response,resp),dist.ZP.error(t((0,error.r)(resp.resultCode))),gotError=!0)}else console.error(response,resp),dist.ZP.error(t((0,error.r)(resp.resultCode))),gotError=!0}else userLang.toLowerCase()!==language.toLowerCase()&&emission&&!instruct&&isMultilanguageEnabled?translateDialogState(currentState,userLang,msg).then((ts=>{let text=ts.translatedEmission||ts.emission;text&&speak(text)})):(setCurrentDialogState({...currentState,emission}),emission&&(pushMessage({text:emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,questionAnswered:msg,generatedByAI:!!currentState.completion,contextVars:currentState.contextVars,date:currentState.currentDate,placeName:currentState.currentPlaceName,placeLatitude:currentState.currentLatitude,placeLongitude:currentState.currentLongitude,placeUncertaintyKm:currentState.currentUncertaintyKm,tag:currentState.currentTag,memoryTags:currentState.memoryTags}),speak(emission)))}else 404===response.resultCode&&(setHistory((h=>[...h.slice(0,h.length-1)])),reopenSession(!1,memoriPwd||memori.secretToken,memoriTokens,instruct&&memori.giverTag?memori.giverTag:void 0,instruct&&memori.giverPIN?memori.giverPIN:void 0,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion).then((state=>{console.info("session timeout"),state?.sessionID&&setTimeout((()=>{sendMessage(text,media,state?.sessionID)}),500)})))}catch(error){console.error(error),gotError=!0,setTypingText(void 0),setMemoriTyping(!1)}hasBatchQueued||(setTypingText(void 0),setMemoriTyping(!1))},translateDialogState=async(state,userLang,msg)=>{const emission=state.emission??currentDialogState?.emission;let translatedState={...state},translatedMsg=null;if(emission&&!instruct&&language.toUpperCase()!==userLang.toUpperCase()&&isMultilanguageEnabled)try{const t=await(0,translations.i)(emission,userLang,language,baseUrl);if(state.hints&&state.hints.length>0){const translatedHints=await Promise.all((state.hints??[]).map((async hint=>{const tHint=await(0,translations.i)(hint,userLang,language,baseUrl);return{text:tHint?.text??hint,originalText:hint}})));translatedState={...state,emission:t.text,translatedHints}}else translatedState={...state,emission,translatedEmission:t.text,hints:state.hints??("G1"===state.state?currentDialogState?.hints:[])};t.text.length>0&&(translatedMsg={text:emission,translatedText:t.text,emitter:state.emitter,media:state.media,fromUser:!1,questionAnswered:msg,generatedByAI:!!state.completion,contextVars:state.contextVars,date:state.currentDate,placeName:state.currentPlaceName,placeLatitude:state.currentLatitude,placeLongitude:state.currentLongitude,placeUncertaintyKm:state.currentUncertaintyKm,tag:state.currentTag,memoryTags:state.memoryTags})}catch(error){console.error(error),translatedState={...state,emission},translatedMsg={text:emission,emitter:state.emitter,media:state.media,fromUser:!1,questionAnswered:msg,contextVars:state.contextVars,date:state.currentDate,placeName:state.currentPlaceName,placeLatitude:state.currentLatitude,placeLongitude:state.currentLongitude,placeUncertaintyKm:state.currentUncertaintyKm,tag:state.currentTag,memoryTags:state.memoryTags}}else translatedState={...state,emission},emission&&(translatedMsg={text:emission,emitter:state.emitter,media:state.media,fromUser:!1,questionAnswered:msg,contextVars:state.contextVars,date:state.currentDate,placeName:state.currentPlaceName,placeLatitude:state.currentLatitude,placeLongitude:state.currentLongitude,placeUncertaintyKm:state.currentUncertaintyKm,tag:state.currentTag,memoryTags:state.memoryTags});return setCurrentDialogState(translatedState),translatedMsg&&pushMessage(translatedMsg),translatedState},minAge=void 0!==memori.ageRestriction?memori.ageRestriction:memori.nsfw?18:memori.enableCompletions?14:0,[birthDate,setBirthDate]=(0,react.useState)(),[showAgeVerification,setShowAgeVerification]=(0,react.useState)(!1),[sessionId,setSessionId]=(0,react.useState)(initialSessionID),[currentDialogState,_setCurrentDialogState]=(0,react.useState)(),setCurrentDialogState=state=>{_setCurrentDialogState(state),onStateChange&&onStateChange(state);const e=new CustomEvent("MemoriNewDialogState",{detail:state});document.dispatchEvent(e);const executableSnippets=state?.media?.filter((m=>"text/javascript"===m.mimeType&&!!m.properties?.executable));executableSnippets?.forEach((s=>{try{setTimeout((()=>{console.log("snippet",s),new Function(s.content??"")(),setTimeout((()=>{document.querySelector(".memori-chat--content")?.scrollTo(0,document.querySelector(".memori-chat--content")?.scrollHeight??0)}),400)}),1e3)}catch(e){console.warn(e)}}))},fetchSession=async params=>{if(birthDate||!minAge)if("PUBLIC"===memori.privacyType||memori.secretToken||memoriPwd||memoriTokens){setLoading(!0);try{if(!memori.giverTag&&memori.receivedInvitations?.length){let giverInvitation=memori.receivedInvitations.find((i=>"GIVER"===i.type&&"ACCEPTED"===i.state));giverInvitation&&(memori.giverTag=giverInvitation.tag,memori.giverPIN=giverInvitation.pin)}let referral;try{referral=window.location.href}catch(err){console.debug(err)}const session=await initSession({...params,tag:params.tag??personification?.tag,pin:params.pin??personification?.pin,additionalInfo:{...additionalInfo||{},loginToken:userToken??loginToken??additionalInfo?.loginToken??authToken,language:getCultureCodeByLanguage(userLang),referral,timeZoneOffset:(new Date).getTimezoneOffset().toString()}});if(session?.sessionID&&session?.currentState&&0===session.resultCode)return setSessionId(session.sessionID),position&&applyPosition(position,session.sessionID),setLoading(!1),{dialogState:session.currentState,sessionID:session.sessionID};session?.resultMessage.startsWith("This Memori is aged restricted")?(console.warn(session),dist.ZP.error(t("underageTwinSession",{age:minAge})),setGotErrorInOpening(!0)):403===session?.resultCode?(setMemoriPwd(void 0),setAuthModalState("password")):(console.warn(session),dist.ZP.error(t((0,error.r)(session?.resultCode))),setGotErrorInOpening(!0))}catch(err){throw console.error(err),dist.ZP.error(t("errorFetchingSession")),new Error("Error fetching session")}}else setAuthModalState("password");else setShowAgeVerification(!0)},reopenSession=async(updateDialogState=!1,password,recoveryTokens,tag,pin,initialContextVars,initialQuestion,birthDate)=>{setLoading(!0);try{if(!birthDate&&minAge)return void setShowAgeVerification(!0);if(!("PUBLIC"===memori.privacyType||password||memori.secretToken||memoriPwd||recoveryTokens||memoriTokens))return void setAuthModalState("password");let referral;try{referral=window.location.href}catch(err){throw console.debug(err),dist.ZP.error(t("errorGettingReferralURL")),new Error("Error getting referral URL")}const{sessionID,currentState,...response}=await initSession({memoriID:memori.engineMemoriID??"",password:password||memoriPwd||memori.secretToken,recoveryTokens:recoveryTokens||memoriTokens,tag,pin,initialContextVars:{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birthDate:birthDate||void 0,additionalInfo:{...additionalInfo||{},loginToken:userToken??loginToken??additionalInfo?.loginToken??authToken,language:getCultureCodeByLanguage(userLang),referral,timeZoneOffset:(new Date).getTimezoneOffset().toString()}});if(sessionID&¤tState&&0===response.resultCode)return setSessionId(sessionID),updateDialogState&&(setCurrentDialogState(currentState),currentState.emission&&(history.length<=1?setHistory([{text:currentState.emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,initial:!0,contextVars:currentState.contextVars,date:currentState.currentDate,placeName:currentState.currentPlaceName,placeLatitude:currentState.currentLatitude,placeLongitude:currentState.currentLongitude,placeUncertaintyKm:currentState.currentUncertaintyKm,tag:currentState.currentTag,memoryTags:currentState.memoryTags}]):pushMessage({text:currentState.emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,initial:!0,contextVars:currentState.contextVars,date:currentState.currentDate,placeName:currentState.currentPlaceName,placeLatitude:currentState.currentLatitude,placeLongitude:currentState.currentLongitude,placeUncertaintyKm:currentState.currentUncertaintyKm,tag:currentState.currentTag,memoryTags:currentState.memoryTags}))),position&&applyPosition(position,sessionID),memori.needsDateTime&&sendDateChangedEvent({sessionID,state:currentState}),setLoading(!1),{dialogState:currentState,sessionID};response?.resultMessage.startsWith("This Memori is aged restricted")?(console.error(response),dist.ZP.error(t("underageTwinSession",{age:minAge})),setGotErrorInOpening(!0)):403===response?.resultCode?(setMemoriPwd(void 0),setAuthModalState("password")):(console.error(response),dist.ZP.error(t((0,error.r)(response.resultCode))),setGotErrorInOpening(!0))}catch(err){throw console.error(err),dist.ZP.error(t("errorReopeningSession")),new Error("Error reopening session")}return setLoading(!1),null},changeTag=async(memoriId,sessionId,tag,pin)=>{if(!memoriId||!sessionId)return console.error("CHANGETAG/Session not found"),Promise.reject("Session not found");try{const{currentState,resultCode}=await postTagChangedEvent(sessionId,tag??constants.QV);if(0===resultCode){let textResult=0;if(tag!==constants.QV&&pin&&("X1a"===currentState.state||"X1b"===currentState.state)){const{resultCode:textResultCode}=await postTextEnteredEvent({sessionId,text:pin??""});textResult=textResultCode}if(0===textResult){const{currentState,...response}=await getSession(sessionId);if(0===response.resultCode&¤tState)return{currentState,sessionId,...response}}else if([400,401,403,404,500].includes(resultCode)){console.warn("[APPCONTEXT/CHANGETAG]",resultCode);let referral,storageBirthDate=(0,configuration.wm)("birthDate",void 0);try{referral=window.location.href}catch(err){console.debug(err)}fetchSession({memoriID:memori.engineMemoriID??"",password:secret||memoriPwd||memori.secretToken,tag:memori.giverTag,pin:memori.giverPIN,initialContextVars:{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birthDate:birthDate||storageBirthDate||void 0,additionalInfo:{...additionalInfo||{},loginToken:userToken??loginToken??additionalInfo?.loginToken??authToken,language:getCultureCodeByLanguage(userLang),referral,timeZoneOffset:(new Date).getTimezoneOffset().toString()}})}else if(currentState)return{currentState,sessionId,resultCode}}}catch(_e){let err=_e;return console.warn("[APPCONTEXT/CHANGETAG]",err),Promise.reject(err)}return null};(0,react.useEffect)((()=>()=>{currentDialogState&¤tDialogState?.currentTag===memori.giverTag||(async()=>{sessionId&&memori.giverTag&&memori.giverPIN&&(setHistory([]),await changeTag(memori.engineMemoriID,sessionId,memori.giverTag,memori.giverPIN))})()}),[]);const sendDateChangedEvent=(0,react.useCallback)((async({sessionID,date,state})=>{const session=sessionID??sessionId,dialogState=state??currentDialogState;if(!session||!memori.needsDateTime||dialogState?.hints?.length)return;const now=(date?luxon.ou.fromISO(date):luxon.ou.now()).toUTC().toFormat("yyyy/MM/dd HH:mm:ss ZZ").split(":").slice(0,-1).join(":"),{currentState,...response}=await postDateChangedEvent(session,now);0===response.resultCode&¤tState&&_setCurrentDialogState((cds=>({...cds,...currentState,hints:currentState.hints?.length?currentState.hints:cds?.hints})))}),[currentDialogState,memori.needsDateTime,sessionId]);(0,react.useEffect)((()=>{if(sessionId&&memori.needsDateTime){sendDateChangedEvent({sessionID:sessionId,state:currentDialogState});let datePolling=setInterval((()=>{sendDateChangedEvent({sessionID:sessionId})}),6e4);return()=>{clearInterval(datePolling)}}}),[memori.needsDateTime,sessionId]);const[userInteractionTimeout,setUserInteractionTimeout]=(0,react.useState)(),timeoutRef=(0,react.useRef)(),clearInteractionTimeout=()=>{userInteractionTimeout&&(clearTimeout(userInteractionTimeout),setUserInteractionTimeout(void 0)),timeoutRef?.current&&(clearTimeout(timeoutRef.current),timeoutRef.current=void 0)},resetInteractionTimeout=()=>{clearInteractionTimeout(),isPlayingAudio||userMessage.length||memoriTyping||listening||setInteractionTimeout()},handleTimeout=async()=>{if(!hasUserActivatedSpeak||isPlayingAudio||userMessage.length||memoriTyping||listening)resetInteractionTimeout();else if(sessionId&&hasUserActivatedSpeak&¤tDialogState?.acceptsTimeout){const{currentState,...response}=await postTimeoutEvent(sessionId);if(0===response.resultCode&¤tState){const emission=currentState.emission;if(!instruct&&isMultilanguageEnabled&&userLang!==i18n?.language&&emission&&emission.length>0)translateDialogState({...currentState,emission},userLang).then((ts=>{let text=ts.translatedEmission||ts.emission;text&&speak(text)}));else{if(!(emission&&emission.length>0))return void resetInteractionTimeout();pushMessage({text:emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,generatedByAI:!!currentState.completion,contextVars:currentState.contextVars,date:currentState.currentDate,placeName:currentState.currentPlaceName,placeLatitude:currentState.currentLatitude,placeLongitude:currentState.currentLongitude,placeUncertaintyKm:currentState.currentUncertaintyKm,tag:currentState.currentTag,memoryTags:currentState.memoryTags}),speak(emission),setCurrentDialogState({...currentState,hints:currentState.hints??("G1"===currentState.state?currentDialogState?.hints:[])})}}}},setInteractionTimeout=()=>{let timeout=currentDialogState?.timeout;if(!timeout){let timeoutLimit=40,timeoutMinLimit=25;if(timeout=Math.floor(Math.random()*(timeoutLimit-timeoutMinLimit))+timeoutMinLimit,currentDialogState?.emission){timeout+=currentDialogState.emission.length/26.5}}if(forcedTimeout&&(timeout=forcedTimeout,currentDialogState?.emission)){timeout+=currentDialogState.emission.length/26.5}let uiTimeout=setTimeout(handleTimeout,1e3*timeout);setUserInteractionTimeout(uiTimeout),timeoutRef.current=uiTimeout};(0,react.useEffect)((()=>{(userMessage.length||isPlayingAudio||memoriTyping)&&clearInteractionTimeout(),sessionId&&!userMessage.length&&resetInteractionTimeout()}),[currentDialogState?.acceptsTimeout,currentDialogState?.timeout,currentDialogState?.state,isPlayingAudio,sessionId,history,userMessage,memoriTyping,hasUserActivatedSpeak]),(0,react.useEffect)((()=>()=>{setHasUserActivatedSpeak(!1),setClickedStart(!1),clearInteractionTimeout(),timeoutRef.current=void 0}),[]);const getTTSVoice=(0,react.useCallback)((lang=>{let voice="",voiceLang=(lang??memori.culture?.split("-")?.[0]??i18n.language??"IT").toUpperCase(),voiceType=memori.voiceType;if(memori.enableBoardOfExperts&¤tDialogState?.emitter){experts?.find((e=>e.name===currentDialogState?.emitter))}switch(voiceLang){case"IT":voice=""+("MALE"===voiceType?"it-IT-DiegoNeural":"it-IT-ElsaNeural");break;case"DE":voice=""+("MALE"===voiceType?"de-DE-ConradNeural":"de-DE-KatjaNeural");break;case"EN":voice=""+("MALE"===voiceType?"en-GB-RyanNeural":"en-GB-SoniaNeural");break;case"ES":voice=""+("MALE"===voiceType?"es-ES-AlvaroNeural":"es-ES-ElviraNeural");break;case"FR":voice=""+("MALE"===voiceType?"fr-FR-HenriNeural":"fr-FR-DeniseNeural");break;case"PT":voice=""+("MALE"===voiceType?"pt-PT-DuarteNeural":"pt-PT-RaquelNeural");break;case"UK":voice=""+("MALE"===voiceType?"uk-UA-OstapNeural":"uk-UA-PolinaNeural");break;case"RU":voice=""+("MALE"===voiceType?"ru-RU-DmitryNeural":"ru-RU-SvetlanaNeural");break;case"PL":voice=""+("MALE"===voiceType?"pl-PL-MarekNeural":"pl-PL-AgnieszkaNeural");break;case"FI":voice=""+("MALE"===voiceType?"fi-FI-HarriNeural":"fi-FI-SelmaNeural");break;case"EL":voice=""+("MALE"===voiceType?"el-GR-NestorasNeural":"el-GR-AthinaNeural");break;case"AR":voice=""+("MALE"===voiceType?"ar-SA-HamedNeural":"ar-SA-ZariyahNeural");break;case"ZH":voice=""+("MALE"===voiceType?"zh-CN-YunxiNeural":"zh-CN-XiaoxiaoNeural");break;case"JA":voice=""+("MALE"===voiceType?"ja-JP-KeitaNeural":"ja-JP-NanamiNeural");break;default:voice=""+("MALE"===voiceType?"it-IT-DiegoNeural":"it-IT-IsabellaNeural")}return voice}),[memori.voiceType,memori.enableBoardOfExperts,currentDialogState?.emitter,i18n.language,memori.culture]),getCultureCodeByLanguage=lang=>{let voice="";switch((lang||memori.culture?.split("-")?.[0]||i18n.language||"IT").toUpperCase()){case"IT":default:voice="it-IT";break;case"DE":voice="de-DE";break;case"EN":voice="en-GB";break;case"ES":voice="es-ES";break;case"FR":voice="fr-FR";break;case"PT":voice="pt-PT";break;case"UK":voice="uk-UK";break;case"RU":voice="ru-RU";break;case"PL":voice="pl-PL";break;case"FI":voice="fi-FI";break;case"EL":voice="el-GR";break;case"AR":voice="ar-SA";break;case"ZH":voice="zh-CN";break;case"JA":voice="ja-JP"}return voice},[phonemesMap,setPhonemesMap]=(0,react.useState)();(0,react.useEffect)((()=>{(async()=>{try{const lexiconReq=await fetch(`${baseUrl||"https://aisuru.com"}/api/lexiconmap`);return await lexiconReq.json()}catch(err){console.error(err)}})().then((lexicon=>{setPhonemesMap(lexicon)}))}),[]);const replaceTextWithPhonemes=(text,lang)=>{if(!phonemesMap)return text;const phonemes={...phonemesMap.common??{},...tenant?.id&&phonemesMap[tenant.id]?phonemesMap[tenant.id]:{}};return Object.keys(phonemes).map((word=>({word,phoneme:phonemes[word][lang.toLowerCase()]??phonemes[word].default,caseSensitive:phonemes[word].caseSensitive}))).reduce(((acc,{word,phoneme,caseSensitive})=>acc.replace(new RegExp(`\\b${word}\\b`,caseSensitive?"g":"gi"),`${word}`)),text)},emitEndSpeakEvent=()=>{const e=new CustomEvent("MemoriEndSpeak");document.dispatchEvent(e)},speak=text=>{if(!AZURE_COGNITIVE_SERVICES_TTS_KEY||preview)return void emitEndSpeakEvent();if(stopListening(),preview)return;if(muteSpeaker||speakerMuted)return memoriSpeaking=!1,setMemoriTyping(!1),emitEndSpeakEvent(),void(continuousSpeech&&setListeningTimeout());audioDestination&&audioDestination.pause();let isSafari=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome"),isIOS=/iPad|iPhone|iPod/.test(navigator.userAgent);if("interrupted"===audioContext.state)return void audioContext.resume().then((()=>speak(text)));if("closed"===audioContext.state){audioContext=new es2019_module.Hm;let buffer=audioContext.createBuffer(1,1e4,22050),source=audioContext.createBufferSource();source.buffer=buffer,source.connect(audioContext.destination)}else if("suspended"===audioContext.state){stopAudio(),audioContext=new es2019_module.Hm;let buffer=audioContext.createBuffer(1,1e4,22050),source=audioContext.createBufferSource();source.buffer=buffer,source.connect(audioContext.destination)}if(!speechSynthesizer){isIOS||(audioDestination=new microsoft_cognitiveservices_speech_sdk.SpeakerAudioDestination);let audioConfig=microsoft_cognitiveservices_speech_sdk.AudioConfig.fromSpeakerOutput(audioDestination);speechSynthesizer=new microsoft_cognitiveservices_speech_sdk.SpeechSynthesizer(speechConfig,audioConfig)}const source=audioContext.createBufferSource();source.addEventListener("ended",(()=>{setIsPlayingAudio(!1),memoriSpeaking=!1})),audioDestination.onAudioEnd=()=>{setIsPlayingAudio(!1),memoriSpeaking=!1,source.disconnect(),emitEndSpeakEvent(),onEndSpeakStartListen()},resetVisemeQueue(),speechSynthesizer.visemeReceived=function(_,e){addViseme(e.visemeId,e.audioOffset)};const textToSpeak=(0,utils.r)((0,utils.LV)((0,utils.h)((0,utils.Cb)((0,utils.kh)(text)))));speechSynthesizer.speakSsmlAsync(`${replaceTextWithPhonemes(textToSpeak,userLang.toLowerCase())}`,(result=>{if(result){setIsPlayingAudio(!0),memoriSpeaking=!0,startProcessing(audioContext);try{audioContext.decodeAudioData(result.audioData,(function(buffer){source.buffer=buffer,source.connect(audioContext.destination),(history.length<1||isSafari&&isIOS)&&source.start(0)})),audioContext.onstatechange=()=>{"suspended"===audioContext.state||"closed"===audioContext.state?(source.disconnect(),setIsPlayingAudio(!1),stopProcessing(),resetVisemeQueue(),memoriSpeaking=!1):"interrupted"===audioContext.state&&audioContext.resume()},audioContext.resume(),speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null)}catch(error){console.error("Error processing audio data:",error),handleFallback(text)}}else handleFallback(text)}),(error=>{console.error("Speak error:",error),handleFallback(text)})),setMemoriTyping(!1)},handleFallback=text=>{console.log("Falling back to browser speech synthesis"),window.speechSynthesis.speak(new SpeechSynthesisUtterance(text)),cleanup()},cleanup=()=>{setIsPlayingAudio(!1),stopProcessing(),resetVisemeQueue(),memoriSpeaking=!1,speechSynthesizer&&(console.log("Closing speech synthesizer"),speechSynthesizer.close(),speechSynthesizer=null),emitEndSpeakEvent()},stopAudio=()=>{setIsPlayingAudio(!1),memoriSpeaking=!1;try{speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null),"closed"!==audioContext.state&&audioContext.close(),audioDestination&&(audioDestination.pause(),audioDestination.close())}catch(e){console.debug("stopAudio error: ",e)}};(0,react.useEffect)((()=>{"TOTEM"!==selectedLayout&&(()=>{let textarea=document.querySelector("#chat-fieldset textarea");textarea&&enableFocusChatInput?textarea.focus():textarea?.blur()})()}),[currentDialogState?.emission]);const[transcript,setTranscript]=(0,react.useState)(""),resetTranscript=()=>setTranscript(""),[transcriptTimeout,setTranscriptTimeout]=(0,react.useState)(null),setListeningTimeout=()=>{let timeout=setTimeout((async()=>{clearListening();const message=(0,utils.vw)(transcript);message.length>0&&listening?(sendMessage(message),resetTranscript(),setUserMessage("")):listening&&resetInteractionTimeout()}),1e3*continuousSpeechTimeout);setTranscriptTimeout(timeout)},clearListeningTimeout=()=>{transcriptTimeout&&(clearTimeout(transcriptTimeout),setTranscriptTimeout(null))};(0,react.useEffect)((()=>{clearListeningTimeout(),continuousSpeech&&setListeningTimeout(),resetInteractionTimeout()}),[transcript]);const startListening=async()=>{if(AZURE_COGNITIVE_SERVICES_TTS_KEY){clearListening(),setTranscript(""),resetTranscript(),(0,utils.xZ)()&&setEnableFocusChatInput(!1);try{navigator.mediaDevices.getUserMedia({audio:!0}).then((function(_stream){setHasUserActivatedListening(!0),speechConfig||(speechConfig=microsoft_cognitiveservices_speech_sdk.SpeechConfig.fromSubscription(AZURE_COGNITIVE_SERVICES_TTS_KEY,"westeurope"),speechConfig.speechRecognitionLanguage=getCultureCodeByLanguage(userLang),speechConfig.speechSynthesisLanguage=getCultureCodeByLanguage(userLang),speechConfig.speechSynthesisVoiceName=getTTSVoice(userLang));const audioConfig=microsoft_cognitiveservices_speech_sdk.AudioConfig.fromDefaultMicrophoneInput();recognizer=new microsoft_cognitiveservices_speech_sdk.SpeechRecognizer(speechConfig,audioConfig),setListening(!0),recognizer.recognized=(_s,e)=>{if(e.result.text)if(e.result.reason===microsoft_cognitiveservices_speech_sdk.ResultReason.RecognizedSpeech){let transcript=e.result.text;if(setTranscript(transcript||""),transcript?.length>0){const transcriptMessage=(0,utils.vw)(transcript);transcriptMessage.length>0&&setUserMessage((msg=>`${msg} ${transcriptMessage}`))}}else e.result.reason===microsoft_cognitiveservices_speech_sdk.ResultReason.NoMatch&&console.debug("NOMATCH: Speech could not be recognized.")},recognizer.canceled=(_s,e)=>{e.reason===microsoft_cognitiveservices_speech_sdk.CancellationReason.Error&&(console.debug(`"CANCELED: ErrorCode=${e.errorCode}`),console.debug(`"CANCELED: ErrorDetails=${e.errorDetails}`),console.debug("CANCELED: Did you set the speech resource key and region values?")),stopListening()},recognizer.sessionStopped=(_s,_e)=>{stopListening()},resetTranscript(),recognizer.startContinuousRecognitionAsync()})).catch(console.debug)}catch(error){console.debug(error)}}},stopListening=()=>{recognizer&&(recognizer.stopContinuousRecognitionAsync(),recognizer.close(),recognizer=null),setListening(!1)},clearListening=()=>{setHasUserActivatedListening(!1),stopListening(),clearListeningTimeout()},resetUIEffects=()=>{try{clearListening(),clearInteractionTimeout(),setClickedStart(!1),timeoutRef.current=void 0,stopAudio()}catch(e){console.log("Error: resetUIEffects",e)}};(0,react.useEffect)((()=>()=>{resetUIEffects()}),[]),(0,react.useEffect)((()=>(document.addEventListener("MemoriResetUIEffects",resetUIEffects),()=>{document.removeEventListener("MemoriResetUIEffects",resetUIEffects)})),[]),(0,react.useEffect)((()=>{"Z0"===currentDialogState?.state&&clearListening()}),[currentDialogState?.state]);const[requestedListening,setRequestedListening]=(0,react.useState)(!1),onEndSpeakStartListen=(0,react.useCallback)((_e=>{isPlayingAudio&&speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null),!continuousSpeech||!hasUserActivatedListening&&requestedListening||(setRequestedListening(!0),startListening())}),[continuousSpeech,hasUserActivatedListening]);(0,react.useEffect)((()=>{history.length>1&&!isPlayingAudio&&continuousSpeech&&(hasUserActivatedListening||!requestedListening)?startListening():isPlayingAudio&&listening&&stopListening()}),[isPlayingAudio]),(0,react.useEffect)((()=>{listening&&(clearListening(),resetTranscript(),setUserMessage(""),startListening())}),[language]);const[sendOnEnter,setSendOnEnter]=(0,react.useState)("keypress");(0,react.useEffect)((()=>{window.innerWidth<=768&&(0,utils.xZ)()?setSendOnEnter("click"):setSendOnEnter("keypress")}),[]);const[attachmentsMenuOpen,setAttachmentsMenuOpen]=(0,react.useState)(),globalBackground=integrationConfig?.globalBackground,globalBackgroundUrl=globalBackground?`url(${globalBackground})`:null,integrationProperties=integration?{"--memori-chat-bubble-bg":"#fff",...integrationConfig&&!showInstruct?{"--memori-text-color":integrationConfig.textColor??"#000"}:{},...integrationConfig?.buttonBgColor?{"--memori-button-bg":integrationConfig.buttonBgColor,"--memori-primary":integrationConfig.buttonBgColor}:{},...integrationConfig?.buttonTextColor?{"--memori-button-text":integrationConfig.buttonTextColor}:{},...integrationConfig?.blurBackground?{"--memori-blur-background":"5px"}:{"--memori-blur-background":"0px"},...integrationConfig?.innerBgColor?{"--memori-inner-bg":`rgba(${"dark"===integrationConfig.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${integrationConfig.innerBgAlpha??.4})`,"--memori-inner-content-pad":"1.5rem","--memori-nav-bg-image":"none","--memori-nav-bg":`rgba(${"dark"===integrationConfig.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${integrationConfig?.innerBgAlpha??.4})`}:{"--memori-inner-content-pad":"0px"}}:{},integrationStylesheet=`\n ${preview?"#preview,":"WEBSITE_ASSISTANT"===selectedLayout?"":":root,"} .memori-widget, .memori-drawer, .memori-modal {\n ${Object.entries(integrationProperties).map((([key,value])=>`${key}: ${value};`)).join("\n")}\n }\n `,showAIicon=void 0===integrationConfig?.showAIicon||integrationConfig?.showAIicon,showWhyThisAnswer=void 0===integrationConfig?.showWhyThisAnswer||integrationConfig?.showWhyThisAnswer,[avatar3dVisible,setAvatar3dVisible]=(0,react.useState)(!1);(0,react.useEffect)((()=>{(window.innerWidth>=768&&"FULLPAGE"===selectedLayout||"FULLPAGE"!==selectedLayout)&&setAvatar3dVisible(!0)}),[]),(0,react.useEffect)((()=>{if(integrationConfig?.seoTitle){let meta=document.createElement("meta");meta.setAttribute("property","og:title"),meta.setAttribute("content",integrationConfig.seoTitle),document.head.append(meta)}if(integrationConfig?.seoDescription){let meta=document.createElement("meta");meta.setAttribute("property","og:description"),meta.setAttribute("content",integrationConfig.seoDescription),document.head.append(meta)}if(integrationConfig?.seoUrl){let meta=document.createElement("meta");meta.setAttribute("property","og:url"),meta.setAttribute("content",integrationConfig.seoUrl),document.head.append(meta)}let image=ogImage||memori.avatarURL;if(integrationConfig?.seoImageShowAvatar&&image){let meta=document.createElement("meta");meta.setAttribute("property","og:image"),meta.setAttribute("content",image),document.head.append(meta)}}),[integrationConfig,memori.avatarURL,ogImage]);const memoriTextEnteredHandler=(0,react.useCallback)((e=>{if(disableTextEnteredEvents)return;const{text,waitForPrevious,hidden,typingText,useLoaderTextAsMsg,hasBatchQueued}=e.detail;text&&(waitForPrevious&&!speakerMuted&&(memoriSpeaking||memoriTyping)?setTimeout((()=>{memoriTextEnteredHandler(e)}),1e3):(stopListening(),stopAudio(),sendMessage(text,void 0,void 0,void 0,void 0,hidden,typingText,useLoaderTextAsMsg,hasBatchQueued)))}),[sessionId,isPlayingAudio,memoriTyping,userLang,disableTextEnteredEvents]);(0,react.useEffect)((()=>(disableTextEnteredEvents?document.removeEventListener("MemoriTextEntered",memoriTextEnteredHandler):document.addEventListener("MemoriTextEntered",memoriTextEnteredHandler),()=>{document.removeEventListener("MemoriTextEntered",memoriTextEnteredHandler)})),[sessionId,userLang,disableTextEnteredEvents]);const onClickStart=(0,react.useCallback)((async session=>{const sessionID=session?.sessionID||sessionId,dialogState=session?.dialogState||currentDialogState;setClickedStart(!0);let memoriAudioElement=document.getElementById("memori-audio"),isSafari=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome");memoriAudioElement&&isSafari&&(memoriAudioElement.muted=!1,memoriAudioElement.play().catch((e=>{console.warn("error playing intro audio",e)})));let storageBirthDate=(0,configuration.wm)("birthDate",void 0),birth=birthDate||storageBirthDate||void 0;if(sessionID||!minAge||birth){if(!sessionID&&"PUBLIC"!==memori.privacyType&&!memori.secretToken&&!memoriPwd&&!memoriTokens||!sessionID&&gotErrorInOpening)return setAuthModalState("password"),void setClickedStart(!1);if(!sessionID){setClickedStart(!1),setGotErrorInOpening(!1);const session=await fetchSession({memoriID:memori.engineMemoriID,password:secret||memoriPwd||memori.secretToken,tag:personification?.tag,pin:personification?.pin,initialContextVars:{PATHNAME:window.location.pathname?.toUpperCase(),ROUTE:window.location.pathname?.split("/")?.pop()?.toUpperCase()||"",...initialContextVars||{}},initialQuestion,birthDate:birth,additionalInfo:{...additionalInfo||{},loginToken:userToken??loginToken??additionalInfo?.loginToken??authToken,language:getCultureCodeByLanguage(userLang),timeZoneOffset:(new Date).getTimezoneOffset().toString()}});return void(session?.dialogState?(setHistory([]),translateDialogState(session.dialogState,userLang).then((ts=>{let text=ts.translatedEmission||ts.emission;text&&speak(text)})).finally((()=>{setHasUserActivatedSpeak(!0)}))):await onClickStart(session||void 0))}if(initialSessionID){const{currentState,...response}=await getSession(sessionID);if(0!==response.resultCode||!currentState)return console.debug("session expired, opening new session"),setGotErrorInOpening(!0),setSessionId(void 0),setClickedStart(!1),void await onClickStart();if(setHistory([]),position&&applyPosition(position,sessionID),memori.needsDateTime&&sendDateChangedEvent({sessionID,state:currentState}),instruct&&memori.giverTag&¤tDialogState?.currentTag!==memori.giverTag)try{console.debug("change tag #0"),await changeTag(memori.engineMemoriID,sessionID,"-");const session=await changeTag(memori.engineMemoriID,sessionID,memori.giverTag,memori.giverPIN);if(!session||0!==session.resultCode)throw console.error("session #1",session),new Error("No session");translateDialogState(session.currentState,userLang).then((ts=>{let text=ts.translatedEmission||ts.emission;text&&speak(text)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}catch(e){console.error("session #2",e),reopenSession(!0,memori?.secretToken,void 0,memori?.giverTag,memori?.giverPIN,{PATHNAME:window.location.pathname?.toUpperCase(),ROUTE:window.location.pathname?.split("/")?.pop()?.toUpperCase()||"",...initialContextVars||{}},initialQuestion,birth).then((()=>{setHasUserActivatedSpeak(!0)}))}else if(!instruct&&personification&¤tDialogState?.currentTag!==personification.tag)try{console.debug("change tag #3"),await changeTag(memori.engineMemoriID,sessionID,"-");const session=await changeTag(memori.engineMemoriID,sessionID,personification.tag,personification.pin);if(!session||0!==session.resultCode)throw console.error("session #4",session),new Error("No session");translateDialogState(session.currentState,userLang).then((ts=>{let text=ts.translatedEmission||ts.emission;text&&speak(text)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}catch(e){console.error("session #5",e),reopenSession(!0,memori?.secretToken,void 0,personification.tag,personification.pin,{PATHNAME:window.location.pathname?.toUpperCase(),ROUTE:window.location.pathname?.split("/")?.pop()?.toUpperCase()||"",...initialContextVars||{}},initialQuestion,birth).then((()=>{setHasUserActivatedSpeak(!0)}))}else if(instruct||personification||!currentDialogState?.currentTag||currentDialogState?.currentTag===constants.QV||"-"===currentDialogState?.currentTag){try{const{chatLogs,...resp}=await getSessionChatLogs(sessionID,sessionID),messages=chatLogs?.[0]?.lines.map(((l,i)=>({text:l.text,media:l.media?.filter((m=>constants.go.includes(m.mimeType)))?.map((m=>({mediumID:`${i}-${m.mimeType}`,...m}))),fromUser:l.inbound,timestamp:l.timestamp,emitter:l.emitter,initial:0===i})));let translatedMessages=messages.slice(0,-1);if(language.toUpperCase()!==userLang.toUpperCase()&&isMultilanguageEnabled)try{translatedMessages=await Promise.all(messages.map((async m=>({...m,originalText:m.text,text:(await(0,translations.i)(m.text,userLang,language,baseUrl)).text}))))}catch(e){console.log("Error translating messages",e)}setHistory(translatedMessages)}catch(e){console.log("Error retrieving chat logs",e)}translateDialogState(currentState,userLang).then((ts=>{let text=ts.translatedEmission||ts.emission;text&&speak(text)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}else try{console.debug("change tag #6"),await changeTag(memori.engineMemoriID,sessionID,"-");const session=await changeTag(memori.engineMemoriID,sessionID,constants.QV);if(!session||0!==session.resultCode)throw console.error("session #7",session),new Error("No session");translateDialogState(session.currentState,userLang).then((ts=>{let text=ts.translatedEmission||ts.emission;text&&speak(text)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}catch(e){console.error("session #8",e),reopenSession(!0,memori?.secretToken,void 0,void 0,void 0,{PATHNAME:window.location.pathname?.toUpperCase(),ROUTE:window.location.pathname?.split("/")?.pop()?.toUpperCase()||"",...initialContextVars||{}},initialQuestion,birth).then((()=>{setHasUserActivatedSpeak(!0)}))}position&&applyPosition(position,sessionID),memori.needsDateTime&&sendDateChangedEvent({sessionID,state:currentState})}else setHistory([]),translateDialogState(dialogState,userLang).then((ts=>{let text=ts.translatedEmission||ts.emission;text&&speak(text)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}else setShowAgeVerification(!0),setClickedStart(!1)}),[memoriPwd,memori,memoriTokens,birthDate,sessionId,userLang,position]);(0,react.useEffect)((()=>{const targetNode=document.querySelector(`memori-client[memoriname="${memori.name}"]`)||document.querySelector(`memori-client[memoriid="${memori.memoriID}"]`)||document.querySelector("memori-client");if(!targetNode)return;const observer=new MutationObserver(((mutationList,_observer)=>{for(const mutation of mutationList)"attributes"===mutation.type&&"authtoken"===mutation.attributeName?.toLowerCase()&&("MEMORI-CLIENT"===mutation.target.nodeName?(setLoginToken(mutation.target.getAttribute("authtoken")||void 0),userToken=mutation.target.getAttribute("authtoken")||void 0):(setLoginToken(mutation.target?.parentElement?.getAttribute("authtoken")||void 0),userToken=mutation.target.getAttribute("authtoken")||void 0))}));return observer.observe(targetNode,{attributes:!0,childList:!1,subtree:!1}),()=>{observer.disconnect()}}),[]);const[experts,setExperts]=(0,react.useState)(),fetchExperts=(0,react.useCallback)((async()=>{if(sessionId&&memori?.enableBoardOfExperts)try{const{experts,count,...resp}=await getExpertReferences(sessionId);0===resp.resultCode?setExperts(experts):console.warn("Error fetching experts",resp)}catch(err){console.warn(err)}}),[sessionId,memori?.enableBoardOfExperts]);(0,react.useEffect)((()=>{fetchExperts()}),[sessionId,fetchExperts]);const deepThoughtEnabled=memori.enableDeepThought&&!!loginToken&&!!user?.userID&&user?.pAndCUAccepted,needsCredits=tenant?.billingDelegation,[hasEnoughCredits,setHasEnoughCredits]=(0,react.useState)(!0),checkCredits=(0,react.useCallback)((async()=>{if(tenant?.billingDelegation)try{const resp=await(async({operation="session_creation",baseUrl,userID,userName,tenant})=>{if(!userID&&!userName)throw new Error("Either userID or userName must be provided");const resp=await fetch(`${baseUrl}/api/verify-tokens`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operation,userID,userName,tenant})});if(!resp.ok)throw new Error("Failed to fetch credits");return resp.json()})({operation:deepThoughtEnabled?"dt_session_creation":"session_creation",baseUrl,userID:ownerUserID,userName:ownerUserName,tenant:tenantID});resp.enough?setHasEnoughCredits(!0):(setHasEnoughCredits(!1),console.warn("Not enough credits. Required:",resp.required))}catch(e){let err=e;console.debug(err)}}),[tenant?.billingDelegation,deepThoughtEnabled]);(0,react.useEffect)((()=>{tenant?.billingDelegation&&checkCredits()}),[tenant?.billingDelegation,deepThoughtEnabled]);const showFullHistory=void 0===showOnlyLastMessages?"TOTEM"!==layout&&"WEBSITE_ASSISTANT"!==layout&&"HIDDEN_CHAT"!==layout:!showOnlyLastMessages,headerProps={memori,tenant,history,showShare:showShare??integrationConfig?.showShare??!0,position,setShowPositionDrawer,setShowSettingsDrawer,setShowKnownFactsDrawer,setShowExpertsDrawer,enableAudio:enableAudio??integrationConfig?.enableAudio??!0,showSpeaker:!!AZURE_COGNITIVE_SERVICES_TTS_KEY,speakerMuted:muteSpeaker||speakerMuted,setSpeakerMuted:mute=>{if(speakerMuted=!!mute,setMuteSpeaker(mute),(0,configuration.A2)("muteSpeaker",!!mute),mute)stopAudio();else{audioContext=new es2019_module.Hm;let buffer=audioContext.createBuffer(1,1e4,22050),source=audioContext.createBufferSource();source.buffer=buffer,source.connect(audioContext.destination)}},showSettings,hasUserActivatedSpeak,showReload:"TOTEM"===selectedLayout,showClear,clearHistory:()=>setHistory((h=>h.slice(-1))),showLogin,setShowLoginDrawer,loginToken,user,sessionID:sessionId},avatarProps={memori,integration,integrationConfig,tenant,instruct,avatar3dVisible,setAvatar3dVisible,hasUserActivatedSpeak,isPlayingAudio:isPlayingAudio&&!muteSpeaker,loading:!!memoriTyping,baseUrl,apiUrl:client.constants.BACKEND_URL,enablePositionControls,setEnablePositionControls,avatarType},startPanelProps={memori,tenant,language,userLang,setUserLang,baseUrl,apiUrl:client.constants.BACKEND_URL,position,openPositionDrawer:()=>setShowPositionDrawer(!0),integrationConfig,instruct,sessionId,clickedStart,isMultilanguageEnabled,onClickStart,initializeTTS:()=>{if(!AZURE_COGNITIVE_SERVICES_TTS_KEY)return;speechConfig=microsoft_cognitiveservices_speech_sdk.SpeechConfig.fromSubscription(AZURE_COGNITIVE_SERVICES_TTS_KEY,"westeurope"),speechConfig.speechSynthesisLanguage=getCultureCodeByLanguage(userLang),speechConfig.speechSynthesisVoiceName=getTTSVoice(userLang),speechConfig.speechRecognitionLanguage=getCultureCodeByLanguage(userLang),speechConfig.setProperty("speechSynthesis.outputFormat","viseme"),(0,utils.xZ)()&&(speechConfig.speechSynthesisOutputFormat=microsoft_cognitiveservices_speech_sdk.SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3),audioContext=new es2019_module.Hm;let buffer=audioContext.createBuffer(1,1e4,22050),source=audioContext.createBufferSource();source.buffer=buffer,source.connect(audioContext.destination),audioDestination=new microsoft_cognitiveservices_speech_sdk.SpeakerAudioDestination;let audioConfig=microsoft_cognitiveservices_speech_sdk.AudioConfig.fromSpeakerOutput(audioDestination);speechSynthesizer=new microsoft_cognitiveservices_speech_sdk.SpeechSynthesizer(speechConfig,audioConfig)},isUserLoggedIn:!!loginToken&&!!user?.userID,hasInitialSession:!!initialSessionID,notEnoughCredits:needsCredits&&!hasEnoughCredits,showLogin,setShowLoginDrawer,user},chatProps={memori,sessionID:sessionId||"",tenant,translateTo:isMultilanguageEnabled&&userLang.toUpperCase()!==(memori.culture?.split("-")?.[0]??i18n.language??"IT")?.toUpperCase()?userLang:void 0,baseUrl,apiUrl:client.constants.BACKEND_URL,layout,memoriTyping,typingText,showTypingText,history:showFullHistory?history:history.slice(-2),authToken:loginToken??userToken??additionalInfo?.loginToken??authToken,dialogState:currentDialogState,setDialogState:setCurrentDialogState,pushMessage,simulateUserPrompt:(text,translatedText)=>{stopListening(),stopAudio(),sendMessage(text,void 0,void 0,!1,translatedText)},showDates,showContextPerLine,showAIicon,showWhyThisAnswer,showCopyButton,showTranslationOriginal,client,selectReceiverTag:async tag=>{if(sessionId)try{const{currentState,...resp}=await postTagChangedEvent(sessionId,tag);if(0===resp.resultCode)if(pushMessage({text:tag,fromUser:!0}),"X4"===currentState.state&&memori.giverTag){const{currentState,...resp}=await client.postTagChangedEvent(sessionId,memori.giverTag);0===resp.resultCode?(setCurrentDialogState(currentState),currentState.emission&&pushMessage({text:currentState.emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,contextVars:currentState.contextVars,date:currentState.currentDate,placeName:currentState.currentPlaceName,placeLatitude:currentState.currentLatitude,placeLongitude:currentState.currentLongitude,placeUncertaintyKm:currentState.currentUncertaintyKm,tag:currentState.currentTag,memoryTags:currentState.memoryTags})):(console.error(resp),dist.ZP.error(t((0,error.r)(resp.resultCode))))}else setCurrentDialogState(currentState),currentState.emission&&pushMessage({text:currentState.emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,contextVars:currentState.contextVars,date:currentState.currentDate,placeName:currentState.currentPlaceName,placeLatitude:currentState.currentLatitude,placeLongitude:currentState.currentLongitude,placeUncertaintyKm:currentState.currentUncertaintyKm,tag:currentState.currentTag,memoryTags:currentState.memoryTags});else console.error(resp,tag,currentDialogState?.knownTags?.[tag]),dist.ZP.error(t((0,error.r)(resp.resultCode)))}catch(e){let err=e;console.error(err),dist.ZP.error(err.message)}},preview,sendOnEnter,setSendOnEnter,microphoneMode:continuousSpeech?"CONTINUOUS":"HOLD_TO_TALK",attachmentsMenuOpen,setAttachmentsMenuOpen,instruct,showInputs,showMicrophone:!!AZURE_COGNITIVE_SERVICES_TTS_KEY,userMessage,onChangeUserMessage:value=>{if(!value||"\n"===value||""===value.trim())return setUserMessage(""),void resetInteractionTimeout();setUserMessage(value),clearInteractionTimeout()},sendMessage:(msg,media)=>{stopAudio(),stopListening(),sendMessage(msg,media),setUserMessage(""),resetTranscript()},stopListening:clearListening,startListening,stopAudio,resetTranscript,listening,setEnableFocusChatInput,isPlayingAudio,customMediaRenderer,user,userAvatar,experts},integrationBackground=integration&&globalBackgroundUrl?(0,jsx_runtime.jsx)("div",{className:"memori--global-background",children:(0,jsx_runtime.jsx)("div",{className:"memori--global-background-image",style:{backgroundImage:globalBackgroundUrl}})}):(0,jsx_runtime.jsx)("div",{className:"memori--global-background no-background-image"}),integrationStyle=integration?(0,jsx_runtime.jsx)("style",{dangerouslySetInnerHTML:{__html:integrationStylesheet}}):null,changeModeProps={canInstruct:!!memori.giverTag,instruct:!!instruct,onChangeMode:mode=>{setInstruct("instruct"===mode),setHasUserActivatedSpeak(!1),setClickedStart(!1)}},poweredBy=(0,jsx_runtime.jsx)(PoweredBy.Z,{tenant,userLang,integrationID:integration?.integrationID,memoriHash:`${memori.ownerTenantName}-${memori.ownerUserName}-${memori.name}`}),Layout=customLayout||("TOTEM"===selectedLayout?layouts_Totem:"CHAT"===selectedLayout?layouts_Chat:"FULLPAGE"===selectedLayout?layouts_FullPage:"WEBSITE_ASSISTANT"===selectedLayout?layouts_WebsiteAssistant:"HIDDEN_CHAT"===selectedLayout?layouts_HiddenChat:"ZOOMED_FULL_BODY"===selectedLayout?layouts_ZoomedFullBody:layouts_FullPage);return(0,jsx_runtime.jsxs)("div",{className:classnames_default()("memori","memori-widget",`memori-layout-${layout.toLowerCase()}`,`memori-controls-${controlsPosition.toLowerCase()}`,`memori--avatar-${integrationConfig?.avatar||"default"}`,{"memori--preview":preview,"memori--embed":embed,"memori--with-integration":integration,"memori--with-speechkey":!!AZURE_COGNITIVE_SERVICES_TTS_KEY,"memori--active":hasUserActivatedSpeak,"memori--hide-emissions":hideEmissions,"memori--has-active-session":!!sessionId}),"data-memori-name":memori?.name,"data-memori-id":memori?.engineMemoriID,"data-memori-secondary-id":memori?.memoriID,"data-memori-session-id":sessionId,"data-memori-integration":integration?.integrationID,"data-memori-engine-state":JSON.stringify({...currentDialogState,sessionID:sessionId}),style:{height},children:[(0,jsx_runtime.jsx)(Layout,{Header:Header.Z,headerProps,Avatar:Avatar.Z,avatarProps,Chat:Chat_Chat.Z,chatProps,StartPanel:StartPanel.Z,startPanelProps,integrationStyle,integrationBackground,ChangeMode:ChangeMode.Z,changeModeProps,poweredBy,sessionId,hasUserActivatedSpeak,showInstruct,loading}),(0,jsx_runtime.jsx)("audio",{id:"memori-audio",style:{display:"none"},src:"https://aisuru.com/intro.mp3"}),isClient&&(0,jsx_runtime.jsx)(Auth.Z,{withModal:!0,pwdOrTokens:authModalState,openModal:!!authModalState,setPwdOrTokens:setAuthModalState,showTokens:"SECRET"===memori.privacyType,onFinish:async values=>{values.password&&setMemoriPwd(values.password),values.password&&(memoriPassword=values.password),values.tokens&&setMemoriTokens(values.tokens),reopenSession(!sessionId,values.password,values.tokens,instruct?memori.giverTag:personification?.tag,instruct?memori.giverPIN:personification?.pin,{PATHNAME:window.location.pathname?.toUpperCase(),ROUTE:window.location.pathname?.split("/")?.pop()?.toUpperCase()||"",...initialContextVars||{}},initialQuestion,birthDate).then((state=>{setAuthModalState(null),onClickStart(state||void 0)})).catch((()=>{setAuthModalState(null),setGotErrorInOpening(!0)}))},minimumNumberOfRecoveryTokens:memori?.minimumNumberOfRecoveryTokens??1}),isClient&&(0,jsx_runtime.jsx)(AgeVerificationModal.Z,{visible:showAgeVerification,minAge,onClose:birthDate=>{birthDate?(setBirthDate(birthDate),(0,configuration.A2)("birthDate",birthDate),reopenSession(!sessionId,memoriPassword||memoriPwd||memori?.secretToken,memoriTokens,instruct?memori.giverTag:personification?.tag,instruct?memori.giverPIN:personification?.pin,{PATHNAME:window.location.pathname?.toUpperCase(),ROUTE:window.location.pathname?.split("/")?.pop()?.toUpperCase()||"",...initialContextVars||{}},initialQuestion,birthDate).then((state=>{setShowAgeVerification(!1),setAuthModalState(null),onClickStart(state||void 0)})).catch((()=>{setShowAgeVerification(!1),setGotErrorInOpening(!0)}))):(setShowAgeVerification(!1),setClickedStart(!1))}}),showSettingsDrawer&&(0,jsx_runtime.jsx)(SettingsDrawer.Z,{layout:selectedLayout,open:!!showSettingsDrawer,onClose:()=>setShowSettingsDrawer(!1),microphoneMode:continuousSpeech?"CONTINUOUS":"HOLD_TO_TALK",continuousSpeechTimeout,setMicrophoneMode:mode=>setContinuousSpeech("CONTINUOUS"===mode),setContinuousSpeechTimeout,controlsPosition,setControlsPosition,hideEmissions,setHideEmissions,avatarType,setAvatarType,enablePositionControls,setEnablePositionControls,isAvatar3d:!!integrationConfig?.avatarURL,additionalSettings}),showPositionDrawer&&(0,jsx_runtime.jsx)(PositionDrawer.Z,{memori,open:!!showPositionDrawer,venue:position,setVenue:venue=>{_setPosition(venue),applyPosition(venue),venue?(0,configuration.A2)("position",JSON.stringify(venue)):(0,configuration.gj)("position")},onClose:position=>{position&&applyPosition(position),setShowPositionDrawer(!1)}}),showKnownFactsDrawer&&sessionId&&(0,jsx_runtime.jsx)(KnownFacts.Z,{apiClient:client,memori,sessionID:sessionId,visible:showKnownFactsDrawer,closeDrawer:()=>setShowKnownFactsDrawer(!1)}),showExpertsDrawer&&!!experts&&(0,jsx_runtime.jsx)(ExpertsDrawer.Z,{apiUrl:client.constants.BACKEND_URL,baseUrl,tenant,experts,open:showExpertsDrawer,onClose:()=>setShowExpertsDrawer(!1)}),showLoginDrawer&&tenant?.id&&(0,jsx_runtime.jsx)(LoginDrawer.Z,{tenant,apiClient:client,open:!!showLoginDrawer,user,loginToken,onClose:()=>setShowLoginDrawer(!1),onLogin:(user,token)=>{setUser(user),setLoginToken(token),userToken=token,setShowLoginDrawer(!1),(0,configuration.A2)("loginToken",token)},onLogout:()=>{loginToken&&client.backend.userLogout(loginToken).then((()=>{setShowLoginDrawer(!1),setUser(void 0),setLoginToken(void 0),userToken=void 0,(0,configuration.gj)("loginToken")}))}})]})};MemoriWidget.displayName="MemoriWidget";const MemoriWidget_MemoriWidget=MemoriWidget;try{MemoriWidget.displayName="MemoriWidget",MemoriWidget.__docgenInfo={description:"",displayName:"MemoriWidget",props:{memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},ownerUserName:{defaultValue:null,description:"",name:"ownerUserName",required:!1,type:{name:"string | null"}},ownerUserID:{defaultValue:null,description:"",name:"ownerUserID",required:!1,type:{name:"string | null"}},tenantID:{defaultValue:null,description:"",name:"tenantID",required:!0,type:{name:"string"}},memoriConfigs:{defaultValue:null,description:"",name:"memoriConfigs",required:!1,type:{name:"MemoriConfig[]"}},memoriLang:{defaultValue:null,description:"",name:"memoriLang",required:!1,type:{name:"string"}},multilingual:{defaultValue:null,description:"",name:"multilingual",required:!1,type:{name:"boolean"}},integration:{defaultValue:null,description:"",name:"integration",required:!1,type:{name:"Integration"}},layout:{defaultValue:{value:"DEFAULT"},description:"",name:"layout",required:!1,type:{name:"enum",value:[{value:'"DEFAULT"'},{value:'"FULLPAGE"'},{value:'"TOTEM"'},{value:'"CHAT"'},{value:'"WEBSITE_ASSISTANT"'},{value:'"HIDDEN_CHAT"'},{value:'"ZOOMED_FULL_BODY"'}]}},customLayout:{defaultValue:null,description:"",name:"customLayout",required:!1,type:{name:"FC"}},showShare:{defaultValue:null,description:"",name:"showShare",required:!1,type:{name:"boolean"}},showCopyButton:{defaultValue:{value:"true"},description:"",name:"showCopyButton",required:!1,type:{name:"boolean"}},showTranslationOriginal:{defaultValue:{value:"false"},description:"",name:"showTranslationOriginal",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},showInputs:{defaultValue:{value:"true"},description:"",name:"showInputs",required:!1,type:{name:"boolean"}},showDates:{defaultValue:{value:"false"},description:"",name:"showDates",required:!1,type:{name:"boolean"}},showContextPerLine:{defaultValue:{value:"false"},description:"",name:"showContextPerLine",required:!1,type:{name:"boolean"}},showSettings:{defaultValue:{value:"true"},description:"",name:"showSettings",required:!1,type:{name:"boolean"}},showClear:{defaultValue:{value:"false"},description:"",name:"showClear",required:!1,type:{name:"boolean"}},showOnlyLastMessages:{defaultValue:null,description:"",name:"showOnlyLastMessages",required:!1,type:{name:"boolean"}},showTypingText:{defaultValue:{value:"false"},description:"",name:"showTypingText",required:!1,type:{name:"boolean"}},showLogin:{defaultValue:{value:"false"},description:"",name:"showLogin",required:!1,type:{name:"boolean"}},preview:{defaultValue:{value:"false"},description:"",name:"preview",required:!1,type:{name:"boolean"}},embed:{defaultValue:{value:"false"},description:"",name:"embed",required:!1,type:{name:"boolean"}},height:{defaultValue:{value:"100vh"},description:"",name:"height",required:!1,type:{name:"string | number"}},secret:{defaultValue:null,description:"",name:"secret",required:!1,type:{name:"string"}},baseUrl:{defaultValue:{value:"https://aisuru.com"},description:"",name:"baseUrl",required:!1,type:{name:"string"}},apiURL:{defaultValue:{value:"https://backend.memori.ai"},description:"",name:"apiURL",required:!1,type:{name:"string"}},engineURL:{defaultValue:{value:"https://engine.memori.ai"},description:"",name:"engineURL",required:!1,type:{name:"string"}},initialContextVars:{defaultValue:null,description:"",name:"initialContextVars",required:!1,type:{name:"{ [key: string]: string; }"}},initialQuestion:{defaultValue:null,description:"",name:"initialQuestion",required:!1,type:{name:"string"}},ogImage:{defaultValue:null,description:"",name:"ogImage",required:!1,type:{name:"string"}},sessionID:{defaultValue:null,description:"",name:"sessionID",required:!1,type:{name:"string"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},personification:{defaultValue:null,description:"",name:"personification",required:!1,type:{name:"{ name?: string; tag: string; pin: string; }"}},authToken:{defaultValue:null,description:"",name:"authToken",required:!1,type:{name:"string"}},AZURE_COGNITIVE_SERVICES_TTS_KEY:{defaultValue:null,description:"",name:"AZURE_COGNITIVE_SERVICES_TTS_KEY",required:!1,type:{name:"string"}},enableAudio:{defaultValue:null,description:"",name:"enableAudio",required:!1,type:{name:"boolean"}},defaultSpeakerActive:{defaultValue:{value:"true"},description:"",name:"defaultSpeakerActive",required:!1,type:{name:"boolean"}},disableTextEnteredEvents:{defaultValue:{value:"false"},description:"",name:"disableTextEnteredEvents",required:!1,type:{name:"boolean"}},onStateChange:{defaultValue:null,description:"",name:"onStateChange",required:!1,type:{name:"((state?: DialogState) => void)"}},additionalInfo:{defaultValue:null,description:"",name:"additionalInfo",required:!1,type:{name:"({ loginToken?: string; language?: string; referral?: string | undefined; timeZoneOffset?: string | undefined; } & { [key: string]: string; }) | undefined"}},customMediaRenderer:{defaultValue:null,description:"",name:"customMediaRenderer",required:!1,type:{name:"((mimeType: string) => Element | null)"}},additionalSettings:{defaultValue:null,description:"",name:"additionalSettings",required:!1,type:{name:"Element | null"}},userAvatar:{defaultValue:null,description:"",name:"userAvatar",required:!1,type:{name:"string | Element"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/MemoriWidget/MemoriWidget.tsx#MemoriWidget"]={docgenInfo:MemoriWidget.__docgenInfo,name:"MemoriWidget",path:"src/components/MemoriWidget/MemoriWidget.tsx#MemoriWidget"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/PositionDrawer/PositionDrawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var _ui_Drawer__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Drawer.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_VenueWidget_VenueWidget__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/VenueWidget/VenueWidget.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const PositionDrawer=({memori,open,onClose,venue,setVenue})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_1__.Z,{className:"memori-position-drawer",open,onClose:()=>onClose(venue),title:t("widget.position")||"Position",animated:!1,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("p",{children:t("write_and_speak.requirePositionHelp",{name:memori.name})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_VenueWidget_VenueWidget__WEBPACK_IMPORTED_MODULE_2__.Z,{venue,setVenue,showUncertainty:!1,saveAndClose:venue=>{setVenue(venue),onClose(venue)}})]})};PositionDrawer.displayName="PositionDrawer";const __WEBPACK_DEFAULT_EXPORT__=PositionDrawer;try{PositionDrawer.displayName="PositionDrawer",PositionDrawer.__docgenInfo={description:"",displayName:"PositionDrawer",props:{memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},open:{defaultValue:null,description:"",name:"open",required:!0,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(venue?: Venue | undefined) => void"}},venue:{defaultValue:null,description:"",name:"venue",required:!1,type:{name:"Venue"}},setVenue:{defaultValue:null,description:"",name:"setVenue",required:!0,type:{name:"(venue: Venue) => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/PositionDrawer/PositionDrawer.tsx#PositionDrawer"]={docgenInfo:PositionDrawer.__docgenInfo,name:"PositionDrawer",path:"src/components/PositionDrawer/PositionDrawer.tsx#PositionDrawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/PoweredBy/PoweredBy.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/jsx-runtime.js");const PoweredBy=({tenant,userLang="en",integrationID,memoriHash})=>{const tenantId="memorytwin"===tenant?.theme?"memorytwin":"twincreator"===tenant?.theme?"twincreator":"aisuru";return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div",{className:"memori--powered-by",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img",{src:`https://aisuru.com/images/${tenantId}/logo.png`,alt:""}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("p",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span",{className:"sr-only",children:"Powered by"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("a",{href:`https://memori.ai/${"it"===userLang?.toLowerCase()?"it":"en"}${integrationID?`?integrationID=${integrationID}`:""}${memoriHash?`${integrationID?"&":"?"}memori=${memoriHash}`:""}`,target:"_blank",rel:"noopener noreferrer",children:"Memori.AI"})]})]})};PoweredBy.displayName="PoweredBy";const __WEBPACK_DEFAULT_EXPORT__=PoweredBy;try{PoweredBy.displayName="PoweredBy",PoweredBy.__docgenInfo={description:"",displayName:"PoweredBy",props:{tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},userLang:{defaultValue:{value:"en"},description:"",name:"userLang",required:!1,type:{name:"string"}},integrationID:{defaultValue:null,description:"",name:"integrationID",required:!1,type:{name:"string"}},memoriHash:{defaultValue:null,description:"",name:"memoriHash",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/PoweredBy/PoweredBy.tsx#PoweredBy"]={docgenInfo:PoweredBy.__docgenInfo,name:"PoweredBy",path:"src/components/PoweredBy/PoweredBy.tsx#PoweredBy"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/StartPanel/StartPanel.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_helpers_media__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__("./src/helpers/media.ts"),react_i18next__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Tooltip.tsx"),_helpers_translations__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__("./src/helpers/translations.ts"),_ui_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Translation__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Translation.tsx"),_helpers_constants__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/helpers/constants.ts"),_BlockedMemoriBadge_BlockedMemoriBadge__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./src/components/BlockedMemoriBadge/BlockedMemoriBadge.tsx"),_icons_AI__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./src/components/icons/AI.tsx"),_icons_Group__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./src/components/icons/Group.tsx"),_icons_DeepThought__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./src/components/icons/DeepThought.tsx"),_CompletionProviderStatus_CompletionProviderStatus__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./src/components/CompletionProviderStatus/CompletionProviderStatus.tsx"),_icons_MapMarker__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("./src/components/icons/MapMarker.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__("./node_modules/react/jsx-runtime.js");const StartPanel=({memori,tenant,language,userLang,setUserLang,baseUrl,apiUrl,position,openPositionDrawer,instruct=!1,hasInitialSession=!1,clickedStart,onClickStart,initializeTTS,_TEST_forceProviderStatus,isUserLoggedIn=!1,user,showLogin=!1,setShowLoginDrawer,notEnoughCredits=!1,isMultilanguageEnabled})=>{const{t,i18n}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_12__.$)(),[translatedDescription,setTranslatedDescription]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(memori.description),[showTranslation,setShowTranslation]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!0);return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{(i18n.language?.toUpperCase()??"IT")===(language?.toUpperCase()??"IT")&&translatedDescription===memori.description||!memori.description?.length||(0,_helpers_translations__WEBPACK_IMPORTED_MODULE_13__.i)(memori.description,i18n.language?.toUpperCase()??"IT",language,baseUrl).then((value=>{setTranslatedDescription(value.text)})).catch(console.error)}),[i18n.language,language,memori.description,baseUrl]),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div",{className:"memori--start-panel",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div",{className:"memori--cover",style:{backgroundImage:`url("${(0,_helpers_media__WEBPACK_IMPORTED_MODULE_14__.v)({type:"cover",tenantID:tenant?.id,resourceURI:memori.coverURL,baseURL:baseUrl,apiURL:apiUrl})}"), url("${(0,_helpers_media__WEBPACK_IMPORTED_MODULE_14__.v)({type:"cover",tenantID:tenant?.id,baseURL:baseUrl,apiURL:apiUrl})}")`},children:[!!memori.enableCompletions&&!memori.enableBoardOfExperts&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div",{className:"memori--completions-enabled",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("completionsEnabled"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span",{"aria-label":t("completionsEnabled")||"Completions",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_icons_AI__WEBPACK_IMPORTED_MODULE_6__.default,{})})})}),!!memori.enableBoardOfExperts&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div",{className:"memori--board-of-experts",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("boardOfExperts"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span",{"aria-label":t("boardOfExperts")||"Board of Experts",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_icons_Group__WEBPACK_IMPORTED_MODULE_7__.default,{})})})}),!!memori.nsfw&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div",{className:"memori--nsfw",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("nsfw"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span",{title:t("nsfw")||"NSFW",children:"🔞"})})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("picture",{className:"memori--avatar",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("source",{src:memori.avatarURL??(0,_helpers_media__WEBPACK_IMPORTED_MODULE_14__.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("img",{alt:memori.name,src:memori.avatarURL&&memori.avatarURL.length>0?(0,_helpers_media__WEBPACK_IMPORTED_MODULE_14__.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl}):(0,_helpers_media__WEBPACK_IMPORTED_MODULE_14__.v)({type:"avatar",tenantID:tenant?.id,baseURL:baseUrl,apiURL:apiUrl})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("h2",{className:"memori--title",children:memori.name}),memori.needsPosition&&!position&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div",{className:"memori--needsPosition",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("p",{children:t("write_and_speak.requirePositionHelp",{name:memori.name})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,onClick:()=>openPositionDrawer(),className:"memori--start-button",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_icons_MapMarker__WEBPACK_IMPORTED_MODULE_10__.default,{}),children:t("widget.position")})]}),(memori.needsPosition&&position||!memori.needsPosition)&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div",{className:"memori--description",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("p",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span",{className:"memori--description-text",children:translatedDescription&&showTranslation?translatedDescription:memori.description}),translatedDescription!==memori.description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{ghost:!0,className:"memori--translation-toggle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_icons_Translation__WEBPACK_IMPORTED_MODULE_3__.default,{}),onClick:()=>{setShowTranslation((show=>!show))},children:t(showTranslation?"showOriginalText":"showTranslatedText")})]}),isMultilanguageEnabled&&!instruct&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div",{className:"memori--language-chooser",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("label",{id:"user-lang-pref-label",htmlFor:"user-lang-pref",children:t("write_and_speak.iWantToTalkToIn",{name:memori.name})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("select",{id:"user-lang-pref",className:"memori-select--button",value:(userLang??i18n.language).toUpperCase(),"aria-labelledby":"user-lang-pref-label",onChange:e=>{setUserLang(e.target.value)},children:_helpers_constants__WEBPACK_IMPORTED_MODULE_4__.cG.map((lang=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("option",{value:lang.value,"aria-label":lang.label,children:lang.label},lang.value)))})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,disabled:!!memori.blockedUntil&&!memori.isGiver||notEnoughCredits,loading:clickedStart,onClick:_e=>{try{window.speechSynthesis.speak(new SpeechSynthesisUtterance(""))}catch(e){console.error(e)}initializeTTS&&initializeTTS(),onClickStart&&onClickStart()},className:"memori--start-button",children:t("write_and_speak."+(instruct?"instructButton":hasInitialSession?"resumeButton":"tryMeButton"))}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_CompletionProviderStatus_CompletionProviderStatus__WEBPACK_IMPORTED_MODULE_9__.Z,{provider:memori?.completionConfigForQuestionAnswering?.provider,forceStatus:_TEST_forceProviderStatus}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("p",{className:"memori--start-description",children:t(instruct?"write_and_speak.pageInstructExplanation":"write_and_speak.pageTryMeExplanation")}),(memori.blockedUntil||notEnoughCredits)&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_BlockedMemoriBadge_BlockedMemoriBadge__WEBPACK_IMPORTED_MODULE_5__.Z,{memoriName:memori.name,blockedUntil:memori.blockedUntil,notEnoughCredits,showGiverInfo:memori.isGiver,showTitle:!0,marginLeft:!0}),!!memori.enableDeepThought&&!instruct&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div",{className:"memori--deep-thought-disclaimer",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("deepThoughtHelper"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_icons_DeepThought__WEBPACK_IMPORTED_MODULE_8__.default,{})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("h2",{children:t(isUserLoggedIn&&user?.pAndCUAccepted?"deepThoughtDisclaimerTitle":"deepThought")}),isUserLoggedIn&&!user?.pAndCUAccepted&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("p",{children:t("deepThoughtPreDisclaimerNotAllowed")}),!isUserLoggedIn&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("p",{children:t("deepThoughtPreDisclaimerUnlogged")}),!isUserLoggedIn&&showLogin&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("p",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{outlined:!0,padded:!1,onClick:()=>setShowLoginDrawer(!0),children:"Login"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("p",{className:"memori--deep-thought-disclaimer-text",children:t("deepThoughtDisclaimer")})]})]})]})};StartPanel.displayName="StartPanel";const __WEBPACK_DEFAULT_EXPORT__=StartPanel;try{StartPanel.displayName="StartPanel",StartPanel.__docgenInfo={description:"",displayName:"StartPanel",props:{memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},language:{defaultValue:null,description:"",name:"language",required:!1,type:{name:"string"}},userLang:{defaultValue:null,description:"",name:"userLang",required:!1,type:{name:"string"}},setUserLang:{defaultValue:null,description:"",name:"setUserLang",required:!0,type:{name:"(lang: string) => void"}},baseUrl:{defaultValue:null,description:"",name:"baseUrl",required:!1,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!1,type:{name:"string"}},position:{defaultValue:null,description:"",name:"position",required:!1,type:{name:"Venue"}},openPositionDrawer:{defaultValue:null,description:"",name:"openPositionDrawer",required:!0,type:{name:"() => void"}},integrationConfig:{defaultValue:null,description:"",name:"integrationConfig",required:!1,type:{name:"{ [key: string]: any; }"}},instruct:{defaultValue:{value:"false"},description:"",name:"instruct",required:!1,type:{name:"boolean"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasInitialSession:{defaultValue:{value:"false"},description:"",name:"hasInitialSession",required:!1,type:{name:"boolean"}},clickedStart:{defaultValue:null,description:"",name:"clickedStart",required:!1,type:{name:"boolean"}},onClickStart:{defaultValue:null,description:"",name:"onClickStart",required:!1,type:{name:"(() => void)"}},initializeTTS:{defaultValue:null,description:"",name:"initializeTTS",required:!1,type:{name:"(() => void)"}},_TEST_forceProviderStatus:{defaultValue:null,description:"",name:"_TEST_forceProviderStatus",required:!1,type:{name:"enum",value:[{value:'"operational"'},{value:'"degraded_performance"'},{value:'"partial_outage"'},{value:'"major_outage"'}]}},isUserLoggedIn:{defaultValue:{value:"false"},description:"",name:"isUserLoggedIn",required:!1,type:{name:"boolean"}},user:{defaultValue:null,description:"",name:"user",required:!1,type:{name:"User"}},showLogin:{defaultValue:{value:"false"},description:"",name:"showLogin",required:!1,type:{name:"boolean"}},setShowLoginDrawer:{defaultValue:null,description:"",name:"setShowLoginDrawer",required:!0,type:{name:"(show: boolean) => void"}},notEnoughCredits:{defaultValue:{value:"false"},description:"",name:"notEnoughCredits",required:!1,type:{name:"boolean"}},isMultilanguageEnabled:{defaultValue:null,description:"",name:"isMultilanguageEnabled",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/StartPanel/StartPanel.tsx#StartPanel"]={docgenInfo:StartPanel.__docgenInfo,name:"StartPanel",path:"src/components/StartPanel/StartPanel.tsx#StartPanel"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/VenueWidget/VenueWidget.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>VenueWidget_VenueWidget});var react=__webpack_require__("./node_modules/react/index.js"),useTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js");const DEGREES_TO_RADIANS=Math.PI/180,getUncertaintyByViewport=bouningBox=>{const[minLat,maxLat,minLng,maxLng]="string"==typeof bouningBox[0]?bouningBox.map(parseFloat):bouningBox,phi1=minLat*DEGREES_TO_RADIANS,lambda1=minLng*DEGREES_TO_RADIANS,phi2=maxLat*DEGREES_TO_RADIANS,lambda2=maxLng*DEGREES_TO_RADIANS;return 6367.5*(2*Math.asin(Math.sqrt(Math.sin((phi2-phi1)/2)*Math.sin((phi2-phi1)/2)+Math.cos(phi1)*Math.cos(phi2)*Math.sin((lambda2-lambda1)/2)*Math.sin((lambda2-lambda1)/2))))};var hooks=__webpack_require__("./node_modules/react-leaflet/lib/hooks.js"),MapContainer=__webpack_require__("./node_modules/react-leaflet/lib/MapContainer.js"),TileLayer=__webpack_require__("./node_modules/react-leaflet/lib/TileLayer.js"),Marker=__webpack_require__("./node_modules/react-leaflet/lib/Marker.js"),Popup=__webpack_require__("./node_modules/react-leaflet/lib/Popup.js"),lib_context=__webpack_require__("./node_modules/@react-leaflet/core/lib/context.js"),leaflet_src=__webpack_require__("./node_modules/leaflet/dist/leaflet-src.js"),leaflet_src_default=__webpack_require__.n(leaflet_src),dist=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),Button=__webpack_require__("./src/components/ui/Button.tsx"),utils=__webpack_require__("./src/helpers/utils.ts"),combobox=__webpack_require__("./node_modules/@headlessui/react/dist/components/combobox/combobox.js"),transition=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),Spin=__webpack_require__("./src/components/ui/Spin.tsx"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const Circle=({center,size})=>{const context=(0,lib_context.mE)();return(0,react.useEffect)((()=>{const square=new(leaflet_src_default().Circle)(center,size),container=context.layerContainer||context.map;return container.addLayer(square),()=>{container.removeLayer(square)}})),null},CenterAndZoomUpdater=({center,uncertainty})=>{const[init,setInit]=(0,react.useState)(!1),map=(0,hooks.Sx)(),updateView=(0,react.useCallback)((()=>{let zoom=void 0!==uncertainty?Math.round(Math.log2(1e7/uncertainty)):map.getZoom();map.setView(center,zoom)}),[center,uncertainty,map]);return(0,react.useEffect)((()=>{init||(updateView(),setInit(!0))}),[]),(0,react.useEffect)((()=>{updateView()}),[center,uncertainty,updateView]),null};let DefaultIcon=leaflet_src_default().icon({iconUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",shadowUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12.5,20.5],shadowAnchor:[12.5,20.5]});leaflet_src_default().Marker.prototype.options.icon=DefaultIcon;const getPlaceName=venue=>{let placeName="Position";return venue?.address?placeName=[venue.address.village||venue.address.suburb,venue.address.town||venue.address.city||venue.address.county||venue.address.state,venue.address.country].filter(Boolean).filter(((v,i,a)=>a.indexOf(v)===i)).join(", "):venue?.display_name&&(placeName=venue.display_name),placeName},VenueWidget=({venue,setVenue,showUncertainty=!1,showGpsButton=!0,saveAndClose})=>{const{t}=(0,useTranslation.$)(),[isClient,setIsClient]=(0,react.useState)(!1),[updatingPosition,setUpdatingPosition]=(0,react.useState)(!1),[fetching,setFetching]=(0,react.useState)(!1),[query,setQuery]=(0,react.useState)(""),[suggestions,setSuggestions]=(0,react.useState)([]),handleSearch=(0,utils.DI)((async value=>{setFetching(!0);try{let response=await fetch(`https://nominatim.openstreetmap.org/search?q=${value}&format=jsonv2&limit=5&addressdetails=1`),data=await response.json();setSuggestions(data)}catch(error){console.error(error)}finally{setFetching(!1)}}),1e3);return(0,react.useEffect)((()=>{setIsClient(!0)}),[]),(0,react.useEffect)((()=>{const leafletCSS=document.createElement("link");return leafletCSS.href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",leafletCSS.rel="stylesheet",leafletCSS.integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=",leafletCSS.crossOrigin="",document.head.appendChild(leafletCSS),()=>{document.head.removeChild(leafletCSS)}}),[]),(0,jsx_runtime.jsxs)("fieldset",{className:"memori--venue-widget",children:[(0,jsx_runtime.jsx)("legend",{className:"sr-only",children:"Venue"}),(0,jsx_runtime.jsxs)("div",{className:"memori--venue-widget__form-item",children:[(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget__geosuggest",children:updatingPosition?(0,jsx_runtime.jsx)("p",{children:t("write_and_speak.updatingPosition")}):(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget-search",children:(0,jsx_runtime.jsxs)(combobox.h,{value:venue?.latitude&&venue?.longitude?{place_id:0,lat:venue?.latitude,lon:venue?.longitude,display_name:venue?.placeName}:void 0,onChange:value=>{console.log(value);const placeName=getPlaceName(value);setVenue({latitude:value.lat,longitude:value.lon,placeName,uncertainty:value?.boundingbox?getUncertaintyByViewport(value.boundingbox):2})},children:[(0,jsx_runtime.jsx)(combobox.h.Input,{className:"memori--venue-widget-search--input",displayValue:i=>i?getPlaceName(i):"",placeholder:t("searchVenue"),onChange:e=>{return value=e.target.value,setQuery(value),void handleSearch(value);var value}}),(fetching||suggestions.length>0||0===suggestions.length&&""!==query)&&(0,jsx_runtime.jsx)(transition.u,{as:react.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,jsx_runtime.jsx)(combobox.h.Options,{className:"memori--venue-widget-search--options",children:fetching?(0,jsx_runtime.jsx)(Spin.Z,{spinning:!0,children:(0,jsx_runtime.jsxs)("center",{className:"memori--venue-widget-search--option",children:[t("loading"),"..."]})}):0===suggestions.length&&""!==query?(0,jsx_runtime.jsx)("center",{className:"memori--venue-widget-search--option",children:t("nothingFound")}):suggestions?.map((s=>(0,jsx_runtime.jsx)(combobox.h.Option,{as:react.Fragment,value:s,children:({active,selected})=>(0,jsx_runtime.jsx)("li",{className:classnames_default()("memori--venue-widget-search--option",{"memori--venue-widget-search--option-active":active,"memori--venue-widget-search--option-selected":selected}),children:s.display_name})},s.place_id)))})})]})}),showGpsButton&&(0,jsx_runtime.jsx)(Button.Z,{className:"memori--venue-widget__gps-button",primary:!0,loading:updatingPosition,onClick:()=>{setUpdatingPosition(!0),(async()=>{setUpdatingPosition(!0),navigator.geolocation.getCurrentPosition((async coords=>{let venue={latitude:coords.coords.latitude,longitude:coords.coords.longitude,placeName:"Position",uncertainty:coords.coords.accuracy/1e3};try{const result=await fetch(`https://nominatim.openstreetmap.org/reverse?lat=${coords.coords.latitude}&lon=${coords.coords.longitude}&format=jsonv2&addressdetails=1`),response=await result.json(),placeName=getPlaceName(response);venue={latitude:coords.coords.latitude,longitude:coords.coords.longitude,placeName,uncertainty:coords.coords.accuracy/1e3},setVenue(venue)}catch(e){let err=e;console.error("[POSITION ERROR]",err),err?.message&&dist.ZP.error(err.message),setVenue(venue)}finally{saveAndClose&&saveAndClose(venue)}setUpdatingPosition(!1)}),(err=>{console.error("[POSITION ERROR]",err),dist.ZP.error(err.message),setUpdatingPosition(!1)}))})()},children:t("write_and_speak.useMyPosition")})]})}),(0,jsx_runtime.jsx)("div",{children:(0,jsx_runtime.jsx)(Button.Z,{outlined:!0,className:"memori--venue-widget__no-location-button",onClick:()=>{let venue={latitude:0,longitude:0,placeName:"Position",uncertainty:0};setVenue(venue),saveAndClose&&saveAndClose(venue)},children:t("write_and_speak.dontWantToProvidePosition")})}),showUncertainty&&(0,jsx_runtime.jsxs)("label",{className:"memori--venue-widget__select-label",children:[(0,jsx_runtime.jsxs)("span",{children:[t("uncertain"),": "]}),(0,jsx_runtime.jsxs)("select",{className:"memori-select--button memori--venue-widget__uncertainty",value:parseFloat((venue?.uncertainty??0).toFixed(2)),disabled:!(venue&&venue.placeName&&venue.latitude&&venue.longitude),onChange:e=>{setVenue({...venue,uncertainty:parseFloat(e.target.value)})},children:[venue?.uncertainty&&![0,1,2,5,10,20,50,100].includes(venue.uncertainty)&&(0,jsx_runtime.jsxs)("option",{value:venue.uncertainty,children:[venue.uncertainty," Km"]}),(0,jsx_runtime.jsx)("option",{value:0,children:t("exactPosition")}),(0,jsx_runtime.jsx)("option",{value:1,children:"1 km"}),(0,jsx_runtime.jsx)("option",{value:2,children:"2 km"}),(0,jsx_runtime.jsx)("option",{value:5,children:"5 km"}),(0,jsx_runtime.jsx)("option",{value:10,children:"10 km"}),(0,jsx_runtime.jsx)("option",{value:20,children:"20 km"}),(0,jsx_runtime.jsx)("option",{value:50,children:"50 km"}),(0,jsx_runtime.jsx)("option",{value:100,children:"100 km"})]})]})]}),(0,jsx_runtime.jsxs)("div",{className:"memori--venue-widget__form-item",children:[venue?.placeName&&"Position"!==venue.placeName&&(0,jsx_runtime.jsxs)("p",{className:"memori--venue--widget__place-name",children:[(0,jsx_runtime.jsx)("strong",{children:t("venue")}),": ",venue.placeName]}),(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget__map",children:isClient&&(0,jsx_runtime.jsxs)(MapContainer.h,{className:"memori--venue-widget__map",center:venue?.latitude&&venue?.longitude?[venue.latitude,venue.longitude]:[44.66579,11.48823],zoom:13,scrollWheelZoom:!0,children:[(0,jsx_runtime.jsx)(TileLayer.I,{attribution:'© OpenStreetMap contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),(0,jsx_runtime.jsx)(CenterAndZoomUpdater,{center:venue?.latitude&&venue?.longitude?[venue.latitude,venue.longitude]:[44.66579,11.48823],uncertainty:1e3*(venue?.uncertainty??0)}),venue?.latitude&&venue?.longitude&&(0,jsx_runtime.jsx)(Marker.J,{position:[venue.latitude,venue.longitude],icon:DefaultIcon,children:(0,jsx_runtime.jsx)(Popup.G,{children:venue.placeName??""})}),venue?.latitude&&venue?.longitude&&void 0!==venue?.uncertainty&&(0,jsx_runtime.jsx)(Circle,{center:[venue.latitude,venue.longitude],size:1e3*venue.uncertainty})]})})]})]})};VenueWidget.displayName="VenueWidget";const VenueWidget_VenueWidget=VenueWidget;try{VenueWidget.displayName="VenueWidget",VenueWidget.__docgenInfo={description:"",displayName:"VenueWidget",props:{venue:{defaultValue:null,description:"",name:"venue",required:!1,type:{name:"Venue"}},setVenue:{defaultValue:null,description:"",name:"setVenue",required:!0,type:{name:"(venue: Venue) => void"}},showUncertainty:{defaultValue:{value:"false"},description:"",name:"showUncertainty",required:!1,type:{name:"boolean"}},showGpsButton:{defaultValue:{value:"true"},description:"",name:"showGpsButton",required:!1,type:{name:"boolean"}},saveAndClose:{defaultValue:null,description:"",name:"saveAndClose",required:!1,type:{name:"((venue: Venue) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/VenueWidget/VenueWidget.tsx#VenueWidget"]={docgenInfo:VenueWidget.__docgenInfo,name:"VenueWidget",path:"src/components/VenueWidget/VenueWidget.tsx#VenueWidget"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/ChevronLeft.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChevronLeft=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M15 18L9 12 15 6"})});ChevronLeft.displayName="ChevronLeft";const __WEBPACK_DEFAULT_EXPORT__=ChevronLeft;try{ChevronLeft.displayName="ChevronLeft",ChevronLeft.__docgenInfo={description:"",displayName:"ChevronLeft",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/ChevronLeft.tsx#ChevronLeft"]={docgenInfo:ChevronLeft.__docgenInfo,name:"ChevronLeft",path:"src/components/icons/ChevronLeft.tsx#ChevronLeft"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/ChevronRight.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChevronRight=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M9 18L15 12 9 6"})});ChevronRight.displayName="ChevronRight";const __WEBPACK_DEFAULT_EXPORT__=ChevronRight;try{ChevronRight.displayName="ChevronRight",ChevronRight.__docgenInfo={description:"",displayName:"ChevronRight",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/ChevronRight.tsx#ChevronRight"]={docgenInfo:ChevronRight.__docgenInfo,name:"ChevronRight",path:"src/components/icons/ChevronRight.tsx#ChevronRight"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Delete.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Delete=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"})});Delete.displayName="Delete";const __WEBPACK_DEFAULT_EXPORT__=Delete;try{Delete.displayName="Delete",Delete.__docgenInfo={description:"",displayName:"Delete",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Delete.tsx#Delete"]={docgenInfo:Delete.__docgenInfo,name:"Delete",path:"src/components/icons/Delete.tsx#Delete"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Edit.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Edit=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"})});Edit.displayName="Edit";const __WEBPACK_DEFAULT_EXPORT__=Edit;try{Edit.displayName="Edit",Edit.__docgenInfo={description:"",displayName:"Edit",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Edit.tsx#Edit"]={docgenInfo:Edit.__docgenInfo,name:"Edit",path:"src/components/icons/Edit.tsx#Edit"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Eye.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Eye=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"})});Eye.displayName="Eye";const __WEBPACK_DEFAULT_EXPORT__=Eye;try{Eye.displayName="Eye",Eye.__docgenInfo={description:"",displayName:"Eye",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Eye.tsx#Eye"]={docgenInfo:Eye.__docgenInfo,name:"Eye",path:"src/components/icons/Eye.tsx#Eye"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/EyeInvisible.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const EyeInvisible=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z"})]});EyeInvisible.displayName="EyeInvisible";const __WEBPACK_DEFAULT_EXPORT__=EyeInvisible;try{EyeInvisible.displayName="EyeInvisible",EyeInvisible.__docgenInfo={description:"",displayName:"EyeInvisible",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/EyeInvisible.tsx#EyeInvisible"]={docgenInfo:EyeInvisible.__docgenInfo,name:"EyeInvisible",path:"src/components/icons/EyeInvisible.tsx#EyeInvisible"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Plus.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Plus=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className,"aria-label":title,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"})]});Plus.displayName="Plus";const __WEBPACK_DEFAULT_EXPORT__=Plus;try{Plus.displayName="Plus",Plus.__docgenInfo={description:"",displayName:"Plus",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Plus.tsx#Plus"]={docgenInfo:Plus.__docgenInfo,name:"Plus",path:"src/components/icons/Plus.tsx#Plus"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Warning.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Warning=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"})});Warning.displayName="Warning";const __WEBPACK_DEFAULT_EXPORT__=Warning;try{Warning.displayName="Warning",Warning.__docgenInfo={description:"",displayName:"Warning",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Warning.tsx#Warning"]={docgenInfo:Warning.__docgenInfo,name:"Warning",path:"src/components/icons/Warning.tsx#Warning"})}catch(__react_docgen_typescript_loader_error){}},"?875c":()=>{},"?f824":()=>{},"?a523":()=>{},"?540f":()=>{},"?71f6":()=>{},"?3dbe":()=>{},"?c417":()=>{}}]); \ No newline at end of file diff --git a/8693.d1426e62.iframe.bundle.js b/8693.d1426e62.iframe.bundle.js new file mode 100644 index 00000000..3383a07e --- /dev/null +++ b/8693.d1426e62.iframe.bundle.js @@ -0,0 +1 @@ +(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[8693],{"./src/components/AgeVerificationModal/AgeVerificationModal.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react_i18next__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),react_hot_toast__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),_ui_Button__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Modal__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Modal.tsx"),luxon__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/luxon/src/luxon.js"),_DateSelector_DateSelector__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/DateSelector/DateSelector.tsx"),react__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/index.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react/jsx-runtime.js");const AgeVerificationModal=({visible=!1,onClose,minAge})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_7__.$)(),[birthDate,setBirthDate]=(0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(),[error,setError]=(0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(),[submitting,setSubmitting]=(0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(!1),onSubmit=(0,react__WEBPACK_IMPORTED_MODULE_5__.useCallback)((()=>{if(setSubmitting(!0),!birthDate)return react_hot_toast__WEBPACK_IMPORTED_MODULE_0__.ZP.error(t("requiredField")),setError(t("requiredField")||"Required field"),void setSubmitting(!1);if(luxon__WEBPACK_IMPORTED_MODULE_3__.ou.now().diff(birthDate,"years").yearsonClose(),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("p",{children:t("ageVerificationText",{minAge})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("form",{className:"age-verification-form",onSubmit:e=>{e.preventDefault(),onSubmit()},children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div",{className:"form-item",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("fieldset",{name:"birthDate",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("legend",{className:"sr-only",children:t("birthDate")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_DateSelector_DateSelector__WEBPACK_IMPORTED_MODULE_4__.Z,{defaultDate:new Date(Date.now()),onChange:date=>{setBirthDate(date)}}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("p",{className:"form-item-help",children:t("birthDateHelper")}),error&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("p",{className:"form-item-error",children:error})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div",{className:"form-item form-submit",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:!0,htmlType:"submit",className:"age-verification-submit",loading:submitting,disabled:!birthDate,children:t("confirm")})})]})]})};AgeVerificationModal.displayName="AgeVerificationModal";const __WEBPACK_DEFAULT_EXPORT__=AgeVerificationModal;try{AgeVerificationModal.displayName="AgeVerificationModal",AgeVerificationModal.__docgenInfo={description:"",displayName:"AgeVerificationModal",props:{visible:{defaultValue:{value:"false"},description:"",name:"visible",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(birthDate?: string | undefined) => void"}},minAge:{defaultValue:null,description:"",name:"minAge",required:!0,type:{name:"number"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AgeVerificationModal/AgeVerificationModal.tsx#AgeVerificationModal"]={docgenInfo:AgeVerificationModal.__docgenInfo,name:"AgeVerificationModal",path:"src/components/AgeVerificationModal/AgeVerificationModal.tsx#AgeVerificationModal"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/Auth/Auth.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),react_i18next__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_ui_Button__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Modal__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Modal.tsx"),react_hook_form__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react-hook-form/dist/index.esm.mjs"),_icons_Plus__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Plus.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react/jsx-runtime.js");const AuthWidget=({pwdOrTokens,setPwdOrTokens,onFinish,minimumNumberOfRecoveryTokens=1,showTokens=!0,openModal=!1,withModal=!1})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_5__.$)(),{register,handleSubmit,formState:{errors},setError}=(0,react_hook_form__WEBPACK_IMPORTED_MODULE_6__.cI)(),[numTokens,setNumTokens]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(1),[showModal,setShowModal]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!!pwdOrTokens),form=(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("form",{name:"memoriAuth",onSubmit:handleSubmit((data=>{"password"===pwdOrTokens&&!data.password?.length||"tokens"===pwdOrTokens&&((data?.tokens?.length||0)t.length)))?setError("tokens",{type:"minLength",message:"Tokens"}):onFinish&&onFinish(data).then((()=>{setShowModal(!1)}))})),className:"memori-auth-widget--form",children:[("password"===pwdOrTokens||!showTokens)&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("fieldset",{className:"memori-auth-widget--password-fieldset",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("label",{children:["Password:"," ",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("input",{className:"memori-auth-widget--input",required:!0,type:"password",placeholder:"Password",...register("password",{required:!0})})]}),showTokens&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("hr",{}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{outlined:!0,onClick:()=>setPwdOrTokens("tokens"),children:t("auth.useRecoveryTokens")||"Recovery tokens"})]})]}),"tokens"===pwdOrTokens&&showTokens&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("fieldset",{className:"memori-auth-widget--tokens-fieldset",name:"tokens",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("legend",{children:[t("auth.tokens"),": "]}),(length=numTokens,Array.from({length},((_,i)=>i))).map((idx=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("label",{className:"memori-auth-widget--token",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("input",{type:"password",className:"memori-auth-widget--input",placeholder:"Recovery token",required:!0,autoComplete:"off",...register(`tokens.${idx}`,{required:!0})})},idx))),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{onClick:()=>setNumTokens((t=>t+1)),className:"memori-auth-widget--token-add",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_icons_Plus__WEBPACK_IMPORTED_MODULE_3__.default,{}),children:t("auth.addToken")||"Add token"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("hr",{}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{outlined:!0,onClick:()=>setPwdOrTokens("password"),children:t("auth.usePassword")||"Password"})]}),"minLength"===errors.tokens?.type&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div",{className:"memori-auth-widget--error",children:[t("auth.atLeast")||"At least"," ",minimumNumberOfRecoveryTokens]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{htmlType:"submit",primary:!0,className:"memori-auth-widget--submit",children:t("confirm")||"Submit"})]});var length;return withModal?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_2__.Z,{open:openModal||showModal,title:t("auth.title")||"Authentication",onClose:()=>setPwdOrTokens(null),closable:!1,children:form}):form},__WEBPACK_DEFAULT_EXPORT__=AuthWidget;try{AuthWidget.displayName="AuthWidget",AuthWidget.__docgenInfo={description:"",displayName:"AuthWidget",props:{pwdOrTokens:{defaultValue:null,description:"",name:"pwdOrTokens",required:!0,type:{name:'"password" | "tokens" | null'}},setPwdOrTokens:{defaultValue:null,description:"",name:"setPwdOrTokens",required:!0,type:{name:'(state: "password" | "tokens" | null) => void'}},onFinish:{defaultValue:null,description:"",name:"onFinish",required:!1,type:{name:"((values: AuthInputs) => Promise)"}},minimumNumberOfRecoveryTokens:{defaultValue:{value:"1"},description:"",name:"minimumNumberOfRecoveryTokens",required:!1,type:{name:"number"}},showTokens:{defaultValue:{value:"true"},description:"",name:"showTokens",required:!1,type:{name:"boolean"}},withModal:{defaultValue:{value:"false"},description:"",name:"withModal",required:!1,type:{name:"boolean"}},openModal:{defaultValue:{value:"false"},description:"",name:"openModal",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Auth/Auth.tsx#AuthWidget"]={docgenInfo:AuthWidget.__docgenInfo,name:"AuthWidget",path:"src/components/Auth/Auth.tsx#AuthWidget"})}catch(__react_docgen_typescript_loader_error){}try{Auth.displayName="Auth",Auth.__docgenInfo={description:"",displayName:"Auth",props:{pwdOrTokens:{defaultValue:null,description:"",name:"pwdOrTokens",required:!0,type:{name:'"password" | "tokens" | null'}},setPwdOrTokens:{defaultValue:null,description:"",name:"setPwdOrTokens",required:!0,type:{name:'(state: "password" | "tokens" | null) => void'}},onFinish:{defaultValue:null,description:"",name:"onFinish",required:!1,type:{name:"((values: AuthInputs) => Promise)"}},minimumNumberOfRecoveryTokens:{defaultValue:{value:"1"},description:"",name:"minimumNumberOfRecoveryTokens",required:!1,type:{name:"number"}},showTokens:{defaultValue:{value:"true"},description:"",name:"showTokens",required:!1,type:{name:"boolean"}},withModal:{defaultValue:{value:"false"},description:"",name:"withModal",required:!1,type:{name:"boolean"}},openModal:{defaultValue:{value:"false"},description:"",name:"openModal",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Auth/Auth.tsx#Auth"]={docgenInfo:Auth.__docgenInfo,name:"Auth",path:"src/components/Auth/Auth.tsx#Auth"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/Avatar/Avatar.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>Avatar_Avatar});var react=__webpack_require__("./node_modules/react/index.js"),Button=__webpack_require__("./src/components/ui/Button.tsx"),withTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/withTranslation.js"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");class ErrorBoundary extends react.Component{state={hasError:!1};static getDerivedStateFromError(_){return{hasError:!0}}componentDidCatch(error,errorInfo){console.error("Uncaught error:",error,errorInfo)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,jsx_runtime.jsxs)("div",{style:{background:"rgba(255, 255, 255, 0.4)",color:"#000",padding:"2rem",borderRadius:"10px"},children:[(0,jsx_runtime.jsx)("h2",{children:this.props.t("error.generic")}),(0,jsx_runtime.jsx)(Button.Z,{primary:!0,onClick:()=>this.setState({hasError:!1}),children:this.props.t("error.tryAgain")||"Try again"})]}):this.props.children}}ErrorBoundary.displayName="ErrorBoundary";const ErrorBoundary_ErrorBoundary=(0,withTranslation.Z)(["common"])(ErrorBoundary);var Tooltip=__webpack_require__("./src/components/ui/Tooltip.tsx"),media=__webpack_require__("./src/helpers/media.ts"),Blob=__webpack_require__("./src/components/Blob/Blob.tsx"),ModelViewer=__webpack_require__("./src/components/CustomGLBModelViewer/ModelViewer.tsx"),useTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),Eye=__webpack_require__("./src/components/icons/Eye.tsx"),EyeInvisible=__webpack_require__("./src/components/icons/EyeInvisible.tsx"),Edit=__webpack_require__("./src/components/icons/Edit.tsx"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),AvatarView=__webpack_require__("./src/components/Avatar/AvatarView/index.tsx"),visemeContext=__webpack_require__("./src/context/visemeContext.tsx");const Avatar=({memori,integration,integrationConfig,tenant,instruct=!1,avatar3dVisible=!1,setAvatar3dVisible,hasUserActivatedSpeak=!1,isPlayingAudio=!1,loading=!1,baseUrl,apiUrl,animation,isZoomed=!1,chatProps,avatarType=null,enablePositionControls,setEnablePositionControls,isTotem=!1})=>{const{t}=(0,useTranslation.$)(),[isClient,setIsClient]=(0,react.useState)(!1),{stopProcessing,updateCurrentViseme,resetVisemeQueue}=(0,visemeContext.LG)();(0,react.useEffect)((()=>{setIsClient(!0)}),[]);const getAvatarUrl=()=>{if("userAvatar"===integrationConfig?.avatar&&memori.avatarURL&&memori.avatarURL.length>0)return(0,media.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl})},renderAvatarContent=()=>isClient?"readyplayerme"===integrationConfig?.avatar||"readyplayerme-full"===integrationConfig?.avatar||"customrpm"===integrationConfig?.avatar?(0,jsx_runtime.jsx)(ErrorBoundary_ErrorBoundary,{fallback:(0,jsx_runtime.jsx)("div",{className:"memori--blob-container",children:isClient&&(0,jsx_runtime.jsx)(Blob.Z,{speaking:isPlayingAudio,avatar:getAvatarUrl()})}),children:(0,jsx_runtime.jsx)(AvatarView.Z,{enablePositionControls,updateCurrentViseme,url:integrationConfig.avatarURL,sex:"FEMALE"===memori.voiceType?"FEMALE":"MALE",fallbackImg:getAvatarUrl(),headMovement:!0,eyeBlink:!0,animation,halfBody:"readyplayerme"===integrationConfig.avatar,speaking:isPlayingAudio,loading,style:getAvatarStyle(),stopProcessing,resetVisemeQueue,isZoomed,isTotem,chatEmission:chatProps?.dialogState?.emission,setEnablePositionControls})}):"customglb"===integrationConfig?.avatar?(0,jsx_runtime.jsx)(ModelViewer.Z,{poster:getAvatarUrl()||"",src:integrationConfig.avatarURL,alt:""}):null:null,renderAvatarToggle=()=>(0,jsx_runtime.jsx)("div",{className:"memori--avatar-toggle",children:(0,jsx_runtime.jsx)(Button.Z,{ghost:!0,onClick:()=>setAvatar3dVisible(!avatar3dVisible),icon:avatar3dVisible?(0,jsx_runtime.jsx)(EyeInvisible.default,{}):(0,jsx_runtime.jsx)(Eye.default,{}),children:(0,jsx_runtime.jsx)("span",{className:"memori--avatar-toggle-text",children:t(avatar3dVisible?"hide":"show")})})}),getAvatarStyle=()=>"readyplayerme"===integrationConfig?.avatar?{width:"100%",height:"100%",backgroundColor:"none",boxShadow:"none"}:{width:"100%",height:"100%",backgroundColor:"none"};return(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[("readyplayerme"===integrationConfig?.avatar||"readyplayerme-full"===integrationConfig?.avatar||"customglb"===integrationConfig?.avatar||"customrpm"===integrationConfig?.avatar)&&integrationConfig?.avatarURL&&avatarType&&"blob"!==avatarType?(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)("div",{className:classnames_default()("memori--avatar-wrapper",`memori--avatar-${integrationConfig?.avatar||"default"}`,{hidden:!avatar3dVisible}),children:renderAvatarContent()}),renderAvatarToggle()]}):(0,jsx_runtime.jsx)("div",{className:"memori--blob-container",children:isClient&&(0,jsx_runtime.jsx)(Blob.Z,{speaking:isPlayingAudio,avatar:getAvatarUrl()})}),(()=>{if(!instruct||hasUserActivatedSpeak||!memori.isGiver||!tenant?.id)return null;const href=`https://${tenant.id}/${"it-IT"===memori.culture?"it":"en"}/${memori.ownerUserName}/${memori.name}/integrations${integration?.integrationID?`?integration=${integration.integrationID}&openAvatarModal=true`:""}`;return(0,jsx_runtime.jsx)("div",{className:"memori--avatar-link-to-integrations",children:(0,jsx_runtime.jsx)("a",{className:"memori-button memori-button--circle memori-button--outlined",href,children:(0,jsx_runtime.jsx)(Tooltip.Z,{content:t("widgetgoToIntegrationsToCustomizeAvatar"),children:(0,jsx_runtime.jsx)("span",{className:"memori-button--icon",children:(0,jsx_runtime.jsx)(Edit.default,{})})})})})})()]})},Avatar_Avatar=(0,react.memo)(Avatar,((prevProps,nextProps)=>JSON.stringify(prevProps)===JSON.stringify(nextProps)));try{Avatar.displayName="Avatar",Avatar.__docgenInfo={description:"",displayName:"Avatar",props:{memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},integration:{defaultValue:null,description:"",name:"integration",required:!1,type:{name:"Integration"}},integrationConfig:{defaultValue:null,description:"",name:"integrationConfig",required:!1,type:{name:"{ [key: string]: any; }"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},instruct:{defaultValue:{value:"false"},description:"",name:"instruct",required:!1,type:{name:"boolean"}},hasUserActivatedSpeak:{defaultValue:{value:"false"},description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},avatar3dVisible:{defaultValue:{value:"false"},description:"",name:"avatar3dVisible",required:!1,type:{name:"boolean"}},setAvatar3dVisible:{defaultValue:null,description:"",name:"setAvatar3dVisible",required:!0,type:{name:"(visible: boolean) => void"}},isPlayingAudio:{defaultValue:{value:"false"},description:"",name:"isPlayingAudio",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},baseUrl:{defaultValue:null,description:"",name:"baseUrl",required:!1,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!1,type:{name:"string"}},animation:{defaultValue:null,description:"",name:"animation",required:!1,type:{name:"string"}},isZoomed:{defaultValue:{value:"false"},description:"",name:"isZoomed",required:!1,type:{name:"boolean"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"any"}},enablePositionControls:{defaultValue:null,description:"",name:"enablePositionControls",required:!1,type:{name:"boolean"}},setEnablePositionControls:{defaultValue:null,description:"",name:"setEnablePositionControls",required:!0,type:{name:"(value: boolean) => void"}},avatarType:{defaultValue:{value:"null"},description:"",name:"avatarType",required:!1,type:{name:'"blob" | "avatar3d" | null'}},isTotem:{defaultValue:{value:"false"},description:"",name:"isTotem",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Avatar/Avatar.tsx#Avatar"]={docgenInfo:Avatar.__docgenInfo,name:"Avatar",path:"src/components/Avatar/Avatar.tsx#Avatar"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/Blob/Blob.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ExperienceBlob=({avatar,speaking=!1})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-blob",{"memori-blob--speaking":speaking}),children:[avatar&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("figure",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("img",{src:avatar,alt:"",role:"presentation"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"})]});ExperienceBlob.displayName="ExperienceBlob";const __WEBPACK_DEFAULT_EXPORT__=ExperienceBlob;try{Blob.displayName="Blob",Blob.__docgenInfo={description:"",displayName:"Blob",props:{avatar:{defaultValue:null,description:"",name:"avatar",required:!1,type:{name:"string"}},speaking:{defaultValue:{value:"false"},description:"",name:"speaking",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Blob/Blob.tsx#Blob"]={docgenInfo:Blob.__docgenInfo,name:"Blob",path:"src/components/Blob/Blob.tsx#Blob"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/BlockedMemoriBadge/BlockedMemoriBadge.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var _ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Tooltip.tsx"),_icons_Warning__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Warning.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const BlockedMemoriBadge=({memoriName,blockedUntil,notEnoughCredits=!1,showGiverInfo=!1,showTitle=!1,marginLeft=!1})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)(),blockedUntilDate=new Date(blockedUntil||Date.now());return notEnoughCredits||blockedUntilDate>new Date(Date.now())?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{className:"blocked-memori-badge--tooltip",content:notEnoughCredits?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.Fragment,{children:t("notEnoughCredits")}):(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.Fragment,{children:[!showGiverInfo&&t("memoriBlockedAnon",{name:memoriName,date:new Intl.DateTimeFormat("it",{day:"numeric",month:"long",year:"numeric"}).format(blockedUntilDate)}),showGiverInfo&&t("memoriBlockedUntil",{date:new Intl.DateTimeFormat("it",{day:"numeric",month:"long",year:"numeric"}).format(blockedUntilDate)}),showGiverInfo&&` ${t("memoriBlockedReasonExceedChats")}`,showGiverInfo&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("br",{}),showGiverInfo&&`\n${t("memoriBlockedGiverHelper")}`]}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:"blocked-memori-badge--wrapper",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"blocked-memori-badge "+(marginLeft?" margin-left":""),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Warning__WEBPACK_IMPORTED_MODULE_2__.default,{className:"blocked-memori-badge--icon"})}),showTitle&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"blocked-memori-badge--title",children:t("memoriBlockedTitle")})]})}):null},__WEBPACK_DEFAULT_EXPORT__=BlockedMemoriBadge;try{BlockedMemoriBadge.displayName="BlockedMemoriBadge",BlockedMemoriBadge.__docgenInfo={description:"",displayName:"BlockedMemoriBadge",props:{memoriName:{defaultValue:null,description:"",name:"memoriName",required:!0,type:{name:"string"}},blockedUntil:{defaultValue:null,description:"",name:"blockedUntil",required:!1,type:{name:"string"}},notEnoughCredits:{defaultValue:{value:"false"},description:"",name:"notEnoughCredits",required:!1,type:{name:"boolean"}},showGiverInfo:{defaultValue:{value:"false"},description:"",name:"showGiverInfo",required:!1,type:{name:"boolean"}},showTitle:{defaultValue:{value:"false"},description:"",name:"showTitle",required:!1,type:{name:"boolean"}},marginLeft:{defaultValue:{value:"false"},description:"",name:"marginLeft",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/BlockedMemoriBadge/BlockedMemoriBadge.tsx#BlockedMemoriBadge"]={docgenInfo:BlockedMemoriBadge.__docgenInfo,name:"BlockedMemoriBadge",path:"src/components/BlockedMemoriBadge/BlockedMemoriBadge.tsx#BlockedMemoriBadge"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ChangeMode/ChangeMode.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var _headlessui_react__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/@headlessui/react/dist/components/radio-group/radio-group.js"),react_i18next__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_ui_Button__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Button.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChangeMode=({instruct,canInstruct,onChangeMode})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_3__.$)();return canInstruct?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"memori--changeMode-instruct",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.E,{name:"instruct",value:instruct?"instruct":"test",defaultValue:instruct?"instruct":"test",className:"memori--changeMode-instruct-radio",onChange:onChangeMode,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.E.Option,{value:"instruct",className:"memori--changeMode-instruct-radio-button",children:({checked})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:checked,children:t("widget.instruct")||"Instruct"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.E.Option,{value:"test",className:"memori--changeMode-instruct-radio-button",children:({checked})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:checked,children:t("widget.test")||"Test"})})]})}):null},__WEBPACK_DEFAULT_EXPORT__=ChangeMode;try{ChangeMode.displayName="ChangeMode",ChangeMode.__docgenInfo={description:"",displayName:"ChangeMode",props:{instruct:{defaultValue:null,description:"",name:"instruct",required:!1,type:{name:"boolean"}},onChangeMode:{defaultValue:null,description:"",name:"onChangeMode",required:!0,type:{name:'(mode: "instruct" | "test") => void'}},canInstruct:{defaultValue:null,description:"",name:"canInstruct",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ChangeMode/ChangeMode.tsx#ChangeMode"]={docgenInfo:ChangeMode.__docgenInfo,name:"ChangeMode",path:"src/components/ChangeMode/ChangeMode.tsx#ChangeMode"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/CompletionProviderStatus/CompletionProviderStatus.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Tooltip.tsx"),_icons_Warning__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Warning.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const CompletionProviderStatus=({forceStatus,provider="OpenAI"})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)(),[status,setStatus]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(forceStatus??"operational"),providerStatus=(provider=>{switch(provider){case"OpenAI":return{getStatus:async()=>{const res=await fetch("https://status.openai.com/api/v2/summary.json"),data=await res.json(),status=data.components.find((component=>"API"===component.name))?.status;return status??"operational"},statusPage:"https://status.openai.com/"};case"Mistral":return{getStatus:async()=>{const res=await fetch("https://status.mistral-data.com/api/v2/summary.json"),data=await res.json(),status=data.components.find((component=>"API"===component.name))?.status;return status??"operational"},statusPage:"https://status.mistral-data.com/"};case"Anthropic":return{getStatus:async()=>{const res=await fetch("https://status.anthropic.com/api/v2/summary.json"),data=await res.json(),status=data.components.find((component=>"API"===component.name))?.status;return status??"operational"},statusPage:"https://status.anthropic.com/"};default:return{getStatus:async()=>"operational",statusPage:""}}})(provider);return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{forceStatus||providerStatus.getStatus().then((status=>setStatus(status))).catch(console.log)}),[forceStatus,providerStatus]),"operational"!==status?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{className:"memori--completion-provider-status--tooltip",align:"topLeft",content:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("p",{children:t("completionProviderDown",{provider:provider??t("completionProviderFallbackName")})}),!!providerStatus.statusPage?.length&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("p",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("a",{href:providerStatus.statusPage,rel:"noopener noreferrer",target:"_blank",children:t("completionProviderCheckStatusPage")})})]}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Warning__WEBPACK_IMPORTED_MODULE_2__.default,{className:"memori--completion-provider-status--icon"})}):null},__WEBPACK_DEFAULT_EXPORT__=CompletionProviderStatus;try{CompletionProviderStatus.displayName="CompletionProviderStatus",CompletionProviderStatus.__docgenInfo={description:"",displayName:"CompletionProviderStatus",props:{forceStatus:{defaultValue:null,description:"",name:"forceStatus",required:!1,type:{name:"enum",value:[{value:'"operational"'},{value:'"degraded_performance"'},{value:'"partial_outage"'},{value:'"major_outage"'}]}},provider:{defaultValue:{value:"OpenAI"},description:"",name:"provider",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/CompletionProviderStatus/CompletionProviderStatus.tsx#CompletionProviderStatus"]={docgenInfo:CompletionProviderStatus.__docgenInfo,name:"CompletionProviderStatus",path:"src/components/CompletionProviderStatus/CompletionProviderStatus.tsx#CompletionProviderStatus"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/DateSelector/DateSelector.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/@headlessui/react/dist/components/listbox/listbox.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),luxon__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/luxon/src/luxon.js"),react_i18next__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/SelectIcon.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const months={en:["January","February","March","April","May","June","July","August","September","October","November","December"],it:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]},DateSelector=(0,react__WEBPACK_IMPORTED_MODULE_0__.memo)((({defaultDate,onChange,disabled=!1})=>{const{t,i18n}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)(),[date,setDate]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(defaultDate?"string"==typeof defaultDate?luxon__WEBPACK_IMPORTED_MODULE_1__.ou.fromISO(defaultDate):luxon__WEBPACK_IMPORTED_MODULE_1__.ou.fromJSDate(defaultDate):luxon__WEBPACK_IMPORTED_MODULE_1__.ou.now());return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{onChange(date)}),[date,onChange]),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:"memori--date-selector",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori--date-selector__select",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R,{value:date,onChange:value=>{setDate(value)},disabled,name:"day",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Label,{className:"memori--date-selector__select-label",children:[t("day"),":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Button,{"aria-label":t("day"),className:"memori--date-selector__select-button",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--value",children:date.day}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__.default,{})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Options,{className:"memori--date-selector__select-options",children:[...Array(31).keys()].map((day=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Option,{value:date.set({day:day+1}),className:"memori--date-selector__select-option",children:day+1},day)))})})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori--date-selector__select",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R,{value:date,onChange:value=>{setDate(value)},disabled,name:"month",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Label,{className:"memori--date-selector__select-label",children:[t("month"),":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Button,{"aria-label":t("month"),className:"memori--date-selector__select-button",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--value",children:months["it"===i18n.language?"it":"en"][date.month-1]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__.default,{})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Options,{className:"memori--date-selector__select-options",children:months["it"===i18n.language?"it":"en"].map((month=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Option,{className:"memori--date-selector__select-option",value:date.set({month:months["it"===i18n.language?"it":"en"].findIndex((m=>m===month))+1}),children:month},month)))})})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori--date-selector__select",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R,{value:date,onChange:value=>{setDate(value)},disabled,name:"year",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Label,{className:"memori--date-selector__select-label",children:[t("year"),":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Button,{"aria-label":t("year"),className:"memori--date-selector__select-button",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--value",children:date.year}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__.default,{})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Options,{className:"memori--date-selector__select-options",children:[...Array(luxon__WEBPACK_IMPORTED_MODULE_1__.ou.now().year-1899).keys()].sort(((a,b)=>b-a)).map((year=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Option,{value:date.set({year:year+1900}),className:"memori--date-selector__select-option",children:year+1900},year)))})})]})})]})}));DateSelector.displayName="DateSelector";const __WEBPACK_DEFAULT_EXPORT__=DateSelector},"./src/components/ExpertsDrawer/ExpertsDrawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var _ui_Drawer__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./src/components/ui/Drawer.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_helpers_media__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/helpers/media.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ExpertsDrawer=({open=!1,baseUrl,apiUrl,tenant,experts,onClose})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_2__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_0__.Z,{open,onClose,className:"memori--experts-drawer",title:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("h2",{className:"memori--experts-drawer--title",children:t("widget.expertsInTheBoard")}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("ul",{className:"memori--experts-drawer--list",children:experts.map((expert=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("li",{className:"memori--experts-drawer--item",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("figure",{className:"memori--experts-drawer--avatar",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("img",{src:`${apiUrl}/api/v1/memoriai/memori/avatar/${expert.expertMemoriID}`,alt:expert.name,onError:e=>{e.currentTarget.src=(0,_helpers_media__WEBPACK_IMPORTED_MODULE_3__.v)({tenantID:tenant?.id,type:"avatar",baseURL:baseUrl}),e.currentTarget.onerror=null}})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("div",{className:"memori--experts-drawer--content",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("h3",{className:"memori--experts-drawer--name",children:expert.name}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("p",{className:"memori--experts-drawer--description",children:expert.description})]})]},expert.expertID)))})})};ExpertsDrawer.displayName="ExpertsDrawer";const __WEBPACK_DEFAULT_EXPORT__=ExpertsDrawer;try{ExpertsDrawer.displayName="ExpertsDrawer",ExpertsDrawer.__docgenInfo={description:"",displayName:"ExpertsDrawer",props:{experts:{defaultValue:null,description:"",name:"experts",required:!0,type:{name:"ExpertReference[]"}},baseUrl:{defaultValue:null,description:"",name:"baseUrl",required:!0,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!0,type:{name:"string"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"() => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ExpertsDrawer/ExpertsDrawer.tsx#ExpertsDrawer"]={docgenInfo:ExpertsDrawer.__docgenInfo,name:"ExpertsDrawer",path:"src/components/ExpertsDrawer/ExpertsDrawer.tsx#ExpertsDrawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/KnownFacts/KnownFacts.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_ui_Button__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Drawer__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Drawer.tsx"),_ui_Spin__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/ui/Spin.tsx"),_ui_Modal__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/ui/Modal.tsx"),react_hot_toast__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),_helpers_error__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./src/helpers/error.ts"),react_i18next__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_icons_Delete__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./src/components/icons/Delete.tsx"),_ui_Checkbox__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./src/components/ui/Checkbox.tsx"),_ui_Select__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./src/components/ui/Select.tsx"),_icons_ChevronLeft__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("./src/components/icons/ChevronLeft.tsx"),_icons_ChevronRight__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__("./src/components/icons/ChevronRight.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__("./node_modules/react/jsx-runtime.js");const KnownFacts=({apiClient,sessionID,memori,visible=!0,initialKnownFacts=[],closeDrawer})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_13__.$)(),{getKnownFactsPaginated,deleteKnownFact}=apiClient.knownFacts,[knownFacts,setKnownFacts]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialKnownFacts),[numberOfResults,setNumberOfResults]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(25),[pageIndex,setPageIndex]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(0),[knownFactsCount,setKnownFactsCount]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialKnownFacts?.length??0),[loading,setLoading]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),fetchKnownFacts=async(sessionId,from,howMany)=>{if(sessionID||sessionId){setLoading(!0);try{const{knownFacts,count,...response}=await getKnownFactsPaginated(sessionId??sessionID,from??pageIndex,howMany??numberOfResults);setKnownFacts(knownFacts??[]),setKnownFactsCount(count??0),0!==response.resultCode&&(console.error(response),react_hot_toast__WEBPACK_IMPORTED_MODULE_5__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_6__.r)(response.resultCode))))}catch(err){console.error("KNOWN_FACTS/FETCH",err),setKnownFacts(initialKnownFacts??[])}setLoading(!1)}};(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{fetchKnownFacts()}),[]);const[bulkDeleteModalVisible,setBulkDeleteModalVisible]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),[deleteModalVisibleFor,setDeleteModalVisibleFor]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(),[selectedRowKeys,setSelectedRowKeys]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]);return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_2__.Z,{open:visible,width:"80%",className:"memori-known-facts-drawer",onClose:()=>closeDrawer(),title:t("knownFacts.title"),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("p",{children:t("knownFacts.description",{memoriName:memori.name})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(_ui_Spin__WEBPACK_IMPORTED_MODULE_3__.Z,{spinning:loading,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("div",{className:"memori-known-facts-actions",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:!0,danger:!0,onClick:()=>{setBulkDeleteModalVisible(!0)},className:"memori-known-facts-delete-selected",disabled:0===selectedRowKeys?.length,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_icons_Delete__WEBPACK_IMPORTED_MODULE_7__.default,{}),loading,children:[t("selected")," (",selectedRowKeys?.length,")"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_4__.Z,{className:"memori-known-facts-modal",open:bulkDeleteModalVisible,closable:!0,title:selectedRowKeys.length>1?t("knownFacts.deleteSelectedConfirmTitle"):t("knownFacts.deleteConfirmTitle"),description:selectedRowKeys.length>1?t("knownFacts.deleteSelectedConfirmMessage",{number:selectedRowKeys.length}):t("knownFacts.deleteConfirmMessage"),onClose:()=>{setBulkDeleteModalVisible(!1)},footer:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{ghost:!0,onClick:()=>{setBulkDeleteModalVisible(!1)},children:t("cancel")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:!0,danger:!0,onClick:async()=>{try{const mutations=selectedRowKeys.map((key=>deleteKnownFact(sessionID,key)));Promise.all(mutations).then((responses=>{if(responses.every((r=>0===r.resultCode)))react_hot_toast__WEBPACK_IMPORTED_MODULE_5__.ZP.success(t("knownFacts.deleteSuccess")),setSelectedRowKeys([]),fetchKnownFacts(),setBulkDeleteModalVisible(!1);else{let errored=responses.find((r=>0!==r.resultCode));console.error(errored),void 0!==errored?.resultCode&&react_hot_toast__WEBPACK_IMPORTED_MODULE_5__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_6__.r)(errored?.resultCode)))}}))}catch(_e){let error=_e;react_hot_toast__WEBPACK_IMPORTED_MODULE_5__.ZP.error(t("Error")+error.message)}},children:t("confirm")})]})})]}),knownFactsCount>25&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("nav",{className:"memori--table--pagination",children:[knownFactsCount>numberOfResults&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("div",{className:"memori--table--pagination--pages",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{shape:"circle",disabled:0===pageIndex||pageIndex{let from=(pageIndex/numberOfResults-1)*numberOfResults;setPageIndex(from),fetchKnownFacts(void 0,from,numberOfResults)}}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("span",{className:"memori--table--pagination--pages--current",children:[Math.ceil(pageIndex/numberOfResults)+1," /"," ",Math.ceil(knownFactsCount/numberOfResults)]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{shape:"circle",padded:!1,title:t("next")||"Next",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_icons_ChevronRight__WEBPACK_IMPORTED_MODULE_11__.default,{}),disabled:(pageIndex/numberOfResults+1)*numberOfResults>=knownFactsCount,onClick:()=>{let from=(pageIndex/numberOfResults+1)*numberOfResults;setPageIndex(from),fetchKnownFacts(void 0,from,numberOfResults)}})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Select__WEBPACK_IMPORTED_MODULE_9__.Z,{options:[{label:`25 / ${t("page")||"page"}`,value:25},{label:`50 / ${t("page")||"page"}`,value:50},{label:`100 / ${t("page")||"page"}`,value:100}],value:numberOfResults,displayValue:`${numberOfResults} / ${t("page")||"page"}`,onChange:value=>{setNumberOfResults(value),setPageIndex(0),fetchKnownFacts(void 0,0,value)}})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("table",{className:"memori--table",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("thead",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("tr",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("th",{className:"memori--table--column-centered",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Checkbox__WEBPACK_IMPORTED_MODULE_8__.Z,{checked:!!knownFacts?.length&&selectedRowKeys?.length===knownFacts.length,indeterminate:!!knownFacts?.length&&!!selectedRowKeys?.length&&selectedRowKeys?.length!==knownFacts?.length,onChange:e=>{e.target.checked?setSelectedRowKeys(knownFacts.map((kf=>kf.knownFactID))):setSelectedRowKeys([])}})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("th",{children:t("knownFacts.text")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("th",{className:"mobile-hidden",children:t("createdAt")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("th",{className:"memori--table--column-right",children:t("actions")})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("tbody",{children:knownFacts.map((kf=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("tr",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("th",{className:"memori--table--column-centered",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Checkbox__WEBPACK_IMPORTED_MODULE_8__.Z,{checked:selectedRowKeys?.includes(kf.knownFactID),onChange:e=>{e.target.checked?setSelectedRowKeys((srk=>[...new Set([...srk,kf.knownFactID])])):setSelectedRowKeys((srk=>srk.filter((key=>key!==kf.knownFactID))))}})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("td",{children:kf.text}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("td",{className:"mobile-hidden",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("span",{className:"memori--table--date",children:kf.creationTimestamp?new Intl.DateTimeFormat("it",{dateStyle:"short",timeStyle:"short"}).format(new Date(kf.creationTimestamp)):"-"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("td",{className:"memori--table--column-right",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("div",{className:"memori--table--action-column",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{danger:!0,ghost:!0,shape:"circle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_icons_Delete__WEBPACK_IMPORTED_MODULE_7__.default,{}),disabled:selectedRowKeys?.length>0,title:t("delete")||"Delete",onClick:()=>setDeleteModalVisibleFor(kf.knownFactID)}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_4__.Z,{className:"memori-known-facts-modal",open:deleteModalVisibleFor===kf.knownFactID,closable:!0,title:t("knownFacts.deleteConfirmTitle"),description:t("knownFacts.deleteConfirmMessage"),onClose:()=>{setDeleteModalVisibleFor(void 0)},footer:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{ghost:!0,onClick:()=>{setDeleteModalVisibleFor(void 0)},children:t("cancel")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:!0,danger:!0,onClick:async()=>{try{const response=await deleteKnownFact(sessionID,kf.knownFactID);0===response.resultCode?(react_hot_toast__WEBPACK_IMPORTED_MODULE_5__.ZP.success(t("knownFacts.deleteSuccess")),setSelectedRowKeys([]),fetchKnownFacts(),setDeleteModalVisibleFor(void 0)):(console.error(response),react_hot_toast__WEBPACK_IMPORTED_MODULE_5__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_6__.r)(response.resultCode),{ns:"common"})))}catch(_e){let error=_e;react_hot_toast__WEBPACK_IMPORTED_MODULE_5__.ZP.error(t("Error")+error.message)}},children:t("confirm")})]})})]})})]},kf.knownFactID)))})]})]})]})};KnownFacts.displayName="KnownFacts";const __WEBPACK_DEFAULT_EXPORT__=KnownFacts;try{KnownFacts.displayName="KnownFacts",KnownFacts.__docgenInfo={description:"",displayName:"KnownFacts",props:{apiClient:{defaultValue:null,description:"",name:"apiClient",required:!0,type:{name:'{ constants: { BACKEND_URL: string; ENGINE_URL: string; allowedMediaTypes: string[]; anonTag: "👤"; }; asset: { getResourceUrl: ({ type, resourceURI, sessionID, baseURL, }: ResourceURLParams) => string; }; getAllFunctions: (sessionId: string) => Promise<...>; ... 125 more ...; backend: { ...; }; }'}},sessionID:{defaultValue:null,description:"",name:"sessionID",required:!0,type:{name:"string"}},memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},initialKnownFacts:{defaultValue:{value:"[]"},description:"",name:"initialKnownFacts",required:!1,type:{name:"KnownFact[]"}},visible:{defaultValue:{value:"true"},description:"",name:"visible",required:!1,type:{name:"boolean"}},closeDrawer:{defaultValue:null,description:"",name:"closeDrawer",required:!0,type:{name:"() => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/KnownFacts/KnownFacts.tsx#KnownFacts"]={docgenInfo:KnownFacts.__docgenInfo,name:"KnownFacts",path:"src/components/KnownFacts/KnownFacts.tsx#KnownFacts"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/MemoriWidget/MemoriWidget.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>MemoriWidget_MemoriWidget});var react=__webpack_require__("./node_modules/react/index.js"),useTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),esm=__webpack_require__("./node_modules/@memori.ai/memori-api-client/esm/index.js"),es2019_module=__webpack_require__("./node_modules/standardized-audio-context/build/es2019/module.js"),microsoft_cognitiveservices_speech_sdk=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/microsoft.cognitiveservices.speech.sdk.js"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),luxon=__webpack_require__("./node_modules/luxon/src/luxon.js"),dist=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),PositionDrawer=__webpack_require__("./src/components/PositionDrawer/PositionDrawer.tsx"),Auth=__webpack_require__("./src/components/Auth/Auth.tsx"),Chat_Chat=__webpack_require__("./src/components/Chat/Chat.tsx"),StartPanel=__webpack_require__("./src/components/StartPanel/StartPanel.tsx"),Avatar=__webpack_require__("./src/components/Avatar/Avatar.tsx"),ChangeMode=__webpack_require__("./src/components/ChangeMode/ChangeMode.tsx"),Header=__webpack_require__("./src/components/Header/Header.tsx"),PoweredBy=__webpack_require__("./src/components/PoweredBy/PoweredBy.tsx"),AgeVerificationModal=__webpack_require__("./src/components/AgeVerificationModal/AgeVerificationModal.tsx"),SettingsDrawer=__webpack_require__("./src/components/SettingsDrawer/SettingsDrawer.tsx"),KnownFacts=__webpack_require__("./src/components/KnownFacts/KnownFacts.tsx"),ExpertsDrawer=__webpack_require__("./src/components/ExpertsDrawer/ExpertsDrawer.tsx"),LoginDrawer=__webpack_require__("./src/components/LoginDrawer/LoginDrawer.tsx"),Spin=__webpack_require__("./src/components/ui/Spin.tsx"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const layouts_FullPage=({Header,headerProps,Avatar,avatarProps,Chat,chatProps,StartPanel,startPanelProps,integrationStyle,integrationBackground,ChangeMode,changeModeProps,sessionId,hasUserActivatedSpeak,showInstruct=!1,loading=!1,poweredBy})=>(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[integrationStyle,integrationBackground,(0,jsx_runtime.jsxs)(Spin.Z,{spinning:loading,children:[showInstruct&&ChangeMode&&changeModeProps&&(0,jsx_runtime.jsx)(ChangeMode,{...changeModeProps}),Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{...headerProps}),(0,jsx_runtime.jsxs)("div",{className:"memori--grid",children:[(0,jsx_runtime.jsxs)("div",{className:"memori--grid-column memori--grid-column-left",children:[Avatar&&avatarProps&&(0,jsx_runtime.jsx)(Avatar,{...avatarProps}),(0,jsx_runtime.jsx)("div",{id:"extension"})]}),(0,jsx_runtime.jsx)("div",{className:"memori--grid-column memori--grid-column-right",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):startPanelProps?(0,jsx_runtime.jsx)(StartPanel,{...startPanelProps}):null}),poweredBy]})]})]});try{FullPage.displayName="FullPage",FullPage.__docgenInfo={description:"",displayName:"FullPage",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/FullPage.tsx#FullPage"]={docgenInfo:FullPage.__docgenInfo,name:"FullPage",path:"src/components/layouts/FullPage.tsx#FullPage"})}catch(__react_docgen_typescript_loader_error){}const layouts_Totem=({Header,headerProps,Avatar,avatarProps,Chat,chatProps,StartPanel,startPanelProps,integrationStyle,integrationBackground,ChangeMode,changeModeProps,sessionId,hasUserActivatedSpeak,showInstruct=!1,loading=!1,poweredBy})=>(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[integrationStyle,integrationBackground,(0,jsx_runtime.jsxs)(Spin.Z,{spinning:loading,className:"memori-totem-layout",children:[poweredBy,showInstruct&&ChangeMode&&changeModeProps&&(0,jsx_runtime.jsx)(ChangeMode,{...changeModeProps}),(0,jsx_runtime.jsx)("div",{className:"memori-totem-layout--header",children:Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{...headerProps})}),(0,jsx_runtime.jsx)("div",{className:"memori-totem-layout--avatar",children:Avatar&&avatarProps&&(0,jsx_runtime.jsx)(Avatar,{...avatarProps,isTotem:!0})}),(0,jsx_runtime.jsx)("div",{id:"extension"}),(0,jsx_runtime.jsx)("div",{className:"memori-totem-layout--controls",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):startPanelProps?(0,jsx_runtime.jsx)(StartPanel,{...startPanelProps}):null})]})]});try{Totem.displayName="Totem",Totem.__docgenInfo={description:"",displayName:"Totem",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/Totem.tsx#Totem"]={docgenInfo:Totem.__docgenInfo,name:"Totem",path:"src/components/layouts/Totem.tsx#Totem"})}catch(__react_docgen_typescript_loader_error){}const layouts_Chat=({Header,headerProps,Chat,chatProps,StartPanel,startPanelProps,integrationStyle,integrationBackground,ChangeMode,changeModeProps,sessionId,hasUserActivatedSpeak,showInstruct=!1,loading=!1,poweredBy})=>(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[integrationStyle,integrationBackground,(0,jsx_runtime.jsxs)(Spin.Z,{spinning:loading,className:"memori-chat-layout",children:[poweredBy,showInstruct&&ChangeMode&&changeModeProps&&(0,jsx_runtime.jsx)(ChangeMode,{...changeModeProps}),(0,jsx_runtime.jsx)("div",{className:"memori-chat-layout--header",children:Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{...headerProps})}),(0,jsx_runtime.jsx)("div",{id:"extension"}),(0,jsx_runtime.jsx)("div",{className:"memori-chat-layout--controls",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):startPanelProps?(0,jsx_runtime.jsx)(StartPanel,{...startPanelProps}):null})]})]});try{Chat.displayName="Chat",Chat.__docgenInfo={description:"",displayName:"Chat",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/Chat.tsx#Chat"]={docgenInfo:Chat.__docgenInfo,name:"Chat",path:"src/components/layouts/Chat.tsx#Chat"})}catch(__react_docgen_typescript_loader_error){}var Button=__webpack_require__("./src/components/ui/Button.tsx"),Blob=__webpack_require__("./src/components/Blob/Blob.tsx"),Close=__webpack_require__("./src/components/icons/Close.tsx");const WebsiteAssistantLayout=({Header,headerProps,Avatar,avatarProps,Chat,chatProps,StartPanel,startPanelProps,integrationStyle,ChangeMode,changeModeProps,sessionId,hasUserActivatedSpeak,showInstruct=!1,loading=!1,poweredBy})=>{const{t}=(0,useTranslation.$)(),[collapsed,_setCollapsed]=(0,react.useState)(!0),[expandedKey,setExpandedKey]=(0,react.useState)(),stopAudio=(0,react.useMemo)((()=>chatProps?.stopAudio),[chatProps?.stopAudio]),setCollapsed=collapsed=>{_setCollapsed(collapsed),setExpandedKey(collapsed?void 0:(new Date).toISOString());try{stopAudio?.()}catch(e){console.log(e)}};return(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant--"+(collapsed?"collapsed":"expanded"),children:collapsed?(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant--trigger",children:(0,jsx_runtime.jsx)(Button.Z,{className:"memori-website_assistant--trigger-button",ghost:!0,shape:"circle",onClick:()=>setCollapsed(!1),title:t("expand")||"Expand",children:(0,jsx_runtime.jsx)(Blob.Z,{avatar:avatarProps?.memori.avatarURL})})}):(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[integrationStyle,(0,jsx_runtime.jsxs)(Spin.Z,{spinning:loading,className:"memori-website_assistant-layout",children:[poweredBy,(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant--close-button-wrapper",children:(0,jsx_runtime.jsx)(Button.Z,{className:"memori-website_assistant--close-button",primary:!0,shape:"circle",onClick:()=>setCollapsed(!0),icon:(0,jsx_runtime.jsx)(Close.default,{}),title:t("close")||"Close"})}),showInstruct&&ChangeMode&&changeModeProps&&(0,jsx_runtime.jsx)(ChangeMode,{...changeModeProps}),(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant-layout--header",children:Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{...headerProps,showSettings:!1,showReload:!1})}),(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant-layout--avatar",children:Avatar&&avatarProps&&(0,react.createElement)(Avatar,{...avatarProps,integrationConfig:avatarProps.integrationConfig?{...avatarProps.integrationConfig,avatarURL:avatarProps.integrationConfig?.avatarURL?`${avatarProps.integrationConfig?.avatarURL.split("#")[0]}#${expandedKey}`:void 0}:{},key:expandedKey})}),(0,jsx_runtime.jsx)("div",{id:"extension"}),(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant-layout--controls",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):startPanelProps?(0,jsx_runtime.jsx)(StartPanel,{...startPanelProps}):null})]})]})})};WebsiteAssistantLayout.displayName="WebsiteAssistantLayout";const layouts_WebsiteAssistant=WebsiteAssistantLayout;try{WebsiteAssistant.displayName="WebsiteAssistant",WebsiteAssistant.__docgenInfo={description:"",displayName:"WebsiteAssistant",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/WebsiteAssistant.tsx#WebsiteAssistant"]={docgenInfo:WebsiteAssistant.__docgenInfo,name:"WebsiteAssistant",path:"src/components/layouts/WebsiteAssistant.tsx#WebsiteAssistant"})}catch(__react_docgen_typescript_loader_error){}var translations=__webpack_require__("./src/helpers/translations.ts"),configuration=__webpack_require__("./src/helpers/configuration.ts"),utils=__webpack_require__("./src/helpers/utils.ts"),constants=__webpack_require__("./src/helpers/constants.ts"),error=__webpack_require__("./src/helpers/error.ts");var QuestionHelp=__webpack_require__("./src/components/icons/QuestionHelp.tsx");const layouts_HiddenChat=({Header,headerProps,Chat,chatProps,startPanelProps,sessionId,hasUserActivatedSpeak})=>{const{t}=(0,useTranslation.$)(),[isOpen,setIsOpen]=(0,react.useState)(!1);(0,react.useEffect)((()=>{const mainDiv=document.body;mainDiv&&(isOpen?(mainDiv.style.width="calc(100% - 350px)",mainDiv.style.marginRight="300px",mainDiv.style.transition="all 0.5s"):(mainDiv.style.width="100%",mainDiv.style.marginLeft="0"))}),[isOpen]);return(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)("input",{type:"checkbox",id:"memori-sidebar-toggle",className:"memori-sidebar-toggle",checked:isOpen,onChange:()=>{setIsOpen(!isOpen),(()=>{try{window.speechSynthesis.speak(new SpeechSynthesisUtterance(""))}catch(e){console.error(e)}startPanelProps&&startPanelProps?.initializeTTS&&startPanelProps?.initializeTTS(),startPanelProps&&startPanelProps?.onClickStart&&startPanelProps?.onClickStart()})()}}),(0,jsx_runtime.jsxs)("div",{className:"memori-sidebar-container",children:[(0,jsx_runtime.jsx)("label",{htmlFor:"memori-sidebar-toggle",className:"memori-sidebar-toggle-label memori-open-label",children:(0,jsx_runtime.jsx)(QuestionHelp.default,{className:"memori-icon","aria-label":t("expand")})}),(0,jsx_runtime.jsxs)("aside",{className:"memori-sidebar",children:[(0,jsx_runtime.jsx)("label",{htmlFor:"memori-sidebar-toggle",className:"memori-sidebar-toggle-label memori-close-label",children:(0,jsx_runtime.jsx)("span",{children:(0,jsx_runtime.jsx)(Close.default,{className:"memori-icon-close","aria-label":t("collapse")})})}),(0,jsx_runtime.jsx)("div",{className:"memori-sidebar-content",children:(0,jsx_runtime.jsx)("div",{className:"memori-hidden-chat-layout--header",children:Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{position:{latitude:0,longitude:0,placeName:""},...headerProps,className:"memori-hidden-chat-layout-header--layout"})})}),(0,jsx_runtime.jsx)("div",{id:"extension"}),(0,jsx_runtime.jsx)("div",{className:"memori-hidden-chat-layout--controls",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):(0,jsx_runtime.jsx)("div",{className:"memori-loading",children:(0,jsx_runtime.jsx)(Spin.Z,{})})})]})]})]})};try{HiddenChat.displayName="HiddenChat",HiddenChat.__docgenInfo={description:"",displayName:"HiddenChat",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:null,description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:null,description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/HiddenChat.tsx#HiddenChat"]={docgenInfo:HiddenChat.__docgenInfo,name:"HiddenChat",path:"src/components/layouts/HiddenChat.tsx#HiddenChat"})}catch(__react_docgen_typescript_loader_error){}const layouts_ZoomedFullBody=({Header,headerProps,Avatar,avatarProps,Chat,chatProps,StartPanel,startPanelProps,integrationStyle,integrationBackground,ChangeMode,changeModeProps,sessionId,hasUserActivatedSpeak,showInstruct=!1,loading=!1,poweredBy})=>((0,react.useEffect)((()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow=""})),[]),(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[integrationStyle,integrationBackground,(0,jsx_runtime.jsxs)(Spin.Z,{className:"memori-spin--zoomed-full-body",spinning:loading,children:[showInstruct&&ChangeMode&&changeModeProps&&(0,jsx_runtime.jsx)(ChangeMode,{...changeModeProps}),Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{...headerProps}),(0,jsx_runtime.jsxs)("div",{className:"memori--grid",children:[(0,jsx_runtime.jsxs)("div",{className:"memori--grid-column memori--grid-column-left",children:[Avatar&&avatarProps&&(0,jsx_runtime.jsx)(Avatar,{chatProps,isZoomed:!0,...avatarProps}),(0,jsx_runtime.jsx)("div",{id:"extension"})]}),(0,jsx_runtime.jsx)("div",{className:"memori--grid-column memori--grid-column--zoomed-full-body memori--grid-column-right",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):startPanelProps?(0,jsx_runtime.jsx)(StartPanel,{...startPanelProps}):null}),(0,jsx_runtime.jsx)("div",{className:"memori--powered-by-custom",children:poweredBy})]})]})]}));try{ZoomedFullBody.displayName="ZoomedFullBody",ZoomedFullBody.__docgenInfo={description:"",displayName:"ZoomedFullBody",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/ZoomedFullBody.tsx#ZoomedFullBody"]={docgenInfo:ZoomedFullBody.__docgenInfo,name:"ZoomedFullBody",path:"src/components/layouts/ZoomedFullBody.tsx#ZoomedFullBody"})}catch(__react_docgen_typescript_loader_error){}var visemeContext=__webpack_require__("./src/context/visemeContext.tsx");const typeMessage=(message,waitForPrevious=!0,hidden=!1,typingText,useLoaderTextAsMsg=!1,hasBatchQueued=!1)=>{const e=new CustomEvent("MemoriTextEntered",{detail:{text:message,waitForPrevious,hidden,typingText,useLoaderTextAsMsg,hasBatchQueued}});document.dispatchEvent(e);window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&setTimeout((()=>{document.dispatchEvent(new CustomEvent("MemoriEndSpeak"))}),300)};let recognizer,speechConfig,speechSynthesizer,audioDestination,audioContext,memoriPassword;window.getMemoriState=integrationId=>{let widget=integrationId?document.querySelector(`.memori-widget[data-memori-integration="${integrationId}"]`)||document.querySelector("memori-client")?.shadowRoot?.querySelector(".memori-widget[data-memori-integration]"):document.querySelector(".memori-widget")||document.querySelector("memori-client")?.shadowRoot?.querySelector(".memori-widget");if(!widget)return null;let engineState=widget.dataset?.memoriEngineState;return engineState?JSON.parse(engineState):null},window.typeMessage=typeMessage,window.typeMessageHidden=(message,waitForPrevious=!0,typingText,useLoaderTextAsMsg=!1,hasBatchQueued=!1)=>typeMessage(message,waitForPrevious,!0,typingText,useLoaderTextAsMsg,hasBatchQueued),window.typeBatchMessages=messages=>{function disableInputs(){document.querySelector("fieldset#chat-fieldset")?.setAttribute("disabled","");const styles="opacity: 0.5; touch-action: none; pointer-events: none;";document.querySelector("textarea.memori-chat-textarea--input")?.setAttribute("style",styles),document.querySelector("button.memori-chat-inputs--send")?.setAttribute("style",styles),document.querySelector("button.memori-chat-inputs--mic")?.setAttribute("style",styles)}function reEnableInputs(){document.querySelector("fieldset#chat-fieldset")?.removeAttribute("disabled"),document.querySelector("textarea.memori-chat-textarea--input")?.removeAttribute("style"),document.querySelector("button.memori-chat-inputs--send")?.removeAttribute("style"),document.querySelector("button.memori-chat-inputs--mic")?.removeAttribute("style")}function areInputsDisabled(){return!!document.querySelector("fieldset#chat-fieldset")?.hasAttribute("disabled")}const isSafariIOS=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")&&/iPad|iPhone|iPod/.test(navigator.userAgent),stepsGenerator=function*(){yield*messages}();disableInputs();const submitNewMessage=()=>{const next=stepsGenerator.next(),step=next.value;if(step){areInputsDisabled()||disableInputs();let waitForPrevious=step.waitForPrevious;isSafariIOS&&(waitForPrevious=!1),typeMessage(step.message,waitForPrevious,step.hidden,step.typingText,step.useLoaderTextAsMsg,!next.done),isSafariIOS&&setTimeout((()=>{document.dispatchEvent(new CustomEvent("MemoriEndSpeak")),reEnableInputs()}),3e3)}else areInputsDisabled()&&reEnableInputs();if(next.done)return document.removeEventListener("MemoriEndSpeak",submitNewMessage),void(areInputsDisabled()&&reEnableInputs())};document.addEventListener("MemoriEndSpeak",submitNewMessage),submitNewMessage()};let userToken,speakerMuted=!1,memoriSpeaking=!1;const MemoriWidget=({memori,memoriConfigs,ownerUserID,ownerUserName,tenantID,memoriLang,multilingual,integration,layout="DEFAULT",customLayout,showInstruct=!1,showShare,preview=!1,embed=!1,showCopyButton=!0,showTranslationOriginal=!1,showInputs=!0,showDates=!1,showContextPerLine=!1,showSettings=!0,showTypingText=!1,showClear=!1,showLogin=!1,showOnlyLastMessages,height="100vh",secret,baseUrl="https://aisuru.com",apiURL="https://backend.memori.ai",engineURL="https://engine.memori.ai",initialContextVars,initialQuestion,ogImage,sessionID:initialSessionID,tenant,personification,authToken,AZURE_COGNITIVE_SERVICES_TTS_KEY,enableAudio,defaultSpeakerActive=!0,disableTextEnteredEvents=!1,onStateChange,additionalInfo,additionalSettings,customMediaRenderer,userAvatar,useMathFormatting=!1})=>{const{t,i18n}=(0,useTranslation.$)(),[isClient,setIsClient]=(0,react.useState)(!1);(0,react.useEffect)((()=>{setIsClient(!0)}),[]);const client=(0,esm.Z)(apiURL,engineURL),{initSession,postTextEnteredEvent,postPlaceChangedEvent,postDateChangedEvent,postTimeoutEvent,postTagChangedEvent,getSession,getExpertReferences,getSessionChatLogs}=client,[instruct,setInstruct]=(0,react.useState)(!1),[enableFocusChatInput,setEnableFocusChatInput]=(0,react.useState)(!0),[loginToken,setLoginToken]=(0,react.useState)(additionalInfo?.loginToken??authToken),[user,setUser]=(0,react.useState)({avatarURL:"string"==typeof userAvatar?userAvatar:void 0});(0,react.useEffect)((()=>{loginToken&&!user?.userID&&showLogin&&client.backend.getCurrentUser(loginToken).then((({user,resultCode})=>{user&&0===resultCode?(setUser(user),(0,configuration.A2)("loginToken",loginToken),user.birthDate&&(setBirthDate(user.birthDate),(0,configuration.A2)("birthDate",user.birthDate))):(0,configuration.gj)("loginToken")}))}),[loginToken,user?.userID]);const[showLoginDrawer,setShowLoginDrawer]=(0,react.useState)(!1),[clickedStart,setClickedStart]=(0,react.useState)(!1),[gotErrorInOpening,setGotErrorInOpening]=(0,react.useState)(!1),language=memori.culture?.split("-")?.[0]?.toUpperCase()||memoriConfigs?.find((c=>c.memoriConfigID===memori.memoriConfigurationID))?.culture?.split("-")?.[0]?.toUpperCase(),integrationConfig=integration?.customData?JSON.parse(integration.customData):null,isMultilanguageEnabled=void 0!==multilingual?multilingual:!!integrationConfig?.multilanguage,forcedTimeout=integrationConfig?.forcedTimeout,[userLang,setUserLang]=(0,react.useState)(memoriLang??integrationConfig?.lang??language??integrationConfig?.uiLang??i18n.language??"IT"),applyMathFormatting=void 0!==useMathFormatting?useMathFormatting:!!integrationConfig?.useMathFormatting;(0,react.useEffect)((()=>{isMultilanguageEnabled&&userLang&&constants.vq.includes(userLang.toLowerCase())&&i18n.changeLanguage(userLang.toLowerCase())}),[userLang]);const[loading,setLoading]=(0,react.useState)(!1),[memoriTyping,setMemoriTyping]=(0,react.useState)(!1),[typingText,setTypingText]=(0,react.useState)(),selectedLayout=layout||integrationConfig?.layout||"DEFAULT",defaultEnableAudio=enableAudio??integrationConfig?.enableAudio??!1,[hasUserActivatedSpeak,setHasUserActivatedSpeak]=(0,react.useState)(!1),[hasUserActivatedListening,setHasUserActivatedListening]=(0,react.useState)(!1),[showPositionDrawer,setShowPositionDrawer]=(0,react.useState)(!1),[showSettingsDrawer,setShowSettingsDrawer]=(0,react.useState)(!1),[showKnownFactsDrawer,setShowKnownFactsDrawer]=(0,react.useState)(!1),[showExpertsDrawer,setShowExpertsDrawer]=(0,react.useState)(!1),[muteSpeaker,setMuteSpeaker]=(0,react.useState)(!defaultEnableAudio||!defaultSpeakerActive),[continuousSpeech,setContinuousSpeech]=(0,react.useState)(!1),[continuousSpeechTimeout,setContinuousSpeechTimeout]=(0,react.useState)(2),[isPlayingAudio,setIsPlayingAudio]=(0,react.useState)(!1),[controlsPosition,setControlsPosition]=(0,react.useState)("center"),[enablePositionControls,setEnablePositionControls]=(0,react.useState)(!1),[avatarType,setAvatarType]=(0,react.useState)(null),[hideEmissions,setHideEmissions]=(0,react.useState)(!1),{startProcessing,setAudioContext,addViseme,stopProcessing,resetVisemeQueue}=(0,visemeContext.LG)();(0,react.useEffect)((()=>{setIsPlayingAudio(!!speechSynthesizer),memoriSpeaking=!!speechSynthesizer}),[speechSynthesizer]),(0,react.useEffect)((()=>{let defaultControlsPosition="bottom",microphoneMode=(0,configuration.wm)("microphoneMode","HOLD_TO_TALK");window.innerWidth<=768?(defaultControlsPosition="bottom",microphoneMode="HOLD_TO_TALK"):defaultControlsPosition=window.matchMedia("(orientation: portrait)").matches||window.innerHeight>window.innerWidth?"center":"bottom",setMuteSpeaker((0,configuration.wm)("muteSpeaker",!defaultEnableAudio||!defaultSpeakerActive)),speakerMuted=(0,configuration.wm)("muteSpeaker",!defaultEnableAudio||!defaultSpeakerActive),setContinuousSpeech("CONTINUOUS"===microphoneMode),setContinuousSpeechTimeout((0,configuration.wm)("continuousSpeechTimeout",2)),setControlsPosition((0,configuration.wm)("controlsPosition",defaultControlsPosition)),setAvatarType((0,configuration.wm)("avatarType","avatar3d")),setHideEmissions((0,configuration.wm)("hideEmissions",!1)),additionalInfo?.loginToken||authToken||(setLoginToken((0,configuration.wm)("loginToken",void 0)),userToken=(0,configuration.wm)("loginToken",void 0),setBirthDate((0,configuration.wm)("birthDate",void 0)))}),[]);const[memoriPwd,setMemoriPwd]=(0,react.useState)(secret),[memoriTokens,setMemoriTokens]=(0,react.useState)(),[authModalState,setAuthModalState]=(0,react.useState)(null),[position,_setPosition]=(0,react.useState)(),applyPosition=async(venue,sessionID)=>{const session=sessionID??sessionId;if(venue&&session){const{currentState,...response}=await postPlaceChangedEvent({sessionId:session,placeName:venue.placeName,latitude:venue.latitude,longitude:venue.longitude,uncertaintyKm:venue.uncertainty??0});currentState&&0===response.resultCode&&_setCurrentDialogState((cds=>({...cds,...currentState,hints:currentState.hints?.length?currentState.hints:cds?.hints})))}};(0,react.useEffect)((()=>{const position=(0,configuration.wm)("position",void 0);position&&_setPosition(position)}),[]);const[userMessage,setUserMessage]=(0,react.useState)(""),[listening,setListening]=(0,react.useState)(!1),[history,setHistory]=(0,react.useState)([]),pushMessage=message=>{setHistory((history=>[...history,{...message,media:message.media?.filter((m=>!("text/javascript"===m.mimeType&&m.properties?.executable)))??[]}]))},sendMessage=async(text,media,newSessionId,translate=!0,translatedText,hidden=!1,typingText,useLoaderTextAsMsg=!1,hasBatchQueued=!1)=>{const sessionID=newSessionId||sessionId||window.getMemoriState()?.sessionID;if(!sessionID||!text?.length)return;hidden||pushMessage({text,translatedText,fromUser:!0,media:media??[],initial:sessionId?!!newSessionId&&newSessionId!==sessionId:!!newSessionId}),setMemoriTyping(!0),setTypingText(typingText);let msg=text,gotError=!1;try{if(!hidden&&translate&&!instruct&&isMultilanguageEnabled&&userLang.toUpperCase()!==language.toUpperCase()){msg=(await(0,translations.i)(text,language,userLang,baseUrl)).text}const{currentState,...response}=await postTextEnteredEvent({sessionId:sessionID,text:msg});if(0===response.resultCode&¤tState){const emission=useLoaderTextAsMsg&&typingText?typingText:currentState.emission??currentDialogState?.emission;if("X4"===currentState.state&&memori.giverTag){const{currentState,...resp}=await postTagChangedEvent(sessionID,memori.giverTag);0===resp.resultCode?(setCurrentDialogState(currentState),emission&&(pushMessage({text:emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,questionAnswered:msg,contextVars:currentState.contextVars,date:currentState.currentDate,placeName:currentState.currentPlaceName,placeLatitude:currentState.currentLatitude,placeLongitude:currentState.currentLongitude,placeUncertaintyKm:currentState.currentUncertaintyKm,tag:currentState.currentTag,memoryTags:currentState.memoryTags}),speak(emission))):(console.error(response,resp),dist.ZP.error(t((0,error.r)(resp.resultCode))),gotError=!0)}else if("X2d"===currentState.state&&memori.giverTag){const{currentState,...resp}=await postTextEnteredEvent({sessionId:sessionID,text:Math.random().toString().substring(2,8)});if(0===resp.resultCode){const{currentState,...resp}=await postTagChangedEvent(sessionID,memori.giverTag);0===resp.resultCode?(setCurrentDialogState(currentState),emission&&(pushMessage({text:emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,questionAnswered:msg,contextVars:currentState.contextVars,date:currentState.currentDate,placeName:currentState.currentPlaceName,placeLatitude:currentState.currentLatitude,placeLongitude:currentState.currentLongitude,placeUncertaintyKm:currentState.currentUncertaintyKm,tag:currentState.currentTag,memoryTags:currentState.memoryTags}),speak(emission))):(console.error(response,resp),dist.ZP.error(t((0,error.r)(resp.resultCode))),gotError=!0)}else console.error(response,resp),dist.ZP.error(t((0,error.r)(resp.resultCode))),gotError=!0}else userLang.toLowerCase()!==language.toLowerCase()&&emission&&!instruct&&isMultilanguageEnabled?translateDialogState(currentState,userLang,msg).then((ts=>{let text=ts.translatedEmission||ts.emission;text&&speak(text)})):(setCurrentDialogState({...currentState,emission}),emission&&(pushMessage({text:emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,questionAnswered:msg,generatedByAI:!!currentState.completion,contextVars:currentState.contextVars,date:currentState.currentDate,placeName:currentState.currentPlaceName,placeLatitude:currentState.currentLatitude,placeLongitude:currentState.currentLongitude,placeUncertaintyKm:currentState.currentUncertaintyKm,tag:currentState.currentTag,memoryTags:currentState.memoryTags}),speak(emission)))}else 404===response.resultCode&&(setHistory((h=>[...h.slice(0,h.length-1)])),reopenSession(!1,memoriPwd||memori.secretToken,memoriTokens,instruct&&memori.giverTag?memori.giverTag:void 0,instruct&&memori.giverPIN?memori.giverPIN:void 0,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion).then((state=>{console.info("session timeout"),state?.sessionID&&setTimeout((()=>{sendMessage(text,media,state?.sessionID)}),500)})))}catch(error){console.error(error),gotError=!0,setTypingText(void 0),setMemoriTyping(!1)}hasBatchQueued||(setTypingText(void 0),setMemoriTyping(!1))},translateDialogState=async(state,userLang,msg)=>{const emission=state.emission??currentDialogState?.emission;let translatedState={...state},translatedMsg=null;if(emission&&!instruct&&language.toUpperCase()!==userLang.toUpperCase()&&isMultilanguageEnabled)try{const t=await(0,translations.i)(emission,userLang,language,baseUrl);if(state.hints&&state.hints.length>0){const translatedHints=await Promise.all((state.hints??[]).map((async hint=>{const tHint=await(0,translations.i)(hint,userLang,language,baseUrl);return{text:tHint?.text??hint,originalText:hint}})));translatedState={...state,emission:t.text,translatedHints}}else translatedState={...state,emission,translatedEmission:t.text,hints:state.hints??("G1"===state.state?currentDialogState?.hints:[])};t.text.length>0&&(translatedMsg={text:emission,translatedText:t.text,emitter:state.emitter,media:state.media,fromUser:!1,questionAnswered:msg,generatedByAI:!!state.completion,contextVars:state.contextVars,date:state.currentDate,placeName:state.currentPlaceName,placeLatitude:state.currentLatitude,placeLongitude:state.currentLongitude,placeUncertaintyKm:state.currentUncertaintyKm,tag:state.currentTag,memoryTags:state.memoryTags})}catch(error){console.error(error),translatedState={...state,emission},translatedMsg={text:emission,emitter:state.emitter,media:state.media,fromUser:!1,questionAnswered:msg,contextVars:state.contextVars,date:state.currentDate,placeName:state.currentPlaceName,placeLatitude:state.currentLatitude,placeLongitude:state.currentLongitude,placeUncertaintyKm:state.currentUncertaintyKm,tag:state.currentTag,memoryTags:state.memoryTags}}else translatedState={...state,emission},emission&&(translatedMsg={text:emission,emitter:state.emitter,media:state.media,fromUser:!1,questionAnswered:msg,contextVars:state.contextVars,date:state.currentDate,placeName:state.currentPlaceName,placeLatitude:state.currentLatitude,placeLongitude:state.currentLongitude,placeUncertaintyKm:state.currentUncertaintyKm,tag:state.currentTag,memoryTags:state.memoryTags});return setCurrentDialogState(translatedState),translatedMsg&&pushMessage(translatedMsg),translatedState},minAge=void 0!==memori.ageRestriction?memori.ageRestriction:memori.nsfw?18:memori.enableCompletions?14:0,[birthDate,setBirthDate]=(0,react.useState)(),[showAgeVerification,setShowAgeVerification]=(0,react.useState)(!1),[sessionId,setSessionId]=(0,react.useState)(initialSessionID),[currentDialogState,_setCurrentDialogState]=(0,react.useState)(),setCurrentDialogState=state=>{_setCurrentDialogState(state),onStateChange&&onStateChange(state);const e=new CustomEvent("MemoriNewDialogState",{detail:state});document.dispatchEvent(e);const executableSnippets=state?.media?.filter((m=>"text/javascript"===m.mimeType&&!!m.properties?.executable));executableSnippets?.forEach((s=>{try{setTimeout((()=>{console.log("snippet",s),new Function(s.content??"")(),setTimeout((()=>{document.querySelector(".memori-chat--content")?.scrollTo(0,document.querySelector(".memori-chat--content")?.scrollHeight??0)}),400)}),1e3)}catch(e){console.warn(e)}}))},fetchSession=async params=>{if(birthDate||!minAge)if("PUBLIC"===memori.privacyType||memori.secretToken||memoriPwd||memoriTokens){setLoading(!0);try{if(!memori.giverTag&&memori.receivedInvitations?.length){let giverInvitation=memori.receivedInvitations.find((i=>"GIVER"===i.type&&"ACCEPTED"===i.state));giverInvitation&&(memori.giverTag=giverInvitation.tag,memori.giverPIN=giverInvitation.pin)}let referral;try{referral=window.location.href}catch(err){console.debug(err)}const session=await initSession({...params,tag:params.tag??personification?.tag,pin:params.pin??personification?.pin,additionalInfo:{...additionalInfo||{},loginToken:userToken??loginToken??additionalInfo?.loginToken??authToken,language:getCultureCodeByLanguage(userLang),referral,timeZoneOffset:(new Date).getTimezoneOffset().toString()}});if(session?.sessionID&&session?.currentState&&0===session.resultCode)return setSessionId(session.sessionID),position&&applyPosition(position,session.sessionID),setLoading(!1),{dialogState:session.currentState,sessionID:session.sessionID};session?.resultMessage.startsWith("This Memori is aged restricted")?(console.warn(session),dist.ZP.error(t("underageTwinSession",{age:minAge})),setGotErrorInOpening(!0)):403===session?.resultCode?(setMemoriPwd(void 0),setAuthModalState("password")):(console.warn(session),dist.ZP.error(t((0,error.r)(session?.resultCode))),setGotErrorInOpening(!0))}catch(err){throw console.error(err),dist.ZP.error(t("errorFetchingSession")),new Error("Error fetching session")}}else setAuthModalState("password");else setShowAgeVerification(!0)},reopenSession=async(updateDialogState=!1,password,recoveryTokens,tag,pin,initialContextVars,initialQuestion,birthDate)=>{setLoading(!0);try{if(!birthDate&&minAge)return void setShowAgeVerification(!0);if(!("PUBLIC"===memori.privacyType||password||memori.secretToken||memoriPwd||recoveryTokens||memoriTokens))return void setAuthModalState("password");let referral;try{referral=window.location.href}catch(err){throw console.debug(err),dist.ZP.error(t("errorGettingReferralURL")),new Error("Error getting referral URL")}const{sessionID,currentState,...response}=await initSession({memoriID:memori.engineMemoriID??"",password:password||memoriPwd||memori.secretToken,recoveryTokens:recoveryTokens||memoriTokens,tag,pin,initialContextVars:{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birthDate:birthDate||void 0,additionalInfo:{...additionalInfo||{},loginToken:userToken??loginToken??additionalInfo?.loginToken??authToken,language:getCultureCodeByLanguage(userLang),referral,timeZoneOffset:(new Date).getTimezoneOffset().toString()}});if(sessionID&¤tState&&0===response.resultCode)return setSessionId(sessionID),updateDialogState&&(setCurrentDialogState(currentState),currentState.emission&&(history.length<=1?setHistory([{text:currentState.emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,initial:!0,contextVars:currentState.contextVars,date:currentState.currentDate,placeName:currentState.currentPlaceName,placeLatitude:currentState.currentLatitude,placeLongitude:currentState.currentLongitude,placeUncertaintyKm:currentState.currentUncertaintyKm,tag:currentState.currentTag,memoryTags:currentState.memoryTags}]):pushMessage({text:currentState.emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,initial:!0,contextVars:currentState.contextVars,date:currentState.currentDate,placeName:currentState.currentPlaceName,placeLatitude:currentState.currentLatitude,placeLongitude:currentState.currentLongitude,placeUncertaintyKm:currentState.currentUncertaintyKm,tag:currentState.currentTag,memoryTags:currentState.memoryTags}))),position&&applyPosition(position,sessionID),memori.needsDateTime&&sendDateChangedEvent({sessionID,state:currentState}),setLoading(!1),{dialogState:currentState,sessionID};response?.resultMessage.startsWith("This Memori is aged restricted")?(console.error(response),dist.ZP.error(t("underageTwinSession",{age:minAge})),setGotErrorInOpening(!0)):403===response?.resultCode?(setMemoriPwd(void 0),setAuthModalState("password")):(console.error(response),dist.ZP.error(t((0,error.r)(response.resultCode))),setGotErrorInOpening(!0))}catch(err){throw console.error(err),dist.ZP.error(t("errorReopeningSession")),new Error("Error reopening session")}return setLoading(!1),null},changeTag=async(memoriId,sessionId,tag,pin)=>{if(!memoriId||!sessionId)return console.error("CHANGETAG/Session not found"),Promise.reject("Session not found");try{const{currentState,resultCode}=await postTagChangedEvent(sessionId,tag??constants.QV);if(0===resultCode){let textResult=0;if(tag!==constants.QV&&pin&&("X1a"===currentState.state||"X1b"===currentState.state)){const{resultCode:textResultCode}=await postTextEnteredEvent({sessionId,text:pin??""});textResult=textResultCode}if(0===textResult){const{currentState,...response}=await getSession(sessionId);if(0===response.resultCode&¤tState)return{currentState,sessionId,...response}}else if([400,401,403,404,500].includes(resultCode)){console.warn("[APPCONTEXT/CHANGETAG]",resultCode);let referral,storageBirthDate=(0,configuration.wm)("birthDate",void 0);try{referral=window.location.href}catch(err){console.debug(err)}fetchSession({memoriID:memori.engineMemoriID??"",password:secret||memoriPwd||memori.secretToken,tag:memori.giverTag,pin:memori.giverPIN,initialContextVars:{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birthDate:birthDate||storageBirthDate||void 0,additionalInfo:{...additionalInfo||{},loginToken:userToken??loginToken??additionalInfo?.loginToken??authToken,language:getCultureCodeByLanguage(userLang),referral,timeZoneOffset:(new Date).getTimezoneOffset().toString()}})}else if(currentState)return{currentState,sessionId,resultCode}}}catch(_e){let err=_e;return console.warn("[APPCONTEXT/CHANGETAG]",err),Promise.reject(err)}return null};(0,react.useEffect)((()=>()=>{currentDialogState&¤tDialogState?.currentTag===memori.giverTag||(async()=>{sessionId&&memori.giverTag&&memori.giverPIN&&(setHistory([]),await changeTag(memori.engineMemoriID,sessionId,memori.giverTag,memori.giverPIN))})()}),[]);const sendDateChangedEvent=(0,react.useCallback)((async({sessionID,date,state})=>{const session=sessionID??sessionId,dialogState=state??currentDialogState;if(!session||!memori.needsDateTime||dialogState?.hints?.length)return;const now=(date?luxon.ou.fromISO(date):luxon.ou.now()).toUTC().toFormat("yyyy/MM/dd HH:mm:ss ZZ").split(":").slice(0,-1).join(":"),{currentState,...response}=await postDateChangedEvent(session,now);0===response.resultCode&¤tState&&_setCurrentDialogState((cds=>({...cds,...currentState,hints:currentState.hints?.length?currentState.hints:cds?.hints})))}),[currentDialogState,memori.needsDateTime,sessionId]);(0,react.useEffect)((()=>{if(sessionId&&memori.needsDateTime){sendDateChangedEvent({sessionID:sessionId,state:currentDialogState});let datePolling=setInterval((()=>{sendDateChangedEvent({sessionID:sessionId})}),6e4);return()=>{clearInterval(datePolling)}}}),[memori.needsDateTime,sessionId]);const[userInteractionTimeout,setUserInteractionTimeout]=(0,react.useState)(),timeoutRef=(0,react.useRef)(),clearInteractionTimeout=()=>{userInteractionTimeout&&(clearTimeout(userInteractionTimeout),setUserInteractionTimeout(void 0)),timeoutRef?.current&&(clearTimeout(timeoutRef.current),timeoutRef.current=void 0)},resetInteractionTimeout=()=>{clearInteractionTimeout(),isPlayingAudio||userMessage.length||memoriTyping||listening||setInteractionTimeout()},handleTimeout=async()=>{if(!hasUserActivatedSpeak||isPlayingAudio||userMessage.length||memoriTyping||listening)resetInteractionTimeout();else if(sessionId&&hasUserActivatedSpeak&¤tDialogState?.acceptsTimeout){const{currentState,...response}=await postTimeoutEvent(sessionId);if(0===response.resultCode&¤tState){const emission=currentState.emission;if(!instruct&&isMultilanguageEnabled&&userLang!==i18n?.language&&emission&&emission.length>0)translateDialogState({...currentState,emission},userLang).then((ts=>{let text=ts.translatedEmission||ts.emission;text&&speak(text)}));else{if(!(emission&&emission.length>0))return void resetInteractionTimeout();pushMessage({text:emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,generatedByAI:!!currentState.completion,contextVars:currentState.contextVars,date:currentState.currentDate,placeName:currentState.currentPlaceName,placeLatitude:currentState.currentLatitude,placeLongitude:currentState.currentLongitude,placeUncertaintyKm:currentState.currentUncertaintyKm,tag:currentState.currentTag,memoryTags:currentState.memoryTags}),speak(emission),setCurrentDialogState({...currentState,hints:currentState.hints??("G1"===currentState.state?currentDialogState?.hints:[])})}}}},setInteractionTimeout=()=>{let timeout=currentDialogState?.timeout;if(!timeout){let timeoutLimit=40,timeoutMinLimit=25;if(timeout=Math.floor(Math.random()*(timeoutLimit-timeoutMinLimit))+timeoutMinLimit,currentDialogState?.emission){timeout+=currentDialogState.emission.length/26.5}}if(forcedTimeout&&(timeout=forcedTimeout,currentDialogState?.emission)){timeout+=currentDialogState.emission.length/26.5}let uiTimeout=setTimeout(handleTimeout,1e3*timeout);setUserInteractionTimeout(uiTimeout),timeoutRef.current=uiTimeout};(0,react.useEffect)((()=>{(userMessage.length||isPlayingAudio||memoriTyping)&&clearInteractionTimeout(),sessionId&&!userMessage.length&&resetInteractionTimeout()}),[currentDialogState?.acceptsTimeout,currentDialogState?.timeout,currentDialogState?.state,isPlayingAudio,sessionId,history,userMessage,memoriTyping,hasUserActivatedSpeak]),(0,react.useEffect)((()=>()=>{setHasUserActivatedSpeak(!1),setClickedStart(!1),clearInteractionTimeout(),timeoutRef.current=void 0}),[]);const getTTSVoice=(0,react.useCallback)((lang=>{let voice="",voiceLang=(lang??memori.culture?.split("-")?.[0]??i18n.language??"IT").toUpperCase(),voiceType=memori.voiceType;if(memori.enableBoardOfExperts&¤tDialogState?.emitter){experts?.find((e=>e.name===currentDialogState?.emitter))}switch(voiceLang){case"IT":voice=""+("MALE"===voiceType?"it-IT-DiegoNeural":"it-IT-ElsaNeural");break;case"DE":voice=""+("MALE"===voiceType?"de-DE-ConradNeural":"de-DE-KatjaNeural");break;case"EN":voice=""+("MALE"===voiceType?"en-GB-RyanNeural":"en-GB-SoniaNeural");break;case"ES":voice=""+("MALE"===voiceType?"es-ES-AlvaroNeural":"es-ES-ElviraNeural");break;case"FR":voice=""+("MALE"===voiceType?"fr-FR-HenriNeural":"fr-FR-DeniseNeural");break;case"PT":voice=""+("MALE"===voiceType?"pt-PT-DuarteNeural":"pt-PT-RaquelNeural");break;case"UK":voice=""+("MALE"===voiceType?"uk-UA-OstapNeural":"uk-UA-PolinaNeural");break;case"RU":voice=""+("MALE"===voiceType?"ru-RU-DmitryNeural":"ru-RU-SvetlanaNeural");break;case"PL":voice=""+("MALE"===voiceType?"pl-PL-MarekNeural":"pl-PL-AgnieszkaNeural");break;case"FI":voice=""+("MALE"===voiceType?"fi-FI-HarriNeural":"fi-FI-SelmaNeural");break;case"EL":voice=""+("MALE"===voiceType?"el-GR-NestorasNeural":"el-GR-AthinaNeural");break;case"AR":voice=""+("MALE"===voiceType?"ar-SA-HamedNeural":"ar-SA-ZariyahNeural");break;case"ZH":voice=""+("MALE"===voiceType?"zh-CN-YunxiNeural":"zh-CN-XiaoxiaoNeural");break;case"JA":voice=""+("MALE"===voiceType?"ja-JP-KeitaNeural":"ja-JP-NanamiNeural");break;default:voice=""+("MALE"===voiceType?"it-IT-DiegoNeural":"it-IT-IsabellaNeural")}return voice}),[memori.voiceType,memori.enableBoardOfExperts,currentDialogState?.emitter,i18n.language,memori.culture]),getCultureCodeByLanguage=lang=>{let voice="";switch((lang||memori.culture?.split("-")?.[0]||i18n.language||"IT").toUpperCase()){case"IT":default:voice="it-IT";break;case"DE":voice="de-DE";break;case"EN":voice="en-GB";break;case"ES":voice="es-ES";break;case"FR":voice="fr-FR";break;case"PT":voice="pt-PT";break;case"UK":voice="uk-UK";break;case"RU":voice="ru-RU";break;case"PL":voice="pl-PL";break;case"FI":voice="fi-FI";break;case"EL":voice="el-GR";break;case"AR":voice="ar-SA";break;case"ZH":voice="zh-CN";break;case"JA":voice="ja-JP"}return voice},[phonemesMap,setPhonemesMap]=(0,react.useState)();(0,react.useEffect)((()=>{(async()=>{try{const lexiconReq=await fetch(`${baseUrl||"https://aisuru.com"}/api/lexiconmap`);return await lexiconReq.json()}catch(err){console.error(err)}})().then((lexicon=>{setPhonemesMap(lexicon)}))}),[]);const replaceTextWithPhonemes=(text,lang)=>{if(!phonemesMap)return text;const phonemes={...phonemesMap.common??{},...tenant?.id&&phonemesMap[tenant.id]?phonemesMap[tenant.id]:{}};return Object.keys(phonemes).map((word=>({word,phoneme:phonemes[word][lang.toLowerCase()]??phonemes[word].default,caseSensitive:phonemes[word].caseSensitive}))).reduce(((acc,{word,phoneme,caseSensitive})=>acc.replace(new RegExp(`\\b${word}\\b`,caseSensitive?"g":"gi"),`${word}`)),text)},emitEndSpeakEvent=()=>{const e=new CustomEvent("MemoriEndSpeak");document.dispatchEvent(e)},speak=text=>{if(!AZURE_COGNITIVE_SERVICES_TTS_KEY||preview)return void emitEndSpeakEvent();if(stopListening(),preview)return;if(muteSpeaker||speakerMuted)return memoriSpeaking=!1,setMemoriTyping(!1),emitEndSpeakEvent(),void(continuousSpeech&&setListeningTimeout());audioDestination&&audioDestination.pause();let isSafari=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome"),isIOS=/iPad|iPhone|iPod/.test(navigator.userAgent);if("interrupted"===audioContext.state)return void audioContext.resume().then((()=>speak(text)));if("closed"===audioContext.state){audioContext=new es2019_module.Hm;let buffer=audioContext.createBuffer(1,1e4,22050),source=audioContext.createBufferSource();source.buffer=buffer,source.connect(audioContext.destination)}else if("suspended"===audioContext.state){stopAudio(),audioContext=new es2019_module.Hm;let buffer=audioContext.createBuffer(1,1e4,22050),source=audioContext.createBufferSource();source.buffer=buffer,source.connect(audioContext.destination)}if(!speechSynthesizer){isIOS||(audioDestination=new microsoft_cognitiveservices_speech_sdk.SpeakerAudioDestination);let audioConfig=microsoft_cognitiveservices_speech_sdk.AudioConfig.fromSpeakerOutput(audioDestination);speechSynthesizer=new microsoft_cognitiveservices_speech_sdk.SpeechSynthesizer(speechConfig,audioConfig)}const source=audioContext.createBufferSource();source.addEventListener("ended",(()=>{setIsPlayingAudio(!1),memoriSpeaking=!1})),audioDestination.onAudioEnd=()=>{setIsPlayingAudio(!1),memoriSpeaking=!1,source.disconnect(),emitEndSpeakEvent(),onEndSpeakStartListen()},resetVisemeQueue(),speechSynthesizer.visemeReceived=function(_,e){addViseme(e.visemeId,e.audioOffset)};const textToSpeak=(0,utils.r)((0,utils.LV)((0,utils.h)((0,utils.Cb)((0,utils.kh)(text)))));speechSynthesizer.speakSsmlAsync(`${replaceTextWithPhonemes(textToSpeak,userLang.toLowerCase())}`,(result=>{if(result){setIsPlayingAudio(!0),memoriSpeaking=!0,startProcessing(audioContext);try{audioContext.decodeAudioData(result.audioData,(function(buffer){source.buffer=buffer,source.connect(audioContext.destination),(history.length<1||isSafari&&isIOS)&&source.start(0)})),audioContext.onstatechange=()=>{"suspended"===audioContext.state||"closed"===audioContext.state?(source.disconnect(),setIsPlayingAudio(!1),stopProcessing(),resetVisemeQueue(),memoriSpeaking=!1):"interrupted"===audioContext.state&&audioContext.resume()},audioContext.resume(),speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null)}catch(error){console.error("Error processing audio data:",error),handleFallback(text)}}else handleFallback(text)}),(error=>{console.error("Speak error:",error),handleFallback(text)})),setMemoriTyping(!1)},handleFallback=text=>{console.log("Falling back to browser speech synthesis"),window.speechSynthesis.speak(new SpeechSynthesisUtterance(text)),cleanup()},cleanup=()=>{setIsPlayingAudio(!1),stopProcessing(),resetVisemeQueue(),memoriSpeaking=!1,speechSynthesizer&&(console.log("Closing speech synthesizer"),speechSynthesizer.close(),speechSynthesizer=null),emitEndSpeakEvent()},stopAudio=()=>{setIsPlayingAudio(!1),memoriSpeaking=!1;try{speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null),"closed"!==audioContext.state&&audioContext.close(),audioDestination&&(audioDestination.pause(),audioDestination.close())}catch(e){console.debug("stopAudio error: ",e)}};(0,react.useEffect)((()=>{"TOTEM"!==selectedLayout&&(()=>{let textarea=document.querySelector("#chat-fieldset textarea");textarea&&enableFocusChatInput?textarea.focus():textarea?.blur()})()}),[currentDialogState?.emission]);const[transcript,setTranscript]=(0,react.useState)(""),resetTranscript=()=>setTranscript(""),[transcriptTimeout,setTranscriptTimeout]=(0,react.useState)(null),setListeningTimeout=()=>{let timeout=setTimeout((async()=>{clearListening();const message=(0,utils.vw)(transcript);message.length>0&&listening?(sendMessage(message),resetTranscript(),setUserMessage("")):listening&&resetInteractionTimeout()}),1e3*continuousSpeechTimeout);setTranscriptTimeout(timeout)},clearListeningTimeout=()=>{transcriptTimeout&&(clearTimeout(transcriptTimeout),setTranscriptTimeout(null))};(0,react.useEffect)((()=>{clearListeningTimeout(),continuousSpeech&&setListeningTimeout(),resetInteractionTimeout()}),[transcript]);const startListening=async()=>{if(AZURE_COGNITIVE_SERVICES_TTS_KEY){clearListening(),setTranscript(""),resetTranscript(),(0,utils.xZ)()&&setEnableFocusChatInput(!1);try{navigator.mediaDevices.getUserMedia({audio:!0}).then((function(_stream){setHasUserActivatedListening(!0),speechConfig||(speechConfig=microsoft_cognitiveservices_speech_sdk.SpeechConfig.fromSubscription(AZURE_COGNITIVE_SERVICES_TTS_KEY,"westeurope"),speechConfig.speechRecognitionLanguage=getCultureCodeByLanguage(userLang),speechConfig.speechSynthesisLanguage=getCultureCodeByLanguage(userLang),speechConfig.speechSynthesisVoiceName=getTTSVoice(userLang));const audioConfig=microsoft_cognitiveservices_speech_sdk.AudioConfig.fromDefaultMicrophoneInput();recognizer=new microsoft_cognitiveservices_speech_sdk.SpeechRecognizer(speechConfig,audioConfig),setListening(!0),recognizer.recognized=(_s,e)=>{if(e.result.text)if(e.result.reason===microsoft_cognitiveservices_speech_sdk.ResultReason.RecognizedSpeech){let transcript=e.result.text;if(setTranscript(transcript||""),transcript?.length>0){const transcriptMessage=(0,utils.vw)(transcript);transcriptMessage.length>0&&setUserMessage((msg=>`${msg} ${transcriptMessage}`))}}else e.result.reason===microsoft_cognitiveservices_speech_sdk.ResultReason.NoMatch&&console.debug("NOMATCH: Speech could not be recognized.")},recognizer.canceled=(_s,e)=>{e.reason===microsoft_cognitiveservices_speech_sdk.CancellationReason.Error&&(console.debug(`"CANCELED: ErrorCode=${e.errorCode}`),console.debug(`"CANCELED: ErrorDetails=${e.errorDetails}`),console.debug("CANCELED: Did you set the speech resource key and region values?")),stopListening()},recognizer.sessionStopped=(_s,_e)=>{stopListening()},resetTranscript(),recognizer.startContinuousRecognitionAsync()})).catch(console.debug)}catch(error){console.debug(error)}}},stopListening=()=>{recognizer&&(recognizer.stopContinuousRecognitionAsync(),recognizer.close(),recognizer=null),setListening(!1)},clearListening=()=>{setHasUserActivatedListening(!1),stopListening(),clearListeningTimeout()},resetUIEffects=()=>{try{clearListening(),clearInteractionTimeout(),setClickedStart(!1),timeoutRef.current=void 0,stopAudio()}catch(e){console.log("Error: resetUIEffects",e)}};(0,react.useEffect)((()=>()=>{resetUIEffects()}),[]),(0,react.useEffect)((()=>(document.addEventListener("MemoriResetUIEffects",resetUIEffects),()=>{document.removeEventListener("MemoriResetUIEffects",resetUIEffects)})),[]),(0,react.useEffect)((()=>{"Z0"===currentDialogState?.state&&clearListening()}),[currentDialogState?.state]);const[requestedListening,setRequestedListening]=(0,react.useState)(!1),onEndSpeakStartListen=(0,react.useCallback)((_e=>{isPlayingAudio&&speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null),!continuousSpeech||!hasUserActivatedListening&&requestedListening||(setRequestedListening(!0),startListening())}),[continuousSpeech,hasUserActivatedListening]);(0,react.useEffect)((()=>{history.length>1&&!isPlayingAudio&&continuousSpeech&&(hasUserActivatedListening||!requestedListening)?startListening():isPlayingAudio&&listening&&stopListening()}),[isPlayingAudio]),(0,react.useEffect)((()=>{listening&&(clearListening(),resetTranscript(),setUserMessage(""),startListening())}),[language]);const[sendOnEnter,setSendOnEnter]=(0,react.useState)("keypress");(0,react.useEffect)((()=>{window.innerWidth<=768&&(0,utils.xZ)()?setSendOnEnter("click"):setSendOnEnter("keypress")}),[]);const[attachmentsMenuOpen,setAttachmentsMenuOpen]=(0,react.useState)(),globalBackground=integrationConfig?.globalBackground,globalBackgroundUrl=globalBackground?`url(${globalBackground})`:null,integrationProperties=integration?{"--memori-chat-bubble-bg":"#fff",...integrationConfig&&!showInstruct?{"--memori-text-color":integrationConfig.textColor??"#000"}:{},...integrationConfig?.buttonBgColor?{"--memori-button-bg":integrationConfig.buttonBgColor,"--memori-primary":integrationConfig.buttonBgColor}:{},...integrationConfig?.buttonTextColor?{"--memori-button-text":integrationConfig.buttonTextColor}:{},...integrationConfig?.blurBackground?{"--memori-blur-background":"5px"}:{"--memori-blur-background":"0px"},...integrationConfig?.innerBgColor?{"--memori-inner-bg":`rgba(${"dark"===integrationConfig.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${integrationConfig.innerBgAlpha??.4})`,"--memori-inner-content-pad":"1.5rem","--memori-nav-bg-image":"none","--memori-nav-bg":`rgba(${"dark"===integrationConfig.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${integrationConfig?.innerBgAlpha??.4})`}:{"--memori-inner-content-pad":"0px"}}:{},integrationStylesheet=`\n ${preview?"#preview,":"WEBSITE_ASSISTANT"===selectedLayout?"":":root,"} .memori-widget, .memori-drawer, .memori-modal {\n ${Object.entries(integrationProperties).map((([key,value])=>`${key}: ${value};`)).join("\n")}\n }\n `,showAIicon=void 0===integrationConfig?.showAIicon||integrationConfig?.showAIicon,showWhyThisAnswer=void 0===integrationConfig?.showWhyThisAnswer||integrationConfig?.showWhyThisAnswer,[avatar3dVisible,setAvatar3dVisible]=(0,react.useState)(!1);(0,react.useEffect)((()=>{(window.innerWidth>=768&&"FULLPAGE"===selectedLayout||"FULLPAGE"!==selectedLayout)&&setAvatar3dVisible(!0)}),[]),(0,react.useEffect)((()=>{if(integrationConfig?.seoTitle){let meta=document.createElement("meta");meta.setAttribute("property","og:title"),meta.setAttribute("content",integrationConfig.seoTitle),document.head.append(meta)}if(integrationConfig?.seoDescription){let meta=document.createElement("meta");meta.setAttribute("property","og:description"),meta.setAttribute("content",integrationConfig.seoDescription),document.head.append(meta)}if(integrationConfig?.seoUrl){let meta=document.createElement("meta");meta.setAttribute("property","og:url"),meta.setAttribute("content",integrationConfig.seoUrl),document.head.append(meta)}let image=ogImage||memori.avatarURL;if(integrationConfig?.seoImageShowAvatar&&image){let meta=document.createElement("meta");meta.setAttribute("property","og:image"),meta.setAttribute("content",image),document.head.append(meta)}}),[integrationConfig,memori.avatarURL,ogImage]);const memoriTextEnteredHandler=(0,react.useCallback)((e=>{if(disableTextEnteredEvents)return;const{text,waitForPrevious,hidden,typingText,useLoaderTextAsMsg,hasBatchQueued}=e.detail;text&&(waitForPrevious&&!speakerMuted&&(memoriSpeaking||memoriTyping)?setTimeout((()=>{memoriTextEnteredHandler(e)}),1e3):(stopListening(),stopAudio(),sendMessage(text,void 0,void 0,void 0,void 0,hidden,typingText,useLoaderTextAsMsg,hasBatchQueued)))}),[sessionId,isPlayingAudio,memoriTyping,userLang,disableTextEnteredEvents]);(0,react.useEffect)((()=>(disableTextEnteredEvents?document.removeEventListener("MemoriTextEntered",memoriTextEnteredHandler):document.addEventListener("MemoriTextEntered",memoriTextEnteredHandler),()=>{document.removeEventListener("MemoriTextEntered",memoriTextEnteredHandler)})),[sessionId,userLang,disableTextEnteredEvents]);const onClickStart=(0,react.useCallback)((async session=>{const sessionID=session?.sessionID||sessionId,dialogState=session?.dialogState||currentDialogState;setClickedStart(!0);let memoriAudioElement=document.getElementById("memori-audio"),isSafari=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome");memoriAudioElement&&isSafari&&(memoriAudioElement.muted=!1,memoriAudioElement.play().catch((e=>{console.warn("error playing intro audio",e)})));let storageBirthDate=(0,configuration.wm)("birthDate",void 0),birth=birthDate||storageBirthDate||void 0;if(sessionID||!minAge||birth){if(!sessionID&&"PUBLIC"!==memori.privacyType&&!memori.secretToken&&!memoriPwd&&!memoriTokens||!sessionID&&gotErrorInOpening)return setAuthModalState("password"),void setClickedStart(!1);if(!sessionID){setClickedStart(!1),setGotErrorInOpening(!1);const session=await fetchSession({memoriID:memori.engineMemoriID,password:secret||memoriPwd||memori.secretToken,tag:personification?.tag,pin:personification?.pin,initialContextVars:{PATHNAME:window.location.pathname?.toUpperCase(),ROUTE:window.location.pathname?.split("/")?.pop()?.toUpperCase()||"",...initialContextVars||{}},initialQuestion,birthDate:birth,additionalInfo:{...additionalInfo||{},loginToken:userToken??loginToken??additionalInfo?.loginToken??authToken,language:getCultureCodeByLanguage(userLang),timeZoneOffset:(new Date).getTimezoneOffset().toString()}});return void(session?.dialogState?(setHistory([]),translateDialogState(session.dialogState,userLang).then((ts=>{let text=ts.translatedEmission||ts.emission;text&&speak(text)})).finally((()=>{setHasUserActivatedSpeak(!0)}))):await onClickStart(session||void 0))}if(initialSessionID){const{currentState,...response}=await getSession(sessionID);if(0!==response.resultCode||!currentState)return console.debug("session expired, opening new session"),setGotErrorInOpening(!0),setSessionId(void 0),setClickedStart(!1),void await onClickStart();if(setHistory([]),position&&applyPosition(position,sessionID),memori.needsDateTime&&sendDateChangedEvent({sessionID,state:currentState}),instruct&&memori.giverTag&¤tDialogState?.currentTag!==memori.giverTag)try{console.debug("change tag #0"),await changeTag(memori.engineMemoriID,sessionID,"-");const session=await changeTag(memori.engineMemoriID,sessionID,memori.giverTag,memori.giverPIN);if(!session||0!==session.resultCode)throw console.error("session #1",session),new Error("No session");translateDialogState(session.currentState,userLang).then((ts=>{let text=ts.translatedEmission||ts.emission;text&&speak(text)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}catch(e){console.error("session #2",e),reopenSession(!0,memori?.secretToken,void 0,memori?.giverTag,memori?.giverPIN,{PATHNAME:window.location.pathname?.toUpperCase(),ROUTE:window.location.pathname?.split("/")?.pop()?.toUpperCase()||"",...initialContextVars||{}},initialQuestion,birth).then((()=>{setHasUserActivatedSpeak(!0)}))}else if(!instruct&&personification&¤tDialogState?.currentTag!==personification.tag)try{console.debug("change tag #3"),await changeTag(memori.engineMemoriID,sessionID,"-");const session=await changeTag(memori.engineMemoriID,sessionID,personification.tag,personification.pin);if(!session||0!==session.resultCode)throw console.error("session #4",session),new Error("No session");translateDialogState(session.currentState,userLang).then((ts=>{let text=ts.translatedEmission||ts.emission;text&&speak(text)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}catch(e){console.error("session #5",e),reopenSession(!0,memori?.secretToken,void 0,personification.tag,personification.pin,{PATHNAME:window.location.pathname?.toUpperCase(),ROUTE:window.location.pathname?.split("/")?.pop()?.toUpperCase()||"",...initialContextVars||{}},initialQuestion,birth).then((()=>{setHasUserActivatedSpeak(!0)}))}else if(instruct||personification||!currentDialogState?.currentTag||currentDialogState?.currentTag===constants.QV||"-"===currentDialogState?.currentTag){try{const{chatLogs,...resp}=await getSessionChatLogs(sessionID,sessionID),messages=chatLogs?.[0]?.lines.map(((l,i)=>({text:l.text,media:l.media?.filter((m=>constants.go.includes(m.mimeType)))?.map((m=>({mediumID:`${i}-${m.mimeType}`,...m}))),fromUser:l.inbound,timestamp:l.timestamp,emitter:l.emitter,initial:0===i})));let translatedMessages=messages.slice(0,-1);if(language.toUpperCase()!==userLang.toUpperCase()&&isMultilanguageEnabled)try{translatedMessages=await Promise.all(messages.map((async m=>({...m,originalText:m.text,text:(await(0,translations.i)(m.text,userLang,language,baseUrl)).text}))))}catch(e){console.log("Error translating messages",e)}setHistory(translatedMessages)}catch(e){console.log("Error retrieving chat logs",e)}translateDialogState(currentState,userLang).then((ts=>{let text=ts.translatedEmission||ts.emission;text&&speak(text)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}else try{console.debug("change tag #6"),await changeTag(memori.engineMemoriID,sessionID,"-");const session=await changeTag(memori.engineMemoriID,sessionID,constants.QV);if(!session||0!==session.resultCode)throw console.error("session #7",session),new Error("No session");translateDialogState(session.currentState,userLang).then((ts=>{let text=ts.translatedEmission||ts.emission;text&&speak(text)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}catch(e){console.error("session #8",e),reopenSession(!0,memori?.secretToken,void 0,void 0,void 0,{PATHNAME:window.location.pathname?.toUpperCase(),ROUTE:window.location.pathname?.split("/")?.pop()?.toUpperCase()||"",...initialContextVars||{}},initialQuestion,birth).then((()=>{setHasUserActivatedSpeak(!0)}))}position&&applyPosition(position,sessionID),memori.needsDateTime&&sendDateChangedEvent({sessionID,state:currentState})}else setHistory([]),translateDialogState(dialogState,userLang).then((ts=>{let text=ts.translatedEmission||ts.emission;text&&speak(text)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}else setShowAgeVerification(!0),setClickedStart(!1)}),[memoriPwd,memori,memoriTokens,birthDate,sessionId,userLang,position]);(0,react.useEffect)((()=>{const targetNode=document.querySelector(`memori-client[memoriname="${memori.name}"]`)||document.querySelector(`memori-client[memoriid="${memori.memoriID}"]`)||document.querySelector("memori-client");if(!targetNode)return;const observer=new MutationObserver(((mutationList,_observer)=>{for(const mutation of mutationList)"attributes"===mutation.type&&"authtoken"===mutation.attributeName?.toLowerCase()&&("MEMORI-CLIENT"===mutation.target.nodeName?(setLoginToken(mutation.target.getAttribute("authtoken")||void 0),userToken=mutation.target.getAttribute("authtoken")||void 0):(setLoginToken(mutation.target?.parentElement?.getAttribute("authtoken")||void 0),userToken=mutation.target.getAttribute("authtoken")||void 0))}));return observer.observe(targetNode,{attributes:!0,childList:!1,subtree:!1}),()=>{observer.disconnect()}}),[]);const[experts,setExperts]=(0,react.useState)(),fetchExperts=(0,react.useCallback)((async()=>{if(sessionId&&memori?.enableBoardOfExperts)try{const{experts,count,...resp}=await getExpertReferences(sessionId);0===resp.resultCode?setExperts(experts):console.warn("Error fetching experts",resp)}catch(err){console.warn(err)}}),[sessionId,memori?.enableBoardOfExperts]);(0,react.useEffect)((()=>{fetchExperts()}),[sessionId,fetchExperts]);const deepThoughtEnabled=memori.enableDeepThought&&!!loginToken&&!!user?.userID&&user?.pAndCUAccepted,needsCredits=tenant?.billingDelegation,[hasEnoughCredits,setHasEnoughCredits]=(0,react.useState)(!0),checkCredits=(0,react.useCallback)((async()=>{if(tenant?.billingDelegation)try{const resp=await(async({operation="session_creation",baseUrl,userID,userName,tenant})=>{if(!userID&&!userName)throw new Error("Either userID or userName must be provided");const resp=await fetch(`${baseUrl}/api/verify-tokens`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operation,userID,userName,tenant})});if(!resp.ok)throw new Error("Failed to fetch credits");return resp.json()})({operation:deepThoughtEnabled?"dt_session_creation":"session_creation",baseUrl,userID:ownerUserID,userName:ownerUserName,tenant:tenantID});resp.enough?setHasEnoughCredits(!0):(setHasEnoughCredits(!1),console.warn("Not enough credits. Required:",resp.required))}catch(e){let err=e;console.debug(err)}}),[tenant?.billingDelegation,deepThoughtEnabled]);(0,react.useEffect)((()=>{tenant?.billingDelegation&&checkCredits()}),[tenant?.billingDelegation,deepThoughtEnabled]);const showFullHistory=void 0===showOnlyLastMessages?"TOTEM"!==layout&&"WEBSITE_ASSISTANT"!==layout&&"HIDDEN_CHAT"!==layout:!showOnlyLastMessages,headerProps={memori,tenant,history,showShare:showShare??integrationConfig?.showShare??!0,position,setShowPositionDrawer,setShowSettingsDrawer,setShowKnownFactsDrawer,setShowExpertsDrawer,enableAudio:enableAudio??integrationConfig?.enableAudio??!0,showSpeaker:!!AZURE_COGNITIVE_SERVICES_TTS_KEY,speakerMuted:muteSpeaker||speakerMuted,setSpeakerMuted:mute=>{if(speakerMuted=!!mute,setMuteSpeaker(mute),(0,configuration.A2)("muteSpeaker",!!mute),mute)stopAudio();else{audioContext=new es2019_module.Hm;let buffer=audioContext.createBuffer(1,1e4,22050),source=audioContext.createBufferSource();source.buffer=buffer,source.connect(audioContext.destination)}},showSettings,hasUserActivatedSpeak,showReload:"TOTEM"===selectedLayout,showClear,clearHistory:()=>setHistory((h=>h.slice(-1))),showLogin,setShowLoginDrawer,loginToken,user,sessionID:sessionId},avatarProps={memori,integration,integrationConfig,tenant,instruct,avatar3dVisible,setAvatar3dVisible,hasUserActivatedSpeak,isPlayingAudio:isPlayingAudio&&!muteSpeaker,loading:!!memoriTyping,baseUrl,apiUrl:client.constants.BACKEND_URL,enablePositionControls,setEnablePositionControls,avatarType},startPanelProps={memori,tenant,language,userLang,setUserLang,baseUrl,apiUrl:client.constants.BACKEND_URL,position,openPositionDrawer:()=>setShowPositionDrawer(!0),integrationConfig,instruct,sessionId,clickedStart,isMultilanguageEnabled,onClickStart,initializeTTS:()=>{if(!AZURE_COGNITIVE_SERVICES_TTS_KEY)return;speechConfig=microsoft_cognitiveservices_speech_sdk.SpeechConfig.fromSubscription(AZURE_COGNITIVE_SERVICES_TTS_KEY,"westeurope"),speechConfig.speechSynthesisLanguage=getCultureCodeByLanguage(userLang),speechConfig.speechSynthesisVoiceName=getTTSVoice(userLang),speechConfig.speechRecognitionLanguage=getCultureCodeByLanguage(userLang),speechConfig.setProperty("speechSynthesis.outputFormat","viseme"),(0,utils.xZ)()&&(speechConfig.speechSynthesisOutputFormat=microsoft_cognitiveservices_speech_sdk.SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3),audioContext=new es2019_module.Hm;let buffer=audioContext.createBuffer(1,1e4,22050),source=audioContext.createBufferSource();source.buffer=buffer,source.connect(audioContext.destination),audioDestination=new microsoft_cognitiveservices_speech_sdk.SpeakerAudioDestination;let audioConfig=microsoft_cognitiveservices_speech_sdk.AudioConfig.fromSpeakerOutput(audioDestination);speechSynthesizer=new microsoft_cognitiveservices_speech_sdk.SpeechSynthesizer(speechConfig,audioConfig)},isUserLoggedIn:!!loginToken&&!!user?.userID,hasInitialSession:!!initialSessionID,notEnoughCredits:needsCredits&&!hasEnoughCredits,showLogin,setShowLoginDrawer,user},chatProps={memori,sessionID:sessionId||"",tenant,translateTo:isMultilanguageEnabled&&userLang.toUpperCase()!==(memori.culture?.split("-")?.[0]??i18n.language??"IT")?.toUpperCase()?userLang:void 0,baseUrl,apiUrl:client.constants.BACKEND_URL,layout,memoriTyping,typingText,showTypingText,history:showFullHistory?history:history.slice(-2),authToken:loginToken??userToken??additionalInfo?.loginToken??authToken,dialogState:currentDialogState,setDialogState:setCurrentDialogState,pushMessage,simulateUserPrompt:(text,translatedText)=>{stopListening(),stopAudio(),sendMessage(text,void 0,void 0,!1,translatedText)},showDates,showContextPerLine,showAIicon,showWhyThisAnswer,showCopyButton,showTranslationOriginal,client,selectReceiverTag:async tag=>{if(sessionId)try{const{currentState,...resp}=await postTagChangedEvent(sessionId,tag);if(0===resp.resultCode)if(pushMessage({text:tag,fromUser:!0}),"X4"===currentState.state&&memori.giverTag){const{currentState,...resp}=await client.postTagChangedEvent(sessionId,memori.giverTag);0===resp.resultCode?(setCurrentDialogState(currentState),currentState.emission&&pushMessage({text:currentState.emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,contextVars:currentState.contextVars,date:currentState.currentDate,placeName:currentState.currentPlaceName,placeLatitude:currentState.currentLatitude,placeLongitude:currentState.currentLongitude,placeUncertaintyKm:currentState.currentUncertaintyKm,tag:currentState.currentTag,memoryTags:currentState.memoryTags})):(console.error(resp),dist.ZP.error(t((0,error.r)(resp.resultCode))))}else setCurrentDialogState(currentState),currentState.emission&&pushMessage({text:currentState.emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,contextVars:currentState.contextVars,date:currentState.currentDate,placeName:currentState.currentPlaceName,placeLatitude:currentState.currentLatitude,placeLongitude:currentState.currentLongitude,placeUncertaintyKm:currentState.currentUncertaintyKm,tag:currentState.currentTag,memoryTags:currentState.memoryTags});else console.error(resp,tag,currentDialogState?.knownTags?.[tag]),dist.ZP.error(t((0,error.r)(resp.resultCode)))}catch(e){let err=e;console.error(err),dist.ZP.error(err.message)}},preview,sendOnEnter,setSendOnEnter,microphoneMode:continuousSpeech?"CONTINUOUS":"HOLD_TO_TALK",attachmentsMenuOpen,setAttachmentsMenuOpen,instruct,showInputs,showMicrophone:!!AZURE_COGNITIVE_SERVICES_TTS_KEY,userMessage,onChangeUserMessage:value=>{if(!value||"\n"===value||""===value.trim())return setUserMessage(""),void resetInteractionTimeout();setUserMessage(value),clearInteractionTimeout()},sendMessage:(msg,media)=>{stopAudio(),stopListening(),sendMessage(msg,media),setUserMessage(""),resetTranscript()},stopListening:clearListening,startListening,stopAudio,resetTranscript,listening,setEnableFocusChatInput,isPlayingAudio,customMediaRenderer,user,userAvatar,experts,useMathFormatting:applyMathFormatting},integrationBackground=integration&&globalBackgroundUrl?(0,jsx_runtime.jsx)("div",{className:"memori--global-background",children:(0,jsx_runtime.jsx)("div",{className:"memori--global-background-image",style:{backgroundImage:globalBackgroundUrl}})}):(0,jsx_runtime.jsx)("div",{className:"memori--global-background no-background-image"}),integrationStyle=integration?(0,jsx_runtime.jsx)("style",{dangerouslySetInnerHTML:{__html:integrationStylesheet}}):null,changeModeProps={canInstruct:!!memori.giverTag,instruct:!!instruct,onChangeMode:mode=>{setInstruct("instruct"===mode),setHasUserActivatedSpeak(!1),setClickedStart(!1)}},poweredBy=(0,jsx_runtime.jsx)(PoweredBy.Z,{tenant,userLang,integrationID:integration?.integrationID,memoriHash:`${memori.ownerTenantName}-${memori.ownerUserName}-${memori.name}`}),Layout=customLayout||("TOTEM"===selectedLayout?layouts_Totem:"CHAT"===selectedLayout?layouts_Chat:"FULLPAGE"===selectedLayout?layouts_FullPage:"WEBSITE_ASSISTANT"===selectedLayout?layouts_WebsiteAssistant:"HIDDEN_CHAT"===selectedLayout?layouts_HiddenChat:"ZOOMED_FULL_BODY"===selectedLayout?layouts_ZoomedFullBody:layouts_FullPage);return(0,jsx_runtime.jsxs)("div",{className:classnames_default()("memori","memori-widget",`memori-layout-${layout.toLowerCase()}`,`memori-controls-${controlsPosition.toLowerCase()}`,`memori--avatar-${integrationConfig?.avatar||"default"}`,{"memori--preview":preview,"memori--embed":embed,"memori--with-integration":integration,"memori--with-speechkey":!!AZURE_COGNITIVE_SERVICES_TTS_KEY,"memori--active":hasUserActivatedSpeak,"memori--hide-emissions":hideEmissions,"memori--has-active-session":!!sessionId}),"data-memori-name":memori?.name,"data-memori-id":memori?.engineMemoriID,"data-memori-secondary-id":memori?.memoriID,"data-memori-session-id":sessionId,"data-memori-integration":integration?.integrationID,"data-memori-engine-state":JSON.stringify({...currentDialogState,sessionID:sessionId}),style:{height},children:[(0,jsx_runtime.jsx)(Layout,{Header:Header.Z,headerProps,Avatar:Avatar.Z,avatarProps,Chat:Chat_Chat.Z,chatProps,StartPanel:StartPanel.Z,startPanelProps,integrationStyle,integrationBackground,ChangeMode:ChangeMode.Z,changeModeProps,poweredBy,sessionId,hasUserActivatedSpeak,showInstruct,loading}),(0,jsx_runtime.jsx)("audio",{id:"memori-audio",style:{display:"none"},src:"https://aisuru.com/intro.mp3"}),isClient&&(0,jsx_runtime.jsx)(Auth.Z,{withModal:!0,pwdOrTokens:authModalState,openModal:!!authModalState,setPwdOrTokens:setAuthModalState,showTokens:"SECRET"===memori.privacyType,onFinish:async values=>{values.password&&setMemoriPwd(values.password),values.password&&(memoriPassword=values.password),values.tokens&&setMemoriTokens(values.tokens),reopenSession(!sessionId,values.password,values.tokens,instruct?memori.giverTag:personification?.tag,instruct?memori.giverPIN:personification?.pin,{PATHNAME:window.location.pathname?.toUpperCase(),ROUTE:window.location.pathname?.split("/")?.pop()?.toUpperCase()||"",...initialContextVars||{}},initialQuestion,birthDate).then((state=>{setAuthModalState(null),onClickStart(state||void 0)})).catch((()=>{setAuthModalState(null),setGotErrorInOpening(!0)}))},minimumNumberOfRecoveryTokens:memori?.minimumNumberOfRecoveryTokens??1}),isClient&&(0,jsx_runtime.jsx)(AgeVerificationModal.Z,{visible:showAgeVerification,minAge,onClose:birthDate=>{birthDate?(setBirthDate(birthDate),(0,configuration.A2)("birthDate",birthDate),reopenSession(!sessionId,memoriPassword||memoriPwd||memori?.secretToken,memoriTokens,instruct?memori.giverTag:personification?.tag,instruct?memori.giverPIN:personification?.pin,{PATHNAME:window.location.pathname?.toUpperCase(),ROUTE:window.location.pathname?.split("/")?.pop()?.toUpperCase()||"",...initialContextVars||{}},initialQuestion,birthDate).then((state=>{setShowAgeVerification(!1),setAuthModalState(null),onClickStart(state||void 0)})).catch((()=>{setShowAgeVerification(!1),setGotErrorInOpening(!0)}))):(setShowAgeVerification(!1),setClickedStart(!1))}}),showSettingsDrawer&&(0,jsx_runtime.jsx)(SettingsDrawer.Z,{layout:selectedLayout,open:!!showSettingsDrawer,onClose:()=>setShowSettingsDrawer(!1),microphoneMode:continuousSpeech?"CONTINUOUS":"HOLD_TO_TALK",continuousSpeechTimeout,setMicrophoneMode:mode=>setContinuousSpeech("CONTINUOUS"===mode),setContinuousSpeechTimeout,controlsPosition,setControlsPosition,hideEmissions,setHideEmissions,avatarType,setAvatarType,enablePositionControls,setEnablePositionControls,isAvatar3d:!!integrationConfig?.avatarURL,additionalSettings}),showPositionDrawer&&(0,jsx_runtime.jsx)(PositionDrawer.Z,{memori,open:!!showPositionDrawer,venue:position,setVenue:venue=>{_setPosition(venue),applyPosition(venue),venue?(0,configuration.A2)("position",JSON.stringify(venue)):(0,configuration.gj)("position")},onClose:position=>{position&&applyPosition(position),setShowPositionDrawer(!1)}}),showKnownFactsDrawer&&sessionId&&(0,jsx_runtime.jsx)(KnownFacts.Z,{apiClient:client,memori,sessionID:sessionId,visible:showKnownFactsDrawer,closeDrawer:()=>setShowKnownFactsDrawer(!1)}),showExpertsDrawer&&!!experts&&(0,jsx_runtime.jsx)(ExpertsDrawer.Z,{apiUrl:client.constants.BACKEND_URL,baseUrl,tenant,experts,open:showExpertsDrawer,onClose:()=>setShowExpertsDrawer(!1)}),showLoginDrawer&&tenant?.id&&(0,jsx_runtime.jsx)(LoginDrawer.Z,{tenant,apiClient:client,open:!!showLoginDrawer,user,loginToken,onClose:()=>setShowLoginDrawer(!1),onLogin:(user,token)=>{setUser(user),setLoginToken(token),userToken=token,setShowLoginDrawer(!1),(0,configuration.A2)("loginToken",token)},onLogout:()=>{loginToken&&client.backend.userLogout(loginToken).then((()=>{setShowLoginDrawer(!1),setUser(void 0),setLoginToken(void 0),userToken=void 0,(0,configuration.gj)("loginToken")}))}})]})};MemoriWidget.displayName="MemoriWidget";const MemoriWidget_MemoriWidget=MemoriWidget;try{MemoriWidget.displayName="MemoriWidget",MemoriWidget.__docgenInfo={description:"",displayName:"MemoriWidget",props:{memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},ownerUserName:{defaultValue:null,description:"",name:"ownerUserName",required:!1,type:{name:"string | null"}},ownerUserID:{defaultValue:null,description:"",name:"ownerUserID",required:!1,type:{name:"string | null"}},tenantID:{defaultValue:null,description:"",name:"tenantID",required:!0,type:{name:"string"}},memoriConfigs:{defaultValue:null,description:"",name:"memoriConfigs",required:!1,type:{name:"MemoriConfig[]"}},memoriLang:{defaultValue:null,description:"",name:"memoriLang",required:!1,type:{name:"string"}},multilingual:{defaultValue:null,description:"",name:"multilingual",required:!1,type:{name:"boolean"}},integration:{defaultValue:null,description:"",name:"integration",required:!1,type:{name:"Integration"}},layout:{defaultValue:{value:"DEFAULT"},description:"",name:"layout",required:!1,type:{name:"enum",value:[{value:'"DEFAULT"'},{value:'"FULLPAGE"'},{value:'"TOTEM"'},{value:'"CHAT"'},{value:'"WEBSITE_ASSISTANT"'},{value:'"HIDDEN_CHAT"'},{value:'"ZOOMED_FULL_BODY"'}]}},customLayout:{defaultValue:null,description:"",name:"customLayout",required:!1,type:{name:"FC"}},showShare:{defaultValue:null,description:"",name:"showShare",required:!1,type:{name:"boolean"}},showCopyButton:{defaultValue:{value:"true"},description:"",name:"showCopyButton",required:!1,type:{name:"boolean"}},showTranslationOriginal:{defaultValue:{value:"false"},description:"",name:"showTranslationOriginal",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},showInputs:{defaultValue:{value:"true"},description:"",name:"showInputs",required:!1,type:{name:"boolean"}},showDates:{defaultValue:{value:"false"},description:"",name:"showDates",required:!1,type:{name:"boolean"}},showContextPerLine:{defaultValue:{value:"false"},description:"",name:"showContextPerLine",required:!1,type:{name:"boolean"}},showSettings:{defaultValue:{value:"true"},description:"",name:"showSettings",required:!1,type:{name:"boolean"}},showClear:{defaultValue:{value:"false"},description:"",name:"showClear",required:!1,type:{name:"boolean"}},showOnlyLastMessages:{defaultValue:null,description:"",name:"showOnlyLastMessages",required:!1,type:{name:"boolean"}},showTypingText:{defaultValue:{value:"false"},description:"",name:"showTypingText",required:!1,type:{name:"boolean"}},showLogin:{defaultValue:{value:"false"},description:"",name:"showLogin",required:!1,type:{name:"boolean"}},preview:{defaultValue:{value:"false"},description:"",name:"preview",required:!1,type:{name:"boolean"}},embed:{defaultValue:{value:"false"},description:"",name:"embed",required:!1,type:{name:"boolean"}},height:{defaultValue:{value:"100vh"},description:"",name:"height",required:!1,type:{name:"string | number"}},secret:{defaultValue:null,description:"",name:"secret",required:!1,type:{name:"string"}},baseUrl:{defaultValue:{value:"https://aisuru.com"},description:"",name:"baseUrl",required:!1,type:{name:"string"}},apiURL:{defaultValue:{value:"https://backend.memori.ai"},description:"",name:"apiURL",required:!1,type:{name:"string"}},engineURL:{defaultValue:{value:"https://engine.memori.ai"},description:"",name:"engineURL",required:!1,type:{name:"string"}},initialContextVars:{defaultValue:null,description:"",name:"initialContextVars",required:!1,type:{name:"{ [key: string]: string; }"}},initialQuestion:{defaultValue:null,description:"",name:"initialQuestion",required:!1,type:{name:"string"}},ogImage:{defaultValue:null,description:"",name:"ogImage",required:!1,type:{name:"string"}},sessionID:{defaultValue:null,description:"",name:"sessionID",required:!1,type:{name:"string"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},personification:{defaultValue:null,description:"",name:"personification",required:!1,type:{name:"{ name?: string; tag: string; pin: string; }"}},authToken:{defaultValue:null,description:"",name:"authToken",required:!1,type:{name:"string"}},AZURE_COGNITIVE_SERVICES_TTS_KEY:{defaultValue:null,description:"",name:"AZURE_COGNITIVE_SERVICES_TTS_KEY",required:!1,type:{name:"string"}},enableAudio:{defaultValue:null,description:"",name:"enableAudio",required:!1,type:{name:"boolean"}},defaultSpeakerActive:{defaultValue:{value:"true"},description:"",name:"defaultSpeakerActive",required:!1,type:{name:"boolean"}},disableTextEnteredEvents:{defaultValue:{value:"false"},description:"",name:"disableTextEnteredEvents",required:!1,type:{name:"boolean"}},onStateChange:{defaultValue:null,description:"",name:"onStateChange",required:!1,type:{name:"((state?: DialogState) => void)"}},additionalInfo:{defaultValue:null,description:"",name:"additionalInfo",required:!1,type:{name:"({ loginToken?: string; language?: string; referral?: string | undefined; timeZoneOffset?: string | undefined; } & { [key: string]: string; }) | undefined"}},customMediaRenderer:{defaultValue:null,description:"",name:"customMediaRenderer",required:!1,type:{name:"((mimeType: string) => Element | null)"}},additionalSettings:{defaultValue:null,description:"",name:"additionalSettings",required:!1,type:{name:"Element | null"}},userAvatar:{defaultValue:null,description:"",name:"userAvatar",required:!1,type:{name:"string | Element"}},useMathFormatting:{defaultValue:{value:"false"},description:"",name:"useMathFormatting",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/MemoriWidget/MemoriWidget.tsx#MemoriWidget"]={docgenInfo:MemoriWidget.__docgenInfo,name:"MemoriWidget",path:"src/components/MemoriWidget/MemoriWidget.tsx#MemoriWidget"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/PositionDrawer/PositionDrawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var _ui_Drawer__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Drawer.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_VenueWidget_VenueWidget__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/VenueWidget/VenueWidget.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const PositionDrawer=({memori,open,onClose,venue,setVenue})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_1__.Z,{className:"memori-position-drawer",open,onClose:()=>onClose(venue),title:t("widget.position")||"Position",animated:!1,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("p",{children:t("write_and_speak.requirePositionHelp",{name:memori.name})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_VenueWidget_VenueWidget__WEBPACK_IMPORTED_MODULE_2__.Z,{venue,setVenue,showUncertainty:!1,saveAndClose:venue=>{setVenue(venue),onClose(venue)}})]})};PositionDrawer.displayName="PositionDrawer";const __WEBPACK_DEFAULT_EXPORT__=PositionDrawer;try{PositionDrawer.displayName="PositionDrawer",PositionDrawer.__docgenInfo={description:"",displayName:"PositionDrawer",props:{memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},open:{defaultValue:null,description:"",name:"open",required:!0,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(venue?: Venue | undefined) => void"}},venue:{defaultValue:null,description:"",name:"venue",required:!1,type:{name:"Venue"}},setVenue:{defaultValue:null,description:"",name:"setVenue",required:!0,type:{name:"(venue: Venue) => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/PositionDrawer/PositionDrawer.tsx#PositionDrawer"]={docgenInfo:PositionDrawer.__docgenInfo,name:"PositionDrawer",path:"src/components/PositionDrawer/PositionDrawer.tsx#PositionDrawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/PoweredBy/PoweredBy.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/jsx-runtime.js");const PoweredBy=({tenant,userLang="en",integrationID,memoriHash})=>{const tenantId="memorytwin"===tenant?.theme?"memorytwin":"twincreator"===tenant?.theme?"twincreator":"aisuru";return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div",{className:"memori--powered-by",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img",{src:`https://aisuru.com/images/${tenantId}/logo.png`,alt:""}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("p",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span",{className:"sr-only",children:"Powered by"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("a",{href:`https://memori.ai/${"it"===userLang?.toLowerCase()?"it":"en"}${integrationID?`?integrationID=${integrationID}`:""}${memoriHash?`${integrationID?"&":"?"}memori=${memoriHash}`:""}`,target:"_blank",rel:"noopener noreferrer",children:"Memori.AI"})]})]})};PoweredBy.displayName="PoweredBy";const __WEBPACK_DEFAULT_EXPORT__=PoweredBy;try{PoweredBy.displayName="PoweredBy",PoweredBy.__docgenInfo={description:"",displayName:"PoweredBy",props:{tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},userLang:{defaultValue:{value:"en"},description:"",name:"userLang",required:!1,type:{name:"string"}},integrationID:{defaultValue:null,description:"",name:"integrationID",required:!1,type:{name:"string"}},memoriHash:{defaultValue:null,description:"",name:"memoriHash",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/PoweredBy/PoweredBy.tsx#PoweredBy"]={docgenInfo:PoweredBy.__docgenInfo,name:"PoweredBy",path:"src/components/PoweredBy/PoweredBy.tsx#PoweredBy"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/StartPanel/StartPanel.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_helpers_media__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__("./src/helpers/media.ts"),react_i18next__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Tooltip.tsx"),_helpers_translations__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__("./src/helpers/translations.ts"),_ui_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Translation__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Translation.tsx"),_helpers_constants__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/helpers/constants.ts"),_BlockedMemoriBadge_BlockedMemoriBadge__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./src/components/BlockedMemoriBadge/BlockedMemoriBadge.tsx"),_icons_AI__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./src/components/icons/AI.tsx"),_icons_Group__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./src/components/icons/Group.tsx"),_icons_DeepThought__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./src/components/icons/DeepThought.tsx"),_CompletionProviderStatus_CompletionProviderStatus__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./src/components/CompletionProviderStatus/CompletionProviderStatus.tsx"),_icons_MapMarker__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("./src/components/icons/MapMarker.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__("./node_modules/react/jsx-runtime.js");const StartPanel=({memori,tenant,language,userLang,setUserLang,baseUrl,apiUrl,position,openPositionDrawer,instruct=!1,hasInitialSession=!1,clickedStart,onClickStart,initializeTTS,_TEST_forceProviderStatus,isUserLoggedIn=!1,user,showLogin=!1,setShowLoginDrawer,notEnoughCredits=!1,isMultilanguageEnabled})=>{const{t,i18n}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_12__.$)(),[translatedDescription,setTranslatedDescription]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(memori.description),[showTranslation,setShowTranslation]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!0);return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{(i18n.language?.toUpperCase()??"IT")===(language?.toUpperCase()??"IT")&&translatedDescription===memori.description||!memori.description?.length||(0,_helpers_translations__WEBPACK_IMPORTED_MODULE_13__.i)(memori.description,i18n.language?.toUpperCase()??"IT",language,baseUrl).then((value=>{setTranslatedDescription(value.text)})).catch(console.error)}),[i18n.language,language,memori.description,baseUrl]),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div",{className:"memori--start-panel",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div",{className:"memori--cover",style:{backgroundImage:`url("${(0,_helpers_media__WEBPACK_IMPORTED_MODULE_14__.v)({type:"cover",tenantID:tenant?.id,resourceURI:memori.coverURL,baseURL:baseUrl,apiURL:apiUrl})}"), url("${(0,_helpers_media__WEBPACK_IMPORTED_MODULE_14__.v)({type:"cover",tenantID:tenant?.id,baseURL:baseUrl,apiURL:apiUrl})}")`},children:[!!memori.enableCompletions&&!memori.enableBoardOfExperts&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div",{className:"memori--completions-enabled",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("completionsEnabled"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span",{"aria-label":t("completionsEnabled")||"Completions",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_icons_AI__WEBPACK_IMPORTED_MODULE_6__.default,{})})})}),!!memori.enableBoardOfExperts&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div",{className:"memori--board-of-experts",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("boardOfExperts"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span",{"aria-label":t("boardOfExperts")||"Board of Experts",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_icons_Group__WEBPACK_IMPORTED_MODULE_7__.default,{})})})}),!!memori.nsfw&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div",{className:"memori--nsfw",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("nsfw"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span",{title:t("nsfw")||"NSFW",children:"🔞"})})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("picture",{className:"memori--avatar",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("source",{src:memori.avatarURL??(0,_helpers_media__WEBPACK_IMPORTED_MODULE_14__.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("img",{alt:memori.name,src:memori.avatarURL&&memori.avatarURL.length>0?(0,_helpers_media__WEBPACK_IMPORTED_MODULE_14__.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl}):(0,_helpers_media__WEBPACK_IMPORTED_MODULE_14__.v)({type:"avatar",tenantID:tenant?.id,baseURL:baseUrl,apiURL:apiUrl})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("h2",{className:"memori--title",children:memori.name}),memori.needsPosition&&!position&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div",{className:"memori--needsPosition",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("p",{children:t("write_and_speak.requirePositionHelp",{name:memori.name})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,onClick:()=>openPositionDrawer(),className:"memori--start-button",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_icons_MapMarker__WEBPACK_IMPORTED_MODULE_10__.default,{}),children:t("widget.position")})]}),(memori.needsPosition&&position||!memori.needsPosition)&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div",{className:"memori--description",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("p",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span",{className:"memori--description-text",children:translatedDescription&&showTranslation?translatedDescription:memori.description}),translatedDescription!==memori.description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{ghost:!0,className:"memori--translation-toggle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_icons_Translation__WEBPACK_IMPORTED_MODULE_3__.default,{}),onClick:()=>{setShowTranslation((show=>!show))},children:t(showTranslation?"showOriginalText":"showTranslatedText")})]}),isMultilanguageEnabled&&!instruct&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div",{className:"memori--language-chooser",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("label",{id:"user-lang-pref-label",htmlFor:"user-lang-pref",children:t("write_and_speak.iWantToTalkToIn",{name:memori.name})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("select",{id:"user-lang-pref",className:"memori-select--button",value:(userLang??i18n.language).toUpperCase(),"aria-labelledby":"user-lang-pref-label",onChange:e=>{setUserLang(e.target.value)},children:_helpers_constants__WEBPACK_IMPORTED_MODULE_4__.cG.map((lang=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("option",{value:lang.value,"aria-label":lang.label,children:lang.label},lang.value)))})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,disabled:!!memori.blockedUntil&&!memori.isGiver||notEnoughCredits,loading:clickedStart,onClick:_e=>{try{window.speechSynthesis.speak(new SpeechSynthesisUtterance(""))}catch(e){console.error(e)}initializeTTS&&initializeTTS(),onClickStart&&onClickStart()},className:"memori--start-button",children:t("write_and_speak."+(instruct?"instructButton":hasInitialSession?"resumeButton":"tryMeButton"))}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_CompletionProviderStatus_CompletionProviderStatus__WEBPACK_IMPORTED_MODULE_9__.Z,{provider:memori?.completionConfigForQuestionAnswering?.provider,forceStatus:_TEST_forceProviderStatus}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("p",{className:"memori--start-description",children:t(instruct?"write_and_speak.pageInstructExplanation":"write_and_speak.pageTryMeExplanation")}),(memori.blockedUntil||notEnoughCredits)&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_BlockedMemoriBadge_BlockedMemoriBadge__WEBPACK_IMPORTED_MODULE_5__.Z,{memoriName:memori.name,blockedUntil:memori.blockedUntil,notEnoughCredits,showGiverInfo:memori.isGiver,showTitle:!0,marginLeft:!0}),!!memori.enableDeepThought&&!instruct&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div",{className:"memori--deep-thought-disclaimer",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("deepThoughtHelper"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_icons_DeepThought__WEBPACK_IMPORTED_MODULE_8__.default,{})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("h2",{children:t(isUserLoggedIn&&user?.pAndCUAccepted?"deepThoughtDisclaimerTitle":"deepThought")}),isUserLoggedIn&&!user?.pAndCUAccepted&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("p",{children:t("deepThoughtPreDisclaimerNotAllowed")}),!isUserLoggedIn&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("p",{children:t("deepThoughtPreDisclaimerUnlogged")}),!isUserLoggedIn&&showLogin&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("p",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{outlined:!0,padded:!1,onClick:()=>setShowLoginDrawer(!0),children:"Login"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("p",{className:"memori--deep-thought-disclaimer-text",children:t("deepThoughtDisclaimer")})]})]})]})};StartPanel.displayName="StartPanel";const __WEBPACK_DEFAULT_EXPORT__=StartPanel;try{StartPanel.displayName="StartPanel",StartPanel.__docgenInfo={description:"",displayName:"StartPanel",props:{memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},language:{defaultValue:null,description:"",name:"language",required:!1,type:{name:"string"}},userLang:{defaultValue:null,description:"",name:"userLang",required:!1,type:{name:"string"}},setUserLang:{defaultValue:null,description:"",name:"setUserLang",required:!0,type:{name:"(lang: string) => void"}},baseUrl:{defaultValue:null,description:"",name:"baseUrl",required:!1,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!1,type:{name:"string"}},position:{defaultValue:null,description:"",name:"position",required:!1,type:{name:"Venue"}},openPositionDrawer:{defaultValue:null,description:"",name:"openPositionDrawer",required:!0,type:{name:"() => void"}},integrationConfig:{defaultValue:null,description:"",name:"integrationConfig",required:!1,type:{name:"{ [key: string]: any; }"}},instruct:{defaultValue:{value:"false"},description:"",name:"instruct",required:!1,type:{name:"boolean"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasInitialSession:{defaultValue:{value:"false"},description:"",name:"hasInitialSession",required:!1,type:{name:"boolean"}},clickedStart:{defaultValue:null,description:"",name:"clickedStart",required:!1,type:{name:"boolean"}},onClickStart:{defaultValue:null,description:"",name:"onClickStart",required:!1,type:{name:"(() => void)"}},initializeTTS:{defaultValue:null,description:"",name:"initializeTTS",required:!1,type:{name:"(() => void)"}},_TEST_forceProviderStatus:{defaultValue:null,description:"",name:"_TEST_forceProviderStatus",required:!1,type:{name:"enum",value:[{value:'"operational"'},{value:'"degraded_performance"'},{value:'"partial_outage"'},{value:'"major_outage"'}]}},isUserLoggedIn:{defaultValue:{value:"false"},description:"",name:"isUserLoggedIn",required:!1,type:{name:"boolean"}},user:{defaultValue:null,description:"",name:"user",required:!1,type:{name:"User"}},showLogin:{defaultValue:{value:"false"},description:"",name:"showLogin",required:!1,type:{name:"boolean"}},setShowLoginDrawer:{defaultValue:null,description:"",name:"setShowLoginDrawer",required:!0,type:{name:"(show: boolean) => void"}},notEnoughCredits:{defaultValue:{value:"false"},description:"",name:"notEnoughCredits",required:!1,type:{name:"boolean"}},isMultilanguageEnabled:{defaultValue:null,description:"",name:"isMultilanguageEnabled",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/StartPanel/StartPanel.tsx#StartPanel"]={docgenInfo:StartPanel.__docgenInfo,name:"StartPanel",path:"src/components/StartPanel/StartPanel.tsx#StartPanel"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/VenueWidget/VenueWidget.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>VenueWidget_VenueWidget});var react=__webpack_require__("./node_modules/react/index.js"),useTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js");const DEGREES_TO_RADIANS=Math.PI/180,getUncertaintyByViewport=bouningBox=>{const[minLat,maxLat,minLng,maxLng]="string"==typeof bouningBox[0]?bouningBox.map(parseFloat):bouningBox,phi1=minLat*DEGREES_TO_RADIANS,lambda1=minLng*DEGREES_TO_RADIANS,phi2=maxLat*DEGREES_TO_RADIANS,lambda2=maxLng*DEGREES_TO_RADIANS;return 6367.5*(2*Math.asin(Math.sqrt(Math.sin((phi2-phi1)/2)*Math.sin((phi2-phi1)/2)+Math.cos(phi1)*Math.cos(phi2)*Math.sin((lambda2-lambda1)/2)*Math.sin((lambda2-lambda1)/2))))};var hooks=__webpack_require__("./node_modules/react-leaflet/lib/hooks.js"),MapContainer=__webpack_require__("./node_modules/react-leaflet/lib/MapContainer.js"),TileLayer=__webpack_require__("./node_modules/react-leaflet/lib/TileLayer.js"),Marker=__webpack_require__("./node_modules/react-leaflet/lib/Marker.js"),Popup=__webpack_require__("./node_modules/react-leaflet/lib/Popup.js"),lib_context=__webpack_require__("./node_modules/@react-leaflet/core/lib/context.js"),leaflet_src=__webpack_require__("./node_modules/leaflet/dist/leaflet-src.js"),leaflet_src_default=__webpack_require__.n(leaflet_src),dist=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),Button=__webpack_require__("./src/components/ui/Button.tsx"),utils=__webpack_require__("./src/helpers/utils.ts"),combobox=__webpack_require__("./node_modules/@headlessui/react/dist/components/combobox/combobox.js"),transition=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),Spin=__webpack_require__("./src/components/ui/Spin.tsx"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const Circle=({center,size})=>{const context=(0,lib_context.mE)();return(0,react.useEffect)((()=>{const square=new(leaflet_src_default().Circle)(center,size),container=context.layerContainer||context.map;return container.addLayer(square),()=>{container.removeLayer(square)}})),null},CenterAndZoomUpdater=({center,uncertainty})=>{const[init,setInit]=(0,react.useState)(!1),map=(0,hooks.Sx)(),updateView=(0,react.useCallback)((()=>{let zoom=void 0!==uncertainty?Math.round(Math.log2(1e7/uncertainty)):map.getZoom();map.setView(center,zoom)}),[center,uncertainty,map]);return(0,react.useEffect)((()=>{init||(updateView(),setInit(!0))}),[]),(0,react.useEffect)((()=>{updateView()}),[center,uncertainty,updateView]),null};let DefaultIcon=leaflet_src_default().icon({iconUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",shadowUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12.5,20.5],shadowAnchor:[12.5,20.5]});leaflet_src_default().Marker.prototype.options.icon=DefaultIcon;const getPlaceName=venue=>{let placeName="Position";return venue?.address?placeName=[venue.address.village||venue.address.suburb,venue.address.town||venue.address.city||venue.address.county||venue.address.state,venue.address.country].filter(Boolean).filter(((v,i,a)=>a.indexOf(v)===i)).join(", "):venue?.display_name&&(placeName=venue.display_name),placeName},VenueWidget=({venue,setVenue,showUncertainty=!1,showGpsButton=!0,saveAndClose})=>{const{t}=(0,useTranslation.$)(),[isClient,setIsClient]=(0,react.useState)(!1),[updatingPosition,setUpdatingPosition]=(0,react.useState)(!1),[fetching,setFetching]=(0,react.useState)(!1),[query,setQuery]=(0,react.useState)(""),[suggestions,setSuggestions]=(0,react.useState)([]),handleSearch=(0,utils.DI)((async value=>{setFetching(!0);try{let response=await fetch(`https://nominatim.openstreetmap.org/search?q=${value}&format=jsonv2&limit=5&addressdetails=1`),data=await response.json();setSuggestions(data)}catch(error){console.error(error)}finally{setFetching(!1)}}),1e3);return(0,react.useEffect)((()=>{setIsClient(!0)}),[]),(0,react.useEffect)((()=>{const leafletCSS=document.createElement("link");return leafletCSS.href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",leafletCSS.rel="stylesheet",leafletCSS.integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=",leafletCSS.crossOrigin="",document.head.appendChild(leafletCSS),()=>{document.head.removeChild(leafletCSS)}}),[]),(0,jsx_runtime.jsxs)("fieldset",{className:"memori--venue-widget",children:[(0,jsx_runtime.jsx)("legend",{className:"sr-only",children:"Venue"}),(0,jsx_runtime.jsxs)("div",{className:"memori--venue-widget__form-item",children:[(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget__geosuggest",children:updatingPosition?(0,jsx_runtime.jsx)("p",{children:t("write_and_speak.updatingPosition")}):(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget-search",children:(0,jsx_runtime.jsxs)(combobox.h,{value:venue?.latitude&&venue?.longitude?{place_id:0,lat:venue?.latitude,lon:venue?.longitude,display_name:venue?.placeName}:void 0,onChange:value=>{console.log(value);const placeName=getPlaceName(value);setVenue({latitude:value.lat,longitude:value.lon,placeName,uncertainty:value?.boundingbox?getUncertaintyByViewport(value.boundingbox):2})},children:[(0,jsx_runtime.jsx)(combobox.h.Input,{className:"memori--venue-widget-search--input",displayValue:i=>i?getPlaceName(i):"",placeholder:t("searchVenue"),onChange:e=>{return value=e.target.value,setQuery(value),void handleSearch(value);var value}}),(fetching||suggestions.length>0||0===suggestions.length&&""!==query)&&(0,jsx_runtime.jsx)(transition.u,{as:react.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,jsx_runtime.jsx)(combobox.h.Options,{className:"memori--venue-widget-search--options",children:fetching?(0,jsx_runtime.jsx)(Spin.Z,{spinning:!0,children:(0,jsx_runtime.jsxs)("center",{className:"memori--venue-widget-search--option",children:[t("loading"),"..."]})}):0===suggestions.length&&""!==query?(0,jsx_runtime.jsx)("center",{className:"memori--venue-widget-search--option",children:t("nothingFound")}):suggestions?.map((s=>(0,jsx_runtime.jsx)(combobox.h.Option,{as:react.Fragment,value:s,children:({active,selected})=>(0,jsx_runtime.jsx)("li",{className:classnames_default()("memori--venue-widget-search--option",{"memori--venue-widget-search--option-active":active,"memori--venue-widget-search--option-selected":selected}),children:s.display_name})},s.place_id)))})})]})}),showGpsButton&&(0,jsx_runtime.jsx)(Button.Z,{className:"memori--venue-widget__gps-button",primary:!0,loading:updatingPosition,onClick:()=>{setUpdatingPosition(!0),(async()=>{setUpdatingPosition(!0),navigator.geolocation.getCurrentPosition((async coords=>{let venue={latitude:coords.coords.latitude,longitude:coords.coords.longitude,placeName:"Position",uncertainty:coords.coords.accuracy/1e3};try{const result=await fetch(`https://nominatim.openstreetmap.org/reverse?lat=${coords.coords.latitude}&lon=${coords.coords.longitude}&format=jsonv2&addressdetails=1`),response=await result.json(),placeName=getPlaceName(response);venue={latitude:coords.coords.latitude,longitude:coords.coords.longitude,placeName,uncertainty:coords.coords.accuracy/1e3},setVenue(venue)}catch(e){let err=e;console.error("[POSITION ERROR]",err),err?.message&&dist.ZP.error(err.message),setVenue(venue)}finally{saveAndClose&&saveAndClose(venue)}setUpdatingPosition(!1)}),(err=>{console.error("[POSITION ERROR]",err),dist.ZP.error(err.message),setUpdatingPosition(!1)}))})()},children:t("write_and_speak.useMyPosition")})]})}),(0,jsx_runtime.jsx)("div",{children:(0,jsx_runtime.jsx)(Button.Z,{outlined:!0,className:"memori--venue-widget__no-location-button",onClick:()=>{let venue={latitude:0,longitude:0,placeName:"Position",uncertainty:0};setVenue(venue),saveAndClose&&saveAndClose(venue)},children:t("write_and_speak.dontWantToProvidePosition")})}),showUncertainty&&(0,jsx_runtime.jsxs)("label",{className:"memori--venue-widget__select-label",children:[(0,jsx_runtime.jsxs)("span",{children:[t("uncertain"),": "]}),(0,jsx_runtime.jsxs)("select",{className:"memori-select--button memori--venue-widget__uncertainty",value:parseFloat((venue?.uncertainty??0).toFixed(2)),disabled:!(venue&&venue.placeName&&venue.latitude&&venue.longitude),onChange:e=>{setVenue({...venue,uncertainty:parseFloat(e.target.value)})},children:[venue?.uncertainty&&![0,1,2,5,10,20,50,100].includes(venue.uncertainty)&&(0,jsx_runtime.jsxs)("option",{value:venue.uncertainty,children:[venue.uncertainty," Km"]}),(0,jsx_runtime.jsx)("option",{value:0,children:t("exactPosition")}),(0,jsx_runtime.jsx)("option",{value:1,children:"1 km"}),(0,jsx_runtime.jsx)("option",{value:2,children:"2 km"}),(0,jsx_runtime.jsx)("option",{value:5,children:"5 km"}),(0,jsx_runtime.jsx)("option",{value:10,children:"10 km"}),(0,jsx_runtime.jsx)("option",{value:20,children:"20 km"}),(0,jsx_runtime.jsx)("option",{value:50,children:"50 km"}),(0,jsx_runtime.jsx)("option",{value:100,children:"100 km"})]})]})]}),(0,jsx_runtime.jsxs)("div",{className:"memori--venue-widget__form-item",children:[venue?.placeName&&"Position"!==venue.placeName&&(0,jsx_runtime.jsxs)("p",{className:"memori--venue--widget__place-name",children:[(0,jsx_runtime.jsx)("strong",{children:t("venue")}),": ",venue.placeName]}),(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget__map",children:isClient&&(0,jsx_runtime.jsxs)(MapContainer.h,{className:"memori--venue-widget__map",center:venue?.latitude&&venue?.longitude?[venue.latitude,venue.longitude]:[44.66579,11.48823],zoom:13,scrollWheelZoom:!0,children:[(0,jsx_runtime.jsx)(TileLayer.I,{attribution:'© OpenStreetMap contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),(0,jsx_runtime.jsx)(CenterAndZoomUpdater,{center:venue?.latitude&&venue?.longitude?[venue.latitude,venue.longitude]:[44.66579,11.48823],uncertainty:1e3*(venue?.uncertainty??0)}),venue?.latitude&&venue?.longitude&&(0,jsx_runtime.jsx)(Marker.J,{position:[venue.latitude,venue.longitude],icon:DefaultIcon,children:(0,jsx_runtime.jsx)(Popup.G,{children:venue.placeName??""})}),venue?.latitude&&venue?.longitude&&void 0!==venue?.uncertainty&&(0,jsx_runtime.jsx)(Circle,{center:[venue.latitude,venue.longitude],size:1e3*venue.uncertainty})]})})]})]})};VenueWidget.displayName="VenueWidget";const VenueWidget_VenueWidget=VenueWidget;try{VenueWidget.displayName="VenueWidget",VenueWidget.__docgenInfo={description:"",displayName:"VenueWidget",props:{venue:{defaultValue:null,description:"",name:"venue",required:!1,type:{name:"Venue"}},setVenue:{defaultValue:null,description:"",name:"setVenue",required:!0,type:{name:"(venue: Venue) => void"}},showUncertainty:{defaultValue:{value:"false"},description:"",name:"showUncertainty",required:!1,type:{name:"boolean"}},showGpsButton:{defaultValue:{value:"true"},description:"",name:"showGpsButton",required:!1,type:{name:"boolean"}},saveAndClose:{defaultValue:null,description:"",name:"saveAndClose",required:!1,type:{name:"((venue: Venue) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/VenueWidget/VenueWidget.tsx#VenueWidget"]={docgenInfo:VenueWidget.__docgenInfo,name:"VenueWidget",path:"src/components/VenueWidget/VenueWidget.tsx#VenueWidget"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/ChevronLeft.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChevronLeft=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M15 18L9 12 15 6"})});ChevronLeft.displayName="ChevronLeft";const __WEBPACK_DEFAULT_EXPORT__=ChevronLeft;try{ChevronLeft.displayName="ChevronLeft",ChevronLeft.__docgenInfo={description:"",displayName:"ChevronLeft",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/ChevronLeft.tsx#ChevronLeft"]={docgenInfo:ChevronLeft.__docgenInfo,name:"ChevronLeft",path:"src/components/icons/ChevronLeft.tsx#ChevronLeft"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/ChevronRight.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChevronRight=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M9 18L15 12 9 6"})});ChevronRight.displayName="ChevronRight";const __WEBPACK_DEFAULT_EXPORT__=ChevronRight;try{ChevronRight.displayName="ChevronRight",ChevronRight.__docgenInfo={description:"",displayName:"ChevronRight",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/ChevronRight.tsx#ChevronRight"]={docgenInfo:ChevronRight.__docgenInfo,name:"ChevronRight",path:"src/components/icons/ChevronRight.tsx#ChevronRight"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Delete.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Delete=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"})});Delete.displayName="Delete";const __WEBPACK_DEFAULT_EXPORT__=Delete;try{Delete.displayName="Delete",Delete.__docgenInfo={description:"",displayName:"Delete",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Delete.tsx#Delete"]={docgenInfo:Delete.__docgenInfo,name:"Delete",path:"src/components/icons/Delete.tsx#Delete"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Edit.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Edit=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"})});Edit.displayName="Edit";const __WEBPACK_DEFAULT_EXPORT__=Edit;try{Edit.displayName="Edit",Edit.__docgenInfo={description:"",displayName:"Edit",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Edit.tsx#Edit"]={docgenInfo:Edit.__docgenInfo,name:"Edit",path:"src/components/icons/Edit.tsx#Edit"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Eye.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Eye=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"})});Eye.displayName="Eye";const __WEBPACK_DEFAULT_EXPORT__=Eye;try{Eye.displayName="Eye",Eye.__docgenInfo={description:"",displayName:"Eye",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Eye.tsx#Eye"]={docgenInfo:Eye.__docgenInfo,name:"Eye",path:"src/components/icons/Eye.tsx#Eye"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/EyeInvisible.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const EyeInvisible=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z"})]});EyeInvisible.displayName="EyeInvisible";const __WEBPACK_DEFAULT_EXPORT__=EyeInvisible;try{EyeInvisible.displayName="EyeInvisible",EyeInvisible.__docgenInfo={description:"",displayName:"EyeInvisible",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/EyeInvisible.tsx#EyeInvisible"]={docgenInfo:EyeInvisible.__docgenInfo,name:"EyeInvisible",path:"src/components/icons/EyeInvisible.tsx#EyeInvisible"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Plus.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Plus=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className,"aria-label":title,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"})]});Plus.displayName="Plus";const __WEBPACK_DEFAULT_EXPORT__=Plus;try{Plus.displayName="Plus",Plus.__docgenInfo={description:"",displayName:"Plus",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Plus.tsx#Plus"]={docgenInfo:Plus.__docgenInfo,name:"Plus",path:"src/components/icons/Plus.tsx#Plus"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Warning.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Warning=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"})});Warning.displayName="Warning";const __WEBPACK_DEFAULT_EXPORT__=Warning;try{Warning.displayName="Warning",Warning.__docgenInfo={description:"",displayName:"Warning",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Warning.tsx#Warning"]={docgenInfo:Warning.__docgenInfo,name:"Warning",path:"src/components/icons/Warning.tsx#Warning"})}catch(__react_docgen_typescript_loader_error){}},"?875c":()=>{},"?f824":()=>{},"?a523":()=>{},"?540f":()=>{},"?71f6":()=>{},"?3dbe":()=>{},"?c417":()=>{}}]); \ No newline at end of file diff --git a/9696.0c0b05ff.iframe.bundle.js b/9696.0c0b05ff.iframe.bundle.js deleted file mode 100644 index 5d7d58ff..00000000 --- a/9696.0c0b05ff.iframe.bundle.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[9696],{"./src/components/ChatBubble/ChatBubble.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>ChatBubble_ChatBubble});var react=__webpack_require__("./node_modules/react/index.js"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),transition=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),media=__webpack_require__("./src/helpers/media.ts"),User=__webpack_require__("./src/components/icons/User.tsx"),AI=__webpack_require__("./src/components/icons/AI.tsx"),Translation=__webpack_require__("./src/components/icons/Translation.tsx"),Tooltip=__webpack_require__("./src/components/ui/Tooltip.tsx"),FeedbackButtons=__webpack_require__("./src/components/FeedbackButtons/FeedbackButtons.tsx"),useTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),marked_esm=__webpack_require__("./node_modules/marked/lib/marked.esm.js"),purify_es=__webpack_require__("./node_modules/dompurify/dist/purify.es.mjs"),Button=__webpack_require__("./src/components/ui/Button.tsx"),QuestionHelp=__webpack_require__("./src/components/icons/QuestionHelp.tsx"),Copy=__webpack_require__("./src/components/icons/Copy.tsx"),Code=__webpack_require__("./src/components/icons/Code.tsx"),WhyThisAnswer=__webpack_require__("./src/components/WhyThisAnswer/WhyThisAnswer.tsx"),utils=__webpack_require__("./src/helpers/utils.ts"),src=__webpack_require__("./node_modules/marked-linkify-it/src/index.js"),marked_katex_extension_src=__webpack_require__("./node_modules/marked-katex-extension/src/index.js");const getTableCell=(text,cell,type,align)=>{if(!cell.rowspan)return"";return`${`<${type}`+(cell.colspan>1?` colspan=${cell.colspan}`:"")+(cell.rowspan>1?` rowspan=${cell.rowspan}`:"")+(align?` align=${align}`:"")+">"+text}\n`},splitCells=(tableRow,count,prevRow=[])=>{const cells=[...tableRow.matchAll(/(?:[^|\\]|\\.?)+(?:\|+|$)/g)].map((x=>x[0]));cells[0]?.trim()||cells.shift(),cells[cells.length-1]?.trim()||cells.pop();let i,j,trimmedCell,prevCell,prevCols,numCols=0;for(i=0;inumCols)break}numCols+=cells[i].colspan}if(numCols>count)cells.splice(count);else for(;numCols{const cleanHref=(0,utils.bw)(href);if(null===cleanHref)return text;let out='",out}}}),marked_esm.TU.use((0,src.Z)()),marked_esm.TU.use((0,marked_katex_extension_src.Z)({throwOnError:!1,output:"htmlAndMathml"})),marked_esm.TU.use(function markedExtendedTables(){return{extensions:[{name:"spanTable",level:"block",start:src=>src.match(/^\n *([^\n ].*\|.*)\n/)?.index,tokenizer(src,tokens){const cap=new RegExp("^ *([^\\n ].*\\|.*\\n(?: *[^\\s].*\\n)*?) {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n| {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)| {0,3}#{1,6} | {0,3}>| {4}[^\\n]| {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n| {0,3}(?:[*+-]|1[.)]) |<\\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?: +|\\n|\\/?>)|<(?:script|pre|style|textarea|!--)).*(?:\\n|$))*)\\n*|$)").exec(src);if(cap){const item={type:"spanTable",header:cap[1].replace(/\n$/,"").split("\n"),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:cap[3]?cap[3].replace(/\n$/,"").split("\n"):[]};item.header[0]=splitCells(item.header[0]);const colCount=item.header[0].reduce(((length,header)=>length+header.colspan),0);if(colCount===item.align.length){let i,j,k,row;item.raw=cap[0];let l=item.align.length;for(i=0;i",j=0;j"}if(output+="",token.rows.length){for(output+="",i=0;i",j=0;j"}output+=""}return output+="",output}}]}}());const ChatBubble=({message,memori,tenant,baseUrl,apiUrl,sessionID,showFeedback,showWhyThisAnswer=!0,showCopyButton=!0,showTranslationOriginal=!1,simulateUserPrompt,showAIicon=!0,isFirst=!1,user,userAvatar,experts})=>{const{t,i18n}=(0,useTranslation.$)(),lang=i18n.language||"en",[showingWhyThisAnswer,setShowingWhyThisAnswer]=(0,react.useState)(!1),text=message.translatedText||message.text,renderedText=(text=>{try{return(text=>text.split("\n").reduce(((acc,row)=>{if(row.includes("=")){let result="",isEscaped=!1;for(let i=0;i$1').replaceAll(/```markdown([^```]+)```/g,"$1").replaceAll("($","( $").replaceAll(":$",": $").replaceAll("\frac","\\frac").replaceAll("\beta","\\beta").replaceAll("cdot","\\cdot")).trim().replace(/\n/g,"
"),{ADD_ATTR:["target"]})).replace(/(
)+/g,"
").replace(/

<\/p>/g,"
").replace(/


<\/p>/g,"
")}catch(e){return console.error(e),text}})(text),plainText=message.fromUser?text:(0,utils.Cb)((0,utils.kh)(renderedText));return(0,react.useLayoutEffect)((()=>{"undefined"==typeof window||message.fromUser||"MathJax"in window&&window.MathJax.typesetPromise&&window.MathJax.typesetPromise([".memori-chat--bubble-content"])}),[message.text,message.fromUser]),(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(message.initial||isFirst)&&(0,jsx_runtime.jsx)("div",{className:"memori-chat--bubble-initial"}),(0,jsx_runtime.jsxs)(transition.u,{show:!0,appear:!0,as:"div",className:classnames_default()("memori-chat--bubble-container",{"memori-chat--bubble-from-user":!!message.fromUser,"memori-chat--with-addon":message.generatedByAI&&showAIicon||showFeedback&&simulateUserPrompt}),children:[!message.fromUser&&(0,jsx_runtime.jsx)(transition.u.Child,{as:"picture",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(message.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(message.fromUser?"translate-x-15":"translate-x--15"),title:message.emitter?.length&&memori.enableBoardOfExperts?message.emitter:memori.name,children:(0,jsx_runtime.jsx)("img",{className:"memori-chat--bubble-avatar-img",alt:message.emitter?.length&&memori.enableBoardOfExperts?message.emitter:memori.name,src:message.emitter?.length&&memori.enableBoardOfExperts&&experts?.find((e=>e.name===message.emitter))?`${apiUrl}/api/v1/memoriai/memori/avatar/${experts.find((e=>e.name===message.emitter))?.expertMemoriID}`:memori.avatarURL&&memori.avatarURL.length>0?(0,media.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl}):(0,media.v)({tenantID:tenant?.id,type:"avatar",baseURL:baseUrl||"https://www.aisuru.com",apiURL:apiUrl}),onError:e=>{e.currentTarget.src=memori.avatarURL&&memori.avatarURL.length>0?(0,media.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl}):(0,media.v)({tenantID:tenant?.id,type:"avatar",baseURL:baseUrl}),e.currentTarget.onerror=null}})}),(0,jsx_runtime.jsxs)(transition.u.Child,{as:"div",className:classnames_default()("memori-chat--bubble",{"memori-chat--user-bubble":!!message.fromUser,"memori-chat--with-addon":!message.fromUser&&showCopyButton||message.generatedByAI&&showAIicon||showFeedback&&simulateUserPrompt,"memori-chat--ai-generated":message.generatedByAI&&showAIicon,"memori-chat--with-feedback":showFeedback}),enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-09 translate-x-"+(message.fromUser?"30":"-30"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-09 translate-x-"+(message.fromUser?"30":"-30"),children:[(0,jsx_runtime.jsx)("div",{dir:"auto",className:"memori-chat--bubble-content",dangerouslySetInnerHTML:{__html:renderedText}}),(!message.fromUser&&showCopyButton||message.generatedByAI&&showAIicon||showFeedback&&simulateUserPrompt)&&(0,jsx_runtime.jsxs)("div",{className:"memori-chat--bubble-addon",children:[!message.fromUser&&showCopyButton&&(0,jsx_runtime.jsx)(Button.Z,{ghost:!0,shape:"circle",title:t("copy")||"Copy",className:"memori-chat--bubble-action-icon",icon:(0,jsx_runtime.jsx)(Copy.default,{"aria-label":t("copy")||"Copy"}),onClick:()=>navigator.clipboard.writeText(plainText)}),!message.fromUser&&showCopyButton&&plainText!==message.text&&(0,jsx_runtime.jsx)(Button.Z,{ghost:!0,shape:"circle",title:t("copyRawCode")||"Copy raw code",className:"memori-chat--bubble-action-icon",icon:(0,jsx_runtime.jsx)(Code.default,{"aria-label":t("copyRawCode")||"Copy raw code"}),onClick:()=>navigator.clipboard.writeText(message.text)}),showFeedback&&!!simulateUserPrompt&&(0,jsx_runtime.jsx)(FeedbackButtons.Z,{memori,className:"memori-chat--bubble-feedback",dropdown:!0,onNegativeClick:msg=>{msg&&simulateUserPrompt(msg)}}),message.generatedByAI&&showAIicon&&(0,jsx_runtime.jsx)(Tooltip.Z,{align:"left",content:t("generatedByAI"),className:"memori-chat--bubble-action-icon memori-chat--bubble-action-icon--ai",children:(0,jsx_runtime.jsx)("span",{children:(0,jsx_runtime.jsx)(AI.default,{title:t("generatedByAI")||void 0})})}),showTranslationOriginal&&message.translatedText&&message.translatedText!==message.text&&(0,jsx_runtime.jsx)(Tooltip.Z,{align:"left",content:`${"it"===lang?"Testo originale":"Original text"}: ${message.text}`,className:"memori-chat--bubble-action-icon memori-chat--bubble-action-icon--ai",children:(0,jsx_runtime.jsx)("span",{children:(0,jsx_runtime.jsx)(Translation.default,{"aria-label":"it"===lang?"Testo originale":"Original text"})})}),!message.fromUser&&message.questionAnswered&&apiUrl&&showWhyThisAnswer&&(0,jsx_runtime.jsx)(Button.Z,{ghost:!0,shape:"circle",title:t("whyThisAnswer")||void 0,className:"memori-chat--bubble-action-icon",onClick:()=>setShowingWhyThisAnswer(!0),disabled:showingWhyThisAnswer,icon:(0,jsx_runtime.jsx)(QuestionHelp.default,{title:t("whyThisAnswer")||void 0})})]})]}),message.fromUser&&(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{children:userAvatar&&"string"==typeof userAvatar||!userAvatar&&user?.avatarURL?.length?(0,jsx_runtime.jsx)(transition.u.Child,{as:"picture",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(message.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(message.fromUser?"translate-x-15":"translate-x--15"),children:(0,jsx_runtime.jsx)("img",{className:"memori-chat--bubble-avatar-img",alt:user?.userName??"User",src:userAvatar??user?.avatarURL})}):userAvatar?(0,jsx_runtime.jsx)(transition.u.Child,{as:"div",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(message.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(message.fromUser?"translate-x-15":"translate-x--15"),children:userAvatar}):(0,jsx_runtime.jsx)(transition.u.Child,{as:"div",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(message.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(message.fromUser?"translate-x-15":"translate-x--15"),children:(0,jsx_runtime.jsx)(User.default,{})})})]}),showingWhyThisAnswer&&apiUrl&&(0,jsx_runtime.jsx)(WhyThisAnswer.Z,{visible:showingWhyThisAnswer,message,closeDrawer:()=>setShowingWhyThisAnswer(!1),apiURL:apiUrl,sessionID})]})},ChatBubble_ChatBubble=ChatBubble;try{ChatBubble.displayName="ChatBubble",ChatBubble.__docgenInfo={description:"",displayName:"ChatBubble",props:{message:{defaultValue:null,description:"",name:"message",required:!0,type:{name:"Message"}},memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},sessionID:{defaultValue:null,description:"",name:"sessionID",required:!0,type:{name:"string"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},baseUrl:{defaultValue:null,description:"",name:"baseUrl",required:!1,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!1,type:{name:"string"}},showFeedback:{defaultValue:null,description:"",name:"showFeedback",required:!1,type:{name:"boolean"}},showWhyThisAnswer:{defaultValue:{value:"true"},description:"",name:"showWhyThisAnswer",required:!1,type:{name:"boolean"}},showCopyButton:{defaultValue:{value:"true"},description:"",name:"showCopyButton",required:!1,type:{name:"boolean"}},showTranslationOriginal:{defaultValue:{value:"false"},description:"",name:"showTranslationOriginal",required:!1,type:{name:"boolean"}},simulateUserPrompt:{defaultValue:null,description:"",name:"simulateUserPrompt",required:!1,type:{name:"((msg: string) => void)"}},showAIicon:{defaultValue:{value:"true"},description:"",name:"showAIicon",required:!1,type:{name:"boolean"}},isFirst:{defaultValue:{value:"false"},description:"",name:"isFirst",required:!1,type:{name:"boolean"}},userAvatar:{defaultValue:null,description:"",name:"userAvatar",required:!1,type:{name:"string | Element"}},user:{defaultValue:null,description:"",name:"user",required:!1,type:{name:"User"}},experts:{defaultValue:null,description:"",name:"experts",required:!1,type:{name:"ExpertReference[]"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ChatBubble/ChatBubble.tsx#ChatBubble"]={docgenInfo:ChatBubble.__docgenInfo,name:"ChatBubble",path:"src/components/ChatBubble/ChatBubble.tsx#ChatBubble"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/FeedbackButtons/FeedbackButtons.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/@headlessui/react/dist/components/menu/menu.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Tooltip.tsx"),_ui_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Feedback__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Feedback.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react/jsx-runtime.js");const feedbackMsgs={"it-IT":"Non è quello che ti ho chiesto","fr-FR":"Ce n'est pas ce que je t'ai demandé","en-GB":"It's not what I asked"},feedbackMsgsHelpers={"it-IT":"La risposta non era corretta","fr-FR":"La réponse n'était pas correcte","en-GB":"The answer was not correct"},dislikeMsgs={"it-IT":"Non mi è piaciuta la risposta","fr-FR":"Je n'ai pas aimé la réponse","en-GB":"I didn't like the answer"},FeedbackButtons=({memori,className,onNegativeClick,toggle=!1,dropdown=!1})=>{const[clicked,setClicked]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(),culture="it-IT"===memori.culture?"it-IT":"fr-FR"===memori.culture?"fr-FR":"en-GB",feedbackMsg=feedbackMsgs[culture],feedbackMsgHelper=feedbackMsgsHelpers[culture],dislikeMsg=dislikeMsgs[culture];return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div",{className:"memori-chat--feedback"+(className?` ${className}`:""),children:dropdown?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.v,{as:"div",className:"memori-chat--feedback-menu",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.v.Button,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{ghost:!0,shape:"circle",title:"Feedback",className:"memori-chat--feedback-menu-button",disabled:!!clicked,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_icons_Feedback__WEBPACK_IMPORTED_MODULE_3__.default,{className:clicked?"memori-chat--feedback-clicked":void 0})})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"transition ease-out duration-200",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.v.Items,{className:"memori-chat--feedback-menu-items",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div",{className:"memori-chat--feedback-menu-items-container",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.v.Item,{children:({active})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("button",{className:"memori-chat--feedback-menu-item"+(active?" memori-chat--feedback-menu-item-active":""),onClick:()=>{setClicked("up"===clicked&&toggle?void 0:"up")},children:dislikeMsg})},"ok"),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.v.Item,{children:({active})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("button",{className:"memori-chat--feedback-menu-item"+(active?" memori-chat--feedback-menu-item-active":""),onClick:()=>{setClicked("down"===clicked&&toggle?void 0:"down"),onNegativeClick(feedbackMsg)},children:feedbackMsgHelper})},"no")]})})})]}):(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:"Feedback",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{title:"Feedback",onClick:()=>{setClicked("down"===clicked&&toggle?void 0:"down"),onNegativeClick(feedbackMsg)},ghost:!0,shape:"circle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_icons_Feedback__WEBPACK_IMPORTED_MODULE_3__.default,{className:clicked?"memori-chat--feedback-clicked":void 0})})})})};FeedbackButtons.displayName="FeedbackButtons";const __WEBPACK_DEFAULT_EXPORT__=FeedbackButtons;try{FeedbackButtons.displayName="FeedbackButtons",FeedbackButtons.__docgenInfo={description:"",displayName:"FeedbackButtons",props:{memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},onNegativeClick:{defaultValue:null,description:"",name:"onNegativeClick",required:!0,type:{name:"(msg?: string | undefined) => void"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},toggle:{defaultValue:{value:"false"},description:"",name:"toggle",required:!1,type:{name:"boolean"}},dropdown:{defaultValue:{value:"false"},description:"",name:"dropdown",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/FeedbackButtons/FeedbackButtons.tsx#FeedbackButtons"]={docgenInfo:FeedbackButtons.__docgenInfo,name:"FeedbackButtons",path:"src/components/FeedbackButtons/FeedbackButtons.tsx#FeedbackButtons"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/AI.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const AI=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{fillRule:"evenodd",d:"M0 4a4 4 0 014-4h16a4 4 0 014 4v16a4 4 0 01-4 4H4a4 4 0 01-4-4zm4-2.4A2.4 2.4 0 001.6 4v16A2.4 2.4 0 004 22.4h16a2.4 2.4 0 002.4-2.4V4A2.4 2.4 0 0020 1.6z",clipRule:"evenodd"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{fillRule:"evenodd",d:"M9.715 8.442a.798.798 0 00-1.43 0l-3.2 6.4a.799.799 0 101.431.716l.579-1.158h3.811l.578 1.158a.8.8 0 001.431-.716zm.391 4.358L9 10.589 7.894 12.8z",clipRule:"evenodd"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{fillRule:"evenodd",d:"M17 8c.552 0 1 .358 1 .8v6.4c0 .442-.448.8-1 .8s-1-.358-1-.8V8.8c0-.442.448-.8 1-.8z",clipRule:"evenodd"})]})});AI.displayName="AI";const __WEBPACK_DEFAULT_EXPORT__=AI;try{AI.displayName="AI",AI.__docgenInfo={description:"",displayName:"AI",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/AI.tsx#AI"]={docgenInfo:AI.__docgenInfo,name:"AI",path:"src/components/icons/AI.tsx#AI"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Code.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Code=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",focusable:"false",role:"img",className,"aria-label":title,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M10 9.5 8 12l2 2.5"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"m14 9.5 2 2.5-2 2.5"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"})]});Code.displayName="Code";const __WEBPACK_DEFAULT_EXPORT__=Code;try{Code.displayName="Code",Code.__docgenInfo={description:"",displayName:"Code",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Code.tsx#Code"]={docgenInfo:Code.__docgenInfo,name:"Code",path:"src/components/icons/Code.tsx#Code"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Feedback.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Feedback=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className,"aria-label":title,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H5.17l-.59.59-.58.58V4h16v12zm-9-4h2v2h-2zm0-6h2v4h-2z"})]});Feedback.displayName="Feedback";const __WEBPACK_DEFAULT_EXPORT__=Feedback;try{Feedback.displayName="Feedback",Feedback.__docgenInfo={description:"",displayName:"Feedback",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Feedback.tsx#Feedback"]={docgenInfo:Feedback.__docgenInfo,name:"Feedback",path:"src/components/icons/Feedback.tsx#Feedback"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/QuestionHelp.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const QuestionHelp=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",viewBox:"0 0 24 24",className,"aria-label":title,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M12 17L12.01 17"})]});QuestionHelp.displayName="QuestionHelp";const __WEBPACK_DEFAULT_EXPORT__=QuestionHelp;try{QuestionHelp.displayName="QuestionHelp",QuestionHelp.__docgenInfo={description:"",displayName:"QuestionHelp",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/QuestionHelp.tsx#QuestionHelp"]={docgenInfo:QuestionHelp.__docgenInfo,name:"QuestionHelp",path:"src/components/icons/QuestionHelp.tsx#QuestionHelp"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Translation.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Translation=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className,"aria-label":title,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M140 188h584v164h76V144c0-17.7-14.3-32-32-32H96c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h544v-76H140V188z"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M414.3 256h-60.6c-3.4 0-6.4 2.2-7.6 5.4L219 629.4c-.3.8-.4 1.7-.4 2.6 0 4.4 3.6 8 8 8h55.1c3.4 0 6.4-2.2 7.6-5.4L322 540h196.2L422 261.4c-1.3-3.2-4.3-5.4-7.7-5.4zm12.4 228h-85.5L384 360.2 426.7 484zM936 528H800v-93c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v93H592c-13.3 0-24 10.7-24 24v176c0 13.3 10.7 24 24 24h136v152c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V752h136c13.3 0 24-10.7 24-24V552c0-13.3-10.7-24-24-24zM728 680h-88v-80h88v80zm160 0h-88v-80h88v80z"})]});Translation.displayName="Translation";const __WEBPACK_DEFAULT_EXPORT__=Translation;try{Translation.displayName="Translation",Translation.__docgenInfo={description:"",displayName:"Translation",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Translation.tsx#Translation"]={docgenInfo:Translation.__docgenInfo,name:"Translation",path:"src/components/icons/Translation.tsx#Translation"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/User.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const User=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M858.5 763.6a374 374 0 0 0-80.6-119.5 375.63 375.63 0 0 0-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 0 0-80.6 119.5A371.7 371.7 0 0 0 136 901.8a8 8 0 0 0 8 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 0 0 8-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"})});User.displayName="User";const __WEBPACK_DEFAULT_EXPORT__=User;try{User.displayName="User",User.__docgenInfo={description:"",displayName:"User",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/User.tsx#User"]={docgenInfo:User.__docgenInfo,name:"User",path:"src/components/icons/User.tsx#User"})}catch(__react_docgen_typescript_loader_error){}}}]); \ No newline at end of file diff --git a/9696.e67acf18.iframe.bundle.js b/9696.e67acf18.iframe.bundle.js new file mode 100644 index 00000000..da3d29bc --- /dev/null +++ b/9696.e67acf18.iframe.bundle.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[9696],{"./src/components/ChatBubble/ChatBubble.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>ChatBubble_ChatBubble});var react=__webpack_require__("./node_modules/react/index.js"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),transition=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),media=__webpack_require__("./src/helpers/media.ts"),User=__webpack_require__("./src/components/icons/User.tsx"),AI=__webpack_require__("./src/components/icons/AI.tsx"),Translation=__webpack_require__("./src/components/icons/Translation.tsx"),Tooltip=__webpack_require__("./src/components/ui/Tooltip.tsx"),FeedbackButtons=__webpack_require__("./src/components/FeedbackButtons/FeedbackButtons.tsx"),useTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),marked_esm=__webpack_require__("./node_modules/marked/lib/marked.esm.js"),purify_es=__webpack_require__("./node_modules/dompurify/dist/purify.es.mjs"),Button=__webpack_require__("./src/components/ui/Button.tsx"),QuestionHelp=__webpack_require__("./src/components/icons/QuestionHelp.tsx"),Copy=__webpack_require__("./src/components/icons/Copy.tsx"),Code=__webpack_require__("./src/components/icons/Code.tsx"),WhyThisAnswer=__webpack_require__("./src/components/WhyThisAnswer/WhyThisAnswer.tsx"),utils=__webpack_require__("./src/helpers/utils.ts"),src=__webpack_require__("./node_modules/marked-linkify-it/src/index.js"),marked_katex_extension_src=__webpack_require__("./node_modules/marked-katex-extension/src/index.js");const getTableCell=(text,cell,type,align)=>{if(!cell.rowspan)return"";return`${`<${type}`+(cell.colspan>1?` colspan=${cell.colspan}`:"")+(cell.rowspan>1?` rowspan=${cell.rowspan}`:"")+(align?` align=${align}`:"")+">"+text}\n`},splitCells=(tableRow,count,prevRow=[])=>{const cells=[...tableRow.matchAll(/(?:[^|\\]|\\.?)+(?:\|+|$)/g)].map((x=>x[0]));cells[0]?.trim()||cells.shift(),cells[cells.length-1]?.trim()||cells.pop();let i,j,trimmedCell,prevCell,prevCols,numCols=0;for(i=0;inumCols)break}numCols+=cells[i].colspan}if(numCols>count)cells.splice(count);else for(;numCols{const cleanHref=(0,utils.bw)(href);if(null===cleanHref)return text;let out='",out}}}),marked_esm.TU.use((0,src.Z)()),marked_esm.TU.use(function markedExtendedTables(){return{extensions:[{name:"spanTable",level:"block",start:src=>src.match(/^\n *([^\n ].*\|.*)\n/)?.index,tokenizer(src,tokens){const cap=new RegExp("^ *([^\\n ].*\\|.*\\n(?: *[^\\s].*\\n)*?) {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n| {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)| {0,3}#{1,6} | {0,3}>| {4}[^\\n]| {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n| {0,3}(?:[*+-]|1[.)]) |<\\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?: +|\\n|\\/?>)|<(?:script|pre|style|textarea|!--)).*(?:\\n|$))*)\\n*|$)").exec(src);if(cap){const item={type:"spanTable",header:cap[1].replace(/\n$/,"").split("\n"),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:cap[3]?cap[3].replace(/\n$/,"").split("\n"):[]};item.header[0]=splitCells(item.header[0]);const colCount=item.header[0].reduce(((length,header)=>length+header.colspan),0);if(colCount===item.align.length){let i,j,k,row;item.raw=cap[0];let l=item.align.length;for(i=0;i",j=0;j"}if(output+="",token.rows.length){for(output+="",i=0;i",j=0;j"}output+=""}return output+="",output}}]}}());const ChatBubble=({message,memori,tenant,baseUrl,apiUrl,sessionID,showFeedback,showWhyThisAnswer=!0,showCopyButton=!0,showTranslationOriginal=!1,simulateUserPrompt,showAIicon=!0,isFirst=!1,useMathFormatting=!1,user,userAvatar,experts})=>{const{t,i18n}=(0,useTranslation.$)(),lang=i18n.language||"en",[showingWhyThisAnswer,setShowingWhyThisAnswer]=(0,react.useState)(!1);useMathFormatting&&marked_esm.TU.use((0,marked_katex_extension_src.Z)({throwOnError:!1,output:"htmlAndMathml"}));const text=message.translatedText||message.text,renderedText=((text,useMathFormatting=!1)=>{try{let parsedText=purify_es.Z.sanitize(marked_esm.TU.parse(text.trim().replaceAll(/\[([^\]]+)\]\(([^\)]+)\)/g,'$1').replaceAll(/```markdown([^```]+)```/g,"$1").replaceAll("($","( $").replaceAll(":$",": $").replaceAll("\frac","\\frac").replaceAll("\beta","\\beta").replaceAll("cdot","\\cdot")).trim().replace(/\n/g,"
"),{ADD_ATTR:["target"]});return useMathFormatting&&(parsedText=(text=>text.split("\n").reduce(((acc,row)=>{if(row.includes("=")){let result="",isEscaped=!1;for(let i=0;i)+/g,"
").replace(/

<\/p>/g,"
").replace(/


<\/p>/g,"
")}catch(e){return console.error(e),text}})(text,useMathFormatting),plainText=message.fromUser?text:(0,utils.Cb)((0,utils.kh)(renderedText));return(0,react.useLayoutEffect)((()=>{"undefined"!=typeof window&&!message.fromUser&&useMathFormatting&&"MathJax"in window&&window.MathJax.typesetPromise&&window.MathJax.typesetPromise([".memori-chat--bubble-content"])}),[message.text,message.fromUser,useMathFormatting]),(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(message.initial||isFirst)&&(0,jsx_runtime.jsx)("div",{className:"memori-chat--bubble-initial"}),(0,jsx_runtime.jsxs)(transition.u,{show:!0,appear:!0,as:"div",className:classnames_default()("memori-chat--bubble-container",{"memori-chat--bubble-from-user":!!message.fromUser,"memori-chat--with-addon":message.generatedByAI&&showAIicon||showFeedback&&simulateUserPrompt}),children:[!message.fromUser&&(0,jsx_runtime.jsx)(transition.u.Child,{as:"picture",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(message.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(message.fromUser?"translate-x-15":"translate-x--15"),title:message.emitter?.length&&memori.enableBoardOfExperts?message.emitter:memori.name,children:(0,jsx_runtime.jsx)("img",{className:"memori-chat--bubble-avatar-img",alt:message.emitter?.length&&memori.enableBoardOfExperts?message.emitter:memori.name,src:message.emitter?.length&&memori.enableBoardOfExperts&&experts?.find((e=>e.name===message.emitter))?`${apiUrl}/api/v1/memoriai/memori/avatar/${experts.find((e=>e.name===message.emitter))?.expertMemoriID}`:memori.avatarURL&&memori.avatarURL.length>0?(0,media.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl}):(0,media.v)({tenantID:tenant?.id,type:"avatar",baseURL:baseUrl||"https://www.aisuru.com",apiURL:apiUrl}),onError:e=>{e.currentTarget.src=memori.avatarURL&&memori.avatarURL.length>0?(0,media.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl}):(0,media.v)({tenantID:tenant?.id,type:"avatar",baseURL:baseUrl}),e.currentTarget.onerror=null}})}),(0,jsx_runtime.jsxs)(transition.u.Child,{as:"div",className:classnames_default()("memori-chat--bubble",{"memori-chat--user-bubble":!!message.fromUser,"memori-chat--with-addon":!message.fromUser&&showCopyButton||message.generatedByAI&&showAIicon||showFeedback&&simulateUserPrompt,"memori-chat--ai-generated":message.generatedByAI&&showAIicon,"memori-chat--with-feedback":showFeedback}),enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-09 translate-x-"+(message.fromUser?"30":"-30"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-09 translate-x-"+(message.fromUser?"30":"-30"),children:[(0,jsx_runtime.jsx)("div",{dir:"auto",className:"memori-chat--bubble-content",dangerouslySetInnerHTML:{__html:renderedText}}),(!message.fromUser&&showCopyButton||message.generatedByAI&&showAIicon||showFeedback&&simulateUserPrompt)&&(0,jsx_runtime.jsxs)("div",{className:"memori-chat--bubble-addon",children:[!message.fromUser&&showCopyButton&&(0,jsx_runtime.jsx)(Button.Z,{ghost:!0,shape:"circle",title:t("copy")||"Copy",className:"memori-chat--bubble-action-icon",icon:(0,jsx_runtime.jsx)(Copy.default,{"aria-label":t("copy")||"Copy"}),onClick:()=>navigator.clipboard.writeText(plainText)}),!message.fromUser&&showCopyButton&&plainText!==message.text&&(0,jsx_runtime.jsx)(Button.Z,{ghost:!0,shape:"circle",title:t("copyRawCode")||"Copy raw code",className:"memori-chat--bubble-action-icon",icon:(0,jsx_runtime.jsx)(Code.default,{"aria-label":t("copyRawCode")||"Copy raw code"}),onClick:()=>navigator.clipboard.writeText(message.text)}),showFeedback&&!!simulateUserPrompt&&(0,jsx_runtime.jsx)(FeedbackButtons.Z,{memori,className:"memori-chat--bubble-feedback",dropdown:!0,onNegativeClick:msg=>{msg&&simulateUserPrompt(msg)}}),message.generatedByAI&&showAIicon&&(0,jsx_runtime.jsx)(Tooltip.Z,{align:"left",content:t("generatedByAI"),className:"memori-chat--bubble-action-icon memori-chat--bubble-action-icon--ai",children:(0,jsx_runtime.jsx)("span",{children:(0,jsx_runtime.jsx)(AI.default,{title:t("generatedByAI")||void 0})})}),showTranslationOriginal&&message.translatedText&&message.translatedText!==message.text&&(0,jsx_runtime.jsx)(Tooltip.Z,{align:"left",content:`${"it"===lang?"Testo originale":"Original text"}: ${message.text}`,className:"memori-chat--bubble-action-icon memori-chat--bubble-action-icon--ai",children:(0,jsx_runtime.jsx)("span",{children:(0,jsx_runtime.jsx)(Translation.default,{"aria-label":"it"===lang?"Testo originale":"Original text"})})}),!message.fromUser&&message.questionAnswered&&apiUrl&&showWhyThisAnswer&&(0,jsx_runtime.jsx)(Button.Z,{ghost:!0,shape:"circle",title:t("whyThisAnswer")||void 0,className:"memori-chat--bubble-action-icon",onClick:()=>setShowingWhyThisAnswer(!0),disabled:showingWhyThisAnswer,icon:(0,jsx_runtime.jsx)(QuestionHelp.default,{title:t("whyThisAnswer")||void 0})})]})]}),message.fromUser&&(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{children:userAvatar&&"string"==typeof userAvatar||!userAvatar&&user?.avatarURL?.length?(0,jsx_runtime.jsx)(transition.u.Child,{as:"picture",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(message.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(message.fromUser?"translate-x-15":"translate-x--15"),children:(0,jsx_runtime.jsx)("img",{className:"memori-chat--bubble-avatar-img",alt:user?.userName??"User",src:userAvatar??user?.avatarURL})}):userAvatar?(0,jsx_runtime.jsx)(transition.u.Child,{as:"div",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(message.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(message.fromUser?"translate-x-15":"translate-x--15"),children:userAvatar}):(0,jsx_runtime.jsx)(transition.u.Child,{as:"div",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(message.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(message.fromUser?"translate-x-15":"translate-x--15"),children:(0,jsx_runtime.jsx)(User.default,{})})})]}),showingWhyThisAnswer&&apiUrl&&(0,jsx_runtime.jsx)(WhyThisAnswer.Z,{visible:showingWhyThisAnswer,message,closeDrawer:()=>setShowingWhyThisAnswer(!1),apiURL:apiUrl,sessionID})]})},ChatBubble_ChatBubble=ChatBubble;try{ChatBubble.displayName="ChatBubble",ChatBubble.__docgenInfo={description:"",displayName:"ChatBubble",props:{message:{defaultValue:null,description:"",name:"message",required:!0,type:{name:"Message"}},memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},sessionID:{defaultValue:null,description:"",name:"sessionID",required:!0,type:{name:"string"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},baseUrl:{defaultValue:null,description:"",name:"baseUrl",required:!1,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!1,type:{name:"string"}},showFeedback:{defaultValue:null,description:"",name:"showFeedback",required:!1,type:{name:"boolean"}},showWhyThisAnswer:{defaultValue:{value:"true"},description:"",name:"showWhyThisAnswer",required:!1,type:{name:"boolean"}},showCopyButton:{defaultValue:{value:"true"},description:"",name:"showCopyButton",required:!1,type:{name:"boolean"}},showTranslationOriginal:{defaultValue:{value:"false"},description:"",name:"showTranslationOriginal",required:!1,type:{name:"boolean"}},simulateUserPrompt:{defaultValue:null,description:"",name:"simulateUserPrompt",required:!1,type:{name:"((msg: string) => void)"}},showAIicon:{defaultValue:{value:"true"},description:"",name:"showAIicon",required:!1,type:{name:"boolean"}},useMathFormatting:{defaultValue:{value:"false"},description:"",name:"useMathFormatting",required:!1,type:{name:"boolean"}},isFirst:{defaultValue:{value:"false"},description:"",name:"isFirst",required:!1,type:{name:"boolean"}},userAvatar:{defaultValue:null,description:"",name:"userAvatar",required:!1,type:{name:"string | Element"}},user:{defaultValue:null,description:"",name:"user",required:!1,type:{name:"User"}},experts:{defaultValue:null,description:"",name:"experts",required:!1,type:{name:"ExpertReference[]"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ChatBubble/ChatBubble.tsx#ChatBubble"]={docgenInfo:ChatBubble.__docgenInfo,name:"ChatBubble",path:"src/components/ChatBubble/ChatBubble.tsx#ChatBubble"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/FeedbackButtons/FeedbackButtons.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/@headlessui/react/dist/components/menu/menu.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Tooltip.tsx"),_ui_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Feedback__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Feedback.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react/jsx-runtime.js");const feedbackMsgs={"it-IT":"Non è quello che ti ho chiesto","fr-FR":"Ce n'est pas ce que je t'ai demandé","en-GB":"It's not what I asked"},feedbackMsgsHelpers={"it-IT":"La risposta non era corretta","fr-FR":"La réponse n'était pas correcte","en-GB":"The answer was not correct"},dislikeMsgs={"it-IT":"Non mi è piaciuta la risposta","fr-FR":"Je n'ai pas aimé la réponse","en-GB":"I didn't like the answer"},FeedbackButtons=({memori,className,onNegativeClick,toggle=!1,dropdown=!1})=>{const[clicked,setClicked]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(),culture="it-IT"===memori.culture?"it-IT":"fr-FR"===memori.culture?"fr-FR":"en-GB",feedbackMsg=feedbackMsgs[culture],feedbackMsgHelper=feedbackMsgsHelpers[culture],dislikeMsg=dislikeMsgs[culture];return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div",{className:"memori-chat--feedback"+(className?` ${className}`:""),children:dropdown?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.v,{as:"div",className:"memori-chat--feedback-menu",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.v.Button,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{ghost:!0,shape:"circle",title:"Feedback",className:"memori-chat--feedback-menu-button",disabled:!!clicked,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_icons_Feedback__WEBPACK_IMPORTED_MODULE_3__.default,{className:clicked?"memori-chat--feedback-clicked":void 0})})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"transition ease-out duration-200",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.v.Items,{className:"memori-chat--feedback-menu-items",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div",{className:"memori-chat--feedback-menu-items-container",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.v.Item,{children:({active})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("button",{className:"memori-chat--feedback-menu-item"+(active?" memori-chat--feedback-menu-item-active":""),onClick:()=>{setClicked("up"===clicked&&toggle?void 0:"up")},children:dislikeMsg})},"ok"),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.v.Item,{children:({active})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("button",{className:"memori-chat--feedback-menu-item"+(active?" memori-chat--feedback-menu-item-active":""),onClick:()=>{setClicked("down"===clicked&&toggle?void 0:"down"),onNegativeClick(feedbackMsg)},children:feedbackMsgHelper})},"no")]})})})]}):(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:"Feedback",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{title:"Feedback",onClick:()=>{setClicked("down"===clicked&&toggle?void 0:"down"),onNegativeClick(feedbackMsg)},ghost:!0,shape:"circle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_icons_Feedback__WEBPACK_IMPORTED_MODULE_3__.default,{className:clicked?"memori-chat--feedback-clicked":void 0})})})})};FeedbackButtons.displayName="FeedbackButtons";const __WEBPACK_DEFAULT_EXPORT__=FeedbackButtons;try{FeedbackButtons.displayName="FeedbackButtons",FeedbackButtons.__docgenInfo={description:"",displayName:"FeedbackButtons",props:{memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},onNegativeClick:{defaultValue:null,description:"",name:"onNegativeClick",required:!0,type:{name:"(msg?: string | undefined) => void"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},toggle:{defaultValue:{value:"false"},description:"",name:"toggle",required:!1,type:{name:"boolean"}},dropdown:{defaultValue:{value:"false"},description:"",name:"dropdown",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/FeedbackButtons/FeedbackButtons.tsx#FeedbackButtons"]={docgenInfo:FeedbackButtons.__docgenInfo,name:"FeedbackButtons",path:"src/components/FeedbackButtons/FeedbackButtons.tsx#FeedbackButtons"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/AI.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const AI=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{fillRule:"evenodd",d:"M0 4a4 4 0 014-4h16a4 4 0 014 4v16a4 4 0 01-4 4H4a4 4 0 01-4-4zm4-2.4A2.4 2.4 0 001.6 4v16A2.4 2.4 0 004 22.4h16a2.4 2.4 0 002.4-2.4V4A2.4 2.4 0 0020 1.6z",clipRule:"evenodd"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{fillRule:"evenodd",d:"M9.715 8.442a.798.798 0 00-1.43 0l-3.2 6.4a.799.799 0 101.431.716l.579-1.158h3.811l.578 1.158a.8.8 0 001.431-.716zm.391 4.358L9 10.589 7.894 12.8z",clipRule:"evenodd"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{fillRule:"evenodd",d:"M17 8c.552 0 1 .358 1 .8v6.4c0 .442-.448.8-1 .8s-1-.358-1-.8V8.8c0-.442.448-.8 1-.8z",clipRule:"evenodd"})]})});AI.displayName="AI";const __WEBPACK_DEFAULT_EXPORT__=AI;try{AI.displayName="AI",AI.__docgenInfo={description:"",displayName:"AI",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/AI.tsx#AI"]={docgenInfo:AI.__docgenInfo,name:"AI",path:"src/components/icons/AI.tsx#AI"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Code.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Code=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",focusable:"false",role:"img",className,"aria-label":title,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M10 9.5 8 12l2 2.5"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"m14 9.5 2 2.5-2 2.5"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"})]});Code.displayName="Code";const __WEBPACK_DEFAULT_EXPORT__=Code;try{Code.displayName="Code",Code.__docgenInfo={description:"",displayName:"Code",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Code.tsx#Code"]={docgenInfo:Code.__docgenInfo,name:"Code",path:"src/components/icons/Code.tsx#Code"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Feedback.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Feedback=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className,"aria-label":title,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H5.17l-.59.59-.58.58V4h16v12zm-9-4h2v2h-2zm0-6h2v4h-2z"})]});Feedback.displayName="Feedback";const __WEBPACK_DEFAULT_EXPORT__=Feedback;try{Feedback.displayName="Feedback",Feedback.__docgenInfo={description:"",displayName:"Feedback",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Feedback.tsx#Feedback"]={docgenInfo:Feedback.__docgenInfo,name:"Feedback",path:"src/components/icons/Feedback.tsx#Feedback"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/QuestionHelp.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const QuestionHelp=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",viewBox:"0 0 24 24",className,"aria-label":title,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M12 17L12.01 17"})]});QuestionHelp.displayName="QuestionHelp";const __WEBPACK_DEFAULT_EXPORT__=QuestionHelp;try{QuestionHelp.displayName="QuestionHelp",QuestionHelp.__docgenInfo={description:"",displayName:"QuestionHelp",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/QuestionHelp.tsx#QuestionHelp"]={docgenInfo:QuestionHelp.__docgenInfo,name:"QuestionHelp",path:"src/components/icons/QuestionHelp.tsx#QuestionHelp"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Translation.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Translation=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className,"aria-label":title,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M140 188h584v164h76V144c0-17.7-14.3-32-32-32H96c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h544v-76H140V188z"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M414.3 256h-60.6c-3.4 0-6.4 2.2-7.6 5.4L219 629.4c-.3.8-.4 1.7-.4 2.6 0 4.4 3.6 8 8 8h55.1c3.4 0 6.4-2.2 7.6-5.4L322 540h196.2L422 261.4c-1.3-3.2-4.3-5.4-7.7-5.4zm12.4 228h-85.5L384 360.2 426.7 484zM936 528H800v-93c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v93H592c-13.3 0-24 10.7-24 24v176c0 13.3 10.7 24 24 24h136v152c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V752h136c13.3 0 24-10.7 24-24V552c0-13.3-10.7-24-24-24zM728 680h-88v-80h88v80zm160 0h-88v-80h88v80z"})]});Translation.displayName="Translation";const __WEBPACK_DEFAULT_EXPORT__=Translation;try{Translation.displayName="Translation",Translation.__docgenInfo={description:"",displayName:"Translation",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Translation.tsx#Translation"]={docgenInfo:Translation.__docgenInfo,name:"Translation",path:"src/components/icons/Translation.tsx#Translation"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/User.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const User=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M858.5 763.6a374 374 0 0 0-80.6-119.5 375.63 375.63 0 0 0-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 0 0-80.6 119.5A371.7 371.7 0 0 0 136 901.8a8 8 0 0 0 8 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 0 0 8-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"})});User.displayName="User";const __WEBPACK_DEFAULT_EXPORT__=User;try{User.displayName="User",User.__docgenInfo={description:"",displayName:"User",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/User.tsx#User"]={docgenInfo:User.__docgenInfo,name:"User",path:"src/components/icons/User.tsx#User"})}catch(__react_docgen_typescript_loader_error){}}}]); \ No newline at end of file diff --git a/components-ChatBubble-ChatBubble-stories.04c9f6d9.iframe.bundle.js b/components-ChatBubble-ChatBubble-stories.04c9f6d9.iframe.bundle.js deleted file mode 100644 index 769d6dca..00000000 --- a/components-ChatBubble-ChatBubble-stories.04c9f6d9.iframe.bundle.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[2994],{"./src/components/ChatBubble/ChatBubble.stories.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{ComplexMarkdownMath1:()=>ComplexMarkdownMath1,ComplexMarkdownMath2:()=>ComplexMarkdownMath2,ComplexMarkdownMath3:()=>ComplexMarkdownMath3,ComplexMarkdownMath4:()=>ComplexMarkdownMath4,ComplexMarkdownMath5:()=>ComplexMarkdownMath5,ComplexMarkdownMath6:()=>ComplexMarkdownMath6,ComplexMarkdownMath7:()=>ComplexMarkdownMath7,CopyDisabled:()=>CopyDisabled,Default:()=>Default,FromExpertOfABoard:()=>FromExpertOfABoard,FromUser:()=>FromUser,FromUserWithAvatar:()=>FromUserWithAvatar,FromUserWithAvatarAndCustomAvatar:()=>FromUserWithAvatarAndCustomAvatar,FromUserWithCustomAvatar:()=>FromUserWithCustomAvatar,FromUserWithCustomAvatarElement:()=>FromUserWithCustomAvatarElement,GeneratedByAI:()=>GeneratedByAI,Initial:()=>Initial,MarkdownWithSquareBrackets:()=>MarkdownWithSquareBrackets,WithAllAddonsContents:()=>WithAllAddonsContents,WithFeedbackButtons:()=>WithFeedbackButtons,WithHTML:()=>WithHTML,WithLongLink:()=>WithLongLink,WithMarkdown:()=>WithMarkdown,WithMarkdownAndBreakLine:()=>WithMarkdownAndBreakLine,WithMarkdownAndMultipleBreakLine:()=>WithMarkdownAndMultipleBreakLine,WithMarkdownCode:()=>WithMarkdownCode,WithMarkdownTable:()=>WithMarkdownTable,WithOutputCode:()=>WithOutputCode,WithTranslationAndOriginal:()=>WithTranslationAndOriginal,__namedExportsOrder:()=>__namedExportsOrder,default:()=>ChatBubble_stories});__webpack_require__("./node_modules/react/index.js");var data=__webpack_require__("./src/mocks/data.ts"),I18nWrapper=__webpack_require__("./src/I18nWrapper.tsx"),ChatBubble=__webpack_require__("./src/components/ChatBubble/ChatBubble.tsx"),injectStylesIntoStyleTag=__webpack_require__("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),injectStylesIntoStyleTag_default=__webpack_require__.n(injectStylesIntoStyleTag),styleDomAPI=__webpack_require__("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),styleDomAPI_default=__webpack_require__.n(styleDomAPI),insertBySelector=__webpack_require__("./node_modules/style-loader/dist/runtime/insertBySelector.js"),insertBySelector_default=__webpack_require__.n(insertBySelector),setAttributesWithoutAttributes=__webpack_require__("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),setAttributesWithoutAttributes_default=__webpack_require__.n(setAttributesWithoutAttributes),insertStyleElement=__webpack_require__("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),insertStyleElement_default=__webpack_require__.n(insertStyleElement),styleTagTransform=__webpack_require__("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),styleTagTransform_default=__webpack_require__.n(styleTagTransform),ChatBubble_ChatBubble=__webpack_require__("./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].use[1]!./src/components/ChatBubble/ChatBubble.css"),options={};options.styleTagTransform=styleTagTransform_default(),options.setAttributes=setAttributesWithoutAttributes_default(),options.insert=insertBySelector_default().bind(null,"head"),options.domAPI=styleDomAPI_default(),options.insertStyleElement=insertStyleElement_default();injectStylesIntoStyleTag_default()(ChatBubble_ChatBubble.Z,options);ChatBubble_ChatBubble.Z&&ChatBubble_ChatBubble.Z.locals&&ChatBubble_ChatBubble.Z.locals;var jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChatBubble_stories={title:"Widget/Chat bubble",component:ChatBubble.Z,argTypes:{fromUser:{control:{type:"boolean"}},text:{control:{type:"text"}},initial:{control:{type:"boolean"}}},parameters:{controls:{expanded:!0}}},Template=args=>(0,jsx_runtime.jsx)(I18nWrapper.Z,{children:(0,jsx_runtime.jsx)(ChatBubble.Z,{...args})});Template.displayName="Template";const Default=Template.bind({});Default.args={memori:data.jF,tenant:data.cm,message:{fromUser:!1,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor."}};const FromUser=Template.bind({});FromUser.args={memori:data.jF,tenant:data.cm,message:{fromUser:!0,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor."}};const Initial=Template.bind({});Initial.args={memori:data.jF,tenant:data.cm,message:{fromUser:!1,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!0,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor."}};const CopyDisabled=Template.bind({});CopyDisabled.args={memori:data.jF,tenant:data.cm,message:{fromUser:!1,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor."},showCopyButton:!1};const GeneratedByAI=Template.bind({});GeneratedByAI.args={memori:data.jF,tenant:data.cm,message:{fromUser:!1,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",generatedByAI:!0}};const WithTranslationAndOriginal=Template.bind({});WithTranslationAndOriginal.args={memori:data.jF,tenant:data.cm,message:{fromUser:!1,text:"Hello, this is a translated text so you can talk to me in different languages",initial:!1,translatedText:"Ciao, questo è un testo tradotto in modo che tu possa parlarmi in diverse lingue"},showTranslationOriginal:!0};const WithLongLink=Template.bind({});WithLongLink.args={memori:data.jF,tenant:data.cm,message:{fromUser:!1,initial:!1,text:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor. Vedi altro su: https://aisuru.aclambda.online/it/memoridev/MANUALE%20DI%20RICHIEDENTE%20CENTRO%20DI%20COSTOAWANAGANAQUESTOLINKNONESISTEMADIVENTAMOLTOLUNGOESENZASPAZI"}};const WithFeedbackButtons=Template.bind({});WithFeedbackButtons.args={memori:data.jF,tenant:data.cm,message:{fromUser:!1,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",generatedByAI:!1},showFeedback:!0,simulateUserPrompt:()=>{}};const WithAllAddonsContents=Template.bind({});WithAllAddonsContents.args={memori:data.jF,tenant:data.cm,message:{fromUser:!1,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",generatedByAI:!0},showFeedback:!0,simulateUserPrompt:()=>{}};const FromUserWithAvatar=Template.bind({});FromUserWithAvatar.args={memori:data.jF,tenant:data.cm,user:{avatarURL:"https://picsum.photos/200"},message:{fromUser:!0,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor."}};const FromUserWithCustomAvatar=Template.bind({});FromUserWithCustomAvatar.args={memori:data.jF,tenant:data.cm,userAvatar:"https://picsum.photos/200",message:{fromUser:!0,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor."}};const FromUserWithCustomAvatarElement=Template.bind({});FromUserWithCustomAvatarElement.args={memori:data.jF,tenant:data.cm,userAvatar:(0,jsx_runtime.jsx)("span",{children:"USER"}),message:{fromUser:!0,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor."}};const FromUserWithAvatarAndCustomAvatar=Template.bind({});FromUserWithAvatarAndCustomAvatar.args={memori:data.jF,tenant:data.cm,userAvatar:()=>(0,jsx_runtime.jsx)("span",{children:"USER"}),user:{avatarURL:"https://picsum.photos/200"},message:{fromUser:!0,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor."}};const FromExpertOfABoard=Template.bind({});FromExpertOfABoard.args={memori:{...data.jF,enableBoardOfExperts:!0},apiUrl:"https://backend.memori.ai",tenant:data.cm,experts:[{expertID:"9b0a2913-d3d8-4e98-a49d-6e1c99479e1b",name:"Expert name",description:"Expert description",expertMemoriID:"9b0a2913-d3d8-4e98-a49d-6e1c99479e1b",expertBaseURL:"https://engine.memori.ai"}],message:{fromUser:!1,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,generatedByAI:!0,emitter:"Expert name",translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor."}};const WithMarkdown=Template.bind({});WithMarkdown.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,message:{fromUser:!1,text:"## Test\n\nEcco tutte le possibili personalizzazioni che puoi applicare:\n\n- **Colletto**:\n - Girocollo\n - Scollo a V\n\n- **Manica**:\n - Manica Lunga\n - Manica Corta\n\n- **Taglia**:\n - XS\n - S\n - M\n - L\n - XL\n - XXL\n - 3XL\n\n- **Posizione Stampa**:\n - Fronte Petto\n - Retro Schiena\n - Fronte DX\n - Fronte SX\n\n- **Generazione Immagine**:\n - Prompt generazione immagine\n\nSeleziona le personalizzazioni che desideri applicare.\n\n[Vedi altro](https://memori.ai)",initial:!1,generatedByAI:!0}};const WithMarkdownAndBreakLine=Template.bind({});WithMarkdownAndBreakLine.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,message:{fromUser:!1,text:"Per l'avvio di una progettualità è necessario fornire le seguenti informazioni:\n- Natura dell'esigenza progettuale e obiettivi\n- Descrizione del progetto\n- Prima identificazione delle risorse necessarie\n- Costi stimati\n- Benefici attesi\n- Rischi identificati.\n\n\n",initial:!1,generatedByAI:!0}};const WithMarkdownAndMultipleBreakLine=Template.bind({});WithMarkdownAndMultipleBreakLine.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,message:{fromUser:!1,initial:!1,generatedByAI:!0,text:'Ah, ottima domanda! Stavo giusto riflettendo su come spiegare al meglio le funzionalità di questo sistema. \n\nDa qui puoi fare diverse cose interessanti:\n\n1. Puoi conversare con me, Nunzio Fiore, e io risponderò basandomi sulle mie conoscenze ed esperienze.\n\n2. Puoi aggiungere nuove "memorie" o informazioni al mio database. Questo significa che puoi insegnarmi cose nuove o aggiornare le mie conoscenze esistenti.\n\n3. Puoi creare, modificare o eliminare "ricevitori". Questi sono come utenti specifici che possono interagire con me in modo personalizzato.\n\n4. Puoi associare determinate memorie a ricevitori specifici, creando così contenuti personalizzati per diverse persone.\n\n5. Puoi cercare tra le memorie esistenti, visualizzare le ultime aggiunte, o modificare quelle già presenti.\n\nIn pratica, stai interagendo con un sistema che permette di creare e gestire un "gemello digitale" - in questo caso, me stesso. È un po\' come scrivere un libro interattivo sulla mia vita e le mie conoscenze.\n\nC\'è qualcosa in particolare che ti interessa esplorare o su cui vorresti saperne di più?'}};const WithMarkdownCode=Template.bind({});WithMarkdownCode.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,message:{fromUser:!1,text:"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n\n```markdown\n# titolo\n```\n\nSed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",initial:!1,generatedByAI:!0}};const WithOutputCode=Template.bind({});WithOutputCode.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,message:{fromUser:!1,text:'Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n\n```markdown\n# titolo\n```\n\nSed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\n\n{ "data": [ 0, 1, 2 ] }',initial:!1,generatedByAI:!0}};const WithMarkdownTable=Template.bind({});WithMarkdownTable.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,message:{fromUser:!1,text:"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n\n| Header 1 | Header 2 | Header 3 |\n| -------- | -------- | -------- |\n| Cell 1 | Cell 2 | Cell 3 |\n| Cell 4 | Cell 5 | Cell 6 |\n\nSed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",initial:!1,generatedByAI:!0}};const MarkdownWithSquareBrackets=Template.bind({});MarkdownWithSquareBrackets.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,message:{fromUser:!1,text:'B. Funzione per lo stock:\n - Nome: "check_stock"\n - Descrizione: "Usa questa funzione per verificare la disponibilità di un prodotto nel magazzino"\n - Webhook: [URL del tuo gestionale]\n - Parametro: "product_id" (string)',initial:!1,generatedByAI:!0}};const ComplexMarkdownMath1=Template.bind({});ComplexMarkdownMath1.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,message:{fromUser:!1,initial:!1,generatedByAI:!0,text:"Per calcolare l'ipotenusa di un triangolo rettangolo, puoi usare il Teorema di Pitagora. Il teorema afferma che in un triangolo rettangolo, il quadrato dell'ipotenusa (la lato opposto all'angolo retto) è uguale alla somma dei quadrati degli altri due lati.\n\nLa formula è:\n\n\\[ c = \\sqrt{a^2 + b^2} \\]\n\nDove:\n- $c$ è l'ipotenusa.\n- $a$ e $ b $ sono i due cateti del triangolo.\n\n### Passaggi per il Calcolo\n\n1. **Misura o identifica i cateti $ a $ e $ b $**:\n I cateti sono i due lati che formano l'angolo retto.\n\n2. **Calcola i quadrati dei cateti**:\n Eleva al quadrato entrambe le misure dei cateti: $ a^2 $ e $ b^2 $.\n\n3. **Somma i quadrati dei cateti**:\n Somma i risultati ottenuti: $ a^2 + b^2 $.\n\n4. **Calcola la radice quadrata della somma**:\n Prendi la radice quadrata della somma per trovare l'ipotenusa: [ c = \\sqrt{a^2 + b^2} ].\n\n### Esempio di Calcolo\n\nSupponiamo di avere un triangolo rettangolo con i cateti di lunghezza 3 cm e 4 cm.\n\n1. **Cateto $ a $**: 3 cm\n2. **Cateto $ b $**: 4 cm\n\nUsiamo la formula:\n\n\\[ c = \\sqrt{a^2 + b^2} \\]\n\n\\[ c = \\sqrt{(3 \\, \\text{cm})^2 + (4 \\, \\text{cm})^2} \\]\n\n\\[ c = \\sqrt{9 \\, \\text{cm}^2 + 16 \\, \\text{cm}^2} \\]\n\n\\[ c = \\sqrt{25 \\, \\text{cm}^2} \\]\n\n\\[ c = 5 \\, \\text{cm} \\]\n\nQuindi, l'ipotenusa del triangolo è di 5 cm."}};const ComplexMarkdownMath2=Template.bind({});ComplexMarkdownMath2.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,message:{fromUser:!1,initial:!1,generatedByAI:!0,text:"Per calcolare le resistenze dei materiali per le verifiche rispetto ad azioni antropiche e ambientali secondo la Specifica Tecnica ST-VAL4, si procede in questo modo:\n\n1. **Determinazione della resistenza dei materiali:**\n La resistenza dei materiali da utilizzare nelle verifiche accurate si determina a partire dalle indagini sull’opera. La caratterizzazione deve essere distinta per tutti i materiali presenti nell'opera, in accordo con la ST-PI. Le resistenze per verifiche rispetto ad azioni antropiche come i carichi da traffico e le azioni ambientali sono definite dalle LG20. Questo include la distinzione rispetto a quelle utilizzate per le azioni sismiche, come dettagliato dalle NTC18 e CIR19 .\n\n2. **Calcolo della resistenza:**\n Il valore della resistenza dei materiali $ f_d $ da utilizzare nelle verifiche per carichi gravitazionali si ottiene mediante la seguente espressione:\n\n \\[\n f_d = \\min \\left( \\frac{f_m}{FC \\cdot \\gamma_M}, \\frac{f_k}{FC} \\right)\n \\]\n\n Dove:\n - $ f_m $ è il valor medio della resistenza valutato dai risultati delle prove effettuate sui campioni prelevati in situ;\n - $ f_k $ è la resistenza caratteristica calcolata sulla base dei risultati delle prove sui campioni prelevati in situ;\n - $ FC $ è il Fattore di Confidenza associato al Livello di Conoscenza raggiunto;\n - $ \\gamma_M $ è il fattore parziale di sicurezza del materiale .\n\n3. **Caratterizzazione dei materiali:**\n I valori medi, caratteristici e di progetto delle resistenze a compressione e trazione per il calcestruzzo, e delle resistenze a snervamento per l’acciaio ordinario sono determinati a partire dai risultati delle prove. Specifiche espressioni e metodi sono forniti per diversi materiali nell'Appendice 13 della ST-VAL4 .\n\n4. **Stima della resistenza da prove non distruttive:**\n Per valutare le resistenze dei materiali, si possono anche utilizzare prove non distruttive come le prove SonReb per il calcestruzzo e le prove di durezza per l'acciaio ordinario e armonico. Formulazioni specifiche per queste prove si trovano in Appendice al §13.1 della ST-VAL4 .\n\n5. **Analisi dei risultati delle indagini:**\n Gli esiti delle prove devono essere attentamente analizzati per confermare le caratteristiche originarie o rilevare eventuali decadimenti del materiale. Questo processo include anche l'identificazione delle cause di dispersione significative nei risultati delle prove .\n\nSeguendo questi passaggi, si ottiene una stima accurata delle resistenze dei materiali che possono essere utilizzate per le verifiche di sicurezza rispetto ad azioni antropiche e ambientali."}};const ComplexMarkdownMath3=Template.bind({});ComplexMarkdownMath3.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,message:{fromUser:!1,initial:!1,generatedByAI:!0,text:"Ok. \n\nPer calcolare l'urto su barriere metalliche, il documento *\"Ponti, viadotti e cavalcavia - Specifica Tecnica per la redazione delle Verifiche Accurate di sicurezza di Livello 4 (ST-VAL4)\"* fornisce un metodo specifico. Ecco l'iter riassunto:\n\n1. **Determinazione del sistema di forze orizzontali:** Partendo dal momento di plasticizzazione del montante (§5.1.3.10 delle NTC18). La forza orizzontale che plasticizza il montante può essere determinata con riferimento alla resistenza caratteristica degli elementi strutturali principali della barriera.\n\n2. **Quota di applicazione della forza:** La forza orizzontale deve essere applicata ad una quota h, che è il minimo tra (altezza della barriera - 0,10 m) e 1,00 m.\n\n3. **Amplificazione delle forze orizzontali:** Per il dimensionamento dell'impalcato, le forze orizzontali sono amplificate di un fattore di 1,50, e il coefficiente parziale di sicurezza per la combinazione di carico agli SLU per l’urto di veicolo in svio è assunto unitario.\n\n4. **Calcolo della massima azione tagliante:** Alla base del montante (estradosso cordolo):\n\n \\[\n F_{\\text{urto}} = \\frac{M_{\\text{pl}}}{h^*}\n \\]\n\n Dove:\n - $M_{\\text{pl}}$ è il momento plastico calcolato con la resistenza caratteristica.\n - $h^* = h - h_R - h_C$\n - $h$ è pari all’altezza della forza di urto sulla superficie di rotolamento (1.00 m), $h_B$ è l’altezza della forza rispetto all’estradosso del cordolo, $h_C$ è l’altezza del cordolo, e $h_R$ è l’altezza dell’irrigidimento del nodo e della piastra di base.\n\n5. **Determinazione del momento trasferito all’estradosso del cordolo:**\n\n \\[\n M_{\\text{urto}} = F_{\\text{urto}} \\cdot h_B = M_{\\text{pl}} \\cdot \\left(1 + \\frac{h_R}{h^*}\\right)\n \\]\n\n6. **Amplificazione per le incertezze:** Il valore caratteristico è amplificato di un fattore parziale pari a 1,50 per tenere conto delle incertezze e possibili deformabilità della lamiera irrigidita.\n\n7. **Considerazione della plasticizzazione:** Nel caso di barriere ordinarie, si considera la piena plasticizzazione di tre montanti consecutivi a seguito dell’urto, salvo diversa valutazione motivata.\n\n8. **Normative alternative:** In assenza di informazioni, si può fare riferimento al valore normativo della forza d’urto di 100 kN (NTC18) da collocarsi a 100 mm sotto la sommità dell’elemento o 1,0 m sopra il livello del piano di marcia【4:0†source】【4:1†source】【4:4†source】【4:9†source】【4:5†source】. \n\nPer ulteriori dettagli o chiarimenti, puoi consultare la sezione del documento ST-VAL4 o scrivere a anna.sganzerla@tecneautostrade.it."}};const ComplexMarkdownMath4=Template.bind({});ComplexMarkdownMath4.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,message:{fromUser:!1,initial:!1,generatedByAI:!0,text:"Per calcolare l'urto su barriere metalliche, è necessario considerare diversi fattori come la massa del veicolo, la velocità dell'impatto, l'angolo di impatto e le caratteristiche della barriera stessa. Di seguito è riportata una descrizione generale del processo di calcolo:\n\n1. **Determinazione dei parametri dell'urto:**\n - **Massa del veicolo (m):** La massa del veicolo che colpisce la barriera.\n - **Velocità dell'impatto (v):** La velocità del veicolo al momento dell'impatto.\n - **Angolo di impatto (θ):** L'angolo con cui il veicolo colpisce la barriera.\n\n2. **Calcolo dell'energia cinetica:**\n L'energia cinetica del veicolo al momento dell'impatto è data dalla formula:\n \\[\n E_k = \\frac{1}{2} m v^2\n \\]\n dove $E_k$ è l'energia cinetica, $m$ è la massa del veicolo e $v$ è la velocità del veicolo.\n\n3. **Calcolo della forza d'impatto:**\n La forza d'impatto può essere calcolata considerando la decelerazione del veicolo e il tempo di contatto con la barriera. Una formula semplificata per la forza d'impatto $F$ è:\n \\[\n F = \\frac{m \\Delta v}{\\Delta t}\n \\]\n dove $ \\Delta v $ è la variazione di velocità (che può essere considerata uguale alla velocità iniziale \\(v\\) se il veicolo si ferma completamente), e $ \\Delta t $ è il tempo di contatto.\n\n4. **Considerazioni sulla barriera:**\n Le barriere metalliche sono progettate per assorbire energia e ridurre la forza trasmessa ai veicoli e agli occupanti. La capacità di assorbimento dell'energia della barriera dipende dal materiale, dalla geometria e dalla costruzione della barriera stessa.\n\n5. **Normative e standard:**\n È importante seguire le normative e gli standard specifici per la progettazione e il calcolo delle barriere di sicurezza. Questi possono variare a seconda del paese e dell'applicazione specifica (ad esempio, autostrade, ponti, ecc.).\n\nPer calcoli più dettagliati e specifici, si consiglia di consultare le normative tecniche locali e di utilizzare software di simulazione specializzati che possono prendere in considerazione tutti i fattori rilevanti."}};const ComplexMarkdownMath5=Template.bind({});ComplexMarkdownMath5.args={memori:data.jF,tenant:data.cm,apiUrl:"https://backend.memori.ai",message:{fromUser:!1,initial:!1,generatedByAI:!0,text:"Per calcolare l'ipotenusa di un triangolo rettangolo, puoi utilizzare il teorema di Pitagora. La formula è:\n\n\\\\[ c = \\\\sqrt{a^2 + b^2} \\\\]\n\nDove:\n- \\\\( c \\\\) è l'ipotenusa,\n- \\\\( a \\\\) e \\\\( b \\\\) sono i due cateti del triangolo.\n\nAd esempio, se hai un triangolo con i cateti di lunghezza 3 e 4, l'ipotenusa sarà:\n\n\\\\[ c = \\\\sqrt{3^2 + 4^2} = \\\\sqrt{9 + 16} = \\\\sqrt{25} = 5 \\\\]\n\nSe hai altre domande o dubbi, sono qui per aiutarti!"}};const ComplexMarkdownMath6=Template.bind({});ComplexMarkdownMath6.args={memori:data.jF,tenant:data.cm,apiUrl:"https://backend.memori.ai",message:{fromUser:!1,initial:!1,generatedByAI:!0,text:"La formula per il calcolo della spinta passiva non è riportata precisamente nel documento, ma in base alle informazioni presenti nella Specifica Tecnica per la redazione delle Verifiche Accurate di sicurezza di Livello 4 (ST-VAL4), il contesto del calcolo delle spinte passive può essere richiamato come segue:\n\nIl calcolo della spinta passiva in geotecnica solitamente coinvolge il coefficiente di spinta passiva, che può esser calcolato usando diverse formulazioni a seconda delle condizioni (statiche o sismiche).\n\n1. **In condizioni statiche**, il calcolo della pressione del terreno avviene considerando il coefficiente passivo $k_p$:$k_p = \frac{1 + sin(phi)}{1 - sin(phi)}$\n\n2. **In condizioni sismiche**, si può utilizzare la formulazione di Mononobe-Okabe:\n [\n k_h = \beta cdot \frac{a_{max}}{g}\n ]\n dove:\n - $\beta$ è il coefficiente di riduzione della accelerazione massima attesa al sito\n - $a_{max}$ è l'accelerazione massima\n - $g$ è l'accelerazione di gravità .\n\nSe hai bisogno di dettagli più specifici o ulteriori informazioni su un altro argomento, fammi sapere!"}};const ComplexMarkdownMath7=Template.bind({});ComplexMarkdownMath7.args={memori:data.jF,tenant:data.cm,apiUrl:"https://backend.memori.ai",message:{fromUser:!1,initial:!1,generatedByAI:!0,text:'Il coefficiente di adeguatezza $𝜁_V$ è definito dalle normative NTC18 come il rapporto tra il valore massimo del sovraccarico verticale variabile sopportabile dalla parte i-esima della costruzione e il valore del sovraccarico verticale variabile che si utilizzerebbe nel progetto di una nuova costruzione.\n\nTale parametro viene calcolato tramite la seguente espressione:\n\n$$\n𝜁_V = \frac{𝑅_d - (𝐸_{d,G} + 𝐸_{d,Q𝑡,𝑜𝑟𝑖𝑧𝑧𝑜𝑛𝑡𝑎𝑙𝑖} + 𝐸_{d,Q𝑣𝑎𝑟𝑖𝑎𝑏𝑖𝑙𝑖})}{𝐸_{d,Q𝑡,𝑣𝑒𝑟𝑡𝑖𝑐𝑎𝑙𝑖}}\n$$\n\ndove:\n\n- $𝑅_d$ è la capacità della sezione resistente;\n- $𝐸_{d,G}$ è l’azione sollecitante derivante dai carichi permanenti;\n- $𝐸_{d,Q𝑣𝑎𝑟𝑖𝑎𝑏𝑖𝑙𝑖}$ è l’azione sollecitante derivante dai carichi accidentali non da traffico (vento, azioni termiche, ecc.);\n- $𝐸_{d,Q𝑡,𝑣𝑒𝑟𝑡𝑖𝑐𝑎𝑙𝑖}$ è l’azione sollecitante derivante dalla componente verticale dei carichi da traffico;\n- $𝐸_{d,Q𝑡,𝑜𝑟𝑖𝑧𝑧𝑜𝑛𝑡𝑎𝑙𝑖}$ è l’azione sollecitante derivante dalla componente orizzontale dei carichi da traffico (frenatura o azione centrifuga).\n\nIn accordo con il §6.1.5 delle LG20, il coefficiente $𝜁_V$ ha significato solo per il livello di analisi di "Adeguamento" in quanto per i livelli di "Operatività" e "Transitabilità" la domanda per la quale si svolgono le valutazioni di sicurezza è determinata in condizioni differenti da quelle che si avrebbero per nuove costruzioni ($𝑡_{r𝑒𝑓}$ ridotto, restrizioni all’uso, limitazioni di carico).\n\nI coefficienti $𝜁_V$ possono essere valutati per le combinazioni che considerano carichi da traffico con componente d’azione verticale .'}};const WithHTML=Template.bind({});WithHTML.args={memori:data.jF,tenant:data.cm,apiUrl:"https://backend.memori.ai",message:{fromUser:!1,initial:!1,generatedByAI:!0,text:'\n

\n
\n\n

Lenovo IdeaPad 3 Chromebook

\n

Intel Celeron, 15", 4GB RAM, 64GB

\n

Prezzo: €194,88 (sconto 12% da €221,59)

\n
\n\n
\n\n

Lenovo IdeaPad 3 Chromebook

\n

Intel Celeron, 15", 4GB RAM, 64GB

\n

Prezzo: €194,88 (sconto 12% da €221,59)

\n
\n\n
\n\n

Lenovo IdeaPad 3 Chromebook

\n

Intel Celeron, 15", 4GB RAM, 64GB

\n

Prezzo: €194,88 (sconto 12% da €221,59)

\n
\n
\n'}},Default.parameters={...Default.parameters,docs:{...Default.parameters?.docs,source:{originalSource:"args => \n \n ",...Default.parameters?.docs?.source}}},FromUser.parameters={...FromUser.parameters,docs:{...FromUser.parameters?.docs,source:{originalSource:"args => \n \n ",...FromUser.parameters?.docs?.source}}},Initial.parameters={...Initial.parameters,docs:{...Initial.parameters?.docs,source:{originalSource:"args => \n \n ",...Initial.parameters?.docs?.source}}},CopyDisabled.parameters={...CopyDisabled.parameters,docs:{...CopyDisabled.parameters?.docs,source:{originalSource:"args => \n \n ",...CopyDisabled.parameters?.docs?.source}}},GeneratedByAI.parameters={...GeneratedByAI.parameters,docs:{...GeneratedByAI.parameters?.docs,source:{originalSource:"args => \n \n ",...GeneratedByAI.parameters?.docs?.source}}},WithTranslationAndOriginal.parameters={...WithTranslationAndOriginal.parameters,docs:{...WithTranslationAndOriginal.parameters?.docs,source:{originalSource:"args => \n \n ",...WithTranslationAndOriginal.parameters?.docs?.source}}},WithLongLink.parameters={...WithLongLink.parameters,docs:{...WithLongLink.parameters?.docs,source:{originalSource:"args => \n \n ",...WithLongLink.parameters?.docs?.source}}},WithFeedbackButtons.parameters={...WithFeedbackButtons.parameters,docs:{...WithFeedbackButtons.parameters?.docs,source:{originalSource:"args => \n \n ",...WithFeedbackButtons.parameters?.docs?.source}}},WithAllAddonsContents.parameters={...WithAllAddonsContents.parameters,docs:{...WithAllAddonsContents.parameters?.docs,source:{originalSource:"args => \n \n ",...WithAllAddonsContents.parameters?.docs?.source}}},FromUserWithAvatar.parameters={...FromUserWithAvatar.parameters,docs:{...FromUserWithAvatar.parameters?.docs,source:{originalSource:"args => \n \n ",...FromUserWithAvatar.parameters?.docs?.source}}},FromUserWithCustomAvatar.parameters={...FromUserWithCustomAvatar.parameters,docs:{...FromUserWithCustomAvatar.parameters?.docs,source:{originalSource:"args => \n \n ",...FromUserWithCustomAvatar.parameters?.docs?.source}}},FromUserWithCustomAvatarElement.parameters={...FromUserWithCustomAvatarElement.parameters,docs:{...FromUserWithCustomAvatarElement.parameters?.docs,source:{originalSource:"args => \n \n ",...FromUserWithCustomAvatarElement.parameters?.docs?.source}}},FromUserWithAvatarAndCustomAvatar.parameters={...FromUserWithAvatarAndCustomAvatar.parameters,docs:{...FromUserWithAvatarAndCustomAvatar.parameters?.docs,source:{originalSource:"args => \n \n ",...FromUserWithAvatarAndCustomAvatar.parameters?.docs?.source}}},FromExpertOfABoard.parameters={...FromExpertOfABoard.parameters,docs:{...FromExpertOfABoard.parameters?.docs,source:{originalSource:"args => \n \n ",...FromExpertOfABoard.parameters?.docs?.source}}},WithMarkdown.parameters={...WithMarkdown.parameters,docs:{...WithMarkdown.parameters?.docs,source:{originalSource:"args => \n \n ",...WithMarkdown.parameters?.docs?.source}}},WithMarkdownAndBreakLine.parameters={...WithMarkdownAndBreakLine.parameters,docs:{...WithMarkdownAndBreakLine.parameters?.docs,source:{originalSource:"args => \n \n ",...WithMarkdownAndBreakLine.parameters?.docs?.source}}},WithMarkdownAndMultipleBreakLine.parameters={...WithMarkdownAndMultipleBreakLine.parameters,docs:{...WithMarkdownAndMultipleBreakLine.parameters?.docs,source:{originalSource:"args => \n \n ",...WithMarkdownAndMultipleBreakLine.parameters?.docs?.source}}},WithMarkdownCode.parameters={...WithMarkdownCode.parameters,docs:{...WithMarkdownCode.parameters?.docs,source:{originalSource:"args => \n \n ",...WithMarkdownCode.parameters?.docs?.source}}},WithOutputCode.parameters={...WithOutputCode.parameters,docs:{...WithOutputCode.parameters?.docs,source:{originalSource:"args => \n \n ",...WithOutputCode.parameters?.docs?.source}}},WithMarkdownTable.parameters={...WithMarkdownTable.parameters,docs:{...WithMarkdownTable.parameters?.docs,source:{originalSource:"args => \n \n ",...WithMarkdownTable.parameters?.docs?.source}}},MarkdownWithSquareBrackets.parameters={...MarkdownWithSquareBrackets.parameters,docs:{...MarkdownWithSquareBrackets.parameters?.docs,source:{originalSource:"args => \n \n ",...MarkdownWithSquareBrackets.parameters?.docs?.source}}},ComplexMarkdownMath1.parameters={...ComplexMarkdownMath1.parameters,docs:{...ComplexMarkdownMath1.parameters?.docs,source:{originalSource:"args => \n \n ",...ComplexMarkdownMath1.parameters?.docs?.source}}},ComplexMarkdownMath2.parameters={...ComplexMarkdownMath2.parameters,docs:{...ComplexMarkdownMath2.parameters?.docs,source:{originalSource:"args => \n \n ",...ComplexMarkdownMath2.parameters?.docs?.source}}},ComplexMarkdownMath3.parameters={...ComplexMarkdownMath3.parameters,docs:{...ComplexMarkdownMath3.parameters?.docs,source:{originalSource:"args => \n \n ",...ComplexMarkdownMath3.parameters?.docs?.source}}},ComplexMarkdownMath4.parameters={...ComplexMarkdownMath4.parameters,docs:{...ComplexMarkdownMath4.parameters?.docs,source:{originalSource:"args => \n \n ",...ComplexMarkdownMath4.parameters?.docs?.source}}},ComplexMarkdownMath5.parameters={...ComplexMarkdownMath5.parameters,docs:{...ComplexMarkdownMath5.parameters?.docs,source:{originalSource:"args => \n \n ",...ComplexMarkdownMath5.parameters?.docs?.source}}},ComplexMarkdownMath6.parameters={...ComplexMarkdownMath6.parameters,docs:{...ComplexMarkdownMath6.parameters?.docs,source:{originalSource:"args => \n \n ",...ComplexMarkdownMath6.parameters?.docs?.source}}},ComplexMarkdownMath7.parameters={...ComplexMarkdownMath7.parameters,docs:{...ComplexMarkdownMath7.parameters?.docs,source:{originalSource:"args => \n \n ",...ComplexMarkdownMath7.parameters?.docs?.source}}},WithHTML.parameters={...WithHTML.parameters,docs:{...WithHTML.parameters?.docs,source:{originalSource:"args => \n \n ",...WithHTML.parameters?.docs?.source}}};const __namedExportsOrder=["Default","FromUser","Initial","CopyDisabled","GeneratedByAI","WithTranslationAndOriginal","WithLongLink","WithFeedbackButtons","WithAllAddonsContents","FromUserWithAvatar","FromUserWithCustomAvatar","FromUserWithCustomAvatarElement","FromUserWithAvatarAndCustomAvatar","FromExpertOfABoard","WithMarkdown","WithMarkdownAndBreakLine","WithMarkdownAndMultipleBreakLine","WithMarkdownCode","WithOutputCode","WithMarkdownTable","MarkdownWithSquareBrackets","ComplexMarkdownMath1","ComplexMarkdownMath2","ComplexMarkdownMath3","ComplexMarkdownMath4","ComplexMarkdownMath5","ComplexMarkdownMath6","ComplexMarkdownMath7","WithHTML"]},"./src/components/ui/Tooltip.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Tooltip=({content,className,align="right",disabled=!1,visible=!1,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-tooltip",`memori-tooltip--align-${align}`,className,{"memori-tooltip--disabled":disabled,"memori-tooltip--visible":visible}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"memori-tooltip--content",children:content}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"memori-tooltip--trigger",children})]});Tooltip.displayName="Tooltip";const __WEBPACK_DEFAULT_EXPORT__=Tooltip;try{Tooltip.displayName="Tooltip",Tooltip.__docgenInfo={description:"",displayName:"Tooltip",props:{content:{defaultValue:null,description:"",name:"content",required:!0,type:{name:"Element | ReactNode"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},align:{defaultValue:{value:"right"},description:"",name:"align",required:!1,type:{name:"enum",value:[{value:'"left"'},{value:'"right"'},{value:'"topLeft"'},{value:'"topRight"'}]}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},visible:{defaultValue:{value:"false"},description:"",name:"visible",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Tooltip.tsx#Tooltip"]={docgenInfo:Tooltip.__docgenInfo,name:"Tooltip",path:"src/components/ui/Tooltip.tsx#Tooltip"})}catch(__react_docgen_typescript_loader_error){}},"./src/mocks/data.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A3:()=>expertReference,AU:()=>memoryQuestion,EA:()=>user,Eu:()=>historyWithMedia,Fr:()=>venue,Gs:()=>dialogState,I_:()=>historyWithAIGeneratedMessages,JZ:()=>knownFact,M9:()=>sessionID,WM:()=>integration,cm:()=>tenant,jF:()=>memori,m8:()=>history});const sessionID="131165be-9d1a-42fb-a3ce-e8f86d40c88f",tenant={adminCount:3,config:{name:"AIsuru",requirePosition:!1,showNewUser:!0},creationTimestamp:"2023-05-31T14:32:48.885287Z",description:"AIsuru",disableRegistration:!1,id:"www.aisuru.com",lastChangeTimestamp:"2023-05-31T14:32:48.885287Z",logoURL:"https://aisuru.com/images/aisuru/logo.png",maxAdmins:0,maxCompletions:0,maxCompletionsPerUser:0,maxFreeSessions:400,maxFreeSessionsPerUser:100,maxMemoriPerAdmin:0,maxMemoriPerUser:3,maxTotalMemori:0,maxUsers:0,memoriCount:0,name:"www.aisuru.com",nonFreeSessionCost:.02,paying:!0,tenantID:"96caa4b4-31a4-48e5-8163-dec61869a2a7",theme:"aisuru",userCount:0},user={tenant:"localhost:3000",userID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",userName:"nzambello",eMail:"nicola@nzambello.dev",admin:!1,maxMemori:0,enableMemoriCreation:!0,enableBoardOfExperts:!0,maxFreeSessions:0,tnCAndPPAccepted:!0,tnCAndPPAcceptanceDate:"2021-03-01T00:00:00.000Z",pAndCUAccepted:!0,pAndCUAcceptanceDate:"2021-03-01T00:00:00.000Z",birthDate:"1900-03-01T00:00:00.000Z",age:28,avatarURL:"https://avatars.githubusercontent.com/u/21101435?v=4"},memori={memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",engineMemoriID:"66b4e161-2431-4b21-9b70-d8c27de730ca",name:"Memori",memoriConfigurationID:"MemoriCloud-it_IT",description:"Lorem ipsum.",voiceType:"male",isGiver:!0,isReceiver:!1,privacyType:"PUBLIC",needsPosition:!1,culture:"it-IT",categories:[],publishedInTheMetaverse:!0,exposed:!0,enableCompletions:!0,nsfw:!1,ageRestriction:14,contentQualityIndex:66.6,contentQualityIndexTimestamp:"2021-03-01T12:00:00.000Z",ownerUserName:"username",ownerTenantName:"aisuru.com",ownerUserID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",metaverseEnvironment:"synthwave",secretToken:"awanagana",giverPIN:"1234",giverTag:"🧑‍💻",avatarURL:"https://aisuru.com/images/aisuru/square_logo.png",coverURL:"https://aisuru.com/images/aisuru/og-image.png"},history=[{text:"Ciao, io sono test, c'è qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'è altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],historyWithMedia=[{text:"Ciao, io sono test, c'è qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'è altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui delle cose per te.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai/en",mimeType:"text/html",title:"Link Memori Srl"},{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efce",url:"https://rawmaterial.it/en",mimeType:"text/html",title:"Link RawMaterial"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5971",mimeType:"text/html",title:"Introducing Plone Remix | Vimeo",url:"https://vimeo.com/766468314"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5969",mimeType:"text/html",title:"A sustainable web: is it possible? - Nicola Zambello | YouTube",url:"https://www.youtube.com/watch?v=feH26j3rBz8"},...Array.from({length:3},((_,i)=>({mediumID:`95226d7e-7bae-465e-8b80-995587bb597${i}`,mimeType:"image/png",title:`Image ${i}`,url:`https://picsum.photos/${i%2?"200":"300"}/${i%3?"300":"200"}?random=${i}`})))],timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z"}],historyWithAIGeneratedMessages=[{text:"Ciao, io sono test, c'è qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Sa. Sa. Prova",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",generatedByAI:!0,contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],dialogState={state:"R1",previousState:"I0",stateName:"WaitingForReceiverQuestion",confidence:1,knownTags:{"☠️":"test","😎":"Ciccio"},emission:"Ciao, io sono test, c'è qualcosa che vorresti chiedermi?",hints:["Va bene","No grazie"],media:[],acceptsTimeout:!0,acceptsAbort:!1,acceptsMedia:!1,acceptsDate:!1,acceptsPlace:!1,acceptsTag:!1,giverID:"c832e2dc-403c-4baf-a3b7-2374e100dbcf",contextVars:{}},integration={integrationID:"cb3c4776-7f0b-4f97-a773-c32a5d7a3bf1",memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",type:"LANDING_EXPERIENCE",state:"NEW",deviceEmails:[],customData:'{"textColor":"#2a2a2a","buttonBgColor":"#823ce1","buttonTextColor":"#ffffff","name":"Web","globalBackground":"https://assets.memori.ai/api/v2/asset/364e498c-11da-42d5-9e32-19e5d137d4b8.jpeg","blurBackground":true,"innerBgColor":"light","innerBgAlpha":0.8,"multilanguage":true,"avatar":"readyplayerme","avatarURL":"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb#1669663599444"}',resources:[],publish:!0,creationTimestamp:"2022-06-11T14:13:45.685038Z",lastChangeTimestamp:"2022-06-11T14:13:45.685038Z"},knownFact={knownFactID:"b0b0b0b0-b0b0-b0b0-b0b0-b0b0b0b0b0b3",knownFactType:"ShortTerm",text:"I am a known fact. Quisque in ultrices lectus. Nulla at urna diam. Proin sodales lobortis libero eu facilisis.",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},expertReference={expertID:"f016f204-c307-483b-8891-680a3c974c53",name:"TEST MEMORI",description:"lui è competente",default:!0,expertMemoriID:"dfc44f1c-1ba7-4e1e-a234-28aa8b6b3d32",expertBaseURL:"http://localhost:7778",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},venue={latitude:44.66579,longitude:11.48823,placeName:"Altedo, Bologna, Italy",uncertainty:2},memoryQuestion={memoryID:"08c0697d-f7f3-4a47-9970-aff75f01fb6c",memoryType:"Question",lastRead:void 0,readOccurrences:void 0,receiverID:void 0,receiverTag:void 0,receiverName:void 0,media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",mimeType:"text/html",url:"https://rawmaterial.it/it",title:"RawMaterial"}],title:"sei umano",titleVariants:["sei reale"],answers:[{text:"se ti dico si ci credi?",preformatted:!1,creationTimestamp:"2022-03-23T09:37:25.410377",creationName:"6cfec2bd-a73f-4a21-b7ff-dd92d6db59c4",lastChangeTimestamp:"2022-03-23T09:37:25.410406",lastChangeName:"6cfec2bd-a73f-4a21-b7ff-dd92d6db59c4"},{text:"probabilmente lo sono più di te",preformatted:!1,creationTimestamp:"2022-03-23T09:37:36.957656",creationName:"6cfec2bd-a73f-4a21-b7ff-dd92d6db59c4",lastChangeTimestamp:"2022-03-23T09:37:36.957657",lastChangeName:"6cfec2bd-a73f-4a21-b7ff-dd92d6db59c4"}],date:void 0,dateUncertaintyDays:void 0,placeName:void 0,placeLatitude:void 0,placeLongitude:void 0,placeUncertaintyKm:void 0,preformatted:!1,conclusive:!1,notPickable:!1,contextVarsToSet:{SUBJECT:"TRAVEL"},contextVarsToMatch:{SUBJECT:"TRANSPORTS"},creationTimestamp:"2022-03-23T09:37:16.568149",creationName:"6cfec2bd-a73f-4a21-b7ff-dd92d6db59c4",lastChangeTimestamp:"2022-03-23T09:37:36.957695",lastChangeName:"6cfec2bd-a73f-4a21-b7ff-dd92d6db59c4"}}}]); \ No newline at end of file diff --git a/components-ChatBubble-ChatBubble-stories.69fa5621.iframe.bundle.js b/components-ChatBubble-ChatBubble-stories.69fa5621.iframe.bundle.js new file mode 100644 index 00000000..cd4468ec --- /dev/null +++ b/components-ChatBubble-ChatBubble-stories.69fa5621.iframe.bundle.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[2994],{"./src/components/ChatBubble/ChatBubble.stories.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{ComplexMarkdownMath1:()=>ComplexMarkdownMath1,ComplexMarkdownMath2:()=>ComplexMarkdownMath2,ComplexMarkdownMath3:()=>ComplexMarkdownMath3,ComplexMarkdownMath4:()=>ComplexMarkdownMath4,ComplexMarkdownMath5:()=>ComplexMarkdownMath5,ComplexMarkdownMath6:()=>ComplexMarkdownMath6,ComplexMarkdownMath7:()=>ComplexMarkdownMath7,CopyDisabled:()=>CopyDisabled,Default:()=>Default,FromExpertOfABoard:()=>FromExpertOfABoard,FromUser:()=>FromUser,FromUserWithAvatar:()=>FromUserWithAvatar,FromUserWithAvatarAndCustomAvatar:()=>FromUserWithAvatarAndCustomAvatar,FromUserWithCustomAvatar:()=>FromUserWithCustomAvatar,FromUserWithCustomAvatarElement:()=>FromUserWithCustomAvatarElement,GeneratedByAI:()=>GeneratedByAI,Initial:()=>Initial,MarkdownWithSquareBrackets:()=>MarkdownWithSquareBrackets,MarkdownWithSquareBracketsAndTable:()=>MarkdownWithSquareBracketsAndTable,WithAllAddonsContents:()=>WithAllAddonsContents,WithFeedbackButtons:()=>WithFeedbackButtons,WithHTML:()=>WithHTML,WithLongLink:()=>WithLongLink,WithMarkdown:()=>WithMarkdown,WithMarkdownAndBreakLine:()=>WithMarkdownAndBreakLine,WithMarkdownAndMultipleBreakLine:()=>WithMarkdownAndMultipleBreakLine,WithMarkdownCode:()=>WithMarkdownCode,WithMarkdownTable:()=>WithMarkdownTable,WithOutputCode:()=>WithOutputCode,WithTranslationAndOriginal:()=>WithTranslationAndOriginal,__namedExportsOrder:()=>__namedExportsOrder,default:()=>ChatBubble_stories});__webpack_require__("./node_modules/react/index.js");var data=__webpack_require__("./src/mocks/data.ts"),I18nWrapper=__webpack_require__("./src/I18nWrapper.tsx"),ChatBubble=__webpack_require__("./src/components/ChatBubble/ChatBubble.tsx"),injectStylesIntoStyleTag=__webpack_require__("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),injectStylesIntoStyleTag_default=__webpack_require__.n(injectStylesIntoStyleTag),styleDomAPI=__webpack_require__("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),styleDomAPI_default=__webpack_require__.n(styleDomAPI),insertBySelector=__webpack_require__("./node_modules/style-loader/dist/runtime/insertBySelector.js"),insertBySelector_default=__webpack_require__.n(insertBySelector),setAttributesWithoutAttributes=__webpack_require__("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),setAttributesWithoutAttributes_default=__webpack_require__.n(setAttributesWithoutAttributes),insertStyleElement=__webpack_require__("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),insertStyleElement_default=__webpack_require__.n(insertStyleElement),styleTagTransform=__webpack_require__("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),styleTagTransform_default=__webpack_require__.n(styleTagTransform),ChatBubble_ChatBubble=__webpack_require__("./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].use[1]!./src/components/ChatBubble/ChatBubble.css"),options={};options.styleTagTransform=styleTagTransform_default(),options.setAttributes=setAttributesWithoutAttributes_default(),options.insert=insertBySelector_default().bind(null,"head"),options.domAPI=styleDomAPI_default(),options.insertStyleElement=insertStyleElement_default();injectStylesIntoStyleTag_default()(ChatBubble_ChatBubble.Z,options);ChatBubble_ChatBubble.Z&&ChatBubble_ChatBubble.Z.locals&&ChatBubble_ChatBubble.Z.locals;var jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChatBubble_stories={title:"Widget/Chat bubble",component:ChatBubble.Z,argTypes:{fromUser:{control:{type:"boolean"}},text:{control:{type:"text"}},initial:{control:{type:"boolean"}}},parameters:{controls:{expanded:!0}}},Template=args=>(0,jsx_runtime.jsx)(I18nWrapper.Z,{children:(0,jsx_runtime.jsx)(ChatBubble.Z,{...args})});Template.displayName="Template";const Default=Template.bind({});Default.args={memori:data.jF,tenant:data.cm,message:{fromUser:!1,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor."}};const FromUser=Template.bind({});FromUser.args={memori:data.jF,tenant:data.cm,message:{fromUser:!0,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor."}};const Initial=Template.bind({});Initial.args={memori:data.jF,tenant:data.cm,message:{fromUser:!1,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!0,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor."}};const CopyDisabled=Template.bind({});CopyDisabled.args={memori:data.jF,tenant:data.cm,message:{fromUser:!1,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor."},showCopyButton:!1};const GeneratedByAI=Template.bind({});GeneratedByAI.args={memori:data.jF,tenant:data.cm,message:{fromUser:!1,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",generatedByAI:!0}};const WithTranslationAndOriginal=Template.bind({});WithTranslationAndOriginal.args={memori:data.jF,tenant:data.cm,message:{fromUser:!1,text:"Hello, this is a translated text so you can talk to me in different languages",initial:!1,translatedText:"Ciao, questo è un testo tradotto in modo che tu possa parlarmi in diverse lingue"},showTranslationOriginal:!0};const WithLongLink=Template.bind({});WithLongLink.args={memori:data.jF,tenant:data.cm,message:{fromUser:!1,initial:!1,text:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor. Vedi altro su: https://aisuru.aclambda.online/it/memoridev/MANUALE%20DI%20RICHIEDENTE%20CENTRO%20DI%20COSTOAWANAGANAQUESTOLINKNONESISTEMADIVENTAMOLTOLUNGOESENZASPAZI"}};const WithFeedbackButtons=Template.bind({});WithFeedbackButtons.args={memori:data.jF,tenant:data.cm,message:{fromUser:!1,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",generatedByAI:!1},showFeedback:!0,simulateUserPrompt:()=>{}};const WithAllAddonsContents=Template.bind({});WithAllAddonsContents.args={memori:data.jF,tenant:data.cm,message:{fromUser:!1,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",generatedByAI:!0},showFeedback:!0,simulateUserPrompt:()=>{}};const FromUserWithAvatar=Template.bind({});FromUserWithAvatar.args={memori:data.jF,tenant:data.cm,user:{avatarURL:"https://picsum.photos/200"},message:{fromUser:!0,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor."}};const FromUserWithCustomAvatar=Template.bind({});FromUserWithCustomAvatar.args={memori:data.jF,tenant:data.cm,userAvatar:"https://picsum.photos/200",message:{fromUser:!0,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor."}};const FromUserWithCustomAvatarElement=Template.bind({});FromUserWithCustomAvatarElement.args={memori:data.jF,tenant:data.cm,userAvatar:(0,jsx_runtime.jsx)("span",{children:"USER"}),message:{fromUser:!0,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor."}};const FromUserWithAvatarAndCustomAvatar=Template.bind({});FromUserWithAvatarAndCustomAvatar.args={memori:data.jF,tenant:data.cm,userAvatar:()=>(0,jsx_runtime.jsx)("span",{children:"USER"}),user:{avatarURL:"https://picsum.photos/200"},message:{fromUser:!0,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor."}};const FromExpertOfABoard=Template.bind({});FromExpertOfABoard.args={memori:{...data.jF,enableBoardOfExperts:!0},apiUrl:"https://backend.memori.ai",tenant:data.cm,experts:[{expertID:"9b0a2913-d3d8-4e98-a49d-6e1c99479e1b",name:"Expert name",description:"Expert description",expertMemoriID:"9b0a2913-d3d8-4e98-a49d-6e1c99479e1b",expertBaseURL:"https://engine.memori.ai"}],message:{fromUser:!1,text:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.",initial:!1,generatedByAI:!0,emitter:"Expert name",translatedText:"Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor."}};const WithMarkdown=Template.bind({});WithMarkdown.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,message:{fromUser:!1,text:"## Test\n\nEcco tutte le possibili personalizzazioni che puoi applicare:\n\n- **Colletto**:\n - Girocollo\n - Scollo a V\n\n- **Manica**:\n - Manica Lunga\n - Manica Corta\n\n- **Taglia**:\n - XS\n - S\n - M\n - L\n - XL\n - XXL\n - 3XL\n\n- **Posizione Stampa**:\n - Fronte Petto\n - Retro Schiena\n - Fronte DX\n - Fronte SX\n\n- **Generazione Immagine**:\n - Prompt generazione immagine\n\nSeleziona le personalizzazioni che desideri applicare.\n\n[Vedi altro](https://memori.ai)",initial:!1,generatedByAI:!0}};const WithMarkdownAndBreakLine=Template.bind({});WithMarkdownAndBreakLine.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,message:{fromUser:!1,text:"Per l'avvio di una progettualità è necessario fornire le seguenti informazioni:\n- Natura dell'esigenza progettuale e obiettivi\n- Descrizione del progetto\n- Prima identificazione delle risorse necessarie\n- Costi stimati\n- Benefici attesi\n- Rischi identificati.\n\n\n",initial:!1,generatedByAI:!0}};const WithMarkdownAndMultipleBreakLine=Template.bind({});WithMarkdownAndMultipleBreakLine.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,message:{fromUser:!1,initial:!1,generatedByAI:!0,text:'Ah, ottima domanda! Stavo giusto riflettendo su come spiegare al meglio le funzionalità di questo sistema. \n\nDa qui puoi fare diverse cose interessanti:\n\n1. Puoi conversare con me, Nunzio Fiore, e io risponderò basandomi sulle mie conoscenze ed esperienze.\n\n2. Puoi aggiungere nuove "memorie" o informazioni al mio database. Questo significa che puoi insegnarmi cose nuove o aggiornare le mie conoscenze esistenti.\n\n3. Puoi creare, modificare o eliminare "ricevitori". Questi sono come utenti specifici che possono interagire con me in modo personalizzato.\n\n4. Puoi associare determinate memorie a ricevitori specifici, creando così contenuti personalizzati per diverse persone.\n\n5. Puoi cercare tra le memorie esistenti, visualizzare le ultime aggiunte, o modificare quelle già presenti.\n\nIn pratica, stai interagendo con un sistema che permette di creare e gestire un "gemello digitale" - in questo caso, me stesso. È un po\' come scrivere un libro interattivo sulla mia vita e le mie conoscenze.\n\nC\'è qualcosa in particolare che ti interessa esplorare o su cui vorresti saperne di più?'}};const WithMarkdownCode=Template.bind({});WithMarkdownCode.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,message:{fromUser:!1,text:"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n\n```markdown\n# titolo\n```\n\nSed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",initial:!1,generatedByAI:!0}};const WithOutputCode=Template.bind({});WithOutputCode.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,message:{fromUser:!1,text:'Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n\n```markdown\n# titolo\n```\n\nSed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\n\n{ "data": [ 0, 1, 2 ] }',initial:!1,generatedByAI:!0}};const WithMarkdownTable=Template.bind({});WithMarkdownTable.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,message:{fromUser:!1,text:"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n\n| Header 1 | Header 2 | Header 3 |\n| -------- | -------- | -------- |\n| Cell 1 | Cell 2 | Cell 3 |\n| Cell 4 | Cell 5 | Cell 6 |\n\nSed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",initial:!1,generatedByAI:!0}};const MarkdownWithSquareBrackets=Template.bind({});MarkdownWithSquareBrackets.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,message:{fromUser:!1,text:'B. Funzione per lo stock:\n - Nome: "check_stock"\n - Descrizione: "Usa questa funzione per verificare la disponibilità di un prodotto nel magazzino"\n - Webhook: [URL del tuo gestionale]\n - Parametro: "product_id" (string)',initial:!1,generatedByAI:!0}};const MarkdownWithSquareBracketsAndTable=Template.bind({});MarkdownWithSquareBracketsAndTable.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,message:{fromUser:!1,initial:!1,generatedByAI:!0,text:'\n\n \n \n \n \n \n \n \n \n\n\n[Vuoi che continui con l\'intera tabella mantenendo lo stesso formato della precedente ma con table-layout: fixed per garantire celle di uguale dimensione?]'}};const ComplexMarkdownMath1=Template.bind({});ComplexMarkdownMath1.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,useMathFormatting:!0,message:{fromUser:!1,initial:!1,generatedByAI:!0,text:"Per calcolare l'ipotenusa di un triangolo rettangolo, puoi usare il Teorema di Pitagora. Il teorema afferma che in un triangolo rettangolo, il quadrato dell'ipotenusa (la lato opposto all'angolo retto) è uguale alla somma dei quadrati degli altri due lati.\n\nLa formula è:\n\n\\[ c = \\sqrt{a^2 + b^2} \\]\n\nDove:\n- $c$ è l'ipotenusa.\n- $a$ e $ b $ sono i due cateti del triangolo.\n\n### Passaggi per il Calcolo\n\n1. **Misura o identifica i cateti $ a $ e $ b $**:\n I cateti sono i due lati che formano l'angolo retto.\n\n2. **Calcola i quadrati dei cateti**:\n Eleva al quadrato entrambe le misure dei cateti: $ a^2 $ e $ b^2 $.\n\n3. **Somma i quadrati dei cateti**:\n Somma i risultati ottenuti: $ a^2 + b^2 $.\n\n4. **Calcola la radice quadrata della somma**:\n Prendi la radice quadrata della somma per trovare l'ipotenusa: [ c = \\sqrt{a^2 + b^2} ].\n\n### Esempio di Calcolo\n\nSupponiamo di avere un triangolo rettangolo con i cateti di lunghezza 3 cm e 4 cm.\n\n1. **Cateto $ a $**: 3 cm\n2. **Cateto $ b $**: 4 cm\n\nUsiamo la formula:\n\n\\[ c = \\sqrt{a^2 + b^2} \\]\n\n\\[ c = \\sqrt{(3 \\, \\text{cm})^2 + (4 \\, \\text{cm})^2} \\]\n\n\\[ c = \\sqrt{9 \\, \\text{cm}^2 + 16 \\, \\text{cm}^2} \\]\n\n\\[ c = \\sqrt{25 \\, \\text{cm}^2} \\]\n\n\\[ c = 5 \\, \\text{cm} \\]\n\nQuindi, l'ipotenusa del triangolo è di 5 cm."}};const ComplexMarkdownMath2=Template.bind({});ComplexMarkdownMath2.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,useMathFormatting:!0,message:{fromUser:!1,initial:!1,generatedByAI:!0,text:"Per calcolare le resistenze dei materiali per le verifiche rispetto ad azioni antropiche e ambientali secondo la Specifica Tecnica ST-VAL4, si procede in questo modo:\n\n1. **Determinazione della resistenza dei materiali:**\n La resistenza dei materiali da utilizzare nelle verifiche accurate si determina a partire dalle indagini sull’opera. La caratterizzazione deve essere distinta per tutti i materiali presenti nell'opera, in accordo con la ST-PI. Le resistenze per verifiche rispetto ad azioni antropiche come i carichi da traffico e le azioni ambientali sono definite dalle LG20. Questo include la distinzione rispetto a quelle utilizzate per le azioni sismiche, come dettagliato dalle NTC18 e CIR19 .\n\n2. **Calcolo della resistenza:**\n Il valore della resistenza dei materiali $ f_d $ da utilizzare nelle verifiche per carichi gravitazionali si ottiene mediante la seguente espressione:\n\n \\[\n f_d = \\min \\left( \\frac{f_m}{FC \\cdot \\gamma_M}, \\frac{f_k}{FC} \\right)\n \\]\n\n Dove:\n - $ f_m $ è il valor medio della resistenza valutato dai risultati delle prove effettuate sui campioni prelevati in situ;\n - $ f_k $ è la resistenza caratteristica calcolata sulla base dei risultati delle prove sui campioni prelevati in situ;\n - $ FC $ è il Fattore di Confidenza associato al Livello di Conoscenza raggiunto;\n - $ \\gamma_M $ è il fattore parziale di sicurezza del materiale .\n\n3. **Caratterizzazione dei materiali:**\n I valori medi, caratteristici e di progetto delle resistenze a compressione e trazione per il calcestruzzo, e delle resistenze a snervamento per l’acciaio ordinario sono determinati a partire dai risultati delle prove. Specifiche espressioni e metodi sono forniti per diversi materiali nell'Appendice 13 della ST-VAL4 .\n\n4. **Stima della resistenza da prove non distruttive:**\n Per valutare le resistenze dei materiali, si possono anche utilizzare prove non distruttive come le prove SonReb per il calcestruzzo e le prove di durezza per l'acciaio ordinario e armonico. Formulazioni specifiche per queste prove si trovano in Appendice al §13.1 della ST-VAL4 .\n\n5. **Analisi dei risultati delle indagini:**\n Gli esiti delle prove devono essere attentamente analizzati per confermare le caratteristiche originarie o rilevare eventuali decadimenti del materiale. Questo processo include anche l'identificazione delle cause di dispersione significative nei risultati delle prove .\n\nSeguendo questi passaggi, si ottiene una stima accurata delle resistenze dei materiali che possono essere utilizzate per le verifiche di sicurezza rispetto ad azioni antropiche e ambientali."}};const ComplexMarkdownMath3=Template.bind({});ComplexMarkdownMath3.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,useMathFormatting:!0,message:{fromUser:!1,initial:!1,generatedByAI:!0,text:"Ok. \n\nPer calcolare l'urto su barriere metalliche, il documento *\"Ponti, viadotti e cavalcavia - Specifica Tecnica per la redazione delle Verifiche Accurate di sicurezza di Livello 4 (ST-VAL4)\"* fornisce un metodo specifico. Ecco l'iter riassunto:\n\n1. **Determinazione del sistema di forze orizzontali:** Partendo dal momento di plasticizzazione del montante (§5.1.3.10 delle NTC18). La forza orizzontale che plasticizza il montante può essere determinata con riferimento alla resistenza caratteristica degli elementi strutturali principali della barriera.\n\n2. **Quota di applicazione della forza:** La forza orizzontale deve essere applicata ad una quota h, che è il minimo tra (altezza della barriera - 0,10 m) e 1,00 m.\n\n3. **Amplificazione delle forze orizzontali:** Per il dimensionamento dell'impalcato, le forze orizzontali sono amplificate di un fattore di 1,50, e il coefficiente parziale di sicurezza per la combinazione di carico agli SLU per l’urto di veicolo in svio è assunto unitario.\n\n4. **Calcolo della massima azione tagliante:** Alla base del montante (estradosso cordolo):\n\n \\[\n F_{\\text{urto}} = \\frac{M_{\\text{pl}}}{h^*}\n \\]\n\n Dove:\n - $M_{\\text{pl}}$ è il momento plastico calcolato con la resistenza caratteristica.\n - $h^* = h - h_R - h_C$\n - $h$ è pari all’altezza della forza di urto sulla superficie di rotolamento (1.00 m), $h_B$ è l’altezza della forza rispetto all’estradosso del cordolo, $h_C$ è l’altezza del cordolo, e $h_R$ è l’altezza dell’irrigidimento del nodo e della piastra di base.\n\n5. **Determinazione del momento trasferito all’estradosso del cordolo:**\n\n \\[\n M_{\\text{urto}} = F_{\\text{urto}} \\cdot h_B = M_{\\text{pl}} \\cdot \\left(1 + \\frac{h_R}{h^*}\\right)\n \\]\n\n6. **Amplificazione per le incertezze:** Il valore caratteristico è amplificato di un fattore parziale pari a 1,50 per tenere conto delle incertezze e possibili deformabilità della lamiera irrigidita.\n\n7. **Considerazione della plasticizzazione:** Nel caso di barriere ordinarie, si considera la piena plasticizzazione di tre montanti consecutivi a seguito dell’urto, salvo diversa valutazione motivata.\n\n8. **Normative alternative:** In assenza di informazioni, si può fare riferimento al valore normativo della forza d’urto di 100 kN (NTC18) da collocarsi a 100 mm sotto la sommità dell’elemento o 1,0 m sopra il livello del piano di marcia【4:0†source】【4:1†source】【4:4†source】【4:9†source】【4:5†source】. \n\nPer ulteriori dettagli o chiarimenti, puoi consultare la sezione del documento ST-VAL4 o scrivere a anna.sganzerla@tecneautostrade.it."}};const ComplexMarkdownMath4=Template.bind({});ComplexMarkdownMath4.args={memori:data.jF,apiUrl:"https://backend.memori.ai",tenant:data.cm,useMathFormatting:!0,message:{fromUser:!1,initial:!1,generatedByAI:!0,text:"Per calcolare l'urto su barriere metalliche, è necessario considerare diversi fattori come la massa del veicolo, la velocità dell'impatto, l'angolo di impatto e le caratteristiche della barriera stessa. Di seguito è riportata una descrizione generale del processo di calcolo:\n\n1. **Determinazione dei parametri dell'urto:**\n - **Massa del veicolo (m):** La massa del veicolo che colpisce la barriera.\n - **Velocità dell'impatto (v):** La velocità del veicolo al momento dell'impatto.\n - **Angolo di impatto (θ):** L'angolo con cui il veicolo colpisce la barriera.\n\n2. **Calcolo dell'energia cinetica:**\n L'energia cinetica del veicolo al momento dell'impatto è data dalla formula:\n \\[\n E_k = \\frac{1}{2} m v^2\n \\]\n dove $E_k$ è l'energia cinetica, $m$ è la massa del veicolo e $v$ è la velocità del veicolo.\n\n3. **Calcolo della forza d'impatto:**\n La forza d'impatto può essere calcolata considerando la decelerazione del veicolo e il tempo di contatto con la barriera. Una formula semplificata per la forza d'impatto $F$ è:\n \\[\n F = \\frac{m \\Delta v}{\\Delta t}\n \\]\n dove $ \\Delta v $ è la variazione di velocità (che può essere considerata uguale alla velocità iniziale \\(v\\) se il veicolo si ferma completamente), e $ \\Delta t $ è il tempo di contatto.\n\n4. **Considerazioni sulla barriera:**\n Le barriere metalliche sono progettate per assorbire energia e ridurre la forza trasmessa ai veicoli e agli occupanti. La capacità di assorbimento dell'energia della barriera dipende dal materiale, dalla geometria e dalla costruzione della barriera stessa.\n\n5. **Normative e standard:**\n È importante seguire le normative e gli standard specifici per la progettazione e il calcolo delle barriere di sicurezza. Questi possono variare a seconda del paese e dell'applicazione specifica (ad esempio, autostrade, ponti, ecc.).\n\nPer calcoli più dettagliati e specifici, si consiglia di consultare le normative tecniche locali e di utilizzare software di simulazione specializzati che possono prendere in considerazione tutti i fattori rilevanti."}};const ComplexMarkdownMath5=Template.bind({});ComplexMarkdownMath5.args={memori:data.jF,tenant:data.cm,useMathFormatting:!0,apiUrl:"https://backend.memori.ai",message:{fromUser:!1,initial:!1,generatedByAI:!0,text:"Per calcolare l'ipotenusa di un triangolo rettangolo, puoi utilizzare il teorema di Pitagora. La formula è:\n\n\\\\[ c = \\\\sqrt{a^2 + b^2} \\\\]\n\nDove:\n- \\\\( c \\\\) è l'ipotenusa,\n- \\\\( a \\\\) e \\\\( b \\\\) sono i due cateti del triangolo.\n\nAd esempio, se hai un triangolo con i cateti di lunghezza 3 e 4, l'ipotenusa sarà:\n\n\\\\[ c = \\\\sqrt{3^2 + 4^2} = \\\\sqrt{9 + 16} = \\\\sqrt{25} = 5 \\\\]\n\nSe hai altre domande o dubbi, sono qui per aiutarti!"}};const ComplexMarkdownMath6=Template.bind({});ComplexMarkdownMath6.args={memori:data.jF,tenant:data.cm,useMathFormatting:!0,apiUrl:"https://backend.memori.ai",message:{fromUser:!1,initial:!1,generatedByAI:!0,text:"La formula per il calcolo della spinta passiva non è riportata precisamente nel documento, ma in base alle informazioni presenti nella Specifica Tecnica per la redazione delle Verifiche Accurate di sicurezza di Livello 4 (ST-VAL4), il contesto del calcolo delle spinte passive può essere richiamato come segue:\n\nIl calcolo della spinta passiva in geotecnica solitamente coinvolge il coefficiente di spinta passiva, che può esser calcolato usando diverse formulazioni a seconda delle condizioni (statiche o sismiche).\n\n1. **In condizioni statiche**, il calcolo della pressione del terreno avviene considerando il coefficiente passivo $k_p$:$k_p = \frac{1 + sin(phi)}{1 - sin(phi)}$\n\n2. **In condizioni sismiche**, si può utilizzare la formulazione di Mononobe-Okabe:\n [\n k_h = \beta cdot \frac{a_{max}}{g}\n ]\n dove:\n - $\beta$ è il coefficiente di riduzione della accelerazione massima attesa al sito\n - $a_{max}$ è l'accelerazione massima\n - $g$ è l'accelerazione di gravità .\n\nSe hai bisogno di dettagli più specifici o ulteriori informazioni su un altro argomento, fammi sapere!"}};const ComplexMarkdownMath7=Template.bind({});ComplexMarkdownMath7.args={memori:data.jF,tenant:data.cm,apiUrl:"https://backend.memori.ai",useMathFormatting:!0,message:{fromUser:!1,initial:!1,generatedByAI:!0,text:'Il coefficiente di adeguatezza $𝜁_V$ è definito dalle normative NTC18 come il rapporto tra il valore massimo del sovraccarico verticale variabile sopportabile dalla parte i-esima della costruzione e il valore del sovraccarico verticale variabile che si utilizzerebbe nel progetto di una nuova costruzione.\n\nTale parametro viene calcolato tramite la seguente espressione:\n\n$$\n𝜁_V = \frac{𝑅_d - (𝐸_{d,G} + 𝐸_{d,Q𝑡,𝑜𝑟𝑖𝑧𝑧𝑜𝑛𝑡𝑎𝑙𝑖} + 𝐸_{d,Q𝑣𝑎𝑟𝑖𝑎𝑏𝑖𝑙𝑖})}{𝐸_{d,Q𝑡,𝑣𝑒𝑟𝑡𝑖𝑐𝑎𝑙𝑖}}\n$$\n\ndove:\n\n- $𝑅_d$ è la capacità della sezione resistente;\n- $𝐸_{d,G}$ è l’azione sollecitante derivante dai carichi permanenti;\n- $𝐸_{d,Q𝑣𝑎𝑟𝑖𝑎𝑏𝑖𝑙𝑖}$ è l’azione sollecitante derivante dai carichi accidentali non da traffico (vento, azioni termiche, ecc.);\n- $𝐸_{d,Q𝑡,𝑣𝑒𝑟𝑡𝑖𝑐𝑎𝑙𝑖}$ è l’azione sollecitante derivante dalla componente verticale dei carichi da traffico;\n- $𝐸_{d,Q𝑡,𝑜𝑟𝑖𝑧𝑧𝑜𝑛𝑡𝑎𝑙𝑖}$ è l’azione sollecitante derivante dalla componente orizzontale dei carichi da traffico (frenatura o azione centrifuga).\n\nIn accordo con il §6.1.5 delle LG20, il coefficiente $𝜁_V$ ha significato solo per il livello di analisi di "Adeguamento" in quanto per i livelli di "Operatività" e "Transitabilità" la domanda per la quale si svolgono le valutazioni di sicurezza è determinata in condizioni differenti da quelle che si avrebbero per nuove costruzioni ($𝑡_{r𝑒𝑓}$ ridotto, restrizioni all’uso, limitazioni di carico).\n\nI coefficienti $𝜁_V$ possono essere valutati per le combinazioni che considerano carichi da traffico con componente d’azione verticale .'}};const WithHTML=Template.bind({});WithHTML.args={memori:data.jF,tenant:data.cm,apiUrl:"https://backend.memori.ai",message:{fromUser:!1,initial:!1,generatedByAI:!0,text:'\n
\n
\n\n

Lenovo IdeaPad 3 Chromebook

\n

Intel Celeron, 15", 4GB RAM, 64GB

\n

Prezzo: €194,88 (sconto 12% da €221,59)

\n
\n\n
\n\n

Lenovo IdeaPad 3 Chromebook

\n

Intel Celeron, 15", 4GB RAM, 64GB

\n

Prezzo: €194,88 (sconto 12% da €221,59)

\n
\n\n
\n\n

Lenovo IdeaPad 3 Chromebook

\n

Intel Celeron, 15", 4GB RAM, 64GB

\n

Prezzo: €194,88 (sconto 12% da €221,59)

\n
\n
\n'}},Default.parameters={...Default.parameters,docs:{...Default.parameters?.docs,source:{originalSource:"args => \n \n ",...Default.parameters?.docs?.source}}},FromUser.parameters={...FromUser.parameters,docs:{...FromUser.parameters?.docs,source:{originalSource:"args => \n \n ",...FromUser.parameters?.docs?.source}}},Initial.parameters={...Initial.parameters,docs:{...Initial.parameters?.docs,source:{originalSource:"args => \n \n ",...Initial.parameters?.docs?.source}}},CopyDisabled.parameters={...CopyDisabled.parameters,docs:{...CopyDisabled.parameters?.docs,source:{originalSource:"args => \n \n ",...CopyDisabled.parameters?.docs?.source}}},GeneratedByAI.parameters={...GeneratedByAI.parameters,docs:{...GeneratedByAI.parameters?.docs,source:{originalSource:"args => \n \n ",...GeneratedByAI.parameters?.docs?.source}}},WithTranslationAndOriginal.parameters={...WithTranslationAndOriginal.parameters,docs:{...WithTranslationAndOriginal.parameters?.docs,source:{originalSource:"args => \n \n ",...WithTranslationAndOriginal.parameters?.docs?.source}}},WithLongLink.parameters={...WithLongLink.parameters,docs:{...WithLongLink.parameters?.docs,source:{originalSource:"args => \n \n ",...WithLongLink.parameters?.docs?.source}}},WithFeedbackButtons.parameters={...WithFeedbackButtons.parameters,docs:{...WithFeedbackButtons.parameters?.docs,source:{originalSource:"args => \n \n ",...WithFeedbackButtons.parameters?.docs?.source}}},WithAllAddonsContents.parameters={...WithAllAddonsContents.parameters,docs:{...WithAllAddonsContents.parameters?.docs,source:{originalSource:"args => \n \n ",...WithAllAddonsContents.parameters?.docs?.source}}},FromUserWithAvatar.parameters={...FromUserWithAvatar.parameters,docs:{...FromUserWithAvatar.parameters?.docs,source:{originalSource:"args => \n \n ",...FromUserWithAvatar.parameters?.docs?.source}}},FromUserWithCustomAvatar.parameters={...FromUserWithCustomAvatar.parameters,docs:{...FromUserWithCustomAvatar.parameters?.docs,source:{originalSource:"args => \n \n ",...FromUserWithCustomAvatar.parameters?.docs?.source}}},FromUserWithCustomAvatarElement.parameters={...FromUserWithCustomAvatarElement.parameters,docs:{...FromUserWithCustomAvatarElement.parameters?.docs,source:{originalSource:"args => \n \n ",...FromUserWithCustomAvatarElement.parameters?.docs?.source}}},FromUserWithAvatarAndCustomAvatar.parameters={...FromUserWithAvatarAndCustomAvatar.parameters,docs:{...FromUserWithAvatarAndCustomAvatar.parameters?.docs,source:{originalSource:"args => \n \n ",...FromUserWithAvatarAndCustomAvatar.parameters?.docs?.source}}},FromExpertOfABoard.parameters={...FromExpertOfABoard.parameters,docs:{...FromExpertOfABoard.parameters?.docs,source:{originalSource:"args => \n \n ",...FromExpertOfABoard.parameters?.docs?.source}}},WithMarkdown.parameters={...WithMarkdown.parameters,docs:{...WithMarkdown.parameters?.docs,source:{originalSource:"args => \n \n ",...WithMarkdown.parameters?.docs?.source}}},WithMarkdownAndBreakLine.parameters={...WithMarkdownAndBreakLine.parameters,docs:{...WithMarkdownAndBreakLine.parameters?.docs,source:{originalSource:"args => \n \n ",...WithMarkdownAndBreakLine.parameters?.docs?.source}}},WithMarkdownAndMultipleBreakLine.parameters={...WithMarkdownAndMultipleBreakLine.parameters,docs:{...WithMarkdownAndMultipleBreakLine.parameters?.docs,source:{originalSource:"args => \n \n ",...WithMarkdownAndMultipleBreakLine.parameters?.docs?.source}}},WithMarkdownCode.parameters={...WithMarkdownCode.parameters,docs:{...WithMarkdownCode.parameters?.docs,source:{originalSource:"args => \n \n ",...WithMarkdownCode.parameters?.docs?.source}}},WithOutputCode.parameters={...WithOutputCode.parameters,docs:{...WithOutputCode.parameters?.docs,source:{originalSource:"args => \n \n ",...WithOutputCode.parameters?.docs?.source}}},WithMarkdownTable.parameters={...WithMarkdownTable.parameters,docs:{...WithMarkdownTable.parameters?.docs,source:{originalSource:"args => \n \n ",...WithMarkdownTable.parameters?.docs?.source}}},MarkdownWithSquareBrackets.parameters={...MarkdownWithSquareBrackets.parameters,docs:{...MarkdownWithSquareBrackets.parameters?.docs,source:{originalSource:"args => \n \n ",...MarkdownWithSquareBrackets.parameters?.docs?.source}}},MarkdownWithSquareBracketsAndTable.parameters={...MarkdownWithSquareBracketsAndTable.parameters,docs:{...MarkdownWithSquareBracketsAndTable.parameters?.docs,source:{originalSource:"args => \n \n ",...MarkdownWithSquareBracketsAndTable.parameters?.docs?.source}}},ComplexMarkdownMath1.parameters={...ComplexMarkdownMath1.parameters,docs:{...ComplexMarkdownMath1.parameters?.docs,source:{originalSource:"args => \n \n ",...ComplexMarkdownMath1.parameters?.docs?.source}}},ComplexMarkdownMath2.parameters={...ComplexMarkdownMath2.parameters,docs:{...ComplexMarkdownMath2.parameters?.docs,source:{originalSource:"args => \n \n ",...ComplexMarkdownMath2.parameters?.docs?.source}}},ComplexMarkdownMath3.parameters={...ComplexMarkdownMath3.parameters,docs:{...ComplexMarkdownMath3.parameters?.docs,source:{originalSource:"args => \n \n ",...ComplexMarkdownMath3.parameters?.docs?.source}}},ComplexMarkdownMath4.parameters={...ComplexMarkdownMath4.parameters,docs:{...ComplexMarkdownMath4.parameters?.docs,source:{originalSource:"args => \n \n ",...ComplexMarkdownMath4.parameters?.docs?.source}}},ComplexMarkdownMath5.parameters={...ComplexMarkdownMath5.parameters,docs:{...ComplexMarkdownMath5.parameters?.docs,source:{originalSource:"args => \n \n ",...ComplexMarkdownMath5.parameters?.docs?.source}}},ComplexMarkdownMath6.parameters={...ComplexMarkdownMath6.parameters,docs:{...ComplexMarkdownMath6.parameters?.docs,source:{originalSource:"args => \n \n ",...ComplexMarkdownMath6.parameters?.docs?.source}}},ComplexMarkdownMath7.parameters={...ComplexMarkdownMath7.parameters,docs:{...ComplexMarkdownMath7.parameters?.docs,source:{originalSource:"args => \n \n ",...ComplexMarkdownMath7.parameters?.docs?.source}}},WithHTML.parameters={...WithHTML.parameters,docs:{...WithHTML.parameters?.docs,source:{originalSource:"args => \n \n ",...WithHTML.parameters?.docs?.source}}};const __namedExportsOrder=["Default","FromUser","Initial","CopyDisabled","GeneratedByAI","WithTranslationAndOriginal","WithLongLink","WithFeedbackButtons","WithAllAddonsContents","FromUserWithAvatar","FromUserWithCustomAvatar","FromUserWithCustomAvatarElement","FromUserWithAvatarAndCustomAvatar","FromExpertOfABoard","WithMarkdown","WithMarkdownAndBreakLine","WithMarkdownAndMultipleBreakLine","WithMarkdownCode","WithOutputCode","WithMarkdownTable","MarkdownWithSquareBrackets","MarkdownWithSquareBracketsAndTable","ComplexMarkdownMath1","ComplexMarkdownMath2","ComplexMarkdownMath3","ComplexMarkdownMath4","ComplexMarkdownMath5","ComplexMarkdownMath6","ComplexMarkdownMath7","WithHTML"]},"./src/components/ui/Tooltip.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Tooltip=({content,className,align="right",disabled=!1,visible=!1,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-tooltip",`memori-tooltip--align-${align}`,className,{"memori-tooltip--disabled":disabled,"memori-tooltip--visible":visible}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"memori-tooltip--content",children:content}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"memori-tooltip--trigger",children})]});Tooltip.displayName="Tooltip";const __WEBPACK_DEFAULT_EXPORT__=Tooltip;try{Tooltip.displayName="Tooltip",Tooltip.__docgenInfo={description:"",displayName:"Tooltip",props:{content:{defaultValue:null,description:"",name:"content",required:!0,type:{name:"Element | ReactNode"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},align:{defaultValue:{value:"right"},description:"",name:"align",required:!1,type:{name:"enum",value:[{value:'"left"'},{value:'"right"'},{value:'"topLeft"'},{value:'"topRight"'}]}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},visible:{defaultValue:{value:"false"},description:"",name:"visible",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Tooltip.tsx#Tooltip"]={docgenInfo:Tooltip.__docgenInfo,name:"Tooltip",path:"src/components/ui/Tooltip.tsx#Tooltip"})}catch(__react_docgen_typescript_loader_error){}},"./src/mocks/data.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A3:()=>expertReference,AU:()=>memoryQuestion,EA:()=>user,Eu:()=>historyWithMedia,Fr:()=>venue,Gs:()=>dialogState,I_:()=>historyWithAIGeneratedMessages,JZ:()=>knownFact,M9:()=>sessionID,WM:()=>integration,cm:()=>tenant,jF:()=>memori,m8:()=>history});const sessionID="131165be-9d1a-42fb-a3ce-e8f86d40c88f",tenant={adminCount:3,config:{name:"AIsuru",requirePosition:!1,showNewUser:!0},creationTimestamp:"2023-05-31T14:32:48.885287Z",description:"AIsuru",disableRegistration:!1,id:"www.aisuru.com",lastChangeTimestamp:"2023-05-31T14:32:48.885287Z",logoURL:"https://aisuru.com/images/aisuru/logo.png",maxAdmins:0,maxCompletions:0,maxCompletionsPerUser:0,maxFreeSessions:400,maxFreeSessionsPerUser:100,maxMemoriPerAdmin:0,maxMemoriPerUser:3,maxTotalMemori:0,maxUsers:0,memoriCount:0,name:"www.aisuru.com",nonFreeSessionCost:.02,paying:!0,tenantID:"96caa4b4-31a4-48e5-8163-dec61869a2a7",theme:"aisuru",userCount:0},user={tenant:"localhost:3000",userID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",userName:"nzambello",eMail:"nicola@nzambello.dev",admin:!1,maxMemori:0,enableMemoriCreation:!0,enableBoardOfExperts:!0,maxFreeSessions:0,tnCAndPPAccepted:!0,tnCAndPPAcceptanceDate:"2021-03-01T00:00:00.000Z",pAndCUAccepted:!0,pAndCUAcceptanceDate:"2021-03-01T00:00:00.000Z",birthDate:"1900-03-01T00:00:00.000Z",age:28,avatarURL:"https://avatars.githubusercontent.com/u/21101435?v=4"},memori={memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",engineMemoriID:"66b4e161-2431-4b21-9b70-d8c27de730ca",name:"Memori",memoriConfigurationID:"MemoriCloud-it_IT",description:"Lorem ipsum.",voiceType:"male",isGiver:!0,isReceiver:!1,privacyType:"PUBLIC",needsPosition:!1,culture:"it-IT",categories:[],publishedInTheMetaverse:!0,exposed:!0,enableCompletions:!0,nsfw:!1,ageRestriction:14,contentQualityIndex:66.6,contentQualityIndexTimestamp:"2021-03-01T12:00:00.000Z",ownerUserName:"username",ownerTenantName:"aisuru.com",ownerUserID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",metaverseEnvironment:"synthwave",secretToken:"awanagana",giverPIN:"1234",giverTag:"🧑‍💻",avatarURL:"https://aisuru.com/images/aisuru/square_logo.png",coverURL:"https://aisuru.com/images/aisuru/og-image.png"},history=[{text:"Ciao, io sono test, c'è qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'è altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],historyWithMedia=[{text:"Ciao, io sono test, c'è qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'è altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui delle cose per te.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai/en",mimeType:"text/html",title:"Link Memori Srl"},{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efce",url:"https://rawmaterial.it/en",mimeType:"text/html",title:"Link RawMaterial"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5971",mimeType:"text/html",title:"Introducing Plone Remix | Vimeo",url:"https://vimeo.com/766468314"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5969",mimeType:"text/html",title:"A sustainable web: is it possible? - Nicola Zambello | YouTube",url:"https://www.youtube.com/watch?v=feH26j3rBz8"},...Array.from({length:3},((_,i)=>({mediumID:`95226d7e-7bae-465e-8b80-995587bb597${i}`,mimeType:"image/png",title:`Image ${i}`,url:`https://picsum.photos/${i%2?"200":"300"}/${i%3?"300":"200"}?random=${i}`})))],timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z"}],historyWithAIGeneratedMessages=[{text:"Ciao, io sono test, c'è qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Sa. Sa. Prova",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",generatedByAI:!0,contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],dialogState={state:"R1",previousState:"I0",stateName:"WaitingForReceiverQuestion",confidence:1,knownTags:{"☠️":"test","😎":"Ciccio"},emission:"Ciao, io sono test, c'è qualcosa che vorresti chiedermi?",hints:["Va bene","No grazie"],media:[],acceptsTimeout:!0,acceptsAbort:!1,acceptsMedia:!1,acceptsDate:!1,acceptsPlace:!1,acceptsTag:!1,giverID:"c832e2dc-403c-4baf-a3b7-2374e100dbcf",contextVars:{}},integration={integrationID:"cb3c4776-7f0b-4f97-a773-c32a5d7a3bf1",memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",type:"LANDING_EXPERIENCE",state:"NEW",deviceEmails:[],customData:'{"textColor":"#2a2a2a","buttonBgColor":"#823ce1","buttonTextColor":"#ffffff","name":"Web","globalBackground":"https://assets.memori.ai/api/v2/asset/364e498c-11da-42d5-9e32-19e5d137d4b8.jpeg","blurBackground":true,"innerBgColor":"light","innerBgAlpha":0.8,"multilanguage":true,"avatar":"readyplayerme","avatarURL":"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb#1669663599444"}',resources:[],publish:!0,creationTimestamp:"2022-06-11T14:13:45.685038Z",lastChangeTimestamp:"2022-06-11T14:13:45.685038Z"},knownFact={knownFactID:"b0b0b0b0-b0b0-b0b0-b0b0-b0b0b0b0b0b3",knownFactType:"ShortTerm",text:"I am a known fact. Quisque in ultrices lectus. Nulla at urna diam. Proin sodales lobortis libero eu facilisis.",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},expertReference={expertID:"f016f204-c307-483b-8891-680a3c974c53",name:"TEST MEMORI",description:"lui è competente",default:!0,expertMemoriID:"dfc44f1c-1ba7-4e1e-a234-28aa8b6b3d32",expertBaseURL:"http://localhost:7778",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},venue={latitude:44.66579,longitude:11.48823,placeName:"Altedo, Bologna, Italy",uncertainty:2},memoryQuestion={memoryID:"08c0697d-f7f3-4a47-9970-aff75f01fb6c",memoryType:"Question",lastRead:void 0,readOccurrences:void 0,receiverID:void 0,receiverTag:void 0,receiverName:void 0,media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",mimeType:"text/html",url:"https://rawmaterial.it/it",title:"RawMaterial"}],title:"sei umano",titleVariants:["sei reale"],answers:[{text:"se ti dico si ci credi?",preformatted:!1,creationTimestamp:"2022-03-23T09:37:25.410377",creationName:"6cfec2bd-a73f-4a21-b7ff-dd92d6db59c4",lastChangeTimestamp:"2022-03-23T09:37:25.410406",lastChangeName:"6cfec2bd-a73f-4a21-b7ff-dd92d6db59c4"},{text:"probabilmente lo sono più di te",preformatted:!1,creationTimestamp:"2022-03-23T09:37:36.957656",creationName:"6cfec2bd-a73f-4a21-b7ff-dd92d6db59c4",lastChangeTimestamp:"2022-03-23T09:37:36.957657",lastChangeName:"6cfec2bd-a73f-4a21-b7ff-dd92d6db59c4"}],date:void 0,dateUncertaintyDays:void 0,placeName:void 0,placeLatitude:void 0,placeLongitude:void 0,placeUncertaintyKm:void 0,preformatted:!1,conclusive:!1,notPickable:!1,contextVarsToSet:{SUBJECT:"TRAVEL"},contextVarsToMatch:{SUBJECT:"TRANSPORTS"},creationTimestamp:"2022-03-23T09:37:16.568149",creationName:"6cfec2bd-a73f-4a21-b7ff-dd92d6db59c4",lastChangeTimestamp:"2022-03-23T09:37:36.957695",lastChangeName:"6cfec2bd-a73f-4a21-b7ff-dd92d6db59c4"}}}]); \ No newline at end of file diff --git a/iframe.html b/iframe.html index 2dc12891..2384d609 100644 --- a/iframe.html +++ b/iframe.html @@ -348,7 +348,7 @@ window['DOCS_OPTIONS'] = {"defaultName":"Docs","autodocs":false};
AttivitàDic 2024Gen 2025Feb 2025Mar 2025Apr 2025Mag 2025Giu 2025