From 69507b28afb71eef5dce1f1e7184830e9cad9468 Mon Sep 17 00:00:00 2001 From: nzambello Date: Fri, 17 Nov 2023 14:01:26 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20=20@=20c7adf?= =?UTF-8?q?7c6e832ac95ae7808a2f6b532204bc5c80d=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ....91c76b57.iframe.bundle.js => 4795.4644f8bd.iframe.bundle.js | 2 +- iframe.html | 2 +- project.json | 2 +- ...e.iframe.bundle.js => runtime~main.acd3c595.iframe.bundle.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename 4795.91c76b57.iframe.bundle.js => 4795.4644f8bd.iframe.bundle.js (83%) rename runtime~main.6e2ffaee.iframe.bundle.js => runtime~main.acd3c595.iframe.bundle.js (99%) diff --git a/4795.91c76b57.iframe.bundle.js b/4795.4644f8bd.iframe.bundle.js similarity index 83% rename from 4795.91c76b57.iframe.bundle.js rename to 4795.4644f8bd.iframe.bundle.js index 7968390a..68a68812 100644 --- a/4795.91c76b57.iframe.bundle.js +++ b/4795.4644f8bd.iframe.bundle.js @@ -1 +1 @@ -(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[4795],{"./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"),_ui_Message__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./src/components/ui/Message.tsx"),_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"),moment__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/moment/moment.js"),moment__WEBPACK_IMPORTED_MODULE_3___default=__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_3__),_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)(),onSubmit=(0,react__WEBPACK_IMPORTED_MODULE_5__.useCallback)((()=>{if(!birthDate)return _ui_Message__WEBPACK_IMPORTED_MODULE_0__.Z.error(t("requiredField")),void setError(t("requiredField")||"Required field");if(moment__WEBPACK_IMPORTED_MODULE_3___default()().diff(birthDate,"years")onClose(),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",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/AttachmentLinkModal/AttachmentLinkModal.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"),_MediaWidget_LinkItemWidget__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/MediaWidget/LinkItemWidget.tsx"),_ui_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Modal__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/ui/Modal.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react/jsx-runtime.js");const AttachmentLinkModal=({visible,onCancel,onOk})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_5__.$)(),[newLink,setNewLink]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)({url:"",title:""}),onKeyPress=e=>{if("Enter"===e.key){if(0===newLink?.url.length||0===newLink?.title.length)return;let saveButton=document.getElementById("save-link-button");saveButton&&saveButton.click()}};return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_3__.Z,{open:visible,title:t("media.addLinkLabel"),className:"attachment-link-modal",closable:!0,width:"100%",widthMd:"80%",onClose:()=>{onCancel&&onCancel()},footer:(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)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{onClick:onCancel,children:t("cancel")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{id:"save-link-button",primary:!0,onClick:()=>{0!==newLink?.url.length&&0!==newLink?.title.length&&(onOk(newLink),setNewLink({url:"",title:""}))},disabled:0===newLink?.url.length||0===newLink?.title.length,children:t("confirm")})]}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div",{className:"attachment-link-modal--row",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div",{className:"attachment-link-modal--column",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("label",{htmlFor:"new-link-url",className:"attachment-link-modal--label",children:[t("media.linkKey"),":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("input",{type:"url",className:"attachment-link-modal--input ",onChange:e=>{let value=e.target.value.startsWith("http")||0===e.target.value.length?e.target.value:`https://${e.target.value}`;setNewLink((l=>({title:l?.title??"",url:value})))},placeholder:"https://memori.ai/...",value:newLink?.url,name:"url",onKeyDown:onKeyPress}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("label",{htmlFor:"new-link-title",className:"attachment-link-modal--label",children:[t("media.linkValue"),":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("input",{type:"text",className:"attachment-link-modal--input ",onChange:e=>setNewLink((l=>({url:l?.url??"",title:e.target.value}))),value:newLink?.title,name:"title",onKeyDown:onKeyPress})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div",{className:"attachment-link-modal--column",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div",{className:"attachment-link-modal--centered",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_MediaWidget_LinkItemWidget__WEBPACK_IMPORTED_MODULE_1__.$,{item:{title:newLink?.title??"",url:newLink?.url??"",mediumID:"",mimeType:"text/html"},onLinkPreviewInfo:data=>{newLink?.title?.length||setNewLink((l=>({...l,title:data?.title??""})))}},newLink?.url??"")})})]})})};AttachmentLinkModal.displayName="AttachmentLinkModal";const __WEBPACK_DEFAULT_EXPORT__=AttachmentLinkModal;try{AttachmentLinkModal.displayName="AttachmentLinkModal",AttachmentLinkModal.__docgenInfo={description:"",displayName:"AttachmentLinkModal",props:{visible:{defaultValue:null,description:"",name:"visible",required:!0,type:{name:"boolean"}},onCancel:{defaultValue:null,description:"",name:"onCancel",required:!1,type:{name:"(() => void)"}},onOk:{defaultValue:null,description:"",name:"onOk",required:!0,type:{name:"({ url, title }: { url: string; title: string; }) => void"}},apiURL:{defaultValue:null,description:"",name:"apiURL",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AttachmentLinkModal/AttachmentLinkModal.tsx#AttachmentLinkModal"]={docgenInfo:AttachmentLinkModal.__docgenInfo,name:"AttachmentLinkModal",path:"src/components/AttachmentLinkModal/AttachmentLinkModal.tsx#AttachmentLinkModal"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/AttachmentMediaModal/AttachmentMediaModal.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_8__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_helpers_error__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/helpers/error.ts"),_helpers_constants__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/helpers/constants.ts"),_helpers_media__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./src/helpers/media.ts"),_ui_Modal__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/ui/Modal.tsx"),_ui_Message__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/ui/Message.tsx"),_ui_Button__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./src/components/ui/Button.tsx"),_ImageUpload_ImageUpload__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./src/components/ImageUpload/ImageUpload.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/react/jsx-runtime.js");const AttachmentMediaModal=({visible,authToken,sessionID,tenantID,uploadAssetURL,deleteAsset,onCancel,onOk,apiURL})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_8__.$)(),[asset,setAsset]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_3__.Z,{open:visible,title:t("media.addMediaLabel"),className:"attachment-media-modal",closable:!0,width:"100%",widthMd:"100%",onClose:()=>{onCancel&&onCancel()},footer:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_5__.Z,{onClick:onCancel,children:t("cancel")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_5__.Z,{primary:!0,onClick:()=>{asset&&onOk(asset),setAsset(void 0)},disabled:!asset,children:t("confirm")})]}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ImageUpload_ImageUpload__WEBPACK_IMPORTED_MODULE_6__.Z,{tenantID,apiUrl:apiURL,uploadMultipleImages:!1,maxNumberOfVisualizedUploads:1,maxFileSizeInMB:100,uploadUrl:uploadAssetURL,useImageCrop:!1,allowedMimeTypes:_helpers_constants__WEBPACK_IMPORTED_MODULE_2__.go,fileList:asset?[{uid:"-1",name:asset.assetID,status:"done",thumbUrl:(0,_helpers_media__WEBPACK_IMPORTED_MODULE_9__.v)({resourceURI:asset.assetURL,tenantID,apiURL,sessionID})}]:[],uploadMessage:t("media.mediaUploadMessage"),imageProportions:1,onUploadFinished:file=>{let newAsset=file.response.asset,response=file.response;0===response.resultCode?setAsset(newAsset):(console.error(response,file),_ui_Message__WEBPACK_IMPORTED_MODULE_4__.Z.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_1__.r)(response.resultCode))))},onFileChanged:(_assetID,asset)=>{setAsset((a=>({...a||{},...asset})))},onRemove:async file=>{const resp=await deleteAsset(authToken,file.thumbUrl);return 0===resp.resultCode?setAsset(void 0):(console.error(resp,file),_ui_Message__WEBPACK_IMPORTED_MODULE_4__.Z.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_1__.r)(resp.resultCode)))),0===resp.resultCode}})})};AttachmentMediaModal.displayName="AttachmentMediaModal";const __WEBPACK_DEFAULT_EXPORT__=AttachmentMediaModal;try{AttachmentMediaModal.displayName="AttachmentMediaModal",AttachmentMediaModal.__docgenInfo={description:"",displayName:"AttachmentMediaModal",props:{visible:{defaultValue:null,description:"",name:"visible",required:!0,type:{name:"boolean"}},authToken:{defaultValue:null,description:"",name:"authToken",required:!0,type:{name:"string"}},sessionID:{defaultValue:null,description:"",name:"sessionID",required:!0,type:{name:"string"}},tenantID:{defaultValue:null,description:"",name:"tenantID",required:!0,type:{name:"string"}},uploadAssetURL:{defaultValue:null,description:"",name:"uploadAssetURL",required:!0,type:{name:"string"}},deleteAsset:{defaultValue:null,description:"",name:"deleteAsset",required:!0,type:{name:"(token: string, assetURL: string) => Promise"}},onCancel:{defaultValue:null,description:"",name:"onCancel",required:!1,type:{name:"(() => void)"}},onOk:{defaultValue:null,description:"",name:"onOk",required:!0,type:{name:"(asset: Asset) => Promise"}},apiURL:{defaultValue:null,description:"",name:"apiURL",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AttachmentMediaModal/AttachmentMediaModal.tsx#AttachmentMediaModal"]={docgenInfo:AttachmentMediaModal.__docgenInfo,name:"AttachmentMediaModal",path:"src/components/AttachmentMediaModal/AttachmentMediaModal.tsx#AttachmentMediaModal"})}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/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,showGiverInfo=!1,showTitle=!1,marginLeft=!1})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)(),blockedUntilDate=new Date(blockedUntil);return blockedUntilDate>new Date?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{className:"blocked-memori-badge--tooltip",content:(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:!0,type:{name:"string"}},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/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"),moment__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/moment/moment.js"),moment__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_1__),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)(moment__WEBPACK_IMPORTED_MODULE_1___default()(defaultDate||Date.now()));return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{onChange(date)}),[date,onChange]),moment__WEBPACK_IMPORTED_MODULE_1___default().locale(i18n.language),(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.date()}),(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.clone().date(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()]}),(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.clone().month(months["it"===i18n.language?"it":"en"].findIndex((m=>m===month))),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(moment__WEBPACK_IMPORTED_MODULE_1___default()().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.clone().year(year+1900),className:"memori--date-selector__select-option",children:year+1900},year)))})})]})})]})}));DateSelector.displayName="DateSelector";const __WEBPACK_DEFAULT_EXPORT__=DateSelector},"./src/components/ImageUpload/ImageUpload.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_Message__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Message.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"),_ui_Modal__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/ui/Modal.tsx"),_ui_Spin__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./src/components/ui/Spin.tsx"),antd_lib_upload_Upload__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__("./node_modules/antd/lib/upload/Upload.js"),antd_img_crop__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/antd-img-crop/dist/antd-img-crop.esm.js"),react_i18next__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_icons_Edit__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./src/components/icons/Edit.tsx"),_icons_Delete__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./src/components/icons/Delete.tsx"),_MediaWidget_MediaItemWidget__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./src/components/MediaWidget/MediaItemWidget.tsx"),_helpers_media__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__("./src/helpers/media.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("./node_modules/react/jsx-runtime.js");const imgMimeTypes=["image/jpeg","image/png","image/jpg","image/gif"],UploadListItem=({originNode,file,tenantID,apiUrl,actions,resourceType})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_11__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{className:"memori--list-item-wrapper"+("uploading"===file.status?" listItemUploading":""),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Spin__WEBPACK_IMPORTED_MODULE_5__.Z,{spinning:"uploading"===file.status,children:"error"===file.status?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_3__.Z,{content:t("media.uploadError"),children:originNode.props.children}):(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_MediaWidget_MediaItemWidget__WEBPACK_IMPORTED_MODULE_9__.e,{item:{mediumID:file.uid,mimeType:"uploading"===file.status?"image/png":file.name?.endsWith(".glb")?"model/gltf-binary":file.type||"image/png",title:file.name??"",url:"uploading"===file.status?"":file.response?.asset?.assetURL?file.response.asset.assetURL:(0,_helpers_media__WEBPACK_IMPORTED_MODULE_12__.v)({type:resourceType,resourceURI:file.thumbUrl,tenantID,apiURL:apiUrl}),content:`${(0,_helpers_media__WEBPACK_IMPORTED_MODULE_12__.v)({resourceURI:file.thumbUrl,type:resourceType,apiURL:apiUrl})}`},preview:!1})}),("success"===file.status||"done"===file.status)&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{className:"list-item-actions",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{outlined:!0,shape:"circle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_icons_Edit__WEBPACK_IMPORTED_MODULE_7__.default,{}),className:"action-button",title:t("edit")||"Edit",onClick:()=>actions?.download(file)}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{outlined:!0,shape:"circle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_icons_Delete__WEBPACK_IMPORTED_MODULE_8__.default,{}),className:"action-button",title:t("delete")||"Delete",onClick:()=>actions?.remove(file)})]})]})};UploadListItem.displayName="UploadListItem";const ImageUpload=({uploadMultipleImages,maxNumberOfVisualizedUploads,uploadUrl,apiUrl,tenantID,fileList,maxFileSizeInMB=2,fileResolution,useImageCrop,uploadMessage,imageProportions=1,imageProportionsHelper,allowedMimeTypes,onRemove,onFileChanged,onUploadFinished,onFileNotValid,disabled,showHelper,additionalHelper,resourceType})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_11__.$)(),[internalFileList,setInternalFileList]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(fileList??[]),[fileTitleModal,setFileTitleModal]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(),upload=(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd_lib_upload_Upload__WEBPACK_IMPORTED_MODULE_13__.default,{className:"memori--upload",disabled:disabled??!1,accept:(allowedMimeTypes??imgMimeTypes)?.join(",")+";capture=camera,camcorder",action:uploadUrl,listType:"picture-card",showUploadList:{showPreviewIcon:!0,showRemoveIcon:!0,showDownloadIcon:!0,downloadIcon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_icons_Edit__WEBPACK_IMPORTED_MODULE_7__.default,{title:t("edit")||"Edit"})},beforeUpload:file=>{if(!(allowedMimeTypes??imgMimeTypes).find((x=>x===file.type))&&file.type)return console.debug("File not allowed",file,allowedMimeTypes??imgMimeTypes),_ui_Message__WEBPACK_IMPORTED_MODULE_1__.Z.error(t("media.uploadMimeTypeNotAllowed")),onFileNotValid&&onFileNotValid(),Promise.reject(t("media.uploadMimeTypeNotAllowed"));if(!(file.size/1024/1024<(maxFileSizeInMB??2)))return _ui_Message__WEBPACK_IMPORTED_MODULE_1__.Z.error(t("media.uploadSizeLimitMessage",{size:maxFileSizeInMB})),onFileNotValid&&onFileNotValid(),Promise.reject(t("media.uploadSizeLimitMessage",{size:maxFileSizeInMB}));if(fileResolution&&fileResolution.length){const reader=new FileReader;return reader.readAsDataURL(file),new Promise(((resolve,reject)=>{reader.addEventListener("load",(event=>{var newImg=new Image;newImg.style.padding="0px",newImg.style.margin="0px",newImg.onload=()=>{newImg.width===fileResolution[0]&&newImg.height===fileResolution[1]?resolve(file):(_ui_Message__WEBPACK_IMPORTED_MODULE_1__.Z.error(t("media.uploadWrongResolutionMessage",{width:fileResolution[0],height:fileResolution[1]})),reject(),onFileNotValid&&onFileNotValid())},newImg.src=event.target?.result?.toString()??""}))}))}return Promise.resolve(file)},supportServerRender:!0,fileList:internalFileList,multiple:uploadMultipleImages,maxCount:maxNumberOfVisualizedUploads||(uploadMultipleImages?100:1),onChange:info=>{setInternalFileList(info.fileList.map((f=>({...f,status:f.status??"error"})))),"done"===info.file.status&&onUploadFinished&&onUploadFinished(info.file)},onRemove,onDownload:file=>{let asset=file.response?.asset;if(asset){let title=asset.originalFileName&&file.name.includes(asset.originalFileName)?asset.originalFileName:file.name;setFileTitleModal({...asset,title:title??asset.title})}else setFileTitleModal({assetID:file.uid,title:file.name??file.fileName})},itemRender:(originNode,file,currFileList,actions)=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(UploadListItem,{resourceType,originNode,file,fileList:internalFileList||currFileList,actions,tenantID,apiUrl}),children:uploadMessage});return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{"aria-live":"polite",children:[useImageCrop?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd_img_crop__WEBPACK_IMPORTED_MODULE_6__.Z,{rotate:!0,aspect:imageProportions,fillColor:"transparent",modalCancel:t("cancel")||"Cancel",modalMaskTransitionName:"none",modalTransitionName:"none",children:upload}):upload,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)(_ui_Modal__WEBPACK_IMPORTED_MODULE_4__.Z,{open:!!fileTitleModal,title:t("media.editAttributes"),onClose:()=>{setFileTitleModal(void 0)},footer:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.Fragment,{}),width:"100%",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("label",{htmlFor:"media-title-input",className:"media-title-label",children:t("media.title")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("input",{id:"media-title-input",className:"media-title-input",type:"text",name:"title",defaultValue:fileTitleModal?.title||"",onChange:e=>{setFileTitleModal({...fileTitleModal,title:e.target.value})}}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{className:"memori-modal--footer",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{onClick:()=>{setFileTitleModal(void 0)},children:t("cancel")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,onClick:()=>{onFileChanged&&fileTitleModal?.assetID&&onFileChanged(fileTitleModal.assetID,{...fileTitleModal}),setInternalFileList((fl=>fl.map((f=>f.uid===fileTitleModal?.assetID||f.response?.asset?.assetID===fileTitleModal?.assetID?{...f,title:fileTitleModal?.title,name:fileTitleModal?.title}:f)))),setFileTitleModal(void 0)},children:t("confirm")})]})]}),showHelper&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("legend",{className:"helper",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("p",{children:t(allowedMimeTypes?"media.uploadHelper":"media.uploadHelperImages").replace("@size@",(maxFileSizeInMB??2).toString())}),imageProportionsHelper&&useImageCrop&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("p",{children:[t("media.scaleRatio"),": ",imageProportionsHelper]}),additionalHelper&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("p",{children:additionalHelper})]})]})};ImageUpload.displayName="ImageUpload";const __WEBPACK_DEFAULT_EXPORT__=ImageUpload;try{ImageUpload.displayName="ImageUpload",ImageUpload.__docgenInfo={description:"",displayName:"ImageUpload",props:{uploadMultipleImages:{defaultValue:null,description:"",name:"uploadMultipleImages",required:!0,type:{name:"boolean"}},maxNumberOfVisualizedUploads:{defaultValue:null,description:"",name:"maxNumberOfVisualizedUploads",required:!1,type:{name:"number"}},fileList:{defaultValue:null,description:"",name:"fileList",required:!1,type:{name:"any[]"}},uploadUrl:{defaultValue:null,description:"",name:"uploadUrl",required:!0,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!1,type:{name:"string"}},tenantID:{defaultValue:null,description:"",name:"tenantID",required:!0,type:{name:"string"}},maxFileSizeInMB:{defaultValue:{value:"2"},description:"",name:"maxFileSizeInMB",required:!1,type:{name:"number"}},fileResolution:{defaultValue:null,description:"",name:"fileResolution",required:!1,type:{name:"number[]"}},useImageCrop:{defaultValue:null,description:"",name:"useImageCrop",required:!1,type:{name:"boolean"}},uploadMessage:{defaultValue:null,description:"",name:"uploadMessage",required:!0,type:{name:"string"}},imageProportions:{defaultValue:{value:"1"},description:"",name:"imageProportions",required:!1,type:{name:"number"}},imageProportionsHelper:{defaultValue:null,description:"",name:"imageProportionsHelper",required:!1,type:{name:"string"}},allowedMimeTypes:{defaultValue:null,description:"",name:"allowedMimeTypes",required:!1,type:{name:"string[]"}},onRemove:{defaultValue:null,description:"",name:"onRemove",required:!1,type:{name:"((file: UploadFile) => Promise)"}},onUploadFinished:{defaultValue:null,description:"",name:"onUploadFinished",required:!1,type:{name:"((file: UploadFile) => void)"}},onFileChanged:{defaultValue:null,description:"",name:"onFileChanged",required:!1,type:{name:"((assetID: string, asset: Partial) => void)"}},onFileNotValid:{defaultValue:null,description:"",name:"onFileNotValid",required:!1,type:{name:"(() => void)"}},disabled:{defaultValue:null,description:"",name:"disabled",required:!1,type:{name:"boolean"}},showHelper:{defaultValue:null,description:"",name:"showHelper",required:!1,type:{name:"boolean"}},additionalHelper:{defaultValue:null,description:"",name:"additionalHelper",required:!1,type:{name:"string"}},resourceType:{defaultValue:null,description:"",name:"resourceType",required:!1,type:{name:"enum",value:[{value:'"cover"'},{value:'"avatar"'}]}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ImageUpload/ImageUpload.tsx#ImageUpload"]={docgenInfo:ImageUpload.__docgenInfo,name:"ImageUpload",path:"src/components/ImageUpload/ImageUpload.tsx#ImageUpload"})}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"),SpeechConfig=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/SpeechConfig.js"),SpeechSynthesisOutputFormat=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/SpeechSynthesisOutputFormat.js"),SpeakerAudioDestination=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/Audio/SpeakerAudioDestination.js"),AudioConfig=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/Audio/AudioConfig.js"),SpeechSynthesizer=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/SpeechSynthesizer.js"),SpeechRecognizer=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/SpeechRecognizer.js"),ResultReason=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/ResultReason.js"),CancellationReason=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/CancellationReason.js"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),Message=__webpack_require__("./src/components/ui/Message.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"),AttachmentMediaModal=__webpack_require__("./src/components/AttachmentMediaModal/AttachmentMediaModal.tsx"),AttachmentLinkModal=__webpack_require__("./src/components/AttachmentLinkModal/AttachmentLinkModal.tsx"),PoweredBy=__webpack_require__("./src/components/PoweredBy/PoweredBy.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})}),(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");const{deleteSession,getStatistics,initSession}=(0,esm.Z)(),BADGES_MAP=new Map([[0,"🆕"],[10,"🐹"],[20,"🐇"],[30,"🐰"],[40,"💡"],[50,"🏆"],[60,"🏅"],[70,"🥉"],[80,"🥈"],[90,"🥇"],[100,"🔥"],[110,"🎓"],[120,"🤖"],[130,"👾"],[150,"🌍"],[180,"💜"],[200,"💙"],[250,"🧡"],[300,"💚"],[350,"💛"],[400,"💖"],[450,"💝"],[500,"🖤"],[550,"❤️"],[600,"🧠"]]),getBadge=points=>{const unlockedBadges=Array.from(BADGES_MAP.keys()).filter((k=>k<=points));if(unlockedBadges.length>0){const lastBadge=unlockedBadges[unlockedBadges.length-1];return BADGES_MAP.get(lastBadge)}return""},getNextBadge=badge=>{if("🆕"===badge)return{points:10,badge:"🐹"};let nextBadgePoints,nextBadge,currentSeen=!1;for(const[key,value]of BADGES_MAP){if(currentSeen){nextBadgePoints=key,nextBadge=value;break}value===badge&&(currentSeen=!0)}return nextBadge&&nextBadgePoints?{points:nextBadgePoints,badge:nextBadge}:void 0},getPointsForBadge=badge=>{let points=0;for(const[key,value]of BADGES_MAP)if(value===badge){points=key;break}return points};var AgeVerificationModal=__webpack_require__("./src/components/AgeVerificationModal/AgeVerificationModal.tsx"),SettingsDrawer=__webpack_require__("./src/components/SettingsDrawer/SettingsDrawer.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 speakerMuted=!1,memoriSpeaking=!1;const MemoriWidget=({memori,memoriConfigs,memoriLang,multilingual,integration,layout="DEFAULT",customLayout,showInstruct=!1,showShare,preview=!1,embed=!1,showInputs=!0,showDates=!1,showContextPerLine=!1,showSettings=!0,showTypingText=!1,showClear=!1,showOnlyLastMessages,height="100vh",secret,baseUrl="https://app.twincreator.com",apiUrl="https://backend.memori.ai",initialContextVars,initialQuestion,ogImage,sessionID:initialSessionID,tenant,personification,authToken,AZURE_COGNITIVE_SERVICES_TTS_KEY,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),{initSession,postTextEnteredEvent,postPlaceChangedEvent,postTimeoutEvent,postTagChangedEvent,getSession,getContentQualityIndexes}=client,[instruct,setInstruct]=(0,react.useState)(!1),[user,setUser]=(0,react.useState)({avatarURL:"string"==typeof userAvatar?userAvatar:void 0}),[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,[userLang,setUserLang]=(0,react.useState)(memoriLang??integrationConfig?.lang??language??integrationConfig?.uiLang??i18n.language??"IT"),[loading,setLoading]=(0,react.useState)(!1),[memoriTyping,setMemoriTyping]=(0,react.useState)(!1),[typingText,setTypingText]=(0,react.useState)(),selectedLayout=layout||integrationConfig?.layout||"DEFAULT",[hasUserActivatedSpeak,setHasUserActivatedSpeak]=(0,react.useState)(!1),[hasUserActivatedListening,setHasUserActivatedListening]=(0,react.useState)(!1),[showPositionDrawer,setShowPositionDrawer]=(0,react.useState)(!1),[showSettingsDrawer,setShowSettingsDrawer]=(0,react.useState)(!1),[muteSpeaker,setMuteSpeaker]=(0,react.useState)(!1),[continuousSpeech,setContinuousSpeech]=(0,react.useState)(!1),[continuousSpeechTimeout,setContinuousSpeechTimeout]=(0,react.useState)(2),[isPlayingAudio,setIsPlayingAudio]=(0,react.useState)(!1),[controlsPosition,setControlsPosition]=(0,react.useState)("center"),[hideEmissions,setHideEmissions]=(0,react.useState)(!1);(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",!1)),speakerMuted=(0,configuration.wm)("muteSpeaker",!1),setContinuousSpeech("CONTINUOUS"===microphoneMode),setContinuousSpeechTimeout((0,configuration.wm)("continuousSpeechTimeout",2)),setControlsPosition((0,configuration.wm)("controlsPosition",defaultControlsPosition)),setHideEmissions((0,configuration.wm)("hideEmissions",!1))}),[]);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({...currentDialogState,...currentState})}},[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;if(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,media:currentState.media,fromUser:!1}),speak(emission))):(console.error(response,resp),Message.Z.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,media:currentState.media,fromUser:!1}),speak(emission))):(console.error(response,resp),Message.Z.error(t((0,error.r)(resp.resultCode))),gotError=!0)}else console.error(response,resp),Message.Z.error(t((0,error.r)(resp.resultCode))),gotError=!0}else userLang.toLowerCase()!==language.toLowerCase()&&emission&&!instruct&&isMultilanguageEnabled?translateDialogState(currentState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})):(setCurrentDialogState({...currentState,emission}),emission&&(pushMessage({text:emission,media:currentState.media,fromUser:!1,generatedByAI:!!currentState.completion}),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)})));hasBatchQueued||(setTypingText(void 0),setMemoriTyping(!1))},translateDialogState=async(state,userLang)=>{const emission=state.emission??currentDialogState?.emission;let translatedState={...state},translatedMsg=null;if(emission&&!instruct&&language.toUpperCase()!==userLang.toUpperCase()&&isMultilanguageEnabled){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:t.text,hints:state.hints??("G1"===state.state?currentDialogState?.hints:[])};t.text.length>0&&(translatedMsg={text:t.text,media:state.media,fromUser:!1,generatedByAI:!!state.completion})}else translatedState={...state,emission},emission&&(translatedMsg={text:emission,media:state.media,fromUser:!1});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 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.error(e)}}))},fetchSession=async params=>{let storageBirthDate=(0,configuration.wm)("birthDate",void 0);if(birthDate||storageBirthDate||!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.error(err)}const session=await initSession({...params,tag:params.tag??personification?.tag,pin:params.pin??personification?.pin,additionalInfo:{...additionalInfo||{},loginToken:additionalInfo?.loginToken??authToken,language:getCultureCodeByLanguage(userLang),referral}});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.error(session),Message.Z.error(t("underageTwinSession",{age:minAge})),setGotErrorInOpening(!0)):403===session?.resultCode?(setMemoriPwd(void 0),setAuthModalState("password")):(console.error(session),Message.Z.error(t((0,error.r)(session?.resultCode))),setGotErrorInOpening(!0))}catch(err){console.error(err),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{let referral,storageBirthDate=(0,configuration.wm)("birthDate",void 0);if(!birthDate&&!storageBirthDate&&minAge)return void setShowAgeVerification(!0);if(!("PUBLIC"===memori.privacyType||password||memori.secretToken||memoriPwd||recoveryTokens||memoriTokens))return void setAuthModalState("password");try{referral=window.location.href}catch(err){console.error(err)}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||storageBirthDate||void 0,additionalInfo:{...additionalInfo||{},loginToken:additionalInfo?.loginToken??authToken,language:getCultureCodeByLanguage(userLang),referral}});if(sessionID&¤tState&&0===response.resultCode)return setSessionId(sessionID),updateDialogState&&(setCurrentDialogState(currentState),currentState.emission&&(history.length<=1?setHistory([{text:currentState.emission,media:currentState.media,fromUser:!1,initial:!0}]):pushMessage({text:currentState.emission,media:currentState.media,fromUser:!1,initial:!0}))),position&&applyPosition(position,sessionID),setLoading(!1),{dialogState:currentState,sessionID};response?.resultMessage.startsWith("This Memori is aged restricted")?(console.error(response),Message.Z.error(t("underageTwinSession",{age:minAge})),setGotErrorInOpening(!0)):403===response?.resultCode?(setMemoriPwd(void 0),setAuthModalState("password")):(console.error(response),Message.Z.error(t((0,error.r)(response.resultCode))),setGotErrorInOpening(!0))}catch(err){console.error(err)}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.error(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:additionalInfo?.loginToken??authToken,language:getCultureCodeByLanguage(userLang),referral}})}else if(currentState)return{currentState,sessionId,resultCode}}}catch(_e){let err=_e;return console.error("[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[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(),!currentDialogState?.acceptsTimeout||speechSynthesizer||isPlayingAudio||userMessage.length||memoriTyping||listening||setInteractionTimeout()},handleTimeout=async()=>{if(speechSynthesizer||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;!instruct&&isMultilanguageEnabled&&userLang!==i18n?.language&&emission&&emission.length>0?translateDialogState({...currentState,emission},userLang).then((ts=>{ts.emission&&speak(ts.emission)})):emission&&emission.length>0&&(pushMessage({text:emission,media:currentState.media,fromUser:!1,generatedByAI:!!currentState.completion}),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}}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]),(0,react.useEffect)((()=>()=>{setHasUserActivatedSpeak(!1),setClickedStart(!1),clearInteractionTimeout(),timeoutRef.current=void 0}),[]);const getTTSVoice=(0,react.useCallback)((lang=>{let voice="";switch((lang??memori.culture?.split("-")?.[0]??i18n.language??"IT").toUpperCase()){case"IT":voice=""+("MALE"===memori.voiceType?"it-IT-DiegoNeural":"it-IT-ElsaNeural");break;case"DE":voice=""+("MALE"===memori.voiceType?"de-DE-ConradNeural":"de-DE-KatjaNeural");break;case"EN":voice=""+("MALE"===memori.voiceType?"en-GB-RyanNeural":"en-GB-SoniaNeural");break;case"ES":voice=""+("MALE"===memori.voiceType?"es-ES-AlvaroNeural":"es-ES-ElviraNeural");break;case"FR":voice=""+("MALE"===memori.voiceType?"fr-FR-HenriNeural":"fr-FR-DeniseNeural");break;case"PT":voice=""+("MALE"===memori.voiceType?"pt-PT-DuarteNeural":"pt-PT-RaquelNeural");break;case"UK":voice=""+("MALE"===memori.voiceType?"uk-UA-OstapNeural":"uk-UA-PolinaNeural");break;case"RU":voice=""+("MALE"===memori.voiceType?"ru-RU-DmitryNeural":"ru-RU-SvetlanaNeural");break;case"PL":voice=""+("MALE"===memori.voiceType?"pl-PL-MarekNeural":"pl-PL-AgnieszkaNeural");break;case"FI":voice=""+("MALE"===memori.voiceType?"fi-FI-HarriNeural":"fi-FI-SelmaNeural");break;default:voice=""+("MALE"===memori.voiceType?"it-IT-DiegoNeural":"it-IT-IsabellaNeural")}return voice}),[memori.voiceType,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"}return voice},[phonemesMap,setPhonemesMap]=(0,react.useState)();(0,react.useEffect)((()=>{(async()=>{try{const lexiconReq=await fetch(`${baseUrl||"https://app.twincreator.com"}/api/lexiconmap`);return await lexiconReq.json()}catch(err){console.error(err)}})().then((lexicon=>{setPhonemesMap(lexicon)}))}),[]);const 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 SpeakerAudioDestination.K);let audioConfig=AudioConfig.rU.fromSpeakerOutput(audioDestination);speechSynthesizer=new SpeechSynthesizer.a(speechConfig,audioConfig)}const source=audioContext.createBufferSource();source.addEventListener("ended",(()=>{setIsPlayingAudio(!1),memoriSpeaking=!1})),audioDestination.onAudioEnd=()=>{setIsPlayingAudio(!1),memoriSpeaking=!1,source.disconnect(),emitEndSpeakEvent(),onEndSpeakStartListen()},speechSynthesizer.speakSsmlAsync(`${((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)})((text=>{const el=document.createElement("textarea");return el.textContent=text,el.innerHTML})((0,utils.h)(text)),userLang.toLowerCase())}`,(result=>{if(result){setIsPlayingAudio(!0),memoriSpeaking=!0;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),memoriSpeaking=!1):"interrupted"===audioContext.state&&audioContext.resume()},audioContext.resume(),speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null)}catch(e){console.error("speak error: ",e),window.speechSynthesis.speak(new SpeechSynthesisUtterance(text)),setIsPlayingAudio(!1),memoriSpeaking=!1,speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null),emitEndSpeakEvent()}}else audioContext.resume(),setIsPlayingAudio(!1),memoriSpeaking=!1,emitEndSpeakEvent()}),(error=>{console.error("speak:",error),window.speechSynthesis.speak(new SpeechSynthesisUtterance(text)),setIsPlayingAudio(!1),memoriSpeaking=!1,emitEndSpeakEvent()})),setMemoriTyping(!1)},stopAudio=()=>{setIsPlayingAudio(!1),memoriSpeaking=!1;try{speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null),"closed"!==audioContext.state&&audioContext.close(),audioDestination&&(audioDestination.pause(),audioDestination.close())}catch(e){console.error("stopAudio error: ",e)}};(0,react.useEffect)((()=>{let textarea=document.querySelector("#chat-fieldset textarea");textarea&&textarea.focus()}),[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=()=>{if(AZURE_COGNITIVE_SERVICES_TTS_KEY){clearListening(),setTranscript(""),resetTranscript();try{navigator.mediaDevices.getUserMedia({audio:!0}).then((function(_stream){setHasUserActivatedListening(!0),speechConfig||(speechConfig=SpeechConfig.c.fromSubscription(AZURE_COGNITIVE_SERVICES_TTS_KEY,"eastus"),speechConfig.speechRecognitionLanguage=getCultureCodeByLanguage(userLang),speechConfig.speechSynthesisLanguage=getCultureCodeByLanguage(userLang),speechConfig.speechSynthesisVoiceName=getTTSVoice(userLang));const audioConfig=AudioConfig.rU.fromDefaultMicrophoneInput();recognizer=new SpeechRecognizer.F(speechConfig,audioConfig),setListening(!0),recognizer.recognized=(_s,e)=>{if(e.result.text)if(e.result.reason===ResultReason.s.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===ResultReason.s.NoMatch&&console.debug("NOMATCH: Speech could not be recognized.")},recognizer.canceled=(_s,e)=>{e.reason===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.error)}catch(error){console.error(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)((()=>{const stored=(0,configuration.wm)("sendOnEnter","keypress");window.innerWidth<=768?setSendOnEnter("click"):setSendOnEnter(stored)}),[]),(0,react.useEffect)((()=>{(0,configuration.A2)("sendOnEnter",sendOnEnter)}),[sendOnEnter]);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 {\n ${Object.entries(integrationProperties).map((([key,value])=>`${key}: ${value};`)).join("\n")}\n }\n `,showAIicon=void 0===integrationConfig?.showAIicon||integrationConfig?.showAIicon,[avatar3dVisible,setAvatar3dVisible]=(0,react.useState)(!1);(0,react.useEffect)((()=>{(window.innerWidth>=768&&"FULLPAGE"===selectedLayout||"FULLPAGE"!==selectedLayout)&&setAvatar3dVisible(!0)}),[]);const[gamificationLevel,setGamificationLevel]=(0,react.useState)();(0,react.useEffect)((()=>{memori.engineMemoriID&&(async memoriID=>{let gamificationPoints,unansQuestions;try{const{contentQualityIndex,answerQualityIndex,unansweredQuestions,...cqResp}=await getContentQualityIndexes(memoriID);0===cqResp.resultCode&&(gamificationPoints=contentQualityIndex,unansQuestions=unansweredQuestions)}catch(_e){let err=_e;console.error("[APPCONTEXT/QUERYGAMIFICATIONPOINTS]",err)}return{points:gamificationPoints??0,unansweredQuestions:unansQuestions??0}})(memori.engineMemoriID).then((value=>{setGamificationLevel((points=>{const roundedPoints=Math.round(points),badge=getBadge(roundedPoints);return{points:roundedPoints,badge,pointsForCurrentBadge:getPointsForBadge(badge),nextBadge:getNextBadge(badge)}})(value.points))})).catch(console.error)}),[memori.engineMemoriID]),(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=>{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]);(0,react.useEffect)((()=>(document.addEventListener("MemoriTextEntered",memoriTextEnteredHandler),()=>{document.removeEventListener("MemoriTextEntered",memoriTextEnteredHandler)})),[sessionId,userLang]);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.error("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,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birthDate:birth});return void(session?.dialogState?(setHistory([]),translateDialogState(session.dialogState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})).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([]),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=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}catch(e){console.error("session #2",e),reopenSession(!0,memori?.secretToken,void 0,memori?.giverTag,memori?.giverPIN,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...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=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}catch(e){console.error("session #5",e),reopenSession(!0,memori?.secretToken,void 0,personification.tag,personification.pin,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birth).then((()=>{setHasUserActivatedSpeak(!0)}))}else if(instruct||personification||currentDialogState?.currentTag===constants.QV)translateDialogState(currentState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})).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=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}catch(e){console.error("session #8",e),reopenSession(!0,memori?.secretToken,void 0,void 0,void 0,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birth).then((()=>{setHasUserActivatedSpeak(!0)}))}}else setHistory([]),translateDialogState(dialogState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}else setShowAgeVerification(!0),setClickedStart(!1)}),[memoriPwd,memori,memoriTokens,birthDate,sessionId,userLang]),[loginToken,setLoginToken]=(0,react.useState)(authToken);(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):setLoginToken(mutation.target?.parentElement?.getAttribute("authtoken")||void 0))}));return observer.observe(targetNode,{attributes:!0,childList:!1,subtree:!1}),()=>{observer.disconnect()}}),[]);const showFullHistory=void 0===showOnlyLastMessages?"TOTEM"!==layout&&"WEBSITE_ASSISTANT"!==layout:!showOnlyLastMessages,headerProps={memori,history,showShare:showShare??integrationConfig?.showShare??!0,position,setShowPositionDrawer,setShowSettingsDrawer,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)))},avatarProps={memori,integration,integrationConfig,tenant,instruct,avatar3dVisible,setAvatar3dVisible,hasUserActivatedSpeak,isPlayingAudio:isPlayingAudio&&!muteSpeaker,loading:!!memoriTyping,baseUrl,apiUrl},startPanelProps={memori,tenant,gamificationLevel,language,userLang,setUserLang,baseUrl,apiUrl,position,openPositionDrawer:()=>setShowPositionDrawer(!0),integrationConfig,instruct,sessionId,clickedStart,onClickStart,initializeTTS:()=>{if(!AZURE_COGNITIVE_SERVICES_TTS_KEY)return;speechConfig=SpeechConfig.c.fromSubscription(AZURE_COGNITIVE_SERVICES_TTS_KEY,"eastus"),speechConfig.speechSynthesisLanguage=getCultureCodeByLanguage(userLang),speechConfig.speechSynthesisVoiceName=getTTSVoice(userLang),speechConfig.speechRecognitionLanguage=getCultureCodeByLanguage(userLang),(0,utils.xZ)()&&(speechConfig.speechSynthesisOutputFormat=SpeechSynthesisOutputFormat.Y.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 SpeakerAudioDestination.K;let audioConfig=AudioConfig.rU.fromSpeakerOutput(audioDestination);speechSynthesizer=new SpeechSynthesizer.a(speechConfig,audioConfig)}},chatProps={memori,sessionID:sessionId||"",tenant,translateTo:isMultilanguageEnabled&&userLang.toUpperCase()!==(memori.culture?.split("-")?.[0]??i18n.language??"IT")?.toUpperCase()?userLang:void 0,baseUrl,apiUrl,layout,memoriTyping,typingText,showTypingText,history:showFullHistory?history:history.slice(-2),authToken:loginToken,dialogState:currentDialogState,setDialogState:setCurrentDialogState,pushMessage,simulateUserPrompt:(text,translatedText)=>{stopListening(),stopAudio(),sendMessage(text,void 0,void 0,!1,translatedText)},showDates,showContextPerLine,showAIicon,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,media:currentState.media,fromUser:!1})):(console.error(resp),Message.Z.error(t((0,error.r)(resp.resultCode))))}else setCurrentDialogState(currentState),currentState.emission&&pushMessage({text:currentState.emission,media:currentState.media,fromUser:!1});else console.error(resp,tag,currentDialogState?.knownTags?.[tag]),Message.Z.error(t((0,error.r)(resp.resultCode)))}catch(e){let err=e;console.error(err),Message.Z.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=>{stopAudio(),stopListening(),sendMessage(msg),setUserMessage(""),resetTranscript()},stopListening:clearListening,startListening,stopAudio,resetTranscript,listening,isPlayingAudio,customMediaRenderer,user,userAvatar},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}),Layout=customLayout||("TOTEM"===selectedLayout?layouts_Totem:"CHAT"===selectedLayout?layouts_Chat:"FULLPAGE"===selectedLayout?layouts_FullPage:"WEBSITE_ASSISTANT"===selectedLayout?layouts_WebsiteAssistant: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://app.twincreator.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,ROUTE:window.location.pathname?.split("/")?.pop()||"",...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,ROUTE:window.location.pathname?.split("/")?.pop()||"",...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,additionalSettings}),sessionId&&(0,jsx_runtime.jsx)(AttachmentLinkModal.Z,{apiURL:apiUrl,visible:"link"===attachmentsMenuOpen,onCancel:()=>setAttachmentsMenuOpen(void 0),onOk:async link=>{if(!sessionId)return;let medium={mediumID:"",mimeType:"text/html",url:link.url,title:link.title};pushMessage({text:t("media.insertThisLink",{url:medium.url,title:medium.title}),fromUser:!0,media:[medium]});try{const{currentState,...resp}=await client.postMediumSelectedEvent(sessionId,medium);currentState&&0===resp.resultCode?(setCurrentDialogState(currentState),currentState.emission&&(pushMessage({text:currentState.emission,media:currentState.media,fromUser:!1}),speak(currentState.emission))):(console.error(resp,currentState,medium),Message.Z.error(t((0,error.r)(resp.resultCode),{ns:"common"})))}catch(e){let err=e;console.error(err),Message.Z.error(err.message)}setAttachmentsMenuOpen(void 0)}}),loginToken&&sessionId&&tenant?.id&&(0,jsx_runtime.jsx)(AttachmentMediaModal.Z,{apiURL:apiUrl,visible:"media"===attachmentsMenuOpen,authToken:loginToken,tenantID:tenant?.id,sessionID:sessionId,uploadAssetURL:client.backend.getUploadAssetURL(loginToken,memori.memoriID),deleteAsset:client.backend.deleteAsset,onCancel:()=>setAttachmentsMenuOpen(void 0),onOk:async asset=>{if(!sessionId)return;let medium={mediumID:"",mimeType:asset.mimeType,url:asset.assetURL,title:asset.title||asset.assetID};pushMessage({text:t("media.insertThisMediaMsg"),fromUser:!0,media:[medium]});try{const{currentState,...resp}=await client.postMediumSelectedEvent(sessionId,medium);currentState&&0===resp.resultCode?(setCurrentDialogState(currentState),currentState.emission&&(pushMessage({text:currentState.emission,media:currentState.media,fromUser:!1}),speak(currentState.emission))):(console.error(resp,currentState,medium),Message.Z.error(t((0,error.r)(resp.resultCode),{ns:"common"})))}catch(e){let err=e;console.error(err),Message.Z.error(err.message)}setAttachmentsMenuOpen(void 0)}})]})};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"}},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"'}]}},customLayout:{defaultValue:null,description:"",name:"customLayout",required:!1,type:{name:"FC"}},showShare:{defaultValue:null,description:"",name:"showShare",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"}},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://app.twincreator.com"},description:"",name:"baseUrl",required:!1,type:{name:"string"}},apiUrl:{defaultValue:{value:"https://backend.memori.ai"},description:"",name:"apiUrl",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"}},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; } & { [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/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"})=>{const tenantId="memorytwin"===tenant?.theme?"memorytwin":"twincreator";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://app.twincreator.com/images/${tenantId}/logo.png`,alt:""}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("p",{children:["Powered by"," ",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("a",{href:`https://app.${tenantId}.com/${userLang?userLang.toLowerCase():""}`,target:"_blank",rel:"noopener noreferrer",children:"memorytwin"===tenantId?"MemoryTwin":"TwinCreator"})]})]})};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"}}}},"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_10__=__webpack_require__("./src/helpers/media.ts"),react_i18next__WEBPACK_IMPORTED_MODULE_8__=__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_9__=__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"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/react/jsx-runtime.js");const StartPanel=({memori,tenant,gamificationLevel,language,userLang,setUserLang,baseUrl,apiUrl,position,openPositionDrawer,integrationConfig,instruct=!1,clickedStart,onClickStart,initializeTTS})=>{const{t,i18n}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_8__.$)(),[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")&&memori.description?.length&&(0,_helpers_translations__WEBPACK_IMPORTED_MODULE_9__.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_7__.jsxs)("div",{className:"memori--start-panel",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div",{className:"memori--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,apiURL:apiUrl})}")`},children:[!!gamificationLevel?.badge?.length&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div",{className:"memori--gamification-badge",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:`${t("gamification.level")} ${gamificationLevel.badge}, ${gamificationLevel.points} ${t("gamification.points")}`,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("span",{"aria-label":`${t("gamification.level")} ${gamificationLevel.badge}, ${gamificationLevel.points} ${t("gamification.points")}`,children:gamificationLevel.badge})})}),!!memori.enableCompletions&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div",{className:"memori--completions-enabled",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("completionsEnabled"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("span",{"aria-label":t("completionsEnabled")||"Completions",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_icons_AI__WEBPACK_IMPORTED_MODULE_6__.default,{})})})}),!!memori.nsfw&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div",{className:"memori--nsfw",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("nsfw"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("span",{title:t("nsfw")||"NSFW",children:"🔞"})})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("picture",{className:"memori--avatar",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("source",{src:memori.avatarURL??(0,_helpers_media__WEBPACK_IMPORTED_MODULE_10__.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("img",{alt:memori.name,src:memori.avatarURL&&memori.avatarURL.length>0?(0,_helpers_media__WEBPACK_IMPORTED_MODULE_10__.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl}):(0,_helpers_media__WEBPACK_IMPORTED_MODULE_10__.v)({type:"avatar",tenantID:tenant?.id,baseURL:baseUrl,apiURL:apiUrl})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("h2",{className:"memori--title",children:memori.name}),memori.needsPosition&&!position&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div",{className:"memori--needsPosition",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("p",{children:t("write_and_speak.requirePosition")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,onClick:()=>openPositionDrawer(),className:"memori--start-button",children:t("widget.position")})]}),(memori.needsPosition&&position||!memori.needsPosition)&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div",{className:"memori--description",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("p",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("span",{className:"memori--description-text",children:translatedDescription&&showTranslation?translatedDescription:memori.description}),translatedDescription!==memori.description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{ghost:!0,className:"memori--translation-toggle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_icons_Translation__WEBPACK_IMPORTED_MODULE_3__.default,{}),onClick:()=>{setShowTranslation((show=>!show))},children:t(showTranslation?"showOriginalText":"showTranslatedText")})]}),integrationConfig?.multilanguage&&!instruct&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div",{className:"memori--language-chooser",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.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_7__.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_7__.jsx)("option",{value:lang.value,"aria-label":lang.label,children:lang.label},lang.value)))})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,disabled:!!memori.blockedUntil&&!memori.isGiver,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":"tryMeButton"))}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("p",{className:"memori--start-description",children:t(instruct?"write_and_speak.pageInstructExplanation":"write_and_speak.pageTryMeExplanation")}),!!memori.blockedUntil&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_BlockedMemoriBadge_BlockedMemoriBadge__WEBPACK_IMPORTED_MODULE_5__.Z,{memoriName:memori.name,blockedUntil:memori.blockedUntil,showGiverInfo:memori.isGiver,showTitle:!0,marginLeft:!0})]})]})};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"}},gamificationLevel:{defaultValue:null,description:"",name:"gamificationLevel",required:!1,type:{name:"GamificationLevel"}},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"}},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)"}}}},"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/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/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/Translation.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 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/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){}},"./src/components/ui/Message.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"),__webpack_require__("./node_modules/react/jsx-runtime.js");const __WEBPACK_DEFAULT_EXPORT__={error:console.error,info:console.info,success:console.log}},"./src/helpers/error.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{r:()=>getErrori18nKey});const BACKEND_ERRORS=new Map(Object.entries({TENANT_NOT_FOUND:-1,TENANT_REGISTRATION_DISABLED:-2,TENANT_MISSING_NAME:-3,TENANT_MAX_USERS_REACHED:-4,TENANT_MAX_ADMINS_REACHED:-5,USER_NOT_CONFIRMED:-11,USER_NOT_FOUND:-12,USER_OR_PASSWORD_INVALID:-13,USER_MUST_CHANGE_PASSWORD:-14,USER_MUST_ENTER_VERIFICATION_CODE:-15,USER_MISSING_TENANT:-21,USER_MISSING_NAME:-22,USER_MISSING_PASSWORD:-23,USER_MISSING_EMAIL:-24,USER_MISSING_VERIFICATION_CODE:-25,USER_NAME_ALREADY_USED:-26,USER_PASSWORD_NOT_CONFORMING_TO_POLICY:-27,USER_EMAIL_ALREADY_USED:-28,USER_EMAIL_INVALID:-29,USER_VERIFICATION_CODE_INVALID:-30,USER_MISSING_NAME_OR_EMAIL:-31,USER_NAME_INVALID:-32,USER_HAS_ONE_OR_MORE_MEMORI:-33,USER_MISSING_NEW_PASSWORD:-34,USER_CANT_CREATE_MEMORI:-35,USER_MAX_MEMORI_REACHED:-36,USER_CANT_EDIT_INTEGRATIONS:-37,MEMORI_NOT_FOUND:-51,MEMORI_NOT_ACCESSIBLE:-52,MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN:-53,SESSION_NOT_FOUND:-101,SESSION_IS_NOT_ADMINISTRATIVE:-102,MEMORI_MISSING_CONFIGURATION:-201,MEMORI_CONFIGURATION_NOT_FOUND:-202,MEMORI_INVALID_PRIVACY_TYPE:-203,MEMORI_MISSING_PASSWORD:-204,MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS:-205,MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS:-206,MEMORI_INVALID_VOICE_TYPE:-207,MEMORI_MISSING_NAME:-208,MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS:-209,MEMORI_INVALID_ID:-210,MEMORI_NAME_ALREADY_USED:-211,MEMORI_INVALID_PIN:-212,MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION:-213,MEMORI_NO_PASSWORD_WHEN_PUBLIC:-214,MEMORI_TRANSFER_MISSING_DESTINATION_USER:-231,MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID:-232,MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT:-233,MEMORI_TRANSFER_NOTHING_TO_DO:-234,MEMORI_CONFIGURATION_CANT_BE_CHANGED:-251,MEMORI_MISSING_NEW_PASSWORD:-252,MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT:-261,MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT:-262,INTEGRATION_NOT_FOUND:-301,INTEGRATION_INVALID_TYPE:-401,INTEGRATION_ALREADY_EXISTS:-402,INTEGRATION_MEMORI_IS_NOT_PUBLIC:-403,INTEGRATION_MISSING_INVOCATION_TEXT:-404,INTEGRATION_MISSING_DEVICE_EMAILS:-405,INTEGRATION_MEMORI_IS_EMPTY:-406,INTEGRATION_MISSING_PRIVACY_POLICY:-407,INTEGRATION_MISSING_CATEGORY:-408,INTEGRATION_MISSING_DESCRIPTION:-409,INTEGRATION_INVALID_INVOCATION_TEXT:-410,INTEGRATION_GOOGLE_NO_MORE_AVAILABLE:-411,UPLOAD_REQUIRES_MULTIPART_ENCODING:-501,UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY:-502,UPLOAD_MAX_LENGTH_EXCEEDED:-503,UPLOAD_FILE_IS_EMPTY:-504,UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE:-505,UPLOAD_MISSING_FILE_NAME:-506,UPLOAD_INVALID_MEMORY_ID:-507,UPLOAD_MISSING_FILE_CONTENT:-508,ASSET_NOT_FOUND:-601,ASSET_NOT_ACCESSIBLE:-602,ASSET_MISSING_SESSION_ID:-603,ASSET_INVALID_FILE_NAME:-604,INVITATION_NOT_FOUND:-701,INVITATION_NOT_ACCESSIBLE:-702,INVITATION_ALREADY_ACCEPTED:-703,INVITATION_ALREADY_REJECTED:-704,INVITATION_MISSING_DESTINATION_EMAIL:-705,INVITATION_DESTINATION_EMAIL_INVALID:-706,INVITATION_MISSING_TAG:-707,INVITATION_MISSING_PIN:-708,INVITATION_INVALID_PIN:-709,INVITATION_INVALID_TYPE:-710,INVITATION_MISSING_DESTINATION_NAME:-711,INVITATION_TAG_PIN_CANT_BE_CHANGED:-712,INVITATION_CANT_BE_CHANGED:-713,ACTIONLOG_INVALID_USER_ID:-801,ACTIONLOG_INVALID_DATE_FROM_FORMAT:-802,ACTIONLOG_INVALID_DATE_TO_FORMAT:-803,ACTIONLOG_INVALID_MEMORI_ID:-804,CONSUMPTIONLOG_INVALID_TYPE:-901,CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT:-902,CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT:-903,CONSUMPTIONLOG_INVALID_USER_ID:-904,CONSUMPTIONLOG_INVALID_MEMORI_ID:-905}).map((([key,value])=>[value,key]))),getErrori18nKey=errorCode=>{if(!errorCode)return"error.generic";if(401===errorCode||403===errorCode)return"error.unauthorized";if(404===errorCode)return"error.notFound";if(422===errorCode)return"error.unprocessableEntity";if(500===errorCode)return"internal server error";let error=BACKEND_ERRORS.get(errorCode);return error?`errors.${error}`:"error.generic"}},"./node_modules/moment/locale sync recursive ^\\.\\/.*$":(module,__unused_webpack_exports,__webpack_require__)=>{var map={"./af":"./node_modules/moment/locale/af.js","./af.js":"./node_modules/moment/locale/af.js","./ar":"./node_modules/moment/locale/ar.js","./ar-dz":"./node_modules/moment/locale/ar-dz.js","./ar-dz.js":"./node_modules/moment/locale/ar-dz.js","./ar-kw":"./node_modules/moment/locale/ar-kw.js","./ar-kw.js":"./node_modules/moment/locale/ar-kw.js","./ar-ly":"./node_modules/moment/locale/ar-ly.js","./ar-ly.js":"./node_modules/moment/locale/ar-ly.js","./ar-ma":"./node_modules/moment/locale/ar-ma.js","./ar-ma.js":"./node_modules/moment/locale/ar-ma.js","./ar-sa":"./node_modules/moment/locale/ar-sa.js","./ar-sa.js":"./node_modules/moment/locale/ar-sa.js","./ar-tn":"./node_modules/moment/locale/ar-tn.js","./ar-tn.js":"./node_modules/moment/locale/ar-tn.js","./ar.js":"./node_modules/moment/locale/ar.js","./az":"./node_modules/moment/locale/az.js","./az.js":"./node_modules/moment/locale/az.js","./be":"./node_modules/moment/locale/be.js","./be.js":"./node_modules/moment/locale/be.js","./bg":"./node_modules/moment/locale/bg.js","./bg.js":"./node_modules/moment/locale/bg.js","./bm":"./node_modules/moment/locale/bm.js","./bm.js":"./node_modules/moment/locale/bm.js","./bn":"./node_modules/moment/locale/bn.js","./bn-bd":"./node_modules/moment/locale/bn-bd.js","./bn-bd.js":"./node_modules/moment/locale/bn-bd.js","./bn.js":"./node_modules/moment/locale/bn.js","./bo":"./node_modules/moment/locale/bo.js","./bo.js":"./node_modules/moment/locale/bo.js","./br":"./node_modules/moment/locale/br.js","./br.js":"./node_modules/moment/locale/br.js","./bs":"./node_modules/moment/locale/bs.js","./bs.js":"./node_modules/moment/locale/bs.js","./ca":"./node_modules/moment/locale/ca.js","./ca.js":"./node_modules/moment/locale/ca.js","./cs":"./node_modules/moment/locale/cs.js","./cs.js":"./node_modules/moment/locale/cs.js","./cv":"./node_modules/moment/locale/cv.js","./cv.js":"./node_modules/moment/locale/cv.js","./cy":"./node_modules/moment/locale/cy.js","./cy.js":"./node_modules/moment/locale/cy.js","./da":"./node_modules/moment/locale/da.js","./da.js":"./node_modules/moment/locale/da.js","./de":"./node_modules/moment/locale/de.js","./de-at":"./node_modules/moment/locale/de-at.js","./de-at.js":"./node_modules/moment/locale/de-at.js","./de-ch":"./node_modules/moment/locale/de-ch.js","./de-ch.js":"./node_modules/moment/locale/de-ch.js","./de.js":"./node_modules/moment/locale/de.js","./dv":"./node_modules/moment/locale/dv.js","./dv.js":"./node_modules/moment/locale/dv.js","./el":"./node_modules/moment/locale/el.js","./el.js":"./node_modules/moment/locale/el.js","./en-au":"./node_modules/moment/locale/en-au.js","./en-au.js":"./node_modules/moment/locale/en-au.js","./en-ca":"./node_modules/moment/locale/en-ca.js","./en-ca.js":"./node_modules/moment/locale/en-ca.js","./en-gb":"./node_modules/moment/locale/en-gb.js","./en-gb.js":"./node_modules/moment/locale/en-gb.js","./en-ie":"./node_modules/moment/locale/en-ie.js","./en-ie.js":"./node_modules/moment/locale/en-ie.js","./en-il":"./node_modules/moment/locale/en-il.js","./en-il.js":"./node_modules/moment/locale/en-il.js","./en-in":"./node_modules/moment/locale/en-in.js","./en-in.js":"./node_modules/moment/locale/en-in.js","./en-nz":"./node_modules/moment/locale/en-nz.js","./en-nz.js":"./node_modules/moment/locale/en-nz.js","./en-sg":"./node_modules/moment/locale/en-sg.js","./en-sg.js":"./node_modules/moment/locale/en-sg.js","./eo":"./node_modules/moment/locale/eo.js","./eo.js":"./node_modules/moment/locale/eo.js","./es":"./node_modules/moment/locale/es.js","./es-do":"./node_modules/moment/locale/es-do.js","./es-do.js":"./node_modules/moment/locale/es-do.js","./es-mx":"./node_modules/moment/locale/es-mx.js","./es-mx.js":"./node_modules/moment/locale/es-mx.js","./es-us":"./node_modules/moment/locale/es-us.js","./es-us.js":"./node_modules/moment/locale/es-us.js","./es.js":"./node_modules/moment/locale/es.js","./et":"./node_modules/moment/locale/et.js","./et.js":"./node_modules/moment/locale/et.js","./eu":"./node_modules/moment/locale/eu.js","./eu.js":"./node_modules/moment/locale/eu.js","./fa":"./node_modules/moment/locale/fa.js","./fa.js":"./node_modules/moment/locale/fa.js","./fi":"./node_modules/moment/locale/fi.js","./fi.js":"./node_modules/moment/locale/fi.js","./fil":"./node_modules/moment/locale/fil.js","./fil.js":"./node_modules/moment/locale/fil.js","./fo":"./node_modules/moment/locale/fo.js","./fo.js":"./node_modules/moment/locale/fo.js","./fr":"./node_modules/moment/locale/fr.js","./fr-ca":"./node_modules/moment/locale/fr-ca.js","./fr-ca.js":"./node_modules/moment/locale/fr-ca.js","./fr-ch":"./node_modules/moment/locale/fr-ch.js","./fr-ch.js":"./node_modules/moment/locale/fr-ch.js","./fr.js":"./node_modules/moment/locale/fr.js","./fy":"./node_modules/moment/locale/fy.js","./fy.js":"./node_modules/moment/locale/fy.js","./ga":"./node_modules/moment/locale/ga.js","./ga.js":"./node_modules/moment/locale/ga.js","./gd":"./node_modules/moment/locale/gd.js","./gd.js":"./node_modules/moment/locale/gd.js","./gl":"./node_modules/moment/locale/gl.js","./gl.js":"./node_modules/moment/locale/gl.js","./gom-deva":"./node_modules/moment/locale/gom-deva.js","./gom-deva.js":"./node_modules/moment/locale/gom-deva.js","./gom-latn":"./node_modules/moment/locale/gom-latn.js","./gom-latn.js":"./node_modules/moment/locale/gom-latn.js","./gu":"./node_modules/moment/locale/gu.js","./gu.js":"./node_modules/moment/locale/gu.js","./he":"./node_modules/moment/locale/he.js","./he.js":"./node_modules/moment/locale/he.js","./hi":"./node_modules/moment/locale/hi.js","./hi.js":"./node_modules/moment/locale/hi.js","./hr":"./node_modules/moment/locale/hr.js","./hr.js":"./node_modules/moment/locale/hr.js","./hu":"./node_modules/moment/locale/hu.js","./hu.js":"./node_modules/moment/locale/hu.js","./hy-am":"./node_modules/moment/locale/hy-am.js","./hy-am.js":"./node_modules/moment/locale/hy-am.js","./id":"./node_modules/moment/locale/id.js","./id.js":"./node_modules/moment/locale/id.js","./is":"./node_modules/moment/locale/is.js","./is.js":"./node_modules/moment/locale/is.js","./it":"./node_modules/moment/locale/it.js","./it-ch":"./node_modules/moment/locale/it-ch.js","./it-ch.js":"./node_modules/moment/locale/it-ch.js","./it.js":"./node_modules/moment/locale/it.js","./ja":"./node_modules/moment/locale/ja.js","./ja.js":"./node_modules/moment/locale/ja.js","./jv":"./node_modules/moment/locale/jv.js","./jv.js":"./node_modules/moment/locale/jv.js","./ka":"./node_modules/moment/locale/ka.js","./ka.js":"./node_modules/moment/locale/ka.js","./kk":"./node_modules/moment/locale/kk.js","./kk.js":"./node_modules/moment/locale/kk.js","./km":"./node_modules/moment/locale/km.js","./km.js":"./node_modules/moment/locale/km.js","./kn":"./node_modules/moment/locale/kn.js","./kn.js":"./node_modules/moment/locale/kn.js","./ko":"./node_modules/moment/locale/ko.js","./ko.js":"./node_modules/moment/locale/ko.js","./ku":"./node_modules/moment/locale/ku.js","./ku.js":"./node_modules/moment/locale/ku.js","./ky":"./node_modules/moment/locale/ky.js","./ky.js":"./node_modules/moment/locale/ky.js","./lb":"./node_modules/moment/locale/lb.js","./lb.js":"./node_modules/moment/locale/lb.js","./lo":"./node_modules/moment/locale/lo.js","./lo.js":"./node_modules/moment/locale/lo.js","./lt":"./node_modules/moment/locale/lt.js","./lt.js":"./node_modules/moment/locale/lt.js","./lv":"./node_modules/moment/locale/lv.js","./lv.js":"./node_modules/moment/locale/lv.js","./me":"./node_modules/moment/locale/me.js","./me.js":"./node_modules/moment/locale/me.js","./mi":"./node_modules/moment/locale/mi.js","./mi.js":"./node_modules/moment/locale/mi.js","./mk":"./node_modules/moment/locale/mk.js","./mk.js":"./node_modules/moment/locale/mk.js","./ml":"./node_modules/moment/locale/ml.js","./ml.js":"./node_modules/moment/locale/ml.js","./mn":"./node_modules/moment/locale/mn.js","./mn.js":"./node_modules/moment/locale/mn.js","./mr":"./node_modules/moment/locale/mr.js","./mr.js":"./node_modules/moment/locale/mr.js","./ms":"./node_modules/moment/locale/ms.js","./ms-my":"./node_modules/moment/locale/ms-my.js","./ms-my.js":"./node_modules/moment/locale/ms-my.js","./ms.js":"./node_modules/moment/locale/ms.js","./mt":"./node_modules/moment/locale/mt.js","./mt.js":"./node_modules/moment/locale/mt.js","./my":"./node_modules/moment/locale/my.js","./my.js":"./node_modules/moment/locale/my.js","./nb":"./node_modules/moment/locale/nb.js","./nb.js":"./node_modules/moment/locale/nb.js","./ne":"./node_modules/moment/locale/ne.js","./ne.js":"./node_modules/moment/locale/ne.js","./nl":"./node_modules/moment/locale/nl.js","./nl-be":"./node_modules/moment/locale/nl-be.js","./nl-be.js":"./node_modules/moment/locale/nl-be.js","./nl.js":"./node_modules/moment/locale/nl.js","./nn":"./node_modules/moment/locale/nn.js","./nn.js":"./node_modules/moment/locale/nn.js","./oc-lnc":"./node_modules/moment/locale/oc-lnc.js","./oc-lnc.js":"./node_modules/moment/locale/oc-lnc.js","./pa-in":"./node_modules/moment/locale/pa-in.js","./pa-in.js":"./node_modules/moment/locale/pa-in.js","./pl":"./node_modules/moment/locale/pl.js","./pl.js":"./node_modules/moment/locale/pl.js","./pt":"./node_modules/moment/locale/pt.js","./pt-br":"./node_modules/moment/locale/pt-br.js","./pt-br.js":"./node_modules/moment/locale/pt-br.js","./pt.js":"./node_modules/moment/locale/pt.js","./ro":"./node_modules/moment/locale/ro.js","./ro.js":"./node_modules/moment/locale/ro.js","./ru":"./node_modules/moment/locale/ru.js","./ru.js":"./node_modules/moment/locale/ru.js","./sd":"./node_modules/moment/locale/sd.js","./sd.js":"./node_modules/moment/locale/sd.js","./se":"./node_modules/moment/locale/se.js","./se.js":"./node_modules/moment/locale/se.js","./si":"./node_modules/moment/locale/si.js","./si.js":"./node_modules/moment/locale/si.js","./sk":"./node_modules/moment/locale/sk.js","./sk.js":"./node_modules/moment/locale/sk.js","./sl":"./node_modules/moment/locale/sl.js","./sl.js":"./node_modules/moment/locale/sl.js","./sq":"./node_modules/moment/locale/sq.js","./sq.js":"./node_modules/moment/locale/sq.js","./sr":"./node_modules/moment/locale/sr.js","./sr-cyrl":"./node_modules/moment/locale/sr-cyrl.js","./sr-cyrl.js":"./node_modules/moment/locale/sr-cyrl.js","./sr.js":"./node_modules/moment/locale/sr.js","./ss":"./node_modules/moment/locale/ss.js","./ss.js":"./node_modules/moment/locale/ss.js","./sv":"./node_modules/moment/locale/sv.js","./sv.js":"./node_modules/moment/locale/sv.js","./sw":"./node_modules/moment/locale/sw.js","./sw.js":"./node_modules/moment/locale/sw.js","./ta":"./node_modules/moment/locale/ta.js","./ta.js":"./node_modules/moment/locale/ta.js","./te":"./node_modules/moment/locale/te.js","./te.js":"./node_modules/moment/locale/te.js","./tet":"./node_modules/moment/locale/tet.js","./tet.js":"./node_modules/moment/locale/tet.js","./tg":"./node_modules/moment/locale/tg.js","./tg.js":"./node_modules/moment/locale/tg.js","./th":"./node_modules/moment/locale/th.js","./th.js":"./node_modules/moment/locale/th.js","./tk":"./node_modules/moment/locale/tk.js","./tk.js":"./node_modules/moment/locale/tk.js","./tl-ph":"./node_modules/moment/locale/tl-ph.js","./tl-ph.js":"./node_modules/moment/locale/tl-ph.js","./tlh":"./node_modules/moment/locale/tlh.js","./tlh.js":"./node_modules/moment/locale/tlh.js","./tr":"./node_modules/moment/locale/tr.js","./tr.js":"./node_modules/moment/locale/tr.js","./tzl":"./node_modules/moment/locale/tzl.js","./tzl.js":"./node_modules/moment/locale/tzl.js","./tzm":"./node_modules/moment/locale/tzm.js","./tzm-latn":"./node_modules/moment/locale/tzm-latn.js","./tzm-latn.js":"./node_modules/moment/locale/tzm-latn.js","./tzm.js":"./node_modules/moment/locale/tzm.js","./ug-cn":"./node_modules/moment/locale/ug-cn.js","./ug-cn.js":"./node_modules/moment/locale/ug-cn.js","./uk":"./node_modules/moment/locale/uk.js","./uk.js":"./node_modules/moment/locale/uk.js","./ur":"./node_modules/moment/locale/ur.js","./ur.js":"./node_modules/moment/locale/ur.js","./uz":"./node_modules/moment/locale/uz.js","./uz-latn":"./node_modules/moment/locale/uz-latn.js","./uz-latn.js":"./node_modules/moment/locale/uz-latn.js","./uz.js":"./node_modules/moment/locale/uz.js","./vi":"./node_modules/moment/locale/vi.js","./vi.js":"./node_modules/moment/locale/vi.js","./x-pseudo":"./node_modules/moment/locale/x-pseudo.js","./x-pseudo.js":"./node_modules/moment/locale/x-pseudo.js","./yo":"./node_modules/moment/locale/yo.js","./yo.js":"./node_modules/moment/locale/yo.js","./zh-cn":"./node_modules/moment/locale/zh-cn.js","./zh-cn.js":"./node_modules/moment/locale/zh-cn.js","./zh-hk":"./node_modules/moment/locale/zh-hk.js","./zh-hk.js":"./node_modules/moment/locale/zh-hk.js","./zh-mo":"./node_modules/moment/locale/zh-mo.js","./zh-mo.js":"./node_modules/moment/locale/zh-mo.js","./zh-tw":"./node_modules/moment/locale/zh-tw.js","./zh-tw.js":"./node_modules/moment/locale/zh-tw.js"};function webpackContext(req){var id=webpackContextResolve(req);return __webpack_require__(id)}function webpackContextResolve(req){if(!__webpack_require__.o(map,req)){var e=new Error("Cannot find module '"+req+"'");throw e.code="MODULE_NOT_FOUND",e}return map[req]}webpackContext.keys=function webpackContextKeys(){return Object.keys(map)},webpackContext.resolve=webpackContextResolve,module.exports=webpackContext,webpackContext.id="./node_modules/moment/locale sync recursive ^\\.\\/.*$"},"?2454":()=>{},"?6483":()=>{},"?bed2":()=>{},"?72ad":()=>{},"?a1bf":()=>{},"?14d6":()=>{},"?e42a":()=>{},"?9463":()=>{}}]); \ No newline at end of file +(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[4795],{"./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"),_ui_Message__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./src/components/ui/Message.tsx"),_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"),moment__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/moment/moment.js"),moment__WEBPACK_IMPORTED_MODULE_3___default=__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_3__),_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)(),onSubmit=(0,react__WEBPACK_IMPORTED_MODULE_5__.useCallback)((()=>{if(!birthDate)return _ui_Message__WEBPACK_IMPORTED_MODULE_0__.Z.error(t("requiredField")),void setError(t("requiredField")||"Required field");if(moment__WEBPACK_IMPORTED_MODULE_3___default()().diff(birthDate,"years")onClose(),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",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/AttachmentLinkModal/AttachmentLinkModal.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"),_MediaWidget_LinkItemWidget__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/MediaWidget/LinkItemWidget.tsx"),_ui_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Modal__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/ui/Modal.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react/jsx-runtime.js");const AttachmentLinkModal=({visible,onCancel,onOk})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_5__.$)(),[newLink,setNewLink]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)({url:"",title:""}),onKeyPress=e=>{if("Enter"===e.key){if(0===newLink?.url.length||0===newLink?.title.length)return;let saveButton=document.getElementById("save-link-button");saveButton&&saveButton.click()}};return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_3__.Z,{open:visible,title:t("media.addLinkLabel"),className:"attachment-link-modal",closable:!0,width:"100%",widthMd:"80%",onClose:()=>{onCancel&&onCancel()},footer:(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)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{onClick:onCancel,children:t("cancel")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{id:"save-link-button",primary:!0,onClick:()=>{0!==newLink?.url.length&&0!==newLink?.title.length&&(onOk(newLink),setNewLink({url:"",title:""}))},disabled:0===newLink?.url.length||0===newLink?.title.length,children:t("confirm")})]}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div",{className:"attachment-link-modal--row",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div",{className:"attachment-link-modal--column",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("label",{htmlFor:"new-link-url",className:"attachment-link-modal--label",children:[t("media.linkKey"),":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("input",{type:"url",className:"attachment-link-modal--input ",onChange:e=>{let value=e.target.value.startsWith("http")||0===e.target.value.length?e.target.value:`https://${e.target.value}`;setNewLink((l=>({title:l?.title??"",url:value})))},placeholder:"https://memori.ai/...",value:newLink?.url,name:"url",onKeyDown:onKeyPress}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("label",{htmlFor:"new-link-title",className:"attachment-link-modal--label",children:[t("media.linkValue"),":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("input",{type:"text",className:"attachment-link-modal--input ",onChange:e=>setNewLink((l=>({url:l?.url??"",title:e.target.value}))),value:newLink?.title,name:"title",onKeyDown:onKeyPress})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div",{className:"attachment-link-modal--column",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div",{className:"attachment-link-modal--centered",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_MediaWidget_LinkItemWidget__WEBPACK_IMPORTED_MODULE_1__.$,{item:{title:newLink?.title??"",url:newLink?.url??"",mediumID:"",mimeType:"text/html"},onLinkPreviewInfo:data=>{newLink?.title?.length||setNewLink((l=>({...l,title:data?.title??""})))}},newLink?.url??"")})})]})})};AttachmentLinkModal.displayName="AttachmentLinkModal";const __WEBPACK_DEFAULT_EXPORT__=AttachmentLinkModal;try{AttachmentLinkModal.displayName="AttachmentLinkModal",AttachmentLinkModal.__docgenInfo={description:"",displayName:"AttachmentLinkModal",props:{visible:{defaultValue:null,description:"",name:"visible",required:!0,type:{name:"boolean"}},onCancel:{defaultValue:null,description:"",name:"onCancel",required:!1,type:{name:"(() => void)"}},onOk:{defaultValue:null,description:"",name:"onOk",required:!0,type:{name:"({ url, title }: { url: string; title: string; }) => void"}},apiURL:{defaultValue:null,description:"",name:"apiURL",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AttachmentLinkModal/AttachmentLinkModal.tsx#AttachmentLinkModal"]={docgenInfo:AttachmentLinkModal.__docgenInfo,name:"AttachmentLinkModal",path:"src/components/AttachmentLinkModal/AttachmentLinkModal.tsx#AttachmentLinkModal"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/AttachmentMediaModal/AttachmentMediaModal.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_8__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_helpers_error__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/helpers/error.ts"),_helpers_constants__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/helpers/constants.ts"),_helpers_media__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./src/helpers/media.ts"),_ui_Modal__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/ui/Modal.tsx"),_ui_Message__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/ui/Message.tsx"),_ui_Button__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./src/components/ui/Button.tsx"),_ImageUpload_ImageUpload__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./src/components/ImageUpload/ImageUpload.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/react/jsx-runtime.js");const AttachmentMediaModal=({visible,authToken,sessionID,tenantID,uploadAssetURL,deleteAsset,onCancel,onOk,apiURL})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_8__.$)(),[asset,setAsset]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_3__.Z,{open:visible,title:t("media.addMediaLabel"),className:"attachment-media-modal",closable:!0,width:"100%",widthMd:"100%",onClose:()=>{onCancel&&onCancel()},footer:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_5__.Z,{onClick:onCancel,children:t("cancel")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_5__.Z,{primary:!0,onClick:()=>{asset&&onOk(asset),setAsset(void 0)},disabled:!asset,children:t("confirm")})]}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ImageUpload_ImageUpload__WEBPACK_IMPORTED_MODULE_6__.Z,{tenantID,apiUrl:apiURL,uploadMultipleImages:!1,maxNumberOfVisualizedUploads:1,maxFileSizeInMB:100,uploadUrl:uploadAssetURL,useImageCrop:!1,allowedMimeTypes:_helpers_constants__WEBPACK_IMPORTED_MODULE_2__.go,fileList:asset?[{uid:"-1",name:asset.assetID,status:"done",thumbUrl:(0,_helpers_media__WEBPACK_IMPORTED_MODULE_9__.v)({resourceURI:asset.assetURL,tenantID,apiURL,sessionID})}]:[],uploadMessage:t("media.mediaUploadMessage"),imageProportions:1,onUploadFinished:file=>{let newAsset=file.response.asset,response=file.response;0===response.resultCode?setAsset(newAsset):(console.error(response,file),_ui_Message__WEBPACK_IMPORTED_MODULE_4__.Z.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_1__.r)(response.resultCode))))},onFileChanged:(_assetID,asset)=>{setAsset((a=>({...a||{},...asset})))},onRemove:async file=>{const resp=await deleteAsset(authToken,file.thumbUrl);return 0===resp.resultCode?setAsset(void 0):(console.error(resp,file),_ui_Message__WEBPACK_IMPORTED_MODULE_4__.Z.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_1__.r)(resp.resultCode)))),0===resp.resultCode}})})};AttachmentMediaModal.displayName="AttachmentMediaModal";const __WEBPACK_DEFAULT_EXPORT__=AttachmentMediaModal;try{AttachmentMediaModal.displayName="AttachmentMediaModal",AttachmentMediaModal.__docgenInfo={description:"",displayName:"AttachmentMediaModal",props:{visible:{defaultValue:null,description:"",name:"visible",required:!0,type:{name:"boolean"}},authToken:{defaultValue:null,description:"",name:"authToken",required:!0,type:{name:"string"}},sessionID:{defaultValue:null,description:"",name:"sessionID",required:!0,type:{name:"string"}},tenantID:{defaultValue:null,description:"",name:"tenantID",required:!0,type:{name:"string"}},uploadAssetURL:{defaultValue:null,description:"",name:"uploadAssetURL",required:!0,type:{name:"string"}},deleteAsset:{defaultValue:null,description:"",name:"deleteAsset",required:!0,type:{name:"(token: string, assetURL: string) => Promise"}},onCancel:{defaultValue:null,description:"",name:"onCancel",required:!1,type:{name:"(() => void)"}},onOk:{defaultValue:null,description:"",name:"onOk",required:!0,type:{name:"(asset: Asset) => Promise"}},apiURL:{defaultValue:null,description:"",name:"apiURL",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AttachmentMediaModal/AttachmentMediaModal.tsx#AttachmentMediaModal"]={docgenInfo:AttachmentMediaModal.__docgenInfo,name:"AttachmentMediaModal",path:"src/components/AttachmentMediaModal/AttachmentMediaModal.tsx#AttachmentMediaModal"})}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/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,showGiverInfo=!1,showTitle=!1,marginLeft=!1})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)(),blockedUntilDate=new Date(blockedUntil);return blockedUntilDate>new Date?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{className:"blocked-memori-badge--tooltip",content:(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:!0,type:{name:"string"}},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/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"),moment__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/moment/moment.js"),moment__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_1__),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)(moment__WEBPACK_IMPORTED_MODULE_1___default()(defaultDate||Date.now()));return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{onChange(date)}),[date,onChange]),moment__WEBPACK_IMPORTED_MODULE_1___default().locale(i18n.language),(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.date()}),(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.clone().date(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()]}),(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.clone().month(months["it"===i18n.language?"it":"en"].findIndex((m=>m===month))),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(moment__WEBPACK_IMPORTED_MODULE_1___default()().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.clone().year(year+1900),className:"memori--date-selector__select-option",children:year+1900},year)))})})]})})]})}));DateSelector.displayName="DateSelector";const __WEBPACK_DEFAULT_EXPORT__=DateSelector},"./src/components/ImageUpload/ImageUpload.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_Message__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Message.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"),_ui_Modal__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/ui/Modal.tsx"),_ui_Spin__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./src/components/ui/Spin.tsx"),antd_lib_upload_Upload__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__("./node_modules/antd/lib/upload/Upload.js"),antd_img_crop__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/antd-img-crop/dist/antd-img-crop.esm.js"),react_i18next__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_icons_Edit__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./src/components/icons/Edit.tsx"),_icons_Delete__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./src/components/icons/Delete.tsx"),_MediaWidget_MediaItemWidget__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./src/components/MediaWidget/MediaItemWidget.tsx"),_helpers_media__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__("./src/helpers/media.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("./node_modules/react/jsx-runtime.js");const imgMimeTypes=["image/jpeg","image/png","image/jpg","image/gif"],UploadListItem=({originNode,file,tenantID,apiUrl,actions,resourceType})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_11__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{className:"memori--list-item-wrapper"+("uploading"===file.status?" listItemUploading":""),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Spin__WEBPACK_IMPORTED_MODULE_5__.Z,{spinning:"uploading"===file.status,children:"error"===file.status?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_3__.Z,{content:t("media.uploadError"),children:originNode.props.children}):(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_MediaWidget_MediaItemWidget__WEBPACK_IMPORTED_MODULE_9__.e,{item:{mediumID:file.uid,mimeType:"uploading"===file.status?"image/png":file.name?.endsWith(".glb")?"model/gltf-binary":file.type||"image/png",title:file.name??"",url:"uploading"===file.status?"":file.response?.asset?.assetURL?file.response.asset.assetURL:(0,_helpers_media__WEBPACK_IMPORTED_MODULE_12__.v)({type:resourceType,resourceURI:file.thumbUrl,tenantID,apiURL:apiUrl}),content:`${(0,_helpers_media__WEBPACK_IMPORTED_MODULE_12__.v)({resourceURI:file.thumbUrl,type:resourceType,apiURL:apiUrl})}`},preview:!1})}),("success"===file.status||"done"===file.status)&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{className:"list-item-actions",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{outlined:!0,shape:"circle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_icons_Edit__WEBPACK_IMPORTED_MODULE_7__.default,{}),className:"action-button",title:t("edit")||"Edit",onClick:()=>actions?.download(file)}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{outlined:!0,shape:"circle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_icons_Delete__WEBPACK_IMPORTED_MODULE_8__.default,{}),className:"action-button",title:t("delete")||"Delete",onClick:()=>actions?.remove(file)})]})]})};UploadListItem.displayName="UploadListItem";const ImageUpload=({uploadMultipleImages,maxNumberOfVisualizedUploads,uploadUrl,apiUrl,tenantID,fileList,maxFileSizeInMB=2,fileResolution,useImageCrop,uploadMessage,imageProportions=1,imageProportionsHelper,allowedMimeTypes,onRemove,onFileChanged,onUploadFinished,onFileNotValid,disabled,showHelper,additionalHelper,resourceType})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_11__.$)(),[internalFileList,setInternalFileList]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(fileList??[]),[fileTitleModal,setFileTitleModal]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(),upload=(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd_lib_upload_Upload__WEBPACK_IMPORTED_MODULE_13__.default,{className:"memori--upload",disabled:disabled??!1,accept:(allowedMimeTypes??imgMimeTypes)?.join(",")+";capture=camera,camcorder",action:uploadUrl,listType:"picture-card",showUploadList:{showPreviewIcon:!0,showRemoveIcon:!0,showDownloadIcon:!0,downloadIcon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_icons_Edit__WEBPACK_IMPORTED_MODULE_7__.default,{title:t("edit")||"Edit"})},beforeUpload:file=>{if(!(allowedMimeTypes??imgMimeTypes).find((x=>x===file.type))&&file.type)return console.debug("File not allowed",file,allowedMimeTypes??imgMimeTypes),_ui_Message__WEBPACK_IMPORTED_MODULE_1__.Z.error(t("media.uploadMimeTypeNotAllowed")),onFileNotValid&&onFileNotValid(),Promise.reject(t("media.uploadMimeTypeNotAllowed"));if(!(file.size/1024/1024<(maxFileSizeInMB??2)))return _ui_Message__WEBPACK_IMPORTED_MODULE_1__.Z.error(t("media.uploadSizeLimitMessage",{size:maxFileSizeInMB})),onFileNotValid&&onFileNotValid(),Promise.reject(t("media.uploadSizeLimitMessage",{size:maxFileSizeInMB}));if(fileResolution&&fileResolution.length){const reader=new FileReader;return reader.readAsDataURL(file),new Promise(((resolve,reject)=>{reader.addEventListener("load",(event=>{var newImg=new Image;newImg.style.padding="0px",newImg.style.margin="0px",newImg.onload=()=>{newImg.width===fileResolution[0]&&newImg.height===fileResolution[1]?resolve(file):(_ui_Message__WEBPACK_IMPORTED_MODULE_1__.Z.error(t("media.uploadWrongResolutionMessage",{width:fileResolution[0],height:fileResolution[1]})),reject(),onFileNotValid&&onFileNotValid())},newImg.src=event.target?.result?.toString()??""}))}))}return Promise.resolve(file)},supportServerRender:!0,fileList:internalFileList,multiple:uploadMultipleImages,maxCount:maxNumberOfVisualizedUploads||(uploadMultipleImages?100:1),onChange:info=>{setInternalFileList(info.fileList.map((f=>({...f,status:f.status??"error"})))),"done"===info.file.status&&onUploadFinished&&onUploadFinished(info.file)},onRemove,onDownload:file=>{let asset=file.response?.asset;if(asset){let title=asset.originalFileName&&file.name.includes(asset.originalFileName)?asset.originalFileName:file.name;setFileTitleModal({...asset,title:title??asset.title})}else setFileTitleModal({assetID:file.uid,title:file.name??file.fileName})},itemRender:(originNode,file,currFileList,actions)=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(UploadListItem,{resourceType,originNode,file,fileList:internalFileList||currFileList,actions,tenantID,apiUrl}),children:uploadMessage});return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{"aria-live":"polite",children:[useImageCrop?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd_img_crop__WEBPACK_IMPORTED_MODULE_6__.Z,{rotate:!0,aspect:imageProportions,fillColor:"transparent",modalCancel:t("cancel")||"Cancel",modalMaskTransitionName:"none",modalTransitionName:"none",children:upload}):upload,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)(_ui_Modal__WEBPACK_IMPORTED_MODULE_4__.Z,{open:!!fileTitleModal,title:t("media.editAttributes"),onClose:()=>{setFileTitleModal(void 0)},footer:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.Fragment,{}),width:"100%",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("label",{htmlFor:"media-title-input",className:"media-title-label",children:t("media.title")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("input",{id:"media-title-input",className:"media-title-input",type:"text",name:"title",defaultValue:fileTitleModal?.title||"",onChange:e=>{setFileTitleModal({...fileTitleModal,title:e.target.value})}}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{className:"memori-modal--footer",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{onClick:()=>{setFileTitleModal(void 0)},children:t("cancel")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,onClick:()=>{onFileChanged&&fileTitleModal?.assetID&&onFileChanged(fileTitleModal.assetID,{...fileTitleModal}),setInternalFileList((fl=>fl.map((f=>f.uid===fileTitleModal?.assetID||f.response?.asset?.assetID===fileTitleModal?.assetID?{...f,title:fileTitleModal?.title,name:fileTitleModal?.title}:f)))),setFileTitleModal(void 0)},children:t("confirm")})]})]}),showHelper&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("legend",{className:"helper",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("p",{children:t(allowedMimeTypes?"media.uploadHelper":"media.uploadHelperImages").replace("@size@",(maxFileSizeInMB??2).toString())}),imageProportionsHelper&&useImageCrop&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("p",{children:[t("media.scaleRatio"),": ",imageProportionsHelper]}),additionalHelper&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("p",{children:additionalHelper})]})]})};ImageUpload.displayName="ImageUpload";const __WEBPACK_DEFAULT_EXPORT__=ImageUpload;try{ImageUpload.displayName="ImageUpload",ImageUpload.__docgenInfo={description:"",displayName:"ImageUpload",props:{uploadMultipleImages:{defaultValue:null,description:"",name:"uploadMultipleImages",required:!0,type:{name:"boolean"}},maxNumberOfVisualizedUploads:{defaultValue:null,description:"",name:"maxNumberOfVisualizedUploads",required:!1,type:{name:"number"}},fileList:{defaultValue:null,description:"",name:"fileList",required:!1,type:{name:"any[]"}},uploadUrl:{defaultValue:null,description:"",name:"uploadUrl",required:!0,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!1,type:{name:"string"}},tenantID:{defaultValue:null,description:"",name:"tenantID",required:!0,type:{name:"string"}},maxFileSizeInMB:{defaultValue:{value:"2"},description:"",name:"maxFileSizeInMB",required:!1,type:{name:"number"}},fileResolution:{defaultValue:null,description:"",name:"fileResolution",required:!1,type:{name:"number[]"}},useImageCrop:{defaultValue:null,description:"",name:"useImageCrop",required:!1,type:{name:"boolean"}},uploadMessage:{defaultValue:null,description:"",name:"uploadMessage",required:!0,type:{name:"string"}},imageProportions:{defaultValue:{value:"1"},description:"",name:"imageProportions",required:!1,type:{name:"number"}},imageProportionsHelper:{defaultValue:null,description:"",name:"imageProportionsHelper",required:!1,type:{name:"string"}},allowedMimeTypes:{defaultValue:null,description:"",name:"allowedMimeTypes",required:!1,type:{name:"string[]"}},onRemove:{defaultValue:null,description:"",name:"onRemove",required:!1,type:{name:"((file: UploadFile) => Promise)"}},onUploadFinished:{defaultValue:null,description:"",name:"onUploadFinished",required:!1,type:{name:"((file: UploadFile) => void)"}},onFileChanged:{defaultValue:null,description:"",name:"onFileChanged",required:!1,type:{name:"((assetID: string, asset: Partial) => void)"}},onFileNotValid:{defaultValue:null,description:"",name:"onFileNotValid",required:!1,type:{name:"(() => void)"}},disabled:{defaultValue:null,description:"",name:"disabled",required:!1,type:{name:"boolean"}},showHelper:{defaultValue:null,description:"",name:"showHelper",required:!1,type:{name:"boolean"}},additionalHelper:{defaultValue:null,description:"",name:"additionalHelper",required:!1,type:{name:"string"}},resourceType:{defaultValue:null,description:"",name:"resourceType",required:!1,type:{name:"enum",value:[{value:'"cover"'},{value:'"avatar"'}]}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ImageUpload/ImageUpload.tsx#ImageUpload"]={docgenInfo:ImageUpload.__docgenInfo,name:"ImageUpload",path:"src/components/ImageUpload/ImageUpload.tsx#ImageUpload"})}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"),SpeechConfig=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/SpeechConfig.js"),SpeechSynthesisOutputFormat=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/SpeechSynthesisOutputFormat.js"),SpeakerAudioDestination=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/Audio/SpeakerAudioDestination.js"),AudioConfig=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/Audio/AudioConfig.js"),SpeechSynthesizer=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/SpeechSynthesizer.js"),SpeechRecognizer=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/SpeechRecognizer.js"),ResultReason=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/ResultReason.js"),CancellationReason=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/CancellationReason.js"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),Message=__webpack_require__("./src/components/ui/Message.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"),AttachmentMediaModal=__webpack_require__("./src/components/AttachmentMediaModal/AttachmentMediaModal.tsx"),AttachmentLinkModal=__webpack_require__("./src/components/AttachmentLinkModal/AttachmentLinkModal.tsx"),PoweredBy=__webpack_require__("./src/components/PoweredBy/PoweredBy.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})}),(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");const{deleteSession,getStatistics,initSession}=(0,esm.Z)(),BADGES_MAP=new Map([[0,"🆕"],[10,"🐹"],[20,"🐇"],[30,"🐰"],[40,"💡"],[50,"🏆"],[60,"🏅"],[70,"🥉"],[80,"🥈"],[90,"🥇"],[100,"🔥"],[110,"🎓"],[120,"🤖"],[130,"👾"],[150,"🌍"],[180,"💜"],[200,"💙"],[250,"🧡"],[300,"💚"],[350,"💛"],[400,"💖"],[450,"💝"],[500,"🖤"],[550,"❤️"],[600,"🧠"]]),getBadge=points=>{const unlockedBadges=Array.from(BADGES_MAP.keys()).filter((k=>k<=points));if(unlockedBadges.length>0){const lastBadge=unlockedBadges[unlockedBadges.length-1];return BADGES_MAP.get(lastBadge)}return""},getNextBadge=badge=>{if("🆕"===badge)return{points:10,badge:"🐹"};let nextBadgePoints,nextBadge,currentSeen=!1;for(const[key,value]of BADGES_MAP){if(currentSeen){nextBadgePoints=key,nextBadge=value;break}value===badge&&(currentSeen=!0)}return nextBadge&&nextBadgePoints?{points:nextBadgePoints,badge:nextBadge}:void 0},getPointsForBadge=badge=>{let points=0;for(const[key,value]of BADGES_MAP)if(value===badge){points=key;break}return points};var AgeVerificationModal=__webpack_require__("./src/components/AgeVerificationModal/AgeVerificationModal.tsx"),SettingsDrawer=__webpack_require__("./src/components/SettingsDrawer/SettingsDrawer.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 speakerMuted=!1,memoriSpeaking=!1;const MemoriWidget=({memori,memoriConfigs,memoriLang,multilingual,integration,layout="DEFAULT",customLayout,showInstruct=!1,showShare,preview=!1,embed=!1,showInputs=!0,showDates=!1,showContextPerLine=!1,showSettings=!0,showTypingText=!1,showClear=!1,showOnlyLastMessages,height="100vh",secret,baseUrl="https://app.twincreator.com",apiUrl="https://backend.memori.ai",initialContextVars,initialQuestion,ogImage,sessionID:initialSessionID,tenant,personification,authToken,AZURE_COGNITIVE_SERVICES_TTS_KEY,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),{initSession,postTextEnteredEvent,postPlaceChangedEvent,postTimeoutEvent,postTagChangedEvent,getSession,getContentQualityIndexes}=client,[instruct,setInstruct]=(0,react.useState)(!1),[user,setUser]=(0,react.useState)({avatarURL:"string"==typeof userAvatar?userAvatar:void 0}),[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,[userLang,setUserLang]=(0,react.useState)(memoriLang??integrationConfig?.lang??language??integrationConfig?.uiLang??i18n.language??"IT"),[loading,setLoading]=(0,react.useState)(!1),[memoriTyping,setMemoriTyping]=(0,react.useState)(!1),[typingText,setTypingText]=(0,react.useState)(),selectedLayout=layout||integrationConfig?.layout||"DEFAULT",[hasUserActivatedSpeak,setHasUserActivatedSpeak]=(0,react.useState)(!1),[hasUserActivatedListening,setHasUserActivatedListening]=(0,react.useState)(!1),[showPositionDrawer,setShowPositionDrawer]=(0,react.useState)(!1),[showSettingsDrawer,setShowSettingsDrawer]=(0,react.useState)(!1),[muteSpeaker,setMuteSpeaker]=(0,react.useState)(!1),[continuousSpeech,setContinuousSpeech]=(0,react.useState)(!1),[continuousSpeechTimeout,setContinuousSpeechTimeout]=(0,react.useState)(2),[isPlayingAudio,setIsPlayingAudio]=(0,react.useState)(!1),[controlsPosition,setControlsPosition]=(0,react.useState)("center"),[hideEmissions,setHideEmissions]=(0,react.useState)(!1);(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",!1)),speakerMuted=(0,configuration.wm)("muteSpeaker",!1),setContinuousSpeech("CONTINUOUS"===microphoneMode),setContinuousSpeechTimeout((0,configuration.wm)("continuousSpeechTimeout",2)),setControlsPosition((0,configuration.wm)("controlsPosition",defaultControlsPosition)),setHideEmissions((0,configuration.wm)("hideEmissions",!1))}),[]);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({...currentDialogState,...currentState})}},[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;if(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,media:currentState.media,fromUser:!1}),speak(emission))):(console.error(response,resp),Message.Z.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,media:currentState.media,fromUser:!1}),speak(emission))):(console.error(response,resp),Message.Z.error(t((0,error.r)(resp.resultCode))),gotError=!0)}else console.error(response,resp),Message.Z.error(t((0,error.r)(resp.resultCode))),gotError=!0}else userLang.toLowerCase()!==language.toLowerCase()&&emission&&!instruct&&isMultilanguageEnabled?translateDialogState(currentState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})):(setCurrentDialogState({...currentState,emission}),emission&&(pushMessage({text:emission,media:currentState.media,fromUser:!1,generatedByAI:!!currentState.completion}),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)})));hasBatchQueued||(setTypingText(void 0),setMemoriTyping(!1))},translateDialogState=async(state,userLang)=>{const emission=state.emission??currentDialogState?.emission;let translatedState={...state},translatedMsg=null;if(emission&&!instruct&&language.toUpperCase()!==userLang.toUpperCase()&&isMultilanguageEnabled){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:t.text,hints:state.hints??("G1"===state.state?currentDialogState?.hints:[])};t.text.length>0&&(translatedMsg={text:t.text,media:state.media,fromUser:!1,generatedByAI:!!state.completion})}else translatedState={...state,emission},emission&&(translatedMsg={text:emission,media:state.media,fromUser:!1});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 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.error(e)}}))},fetchSession=async params=>{let storageBirthDate=(0,configuration.wm)("birthDate",void 0);if(birthDate||storageBirthDate||!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.error(err)}const session=await initSession({...params,tag:params.tag??personification?.tag,pin:params.pin??personification?.pin,additionalInfo:{...additionalInfo||{},loginToken:additionalInfo?.loginToken??loginToken??authToken,language:getCultureCodeByLanguage(userLang),referral}});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.error(session),Message.Z.error(t("underageTwinSession",{age:minAge})),setGotErrorInOpening(!0)):403===session?.resultCode?(setMemoriPwd(void 0),setAuthModalState("password")):(console.error(session),Message.Z.error(t((0,error.r)(session?.resultCode))),setGotErrorInOpening(!0))}catch(err){console.error(err),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{let referral,storageBirthDate=(0,configuration.wm)("birthDate",void 0);if(!birthDate&&!storageBirthDate&&minAge)return void setShowAgeVerification(!0);if(!("PUBLIC"===memori.privacyType||password||memori.secretToken||memoriPwd||recoveryTokens||memoriTokens))return void setAuthModalState("password");try{referral=window.location.href}catch(err){console.error(err)}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||storageBirthDate||void 0,additionalInfo:{...additionalInfo||{},loginToken:additionalInfo?.loginToken??loginToken??authToken,language:getCultureCodeByLanguage(userLang),referral}});if(sessionID&¤tState&&0===response.resultCode)return setSessionId(sessionID),updateDialogState&&(setCurrentDialogState(currentState),currentState.emission&&(history.length<=1?setHistory([{text:currentState.emission,media:currentState.media,fromUser:!1,initial:!0}]):pushMessage({text:currentState.emission,media:currentState.media,fromUser:!1,initial:!0}))),position&&applyPosition(position,sessionID),setLoading(!1),{dialogState:currentState,sessionID};response?.resultMessage.startsWith("This Memori is aged restricted")?(console.error(response),Message.Z.error(t("underageTwinSession",{age:minAge})),setGotErrorInOpening(!0)):403===response?.resultCode?(setMemoriPwd(void 0),setAuthModalState("password")):(console.error(response),Message.Z.error(t((0,error.r)(response.resultCode))),setGotErrorInOpening(!0))}catch(err){console.error(err)}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.error(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:additionalInfo?.loginToken??loginToken??authToken,language:getCultureCodeByLanguage(userLang),referral}})}else if(currentState)return{currentState,sessionId,resultCode}}}catch(_e){let err=_e;return console.error("[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[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(),!currentDialogState?.acceptsTimeout||speechSynthesizer||isPlayingAudio||userMessage.length||memoriTyping||listening||setInteractionTimeout()},handleTimeout=async()=>{if(speechSynthesizer||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;!instruct&&isMultilanguageEnabled&&userLang!==i18n?.language&&emission&&emission.length>0?translateDialogState({...currentState,emission},userLang).then((ts=>{ts.emission&&speak(ts.emission)})):emission&&emission.length>0&&(pushMessage({text:emission,media:currentState.media,fromUser:!1,generatedByAI:!!currentState.completion}),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}}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]),(0,react.useEffect)((()=>()=>{setHasUserActivatedSpeak(!1),setClickedStart(!1),clearInteractionTimeout(),timeoutRef.current=void 0}),[]);const getTTSVoice=(0,react.useCallback)((lang=>{let voice="";switch((lang??memori.culture?.split("-")?.[0]??i18n.language??"IT").toUpperCase()){case"IT":voice=""+("MALE"===memori.voiceType?"it-IT-DiegoNeural":"it-IT-ElsaNeural");break;case"DE":voice=""+("MALE"===memori.voiceType?"de-DE-ConradNeural":"de-DE-KatjaNeural");break;case"EN":voice=""+("MALE"===memori.voiceType?"en-GB-RyanNeural":"en-GB-SoniaNeural");break;case"ES":voice=""+("MALE"===memori.voiceType?"es-ES-AlvaroNeural":"es-ES-ElviraNeural");break;case"FR":voice=""+("MALE"===memori.voiceType?"fr-FR-HenriNeural":"fr-FR-DeniseNeural");break;case"PT":voice=""+("MALE"===memori.voiceType?"pt-PT-DuarteNeural":"pt-PT-RaquelNeural");break;case"UK":voice=""+("MALE"===memori.voiceType?"uk-UA-OstapNeural":"uk-UA-PolinaNeural");break;case"RU":voice=""+("MALE"===memori.voiceType?"ru-RU-DmitryNeural":"ru-RU-SvetlanaNeural");break;case"PL":voice=""+("MALE"===memori.voiceType?"pl-PL-MarekNeural":"pl-PL-AgnieszkaNeural");break;case"FI":voice=""+("MALE"===memori.voiceType?"fi-FI-HarriNeural":"fi-FI-SelmaNeural");break;default:voice=""+("MALE"===memori.voiceType?"it-IT-DiegoNeural":"it-IT-IsabellaNeural")}return voice}),[memori.voiceType,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"}return voice},[phonemesMap,setPhonemesMap]=(0,react.useState)();(0,react.useEffect)((()=>{(async()=>{try{const lexiconReq=await fetch(`${baseUrl||"https://app.twincreator.com"}/api/lexiconmap`);return await lexiconReq.json()}catch(err){console.error(err)}})().then((lexicon=>{setPhonemesMap(lexicon)}))}),[]);const 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 SpeakerAudioDestination.K);let audioConfig=AudioConfig.rU.fromSpeakerOutput(audioDestination);speechSynthesizer=new SpeechSynthesizer.a(speechConfig,audioConfig)}const source=audioContext.createBufferSource();source.addEventListener("ended",(()=>{setIsPlayingAudio(!1),memoriSpeaking=!1})),audioDestination.onAudioEnd=()=>{setIsPlayingAudio(!1),memoriSpeaking=!1,source.disconnect(),emitEndSpeakEvent(),onEndSpeakStartListen()},speechSynthesizer.speakSsmlAsync(`${((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)})((text=>{const el=document.createElement("textarea");return el.textContent=text,el.innerHTML})((0,utils.h)(text)),userLang.toLowerCase())}`,(result=>{if(result){setIsPlayingAudio(!0),memoriSpeaking=!0;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),memoriSpeaking=!1):"interrupted"===audioContext.state&&audioContext.resume()},audioContext.resume(),speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null)}catch(e){console.error("speak error: ",e),window.speechSynthesis.speak(new SpeechSynthesisUtterance(text)),setIsPlayingAudio(!1),memoriSpeaking=!1,speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null),emitEndSpeakEvent()}}else audioContext.resume(),setIsPlayingAudio(!1),memoriSpeaking=!1,emitEndSpeakEvent()}),(error=>{console.error("speak:",error),window.speechSynthesis.speak(new SpeechSynthesisUtterance(text)),setIsPlayingAudio(!1),memoriSpeaking=!1,emitEndSpeakEvent()})),setMemoriTyping(!1)},stopAudio=()=>{setIsPlayingAudio(!1),memoriSpeaking=!1;try{speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null),"closed"!==audioContext.state&&audioContext.close(),audioDestination&&(audioDestination.pause(),audioDestination.close())}catch(e){console.error("stopAudio error: ",e)}};(0,react.useEffect)((()=>{let textarea=document.querySelector("#chat-fieldset textarea");textarea&&textarea.focus()}),[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=()=>{if(AZURE_COGNITIVE_SERVICES_TTS_KEY){clearListening(),setTranscript(""),resetTranscript();try{navigator.mediaDevices.getUserMedia({audio:!0}).then((function(_stream){setHasUserActivatedListening(!0),speechConfig||(speechConfig=SpeechConfig.c.fromSubscription(AZURE_COGNITIVE_SERVICES_TTS_KEY,"eastus"),speechConfig.speechRecognitionLanguage=getCultureCodeByLanguage(userLang),speechConfig.speechSynthesisLanguage=getCultureCodeByLanguage(userLang),speechConfig.speechSynthesisVoiceName=getTTSVoice(userLang));const audioConfig=AudioConfig.rU.fromDefaultMicrophoneInput();recognizer=new SpeechRecognizer.F(speechConfig,audioConfig),setListening(!0),recognizer.recognized=(_s,e)=>{if(e.result.text)if(e.result.reason===ResultReason.s.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===ResultReason.s.NoMatch&&console.debug("NOMATCH: Speech could not be recognized.")},recognizer.canceled=(_s,e)=>{e.reason===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.error)}catch(error){console.error(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)((()=>{const stored=(0,configuration.wm)("sendOnEnter","keypress");window.innerWidth<=768?setSendOnEnter("click"):setSendOnEnter(stored)}),[]),(0,react.useEffect)((()=>{(0,configuration.A2)("sendOnEnter",sendOnEnter)}),[sendOnEnter]);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 {\n ${Object.entries(integrationProperties).map((([key,value])=>`${key}: ${value};`)).join("\n")}\n }\n `,showAIicon=void 0===integrationConfig?.showAIicon||integrationConfig?.showAIicon,[avatar3dVisible,setAvatar3dVisible]=(0,react.useState)(!1);(0,react.useEffect)((()=>{(window.innerWidth>=768&&"FULLPAGE"===selectedLayout||"FULLPAGE"!==selectedLayout)&&setAvatar3dVisible(!0)}),[]);const[gamificationLevel,setGamificationLevel]=(0,react.useState)();(0,react.useEffect)((()=>{memori.engineMemoriID&&(async memoriID=>{let gamificationPoints,unansQuestions;try{const{contentQualityIndex,answerQualityIndex,unansweredQuestions,...cqResp}=await getContentQualityIndexes(memoriID);0===cqResp.resultCode&&(gamificationPoints=contentQualityIndex,unansQuestions=unansweredQuestions)}catch(_e){let err=_e;console.error("[APPCONTEXT/QUERYGAMIFICATIONPOINTS]",err)}return{points:gamificationPoints??0,unansweredQuestions:unansQuestions??0}})(memori.engineMemoriID).then((value=>{setGamificationLevel((points=>{const roundedPoints=Math.round(points),badge=getBadge(roundedPoints);return{points:roundedPoints,badge,pointsForCurrentBadge:getPointsForBadge(badge),nextBadge:getNextBadge(badge)}})(value.points))})).catch(console.error)}),[memori.engineMemoriID]),(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=>{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]);(0,react.useEffect)((()=>(document.addEventListener("MemoriTextEntered",memoriTextEnteredHandler),()=>{document.removeEventListener("MemoriTextEntered",memoriTextEnteredHandler)})),[sessionId,userLang]);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.error("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,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birthDate:birth});return void(session?.dialogState?(setHistory([]),translateDialogState(session.dialogState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})).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([]),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=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}catch(e){console.error("session #2",e),reopenSession(!0,memori?.secretToken,void 0,memori?.giverTag,memori?.giverPIN,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...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=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}catch(e){console.error("session #5",e),reopenSession(!0,memori?.secretToken,void 0,personification.tag,personification.pin,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birth).then((()=>{setHasUserActivatedSpeak(!0)}))}else if(instruct||personification||currentDialogState?.currentTag===constants.QV)translateDialogState(currentState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})).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=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}catch(e){console.error("session #8",e),reopenSession(!0,memori?.secretToken,void 0,void 0,void 0,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birth).then((()=>{setHasUserActivatedSpeak(!0)}))}}else setHistory([]),translateDialogState(dialogState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}else setShowAgeVerification(!0),setClickedStart(!1)}),[memoriPwd,memori,memoriTokens,birthDate,sessionId,userLang]),[loginToken,setLoginToken]=(0,react.useState)(additionalInfo?.loginToken??authToken);(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):setLoginToken(mutation.target?.parentElement?.getAttribute("authtoken")||void 0))}));return observer.observe(targetNode,{attributes:!0,childList:!1,subtree:!1}),()=>{observer.disconnect()}}),[]);const showFullHistory=void 0===showOnlyLastMessages?"TOTEM"!==layout&&"WEBSITE_ASSISTANT"!==layout:!showOnlyLastMessages,headerProps={memori,history,showShare:showShare??integrationConfig?.showShare??!0,position,setShowPositionDrawer,setShowSettingsDrawer,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)))},avatarProps={memori,integration,integrationConfig,tenant,instruct,avatar3dVisible,setAvatar3dVisible,hasUserActivatedSpeak,isPlayingAudio:isPlayingAudio&&!muteSpeaker,loading:!!memoriTyping,baseUrl,apiUrl},startPanelProps={memori,tenant,gamificationLevel,language,userLang,setUserLang,baseUrl,apiUrl,position,openPositionDrawer:()=>setShowPositionDrawer(!0),integrationConfig,instruct,sessionId,clickedStart,onClickStart,initializeTTS:()=>{if(!AZURE_COGNITIVE_SERVICES_TTS_KEY)return;speechConfig=SpeechConfig.c.fromSubscription(AZURE_COGNITIVE_SERVICES_TTS_KEY,"eastus"),speechConfig.speechSynthesisLanguage=getCultureCodeByLanguage(userLang),speechConfig.speechSynthesisVoiceName=getTTSVoice(userLang),speechConfig.speechRecognitionLanguage=getCultureCodeByLanguage(userLang),(0,utils.xZ)()&&(speechConfig.speechSynthesisOutputFormat=SpeechSynthesisOutputFormat.Y.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 SpeakerAudioDestination.K;let audioConfig=AudioConfig.rU.fromSpeakerOutput(audioDestination);speechSynthesizer=new SpeechSynthesizer.a(speechConfig,audioConfig)}},chatProps={memori,sessionID:sessionId||"",tenant,translateTo:isMultilanguageEnabled&&userLang.toUpperCase()!==(memori.culture?.split("-")?.[0]??i18n.language??"IT")?.toUpperCase()?userLang:void 0,baseUrl,apiUrl,layout,memoriTyping,typingText,showTypingText,history:showFullHistory?history:history.slice(-2),authToken:loginToken,dialogState:currentDialogState,setDialogState:setCurrentDialogState,pushMessage,simulateUserPrompt:(text,translatedText)=>{stopListening(),stopAudio(),sendMessage(text,void 0,void 0,!1,translatedText)},showDates,showContextPerLine,showAIicon,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,media:currentState.media,fromUser:!1})):(console.error(resp),Message.Z.error(t((0,error.r)(resp.resultCode))))}else setCurrentDialogState(currentState),currentState.emission&&pushMessage({text:currentState.emission,media:currentState.media,fromUser:!1});else console.error(resp,tag,currentDialogState?.knownTags?.[tag]),Message.Z.error(t((0,error.r)(resp.resultCode)))}catch(e){let err=e;console.error(err),Message.Z.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=>{stopAudio(),stopListening(),sendMessage(msg),setUserMessage(""),resetTranscript()},stopListening:clearListening,startListening,stopAudio,resetTranscript,listening,isPlayingAudio,customMediaRenderer,user,userAvatar},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}),Layout=customLayout||("TOTEM"===selectedLayout?layouts_Totem:"CHAT"===selectedLayout?layouts_Chat:"FULLPAGE"===selectedLayout?layouts_FullPage:"WEBSITE_ASSISTANT"===selectedLayout?layouts_WebsiteAssistant: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://app.twincreator.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,ROUTE:window.location.pathname?.split("/")?.pop()||"",...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,ROUTE:window.location.pathname?.split("/")?.pop()||"",...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,additionalSettings}),sessionId&&(0,jsx_runtime.jsx)(AttachmentLinkModal.Z,{apiURL:apiUrl,visible:"link"===attachmentsMenuOpen,onCancel:()=>setAttachmentsMenuOpen(void 0),onOk:async link=>{if(!sessionId)return;let medium={mediumID:"",mimeType:"text/html",url:link.url,title:link.title};pushMessage({text:t("media.insertThisLink",{url:medium.url,title:medium.title}),fromUser:!0,media:[medium]});try{const{currentState,...resp}=await client.postMediumSelectedEvent(sessionId,medium);currentState&&0===resp.resultCode?(setCurrentDialogState(currentState),currentState.emission&&(pushMessage({text:currentState.emission,media:currentState.media,fromUser:!1}),speak(currentState.emission))):(console.error(resp,currentState,medium),Message.Z.error(t((0,error.r)(resp.resultCode),{ns:"common"})))}catch(e){let err=e;console.error(err),Message.Z.error(err.message)}setAttachmentsMenuOpen(void 0)}}),loginToken&&sessionId&&tenant?.id&&(0,jsx_runtime.jsx)(AttachmentMediaModal.Z,{apiURL:apiUrl,visible:"media"===attachmentsMenuOpen,authToken:loginToken,tenantID:tenant?.id,sessionID:sessionId,uploadAssetURL:client.backend.getUploadAssetURL(loginToken,memori.memoriID),deleteAsset:client.backend.deleteAsset,onCancel:()=>setAttachmentsMenuOpen(void 0),onOk:async asset=>{if(!sessionId)return;let medium={mediumID:"",mimeType:asset.mimeType,url:asset.assetURL,title:asset.title||asset.assetID};pushMessage({text:t("media.insertThisMediaMsg"),fromUser:!0,media:[medium]});try{const{currentState,...resp}=await client.postMediumSelectedEvent(sessionId,medium);currentState&&0===resp.resultCode?(setCurrentDialogState(currentState),currentState.emission&&(pushMessage({text:currentState.emission,media:currentState.media,fromUser:!1}),speak(currentState.emission))):(console.error(resp,currentState,medium),Message.Z.error(t((0,error.r)(resp.resultCode),{ns:"common"})))}catch(e){let err=e;console.error(err),Message.Z.error(err.message)}setAttachmentsMenuOpen(void 0)}})]})};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"}},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"'}]}},customLayout:{defaultValue:null,description:"",name:"customLayout",required:!1,type:{name:"FC"}},showShare:{defaultValue:null,description:"",name:"showShare",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"}},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://app.twincreator.com"},description:"",name:"baseUrl",required:!1,type:{name:"string"}},apiUrl:{defaultValue:{value:"https://backend.memori.ai"},description:"",name:"apiUrl",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"}},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; } & { [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/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"})=>{const tenantId="memorytwin"===tenant?.theme?"memorytwin":"twincreator";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://app.twincreator.com/images/${tenantId}/logo.png`,alt:""}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("p",{children:["Powered by"," ",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("a",{href:`https://app.${tenantId}.com/${userLang?userLang.toLowerCase():""}`,target:"_blank",rel:"noopener noreferrer",children:"memorytwin"===tenantId?"MemoryTwin":"TwinCreator"})]})]})};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"}}}},"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_10__=__webpack_require__("./src/helpers/media.ts"),react_i18next__WEBPACK_IMPORTED_MODULE_8__=__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_9__=__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"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/react/jsx-runtime.js");const StartPanel=({memori,tenant,gamificationLevel,language,userLang,setUserLang,baseUrl,apiUrl,position,openPositionDrawer,integrationConfig,instruct=!1,clickedStart,onClickStart,initializeTTS})=>{const{t,i18n}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_8__.$)(),[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")&&memori.description?.length&&(0,_helpers_translations__WEBPACK_IMPORTED_MODULE_9__.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_7__.jsxs)("div",{className:"memori--start-panel",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div",{className:"memori--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,apiURL:apiUrl})}")`},children:[!!gamificationLevel?.badge?.length&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div",{className:"memori--gamification-badge",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:`${t("gamification.level")} ${gamificationLevel.badge}, ${gamificationLevel.points} ${t("gamification.points")}`,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("span",{"aria-label":`${t("gamification.level")} ${gamificationLevel.badge}, ${gamificationLevel.points} ${t("gamification.points")}`,children:gamificationLevel.badge})})}),!!memori.enableCompletions&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div",{className:"memori--completions-enabled",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("completionsEnabled"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("span",{"aria-label":t("completionsEnabled")||"Completions",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_icons_AI__WEBPACK_IMPORTED_MODULE_6__.default,{})})})}),!!memori.nsfw&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div",{className:"memori--nsfw",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("nsfw"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("span",{title:t("nsfw")||"NSFW",children:"🔞"})})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("picture",{className:"memori--avatar",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("source",{src:memori.avatarURL??(0,_helpers_media__WEBPACK_IMPORTED_MODULE_10__.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("img",{alt:memori.name,src:memori.avatarURL&&memori.avatarURL.length>0?(0,_helpers_media__WEBPACK_IMPORTED_MODULE_10__.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl}):(0,_helpers_media__WEBPACK_IMPORTED_MODULE_10__.v)({type:"avatar",tenantID:tenant?.id,baseURL:baseUrl,apiURL:apiUrl})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("h2",{className:"memori--title",children:memori.name}),memori.needsPosition&&!position&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div",{className:"memori--needsPosition",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("p",{children:t("write_and_speak.requirePosition")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,onClick:()=>openPositionDrawer(),className:"memori--start-button",children:t("widget.position")})]}),(memori.needsPosition&&position||!memori.needsPosition)&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div",{className:"memori--description",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("p",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("span",{className:"memori--description-text",children:translatedDescription&&showTranslation?translatedDescription:memori.description}),translatedDescription!==memori.description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{ghost:!0,className:"memori--translation-toggle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_icons_Translation__WEBPACK_IMPORTED_MODULE_3__.default,{}),onClick:()=>{setShowTranslation((show=>!show))},children:t(showTranslation?"showOriginalText":"showTranslatedText")})]}),integrationConfig?.multilanguage&&!instruct&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div",{className:"memori--language-chooser",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.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_7__.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_7__.jsx)("option",{value:lang.value,"aria-label":lang.label,children:lang.label},lang.value)))})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,disabled:!!memori.blockedUntil&&!memori.isGiver,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":"tryMeButton"))}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("p",{className:"memori--start-description",children:t(instruct?"write_and_speak.pageInstructExplanation":"write_and_speak.pageTryMeExplanation")}),!!memori.blockedUntil&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_BlockedMemoriBadge_BlockedMemoriBadge__WEBPACK_IMPORTED_MODULE_5__.Z,{memoriName:memori.name,blockedUntil:memori.blockedUntil,showGiverInfo:memori.isGiver,showTitle:!0,marginLeft:!0})]})]})};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"}},gamificationLevel:{defaultValue:null,description:"",name:"gamificationLevel",required:!1,type:{name:"GamificationLevel"}},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"}},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)"}}}},"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/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/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/Translation.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 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/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){}},"./src/components/ui/Message.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"),__webpack_require__("./node_modules/react/jsx-runtime.js");const __WEBPACK_DEFAULT_EXPORT__={error:console.error,info:console.info,success:console.log}},"./src/helpers/error.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{r:()=>getErrori18nKey});const BACKEND_ERRORS=new Map(Object.entries({TENANT_NOT_FOUND:-1,TENANT_REGISTRATION_DISABLED:-2,TENANT_MISSING_NAME:-3,TENANT_MAX_USERS_REACHED:-4,TENANT_MAX_ADMINS_REACHED:-5,USER_NOT_CONFIRMED:-11,USER_NOT_FOUND:-12,USER_OR_PASSWORD_INVALID:-13,USER_MUST_CHANGE_PASSWORD:-14,USER_MUST_ENTER_VERIFICATION_CODE:-15,USER_MISSING_TENANT:-21,USER_MISSING_NAME:-22,USER_MISSING_PASSWORD:-23,USER_MISSING_EMAIL:-24,USER_MISSING_VERIFICATION_CODE:-25,USER_NAME_ALREADY_USED:-26,USER_PASSWORD_NOT_CONFORMING_TO_POLICY:-27,USER_EMAIL_ALREADY_USED:-28,USER_EMAIL_INVALID:-29,USER_VERIFICATION_CODE_INVALID:-30,USER_MISSING_NAME_OR_EMAIL:-31,USER_NAME_INVALID:-32,USER_HAS_ONE_OR_MORE_MEMORI:-33,USER_MISSING_NEW_PASSWORD:-34,USER_CANT_CREATE_MEMORI:-35,USER_MAX_MEMORI_REACHED:-36,USER_CANT_EDIT_INTEGRATIONS:-37,MEMORI_NOT_FOUND:-51,MEMORI_NOT_ACCESSIBLE:-52,MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN:-53,SESSION_NOT_FOUND:-101,SESSION_IS_NOT_ADMINISTRATIVE:-102,MEMORI_MISSING_CONFIGURATION:-201,MEMORI_CONFIGURATION_NOT_FOUND:-202,MEMORI_INVALID_PRIVACY_TYPE:-203,MEMORI_MISSING_PASSWORD:-204,MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS:-205,MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS:-206,MEMORI_INVALID_VOICE_TYPE:-207,MEMORI_MISSING_NAME:-208,MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS:-209,MEMORI_INVALID_ID:-210,MEMORI_NAME_ALREADY_USED:-211,MEMORI_INVALID_PIN:-212,MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION:-213,MEMORI_NO_PASSWORD_WHEN_PUBLIC:-214,MEMORI_TRANSFER_MISSING_DESTINATION_USER:-231,MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID:-232,MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT:-233,MEMORI_TRANSFER_NOTHING_TO_DO:-234,MEMORI_CONFIGURATION_CANT_BE_CHANGED:-251,MEMORI_MISSING_NEW_PASSWORD:-252,MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT:-261,MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT:-262,INTEGRATION_NOT_FOUND:-301,INTEGRATION_INVALID_TYPE:-401,INTEGRATION_ALREADY_EXISTS:-402,INTEGRATION_MEMORI_IS_NOT_PUBLIC:-403,INTEGRATION_MISSING_INVOCATION_TEXT:-404,INTEGRATION_MISSING_DEVICE_EMAILS:-405,INTEGRATION_MEMORI_IS_EMPTY:-406,INTEGRATION_MISSING_PRIVACY_POLICY:-407,INTEGRATION_MISSING_CATEGORY:-408,INTEGRATION_MISSING_DESCRIPTION:-409,INTEGRATION_INVALID_INVOCATION_TEXT:-410,INTEGRATION_GOOGLE_NO_MORE_AVAILABLE:-411,UPLOAD_REQUIRES_MULTIPART_ENCODING:-501,UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY:-502,UPLOAD_MAX_LENGTH_EXCEEDED:-503,UPLOAD_FILE_IS_EMPTY:-504,UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE:-505,UPLOAD_MISSING_FILE_NAME:-506,UPLOAD_INVALID_MEMORY_ID:-507,UPLOAD_MISSING_FILE_CONTENT:-508,ASSET_NOT_FOUND:-601,ASSET_NOT_ACCESSIBLE:-602,ASSET_MISSING_SESSION_ID:-603,ASSET_INVALID_FILE_NAME:-604,INVITATION_NOT_FOUND:-701,INVITATION_NOT_ACCESSIBLE:-702,INVITATION_ALREADY_ACCEPTED:-703,INVITATION_ALREADY_REJECTED:-704,INVITATION_MISSING_DESTINATION_EMAIL:-705,INVITATION_DESTINATION_EMAIL_INVALID:-706,INVITATION_MISSING_TAG:-707,INVITATION_MISSING_PIN:-708,INVITATION_INVALID_PIN:-709,INVITATION_INVALID_TYPE:-710,INVITATION_MISSING_DESTINATION_NAME:-711,INVITATION_TAG_PIN_CANT_BE_CHANGED:-712,INVITATION_CANT_BE_CHANGED:-713,ACTIONLOG_INVALID_USER_ID:-801,ACTIONLOG_INVALID_DATE_FROM_FORMAT:-802,ACTIONLOG_INVALID_DATE_TO_FORMAT:-803,ACTIONLOG_INVALID_MEMORI_ID:-804,CONSUMPTIONLOG_INVALID_TYPE:-901,CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT:-902,CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT:-903,CONSUMPTIONLOG_INVALID_USER_ID:-904,CONSUMPTIONLOG_INVALID_MEMORI_ID:-905}).map((([key,value])=>[value,key]))),getErrori18nKey=errorCode=>{if(!errorCode)return"error.generic";if(401===errorCode||403===errorCode)return"error.unauthorized";if(404===errorCode)return"error.notFound";if(422===errorCode)return"error.unprocessableEntity";if(500===errorCode)return"internal server error";let error=BACKEND_ERRORS.get(errorCode);return error?`errors.${error}`:"error.generic"}},"./node_modules/moment/locale sync recursive ^\\.\\/.*$":(module,__unused_webpack_exports,__webpack_require__)=>{var map={"./af":"./node_modules/moment/locale/af.js","./af.js":"./node_modules/moment/locale/af.js","./ar":"./node_modules/moment/locale/ar.js","./ar-dz":"./node_modules/moment/locale/ar-dz.js","./ar-dz.js":"./node_modules/moment/locale/ar-dz.js","./ar-kw":"./node_modules/moment/locale/ar-kw.js","./ar-kw.js":"./node_modules/moment/locale/ar-kw.js","./ar-ly":"./node_modules/moment/locale/ar-ly.js","./ar-ly.js":"./node_modules/moment/locale/ar-ly.js","./ar-ma":"./node_modules/moment/locale/ar-ma.js","./ar-ma.js":"./node_modules/moment/locale/ar-ma.js","./ar-sa":"./node_modules/moment/locale/ar-sa.js","./ar-sa.js":"./node_modules/moment/locale/ar-sa.js","./ar-tn":"./node_modules/moment/locale/ar-tn.js","./ar-tn.js":"./node_modules/moment/locale/ar-tn.js","./ar.js":"./node_modules/moment/locale/ar.js","./az":"./node_modules/moment/locale/az.js","./az.js":"./node_modules/moment/locale/az.js","./be":"./node_modules/moment/locale/be.js","./be.js":"./node_modules/moment/locale/be.js","./bg":"./node_modules/moment/locale/bg.js","./bg.js":"./node_modules/moment/locale/bg.js","./bm":"./node_modules/moment/locale/bm.js","./bm.js":"./node_modules/moment/locale/bm.js","./bn":"./node_modules/moment/locale/bn.js","./bn-bd":"./node_modules/moment/locale/bn-bd.js","./bn-bd.js":"./node_modules/moment/locale/bn-bd.js","./bn.js":"./node_modules/moment/locale/bn.js","./bo":"./node_modules/moment/locale/bo.js","./bo.js":"./node_modules/moment/locale/bo.js","./br":"./node_modules/moment/locale/br.js","./br.js":"./node_modules/moment/locale/br.js","./bs":"./node_modules/moment/locale/bs.js","./bs.js":"./node_modules/moment/locale/bs.js","./ca":"./node_modules/moment/locale/ca.js","./ca.js":"./node_modules/moment/locale/ca.js","./cs":"./node_modules/moment/locale/cs.js","./cs.js":"./node_modules/moment/locale/cs.js","./cv":"./node_modules/moment/locale/cv.js","./cv.js":"./node_modules/moment/locale/cv.js","./cy":"./node_modules/moment/locale/cy.js","./cy.js":"./node_modules/moment/locale/cy.js","./da":"./node_modules/moment/locale/da.js","./da.js":"./node_modules/moment/locale/da.js","./de":"./node_modules/moment/locale/de.js","./de-at":"./node_modules/moment/locale/de-at.js","./de-at.js":"./node_modules/moment/locale/de-at.js","./de-ch":"./node_modules/moment/locale/de-ch.js","./de-ch.js":"./node_modules/moment/locale/de-ch.js","./de.js":"./node_modules/moment/locale/de.js","./dv":"./node_modules/moment/locale/dv.js","./dv.js":"./node_modules/moment/locale/dv.js","./el":"./node_modules/moment/locale/el.js","./el.js":"./node_modules/moment/locale/el.js","./en-au":"./node_modules/moment/locale/en-au.js","./en-au.js":"./node_modules/moment/locale/en-au.js","./en-ca":"./node_modules/moment/locale/en-ca.js","./en-ca.js":"./node_modules/moment/locale/en-ca.js","./en-gb":"./node_modules/moment/locale/en-gb.js","./en-gb.js":"./node_modules/moment/locale/en-gb.js","./en-ie":"./node_modules/moment/locale/en-ie.js","./en-ie.js":"./node_modules/moment/locale/en-ie.js","./en-il":"./node_modules/moment/locale/en-il.js","./en-il.js":"./node_modules/moment/locale/en-il.js","./en-in":"./node_modules/moment/locale/en-in.js","./en-in.js":"./node_modules/moment/locale/en-in.js","./en-nz":"./node_modules/moment/locale/en-nz.js","./en-nz.js":"./node_modules/moment/locale/en-nz.js","./en-sg":"./node_modules/moment/locale/en-sg.js","./en-sg.js":"./node_modules/moment/locale/en-sg.js","./eo":"./node_modules/moment/locale/eo.js","./eo.js":"./node_modules/moment/locale/eo.js","./es":"./node_modules/moment/locale/es.js","./es-do":"./node_modules/moment/locale/es-do.js","./es-do.js":"./node_modules/moment/locale/es-do.js","./es-mx":"./node_modules/moment/locale/es-mx.js","./es-mx.js":"./node_modules/moment/locale/es-mx.js","./es-us":"./node_modules/moment/locale/es-us.js","./es-us.js":"./node_modules/moment/locale/es-us.js","./es.js":"./node_modules/moment/locale/es.js","./et":"./node_modules/moment/locale/et.js","./et.js":"./node_modules/moment/locale/et.js","./eu":"./node_modules/moment/locale/eu.js","./eu.js":"./node_modules/moment/locale/eu.js","./fa":"./node_modules/moment/locale/fa.js","./fa.js":"./node_modules/moment/locale/fa.js","./fi":"./node_modules/moment/locale/fi.js","./fi.js":"./node_modules/moment/locale/fi.js","./fil":"./node_modules/moment/locale/fil.js","./fil.js":"./node_modules/moment/locale/fil.js","./fo":"./node_modules/moment/locale/fo.js","./fo.js":"./node_modules/moment/locale/fo.js","./fr":"./node_modules/moment/locale/fr.js","./fr-ca":"./node_modules/moment/locale/fr-ca.js","./fr-ca.js":"./node_modules/moment/locale/fr-ca.js","./fr-ch":"./node_modules/moment/locale/fr-ch.js","./fr-ch.js":"./node_modules/moment/locale/fr-ch.js","./fr.js":"./node_modules/moment/locale/fr.js","./fy":"./node_modules/moment/locale/fy.js","./fy.js":"./node_modules/moment/locale/fy.js","./ga":"./node_modules/moment/locale/ga.js","./ga.js":"./node_modules/moment/locale/ga.js","./gd":"./node_modules/moment/locale/gd.js","./gd.js":"./node_modules/moment/locale/gd.js","./gl":"./node_modules/moment/locale/gl.js","./gl.js":"./node_modules/moment/locale/gl.js","./gom-deva":"./node_modules/moment/locale/gom-deva.js","./gom-deva.js":"./node_modules/moment/locale/gom-deva.js","./gom-latn":"./node_modules/moment/locale/gom-latn.js","./gom-latn.js":"./node_modules/moment/locale/gom-latn.js","./gu":"./node_modules/moment/locale/gu.js","./gu.js":"./node_modules/moment/locale/gu.js","./he":"./node_modules/moment/locale/he.js","./he.js":"./node_modules/moment/locale/he.js","./hi":"./node_modules/moment/locale/hi.js","./hi.js":"./node_modules/moment/locale/hi.js","./hr":"./node_modules/moment/locale/hr.js","./hr.js":"./node_modules/moment/locale/hr.js","./hu":"./node_modules/moment/locale/hu.js","./hu.js":"./node_modules/moment/locale/hu.js","./hy-am":"./node_modules/moment/locale/hy-am.js","./hy-am.js":"./node_modules/moment/locale/hy-am.js","./id":"./node_modules/moment/locale/id.js","./id.js":"./node_modules/moment/locale/id.js","./is":"./node_modules/moment/locale/is.js","./is.js":"./node_modules/moment/locale/is.js","./it":"./node_modules/moment/locale/it.js","./it-ch":"./node_modules/moment/locale/it-ch.js","./it-ch.js":"./node_modules/moment/locale/it-ch.js","./it.js":"./node_modules/moment/locale/it.js","./ja":"./node_modules/moment/locale/ja.js","./ja.js":"./node_modules/moment/locale/ja.js","./jv":"./node_modules/moment/locale/jv.js","./jv.js":"./node_modules/moment/locale/jv.js","./ka":"./node_modules/moment/locale/ka.js","./ka.js":"./node_modules/moment/locale/ka.js","./kk":"./node_modules/moment/locale/kk.js","./kk.js":"./node_modules/moment/locale/kk.js","./km":"./node_modules/moment/locale/km.js","./km.js":"./node_modules/moment/locale/km.js","./kn":"./node_modules/moment/locale/kn.js","./kn.js":"./node_modules/moment/locale/kn.js","./ko":"./node_modules/moment/locale/ko.js","./ko.js":"./node_modules/moment/locale/ko.js","./ku":"./node_modules/moment/locale/ku.js","./ku.js":"./node_modules/moment/locale/ku.js","./ky":"./node_modules/moment/locale/ky.js","./ky.js":"./node_modules/moment/locale/ky.js","./lb":"./node_modules/moment/locale/lb.js","./lb.js":"./node_modules/moment/locale/lb.js","./lo":"./node_modules/moment/locale/lo.js","./lo.js":"./node_modules/moment/locale/lo.js","./lt":"./node_modules/moment/locale/lt.js","./lt.js":"./node_modules/moment/locale/lt.js","./lv":"./node_modules/moment/locale/lv.js","./lv.js":"./node_modules/moment/locale/lv.js","./me":"./node_modules/moment/locale/me.js","./me.js":"./node_modules/moment/locale/me.js","./mi":"./node_modules/moment/locale/mi.js","./mi.js":"./node_modules/moment/locale/mi.js","./mk":"./node_modules/moment/locale/mk.js","./mk.js":"./node_modules/moment/locale/mk.js","./ml":"./node_modules/moment/locale/ml.js","./ml.js":"./node_modules/moment/locale/ml.js","./mn":"./node_modules/moment/locale/mn.js","./mn.js":"./node_modules/moment/locale/mn.js","./mr":"./node_modules/moment/locale/mr.js","./mr.js":"./node_modules/moment/locale/mr.js","./ms":"./node_modules/moment/locale/ms.js","./ms-my":"./node_modules/moment/locale/ms-my.js","./ms-my.js":"./node_modules/moment/locale/ms-my.js","./ms.js":"./node_modules/moment/locale/ms.js","./mt":"./node_modules/moment/locale/mt.js","./mt.js":"./node_modules/moment/locale/mt.js","./my":"./node_modules/moment/locale/my.js","./my.js":"./node_modules/moment/locale/my.js","./nb":"./node_modules/moment/locale/nb.js","./nb.js":"./node_modules/moment/locale/nb.js","./ne":"./node_modules/moment/locale/ne.js","./ne.js":"./node_modules/moment/locale/ne.js","./nl":"./node_modules/moment/locale/nl.js","./nl-be":"./node_modules/moment/locale/nl-be.js","./nl-be.js":"./node_modules/moment/locale/nl-be.js","./nl.js":"./node_modules/moment/locale/nl.js","./nn":"./node_modules/moment/locale/nn.js","./nn.js":"./node_modules/moment/locale/nn.js","./oc-lnc":"./node_modules/moment/locale/oc-lnc.js","./oc-lnc.js":"./node_modules/moment/locale/oc-lnc.js","./pa-in":"./node_modules/moment/locale/pa-in.js","./pa-in.js":"./node_modules/moment/locale/pa-in.js","./pl":"./node_modules/moment/locale/pl.js","./pl.js":"./node_modules/moment/locale/pl.js","./pt":"./node_modules/moment/locale/pt.js","./pt-br":"./node_modules/moment/locale/pt-br.js","./pt-br.js":"./node_modules/moment/locale/pt-br.js","./pt.js":"./node_modules/moment/locale/pt.js","./ro":"./node_modules/moment/locale/ro.js","./ro.js":"./node_modules/moment/locale/ro.js","./ru":"./node_modules/moment/locale/ru.js","./ru.js":"./node_modules/moment/locale/ru.js","./sd":"./node_modules/moment/locale/sd.js","./sd.js":"./node_modules/moment/locale/sd.js","./se":"./node_modules/moment/locale/se.js","./se.js":"./node_modules/moment/locale/se.js","./si":"./node_modules/moment/locale/si.js","./si.js":"./node_modules/moment/locale/si.js","./sk":"./node_modules/moment/locale/sk.js","./sk.js":"./node_modules/moment/locale/sk.js","./sl":"./node_modules/moment/locale/sl.js","./sl.js":"./node_modules/moment/locale/sl.js","./sq":"./node_modules/moment/locale/sq.js","./sq.js":"./node_modules/moment/locale/sq.js","./sr":"./node_modules/moment/locale/sr.js","./sr-cyrl":"./node_modules/moment/locale/sr-cyrl.js","./sr-cyrl.js":"./node_modules/moment/locale/sr-cyrl.js","./sr.js":"./node_modules/moment/locale/sr.js","./ss":"./node_modules/moment/locale/ss.js","./ss.js":"./node_modules/moment/locale/ss.js","./sv":"./node_modules/moment/locale/sv.js","./sv.js":"./node_modules/moment/locale/sv.js","./sw":"./node_modules/moment/locale/sw.js","./sw.js":"./node_modules/moment/locale/sw.js","./ta":"./node_modules/moment/locale/ta.js","./ta.js":"./node_modules/moment/locale/ta.js","./te":"./node_modules/moment/locale/te.js","./te.js":"./node_modules/moment/locale/te.js","./tet":"./node_modules/moment/locale/tet.js","./tet.js":"./node_modules/moment/locale/tet.js","./tg":"./node_modules/moment/locale/tg.js","./tg.js":"./node_modules/moment/locale/tg.js","./th":"./node_modules/moment/locale/th.js","./th.js":"./node_modules/moment/locale/th.js","./tk":"./node_modules/moment/locale/tk.js","./tk.js":"./node_modules/moment/locale/tk.js","./tl-ph":"./node_modules/moment/locale/tl-ph.js","./tl-ph.js":"./node_modules/moment/locale/tl-ph.js","./tlh":"./node_modules/moment/locale/tlh.js","./tlh.js":"./node_modules/moment/locale/tlh.js","./tr":"./node_modules/moment/locale/tr.js","./tr.js":"./node_modules/moment/locale/tr.js","./tzl":"./node_modules/moment/locale/tzl.js","./tzl.js":"./node_modules/moment/locale/tzl.js","./tzm":"./node_modules/moment/locale/tzm.js","./tzm-latn":"./node_modules/moment/locale/tzm-latn.js","./tzm-latn.js":"./node_modules/moment/locale/tzm-latn.js","./tzm.js":"./node_modules/moment/locale/tzm.js","./ug-cn":"./node_modules/moment/locale/ug-cn.js","./ug-cn.js":"./node_modules/moment/locale/ug-cn.js","./uk":"./node_modules/moment/locale/uk.js","./uk.js":"./node_modules/moment/locale/uk.js","./ur":"./node_modules/moment/locale/ur.js","./ur.js":"./node_modules/moment/locale/ur.js","./uz":"./node_modules/moment/locale/uz.js","./uz-latn":"./node_modules/moment/locale/uz-latn.js","./uz-latn.js":"./node_modules/moment/locale/uz-latn.js","./uz.js":"./node_modules/moment/locale/uz.js","./vi":"./node_modules/moment/locale/vi.js","./vi.js":"./node_modules/moment/locale/vi.js","./x-pseudo":"./node_modules/moment/locale/x-pseudo.js","./x-pseudo.js":"./node_modules/moment/locale/x-pseudo.js","./yo":"./node_modules/moment/locale/yo.js","./yo.js":"./node_modules/moment/locale/yo.js","./zh-cn":"./node_modules/moment/locale/zh-cn.js","./zh-cn.js":"./node_modules/moment/locale/zh-cn.js","./zh-hk":"./node_modules/moment/locale/zh-hk.js","./zh-hk.js":"./node_modules/moment/locale/zh-hk.js","./zh-mo":"./node_modules/moment/locale/zh-mo.js","./zh-mo.js":"./node_modules/moment/locale/zh-mo.js","./zh-tw":"./node_modules/moment/locale/zh-tw.js","./zh-tw.js":"./node_modules/moment/locale/zh-tw.js"};function webpackContext(req){var id=webpackContextResolve(req);return __webpack_require__(id)}function webpackContextResolve(req){if(!__webpack_require__.o(map,req)){var e=new Error("Cannot find module '"+req+"'");throw e.code="MODULE_NOT_FOUND",e}return map[req]}webpackContext.keys=function webpackContextKeys(){return Object.keys(map)},webpackContext.resolve=webpackContextResolve,module.exports=webpackContext,webpackContext.id="./node_modules/moment/locale sync recursive ^\\.\\/.*$"},"?2454":()=>{},"?6483":()=>{},"?bed2":()=>{},"?72ad":()=>{},"?a1bf":()=>{},"?14d6":()=>{},"?e42a":()=>{},"?9463":()=>{}}]); \ No newline at end of file diff --git a/iframe.html b/iframe.html index 2e81db03..4865a35f 100644 --- a/iframe.html +++ b/iframe.html @@ -348,7 +348,7 @@ window['DOCS_OPTIONS'] = {"defaultName":"Docs","autodocs":true};