From 2c4c7a6c25c5656f6498c555b1abaa2922bf1482 Mon Sep 17 00:00:00 2001 From: Prateek Jakhar Date: Mon, 5 Jun 2023 18:16:10 +0530 Subject: [PATCH] Adding transliteration to production (#145) * Style: fixed odia title (#104) * style: ui scroll bug on faq page * style: fixed odia title * Feat chat history (#106) fix: token authentication * Delete .env.production * UI changes (#112) * style: minor ui changes * fix: delete history page fix and flagsmith self hoasted added --------- Co-authored-by: Prateek Jakhar * fix: conversation id (#115) * fix: conversation id * Added down time page (#117) * Update ContextProvider.tsx (#118) * Feat dialer popup (#120) * added down time page * Update chat.tsx * Added Auth header (#122) * added down time page * added dialer popup * added auth in headers * Update chat.tsx * chore: msgId display for testing (#127) * chore: msgId display for testing * Feat dsply msg (#128) * fix: history not loading on refresh * chore: fixed userID bug (#130) * Feat fcm (#133) * feat: added fcm --------- Co-authored-by: Saiyan Abhishek <74703491+geeky-abhishek@users.noreply.github.com> * fix: update in conversation api (#135) * fix: added firebase event for msg delay (#136) * fix: flagsmith init inside useeffect (#140) * fix: flagsmith init inside useeffect * added flagsmith cloud --------- Co-authored-by: Prateek Jakhar * Added query log and splash screen log (#143) * Feat trans (#134) * feat: mic button working * feat: audio to speech added * chore: ui changes * chore: ui changes * feat: speech to text added to chat ui * added flagsmith for model ids * feat: transliteration added * style: changed translate to transliterate * style: changed translate text to transliterate * feat: added eng dictionary * feat: added eng dictionary * added flagsmith cloud * added conv. api change * chore: removed dictionary, now transliterating every msg * fix: transliteration added in or only * fix: added transliteration only on or lang * minor ui changes * minor ui changes --------- Co-authored-by: Saiyan Abhishek <74703491+geeky-abhishek@users.noreply.github.com> --------- Co-authored-by: Saiyan Abhishek <74703491+geeky-abhishek@users.noreply.github.com> --- apps/amakrushi/package.json | 1 + .../src/components/HomePage/index.module.css | 1 + .../src/components/HomePage/index.tsx | 119 +++-- .../PhoneView/ChatWindow/ChatUiWindow.tsx | 121 +++-- .../src/components/down-time-page/index.tsx | 3 +- .../amakrushi/src/context/ContextProvider.tsx | 3 + apps/amakrushi/src/pages/_app.tsx | 26 +- apps/amakrushi/src/pages/index.tsx | 2 + package-lock.json | 472 ++++++++++++++++++ packages/chat-ui/dist/index.js | 2 +- packages/chat-ui/es/components/Chat/index.js | 6 +- .../chat-ui/es/components/Composer/index.js | 6 +- packages/chat-ui/lib/components/Chat/index.js | 6 +- .../chat-ui/lib/components/Composer/index.js | 6 +- .../chat-ui/src/components/Chat/index.tsx | 12 +- .../chat-ui/src/components/Composer/index.tsx | 9 +- turbo.json | 1 + yarn.lock | 184 ++++++- 18 files changed, 865 insertions(+), 115 deletions(-) diff --git a/apps/amakrushi/package.json b/apps/amakrushi/package.json index ec4d93c9..57c4360d 100644 --- a/apps/amakrushi/package.json +++ b/apps/amakrushi/package.json @@ -16,6 +16,7 @@ "@emotion/react": "^11.7.1", "@emotion/styled": "^11.6.0", "@magicbell/magicbell-react": "^8.5.3", + "@material-ui/core": "^4.12.4", "@next/bundle-analyzer": "^13.3.0", "@storybook/react": "^6.5.9", "@testing-library/jest-dom": "^5.16.2", diff --git a/apps/amakrushi/src/components/HomePage/index.module.css b/apps/amakrushi/src/components/HomePage/index.module.css index 081b6dc1..dd4a9112 100644 --- a/apps/amakrushi/src/components/HomePage/index.module.css +++ b/apps/amakrushi/src/components/HomePage/index.module.css @@ -79,3 +79,4 @@ border-radius: 40px !important; background-color: var(--secondarygreen) !important; } + diff --git a/apps/amakrushi/src/components/HomePage/index.tsx b/apps/amakrushi/src/components/HomePage/index.tsx index 610583da..a87396ab 100644 --- a/apps/amakrushi/src/components/HomePage/index.tsx +++ b/apps/amakrushi/src/components/HomePage/index.tsx @@ -1,35 +1,36 @@ -import styles from './index.module.css'; +import styles from "./index.module.css"; import React, { useCallback, useContext, useEffect, useMemo, useState, -} from 'react'; -import { NextPage } from 'next'; - +} from "react"; +import { NextPage } from "next"; +import axios from "axios"; //@ts-ignore -import { analytics } from '../../utils/firebase'; -import { logEvent } from 'firebase/analytics'; -import Menu from '../menu'; -import { getInitialMsgs } from '../../utils/textUtility'; -import { AppContext } from '../../context'; -import RightIcon from '../../assets/icons/right'; -import sunIcon from '../../assets/icons/sun.svg'; -import reloadIcon from '../../assets/icons/reload.svg'; -import { useLocalization } from '../../hooks'; -import router from 'next/router'; -import Image from 'next/image'; -import { Button } from '@chakra-ui/react'; -import toast from 'react-hot-toast'; -import { v4 as uuidv4 } from 'uuid'; +import { analytics } from "../../utils/firebase"; +import { logEvent } from "firebase/analytics"; +import Menu from "../menu"; +import { getInitialMsgs } from "../../utils/textUtility"; +import { AppContext } from "../../context"; + +import RightIcon from "../../assets/icons/right"; +import sunIcon from "../../assets/icons/sun.svg"; +import reloadIcon from "../../assets/icons/reload.svg"; +import { useLocalization } from "../../hooks"; +import router from "next/router"; +import Image from "next/image"; +import { Button } from "@chakra-ui/react"; +import toast from "react-hot-toast"; +import { v4 as uuidv4 } from "uuid"; const HomePage: NextPage = () => { const context = useContext(AppContext); const t = useLocalization(); - const placeholder = useMemo(() => t('message.ask_ur_question'), [t]); + const placeholder = useMemo(() => t("message.ask_ur_question"), [t]); const [messages, setMessages] = useState>([getInitialMsgs(t)]); - const [inputMsg, setInputMsg] = useState(''); + const [inputMsg, setInputMsg] = useState(""); useEffect(() => { setMessages([getInitialMsgs(t)]); @@ -37,32 +38,74 @@ const HomePage: NextPage = () => { useEffect(() => { //@ts-ignore - logEvent(analytics, 'Home_page'); + logEvent(analytics, "Home_page"); context?.fetchIsDown(); // check if server is down - if(!sessionStorage.getItem('conversationId')){ - const newConversationId = uuidv4(); - sessionStorage.setItem('conversationId', newConversationId); - context?.setConversationId(newConversationId); - } - // eslint-disable-next-line react-hooks/exhaustive-deps + if (!sessionStorage.getItem("conversationId")) { + const newConversationId = uuidv4(); + sessionStorage.setItem("conversationId", newConversationId); + context?.setConversationId(newConversationId); + } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const sendMessage = useCallback( - (msg: string) => { + async (msg: string) => { if (msg.length === 0) { - toast.error(t('error.empty_msg')); + toast.error(t("error.empty_msg")); return; } - if (context?.socketSession && context?.newSocket?.connected) { - console.log('clearing mssgs'); - context?.setMessages([]); - router.push('/chat'); - context?.sendMessage(msg); - } else { - toast.error(t('error.disconnected')); - return; + try { + if (!(localStorage.getItem("locale") === "en")) { + const words = msg.split(" "); + // Call transliteration API + const input = words.map((word) => ({ + source: word, + })); + + const response = await axios.post( + "https://meity-auth.ulcacontrib.org/ulca/apis/v0/model/compute", + { + modelId: process.env.NEXT_PUBLIC_TRANSLITERATION_MODELID, + task: "transliteration", + input: input, + }, + { + headers: { + "Content-Type": "application/json", + }, + } + ); + console.log("transliterated msg: ", response.data.output); + const transliteratedArray = []; + for (const element of response.data.output) { + transliteratedArray.push(element?.target?.[0]); + } + + if (context?.socketSession && context?.newSocket?.connected) { + console.log("clearing mssgs"); + context?.setMessages([]); + router.push("/chat"); + context?.sendMessage(transliteratedArray.join(" ")); + } else { + toast.error(t("error.disconnected")); + return; + } + } else { + if (context?.socketSession && context?.newSocket?.connected) { + console.log("clearing mssgs"); + context?.setMessages([]); + router.push("/chat"); + context?.sendMessage(msg); + } else { + toast.error(t("error.disconnected")); + return; + } + + } + } catch (error) { + console.error(error); } }, [context, t] @@ -112,7 +155,7 @@ const HomePage: NextPage = () => { type="submit" onClick={() => sendMessage(inputMsg)} className={styles.sendButton}> - {t('label.send')} + {t("label.send")} diff --git a/apps/amakrushi/src/components/PhoneView/ChatWindow/ChatUiWindow.tsx b/apps/amakrushi/src/components/PhoneView/ChatWindow/ChatUiWindow.tsx index 48c0f7e7..e61959ad 100644 --- a/apps/amakrushi/src/components/PhoneView/ChatWindow/ChatUiWindow.tsx +++ b/apps/amakrushi/src/components/PhoneView/ChatWindow/ChatUiWindow.tsx @@ -1,6 +1,6 @@ -import axios from 'axios'; +import axios from "axios"; //@ts-ignore -import Chat from 'chatui'; +import Chat from "chatui"; import React, { ReactElement, useCallback, @@ -8,46 +8,48 @@ import React, { useEffect, useMemo, useState, -} from 'react'; -import { analytics } from '../../../utils/firebase'; -import { logEvent } from 'firebase/analytics'; -import { AppContext } from '../../../context'; -import { useLocalization } from '../../../hooks'; -import { getMsgType } from '../../../utils/getMsgType'; -import ChatMessageItem from '../../chat-message-item'; -import { v4 as uuidv4 } from 'uuid'; -import DownTimePage from '../../down-time-page'; +} from "react"; +import { analytics } from "../../../utils/firebase"; +import { logEvent } from "firebase/analytics"; +import { AppContext } from "../../../context"; +import { useLocalization } from "../../../hooks"; +import { getMsgType } from "../../../utils/getMsgType"; +import ChatMessageItem from "../../chat-message-item"; +import { v4 as uuidv4 } from "uuid"; +import toast from "react-hot-toast"; +import DownTimePage from "../../down-time-page"; const ChatUiWindow: React.FC = () => { const t = useLocalization(); - const context = useContext(AppContext); + const context = useContext(AppContext); useEffect(() => { const fetchData = async () => { try { await context?.fetchIsDown(); if(!context?.isDown){ - const chatHistory = await axios.get( `${ process.env.NEXT_PUBLIC_BASE_URL - }/user/chathistory/${sessionStorage.getItem('conversationId')}`, + }/user/chathistory/${sessionStorage.getItem("conversationId")}`, { headers: { - authorization: `Bearer ${localStorage.getItem('auth')}`, + authorization: `Bearer ${localStorage.getItem("auth")}`, }, } ); + console.log("ghji:",chatHistory) console.log('history:', chatHistory.data); + const normalizedChats = normalizedChat(chatHistory.data); if (normalizedChats.length > 0) { context?.setMessages(normalizedChats); } } - } catch (error:any) { + } catch (error: any) { //@ts-ignore - logEvent(analytics, 'console_error', { + logEvent(analytics, "console_error", { error_message: error.message, }); } @@ -61,23 +63,23 @@ const ChatUiWindow: React.FC = () => { const normalizedChat = (chats: any): any => { - console.log('in normalized'); - const conversationId = sessionStorage.getItem('conversationId'); + console.log("in normalized"); + const conversationId = sessionStorage.getItem("conversationId"); const history = chats .filter( (item: any) => - conversationId === 'null' || item.conversationId === conversationId + conversationId === "null" || item.conversationId === conversationId ) .flatMap((item: any) => [ { text: item.query, - position: 'right', + position: "right", repliedTimestamp: item.createdAt, messageId: uuidv4(), }, { text: item.response, - position: 'left', + position: "left", sentTimestamp: item.createdAt, reaction: item.reaction, msgId: item.id, @@ -85,52 +87,95 @@ const ChatUiWindow: React.FC = () => { }, ]); - console.log('historyyy', history); - console.log('history length:', history.length); + console.log("historyyy", history); + console.log("history length:", history.length); return history; }; const handleSend = useCallback( - (type: string, val: any) => { - console.log('mssgs:', context?.messages); - if (type === 'text' && val.trim()) { - context?.sendMessage(val.trim()); + async (type: string, msg: any) => { + if (msg.length === 0) { + toast.error(t("error.empty_msg")); + return; + } + console.log("mssgs:", context?.messages); + try { + if (!(localStorage.getItem("locale") === "en")) { + const words = msg.split(" "); + // Call transliteration API + const input = words.map((word: string) => ({ + source: word, + })); + + const response = await axios.post( + "https://meity-auth.ulcacontrib.org/ulca/apis/v0/model/compute", + { + modelId: process.env.NEXT_PUBLIC_TRANSLITERATION_MODELID, + task: "transliteration", + input: input, + }, + { + headers: { + "Content-Type": "application/json", + }, + } + ); + console.log("transliterated msg: ", response.data.output); + const transliteratedArray = []; + for (const element of response.data.output) { + transliteratedArray.push(element?.target?.[0]); + } + + if (context?.socketSession && context?.newSocket?.connected) { + context?.sendMessage(transliteratedArray.join(" ")); + } else { + toast.error(t("error.disconnected")); + return; + } + } else { + if (type === "text" && msg.trim()) { + context?.sendMessage(msg.trim()); + } + } + } catch (error) { + console.error(error); } }, - [context] + [context, t] ); const normalizeMsgs = useMemo( () => context?.messages?.map((msg: any) => ({ type: getMsgType(msg), content: { text: msg?.text, data: { ...msg } }, - position: msg?.position ?? 'right', + position: msg?.position ?? "right", })), [context?.messages] ); - + console.log("fghj:", { messages: context?.messages }); const msgToRender = useMemo(() => { return context?.isMsgReceiving ? [ ...normalizeMsgs, { - type: 'loader', - position: 'left', - botUuid: '1', + type: "loader", + position: "left", + botUuid: "1", }, ] : normalizeMsgs; }, [context?.isMsgReceiving, normalizeMsgs]); - console.log('debug:', { msgToRender }); + console.log("debug:", { msgToRender }); + + const placeholder = useMemo(() => t("message.ask_ur_question"), [t]); - const placeholder = useMemo(() => t('message.ask_ur_question'), [t]); if (context?.isDown) { return ; } else return ( -
+
{ ); }; -export default ChatUiWindow; \ No newline at end of file +export default ChatUiWindow; diff --git a/apps/amakrushi/src/components/down-time-page/index.tsx b/apps/amakrushi/src/components/down-time-page/index.tsx index 8c192b56..d3477046 100644 --- a/apps/amakrushi/src/components/down-time-page/index.tsx +++ b/apps/amakrushi/src/components/down-time-page/index.tsx @@ -27,4 +27,5 @@ function DownTimePage() { ); } -export default DownTimePage; \ No newline at end of file +export default DownTimePage; + diff --git a/apps/amakrushi/src/context/ContextProvider.tsx b/apps/amakrushi/src/context/ContextProvider.tsx index 4d3f9b7d..c03c0ae7 100644 --- a/apps/amakrushi/src/context/ContextProvider.tsx +++ b/apps/amakrushi/src/context/ContextProvider.tsx @@ -121,11 +121,14 @@ const ContextProvider: FC<{ //@ts-ignore if (conversationId === msg?.content?.conversationId) setMessages((prev: any) => _.uniq([...prev, newMsg], ['messageId'])); + } }, [conversationId] ); + console.log("erty:",{conversationId}) + const onMessageReceived = useCallback( (msg: any): void => { console.log('mssgs:', messages); diff --git a/apps/amakrushi/src/pages/_app.tsx b/apps/amakrushi/src/pages/_app.tsx index c883b7d4..9f78f1f4 100644 --- a/apps/amakrushi/src/pages/_app.tsx +++ b/apps/amakrushi/src/pages/_app.tsx @@ -46,10 +46,6 @@ const App = ({ const [flagsmithState, setflagsmithState] = useState(null); - const [flagsmithState, setflagsmithState] = useState(null) - - - useEffect(() => { const isEventLogged = sessionStorage.getItem('isSplashScreenLogged'); if (!isEventLogged) { @@ -65,25 +61,6 @@ const App = ({ - useEffect(() =>{ - const getFlagSmithState =async ()=>{ - await flagsmith.init({ - // api: process.env.NEXT_PUBLIC_FLAGSMITH_API, - environmentID: process.env.NEXT_PUBLIC_ENVIRONMENT_ID || '', - }) - if(flagsmith.getState()) - { - //@ts-ignore - setflagsmithState(flagsmith.getState()) - } - } - getFlagSmithState() - - },[]) - - - - useEffect(() =>{ const getFlagSmithState =async ()=>{ await flagsmith.init({ @@ -208,5 +185,4 @@ const App = ({ // return { flagsmithState: flagsmith.getState() }; // }; - -export default App; +export default App; \ No newline at end of file diff --git a/apps/amakrushi/src/pages/index.tsx b/apps/amakrushi/src/pages/index.tsx index bf0fa003..88a1a221 100644 --- a/apps/amakrushi/src/pages/index.tsx +++ b/apps/amakrushi/src/pages/index.tsx @@ -6,6 +6,7 @@ import { useLocalization } from "../hooks/useLocalization"; import HomePage from "../components/HomePage"; import { useContext, useEffect } from "react"; import { AppContext } from "../context"; +import DownTimePage from "../components/down-time-page"; const Home: NextPage = () => { const t = useLocalization(); @@ -36,6 +37,7 @@ const Home: NextPage = () => { }} > + {/* */}
diff --git a/package-lock.json b/package-lock.json index 5a326e3b..2aec70d5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,6 +30,7 @@ "@emotion/react": "^11.7.1", "@emotion/styled": "^11.6.0", "@magicbell/magicbell-react": "^8.5.3", + "@material-ui/core": "^4.12.4", "@next/bundle-analyzer": "^13.3.0", "@storybook/react": "^6.5.9", "@testing-library/jest-dom": "^5.16.2", @@ -37,6 +38,7 @@ "@testing-library/user-event": "^12.8.3", "@types/jest": "^25.2.3", "@types/node": "^12.20.46", + "audio-react-recorder": "^1.0.4", "axios": "^1.3.5", "bootstrap": "^5.1.3", "chatui": "*", @@ -7617,6 +7619,157 @@ "version": "1.10.8", "license": "MIT" }, + "node_modules/@material-ui/core": { + "version": "4.12.4", + "resolved": "https://registry.npmjs.org/@material-ui/core/-/core-4.12.4.tgz", + "integrity": "sha512-tr7xekNlM9LjA6pagJmL8QCgZXaubWUwkJnoYcMKd4gw/t4XiyvnTkjdGrUVicyB2BsdaAv1tvow45bPM4sSwQ==", + "deprecated": "Material UI v4 doesn't receive active development since September 2021. See the guide https://mui.com/material-ui/migration/migration-v4/ to upgrade to v5.", + "dependencies": { + "@babel/runtime": "^7.4.4", + "@material-ui/styles": "^4.11.5", + "@material-ui/system": "^4.12.2", + "@material-ui/types": "5.1.0", + "@material-ui/utils": "^4.11.3", + "@types/react-transition-group": "^4.2.0", + "clsx": "^1.0.4", + "hoist-non-react-statics": "^3.3.2", + "popper.js": "1.16.1-lts", + "prop-types": "^15.7.2", + "react-is": "^16.8.0 || ^17.0.0", + "react-transition-group": "^4.4.0" + }, + "engines": { + "node": ">=8.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/material-ui" + }, + "peerDependencies": { + "@types/react": "^16.8.6 || ^17.0.0", + "react": "^16.8.0 || ^17.0.0", + "react-dom": "^16.8.0 || ^17.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@material-ui/styles": { + "version": "4.11.5", + "resolved": "https://registry.npmjs.org/@material-ui/styles/-/styles-4.11.5.tgz", + "integrity": "sha512-o/41ot5JJiUsIETME9wVLAJrmIWL3j0R0Bj2kCOLbSfqEkKf0fmaPt+5vtblUh5eXr2S+J/8J3DaCb10+CzPGA==", + "deprecated": "Material UI v4 doesn't receive active development since September 2021. See the guide https://mui.com/material-ui/migration/migration-v4/ to upgrade to v5.", + "dependencies": { + "@babel/runtime": "^7.4.4", + "@emotion/hash": "^0.8.0", + "@material-ui/types": "5.1.0", + "@material-ui/utils": "^4.11.3", + "clsx": "^1.0.4", + "csstype": "^2.5.2", + "hoist-non-react-statics": "^3.3.2", + "jss": "^10.5.1", + "jss-plugin-camel-case": "^10.5.1", + "jss-plugin-default-unit": "^10.5.1", + "jss-plugin-global": "^10.5.1", + "jss-plugin-nested": "^10.5.1", + "jss-plugin-props-sort": "^10.5.1", + "jss-plugin-rule-value-function": "^10.5.1", + "jss-plugin-vendor-prefixer": "^10.5.1", + "prop-types": "^15.7.2" + }, + "engines": { + "node": ">=8.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/material-ui" + }, + "peerDependencies": { + "@types/react": "^16.8.6 || ^17.0.0", + "react": "^16.8.0 || ^17.0.0", + "react-dom": "^16.8.0 || ^17.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@material-ui/styles/node_modules/@emotion/hash": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz", + "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==" + }, + "node_modules/@material-ui/styles/node_modules/csstype": { + "version": "2.6.21", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.21.tgz", + "integrity": "sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==" + }, + "node_modules/@material-ui/system": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@material-ui/system/-/system-4.12.2.tgz", + "integrity": "sha512-6CSKu2MtmiJgcCGf6nBQpM8fLkuB9F55EKfbdTC80NND5wpTmKzwdhLYLH3zL4cLlK0gVaaltW7/wMuyTnN0Lw==", + "dependencies": { + "@babel/runtime": "^7.4.4", + "@material-ui/utils": "^4.11.3", + "csstype": "^2.5.2", + "prop-types": "^15.7.2" + }, + "engines": { + "node": ">=8.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/material-ui" + }, + "peerDependencies": { + "@types/react": "^16.8.6 || ^17.0.0", + "react": "^16.8.0 || ^17.0.0", + "react-dom": "^16.8.0 || ^17.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@material-ui/system/node_modules/csstype": { + "version": "2.6.21", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.21.tgz", + "integrity": "sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==" + }, + "node_modules/@material-ui/types": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@material-ui/types/-/types-5.1.0.tgz", + "integrity": "sha512-7cqRjrY50b8QzRSYyhSpx4WRw2YuO0KKIGQEVk5J8uoz2BanawykgZGoWEqKm7pVIbzFDN0SpPcVV4IhOFkl8A==", + "peerDependencies": { + "@types/react": "*" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@material-ui/utils": { + "version": "4.11.3", + "resolved": "https://registry.npmjs.org/@material-ui/utils/-/utils-4.11.3.tgz", + "integrity": "sha512-ZuQPV4rBK/V1j2dIkSSEcH5uT6AaHuKWFfotADHsC0wVL1NLd2WkFCm4ZZbX33iO4ydl6V0GPngKm8HZQ2oujg==", + "dependencies": { + "@babel/runtime": "^7.4.4", + "prop-types": "^15.7.2", + "react-is": "^16.8.0 || ^17.0.0" + }, + "engines": { + "node": ">=8.0.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0", + "react-dom": "^16.8.0 || ^17.0.0" + } + }, "node_modules/@mdn/browser-compat-data": { "version": "5.2.48", "dev": true, @@ -18312,6 +18465,20 @@ "node": ">= 4.5.0" } }, + "node_modules/audio-react-recorder": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/audio-react-recorder/-/audio-react-recorder-1.0.4.tgz", + "integrity": "sha512-an7eX0yOGDbZOSu2LvnfWIsI41pkx9nXgtBVbI+9ByS91WKqoVGVb5pbmqHax5sZty2DjOIG/neuxcghIU/ucg==", + "dependencies": { + "prop-types": "^15.7.2" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "react": "^16.0.0" + } + }, "node_modules/autoprefixer": { "version": "10.4.14", "funding": [ @@ -22036,6 +22203,15 @@ "node": ">=0.10.0" } }, + "node_modules/css-vendor": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/css-vendor/-/css-vendor-2.0.8.tgz", + "integrity": "sha512-x9Aq0XTInxrkuFeHKbYC7zWY8ai7qJ04Kxd9MnvbC1uO5DagxoHQjm4JvG+vCdXOoFtCjbL2XSZfxmoYa9uQVQ==", + "dependencies": { + "@babel/runtime": "^7.8.3", + "is-in-browser": "^1.0.2" + } + }, "node_modules/css-what": { "version": "6.1.0", "license": "BSD-2-Clause", @@ -28130,6 +28306,11 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/is-in-browser": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/is-in-browser/-/is-in-browser-1.1.3.tgz", + "integrity": "sha512-FeXIBgG/CPGd/WUxuEyvgGTEfwiG9Z4EKGxjNMRqviiIIfsmgrpnHLffEDdwUHqNva1VEW91o3xBT/m8Elgl9g==" + }, "node_modules/is-installed-globally": { "version": "0.4.0", "dev": true, @@ -31757,6 +31938,88 @@ "verror": "1.10.0" } }, + "node_modules/jss": { + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/jss/-/jss-10.10.0.tgz", + "integrity": "sha512-cqsOTS7jqPsPMjtKYDUpdFC0AbhYFLTcuGRqymgmdJIeQ8cH7+AgX7YSgQy79wXloZq2VvATYxUOUQEvS1V/Zw==", + "dependencies": { + "@babel/runtime": "^7.3.1", + "csstype": "^3.0.2", + "is-in-browser": "^1.1.3", + "tiny-warning": "^1.0.2" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/jss" + } + }, + "node_modules/jss-plugin-camel-case": { + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/jss-plugin-camel-case/-/jss-plugin-camel-case-10.10.0.tgz", + "integrity": "sha512-z+HETfj5IYgFxh1wJnUAU8jByI48ED+v0fuTuhKrPR+pRBYS2EDwbusU8aFOpCdYhtRc9zhN+PJ7iNE8pAWyPw==", + "dependencies": { + "@babel/runtime": "^7.3.1", + "hyphenate-style-name": "^1.0.3", + "jss": "10.10.0" + } + }, + "node_modules/jss-plugin-default-unit": { + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/jss-plugin-default-unit/-/jss-plugin-default-unit-10.10.0.tgz", + "integrity": "sha512-SvpajxIECi4JDUbGLefvNckmI+c2VWmP43qnEy/0eiwzRUsafg5DVSIWSzZe4d2vFX1u9nRDP46WCFV/PXVBGQ==", + "dependencies": { + "@babel/runtime": "^7.3.1", + "jss": "10.10.0" + } + }, + "node_modules/jss-plugin-global": { + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/jss-plugin-global/-/jss-plugin-global-10.10.0.tgz", + "integrity": "sha512-icXEYbMufiNuWfuazLeN+BNJO16Ge88OcXU5ZDC2vLqElmMybA31Wi7lZ3lf+vgufRocvPj8443irhYRgWxP+A==", + "dependencies": { + "@babel/runtime": "^7.3.1", + "jss": "10.10.0" + } + }, + "node_modules/jss-plugin-nested": { + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/jss-plugin-nested/-/jss-plugin-nested-10.10.0.tgz", + "integrity": "sha512-9R4JHxxGgiZhurDo3q7LdIiDEgtA1bTGzAbhSPyIOWb7ZubrjQe8acwhEQ6OEKydzpl8XHMtTnEwHXCARLYqYA==", + "dependencies": { + "@babel/runtime": "^7.3.1", + "jss": "10.10.0", + "tiny-warning": "^1.0.2" + } + }, + "node_modules/jss-plugin-props-sort": { + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/jss-plugin-props-sort/-/jss-plugin-props-sort-10.10.0.tgz", + "integrity": "sha512-5VNJvQJbnq/vRfje6uZLe/FyaOpzP/IH1LP+0fr88QamVrGJa0hpRRyAa0ea4U/3LcorJfBFVyC4yN2QC73lJg==", + "dependencies": { + "@babel/runtime": "^7.3.1", + "jss": "10.10.0" + } + }, + "node_modules/jss-plugin-rule-value-function": { + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.10.0.tgz", + "integrity": "sha512-uEFJFgaCtkXeIPgki8ICw3Y7VMkL9GEan6SqmT9tqpwM+/t+hxfMUdU4wQ0MtOiMNWhwnckBV0IebrKcZM9C0g==", + "dependencies": { + "@babel/runtime": "^7.3.1", + "jss": "10.10.0", + "tiny-warning": "^1.0.2" + } + }, + "node_modules/jss-plugin-vendor-prefixer": { + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.10.0.tgz", + "integrity": "sha512-UY/41WumgjW8r1qMCO8l1ARg7NHnfRVWRhZ2E2m0DMYsr2DD91qIXLyNhiX83hHswR7Wm4D+oDYNC1zWCJWtqg==", + "dependencies": { + "@babel/runtime": "^7.3.1", + "css-vendor": "^2.0.8", + "jss": "10.10.0" + } + }, "node_modules/jsx-ast-utils": { "version": "3.3.3", "license": "MIT", @@ -37111,6 +37374,11 @@ "tslib": "^2.1.0" } }, + "node_modules/popper.js": { + "version": "1.16.1-lts", + "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1-lts.tgz", + "integrity": "sha512-Kjw8nKRl1m+VrSFCoVGPph93W/qrSO7ZkqPpTf7F4bk/sqcfWK019dWBUpE/fBOsOQY1dks/Bmcbfn1heM/IsA==" + }, "node_modules/posix-character-classes": { "version": "0.1.1", "dev": true, @@ -43351,6 +43619,11 @@ "version": "1.3.1", "license": "MIT" }, + "node_modules/tiny-warning": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", + "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==" + }, "node_modules/tinycolor2": { "version": "1.6.0", "license": "MIT" @@ -52877,6 +53150,93 @@ } } }, + "@material-ui/core": { + "version": "4.12.4", + "resolved": "https://registry.npmjs.org/@material-ui/core/-/core-4.12.4.tgz", + "integrity": "sha512-tr7xekNlM9LjA6pagJmL8QCgZXaubWUwkJnoYcMKd4gw/t4XiyvnTkjdGrUVicyB2BsdaAv1tvow45bPM4sSwQ==", + "requires": { + "@babel/runtime": "^7.4.4", + "@material-ui/styles": "^4.11.5", + "@material-ui/system": "^4.12.2", + "@material-ui/types": "5.1.0", + "@material-ui/utils": "^4.11.3", + "@types/react-transition-group": "^4.2.0", + "clsx": "^1.0.4", + "hoist-non-react-statics": "^3.3.2", + "popper.js": "1.16.1-lts", + "prop-types": "^15.7.2", + "react-is": "^16.8.0 || ^17.0.0", + "react-transition-group": "^4.4.0" + } + }, + "@material-ui/styles": { + "version": "4.11.5", + "resolved": "https://registry.npmjs.org/@material-ui/styles/-/styles-4.11.5.tgz", + "integrity": "sha512-o/41ot5JJiUsIETME9wVLAJrmIWL3j0R0Bj2kCOLbSfqEkKf0fmaPt+5vtblUh5eXr2S+J/8J3DaCb10+CzPGA==", + "requires": { + "@babel/runtime": "^7.4.4", + "@emotion/hash": "^0.8.0", + "@material-ui/types": "5.1.0", + "@material-ui/utils": "^4.11.3", + "clsx": "^1.0.4", + "csstype": "^2.5.2", + "hoist-non-react-statics": "^3.3.2", + "jss": "^10.5.1", + "jss-plugin-camel-case": "^10.5.1", + "jss-plugin-default-unit": "^10.5.1", + "jss-plugin-global": "^10.5.1", + "jss-plugin-nested": "^10.5.1", + "jss-plugin-props-sort": "^10.5.1", + "jss-plugin-rule-value-function": "^10.5.1", + "jss-plugin-vendor-prefixer": "^10.5.1", + "prop-types": "^15.7.2" + }, + "dependencies": { + "@emotion/hash": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz", + "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==" + }, + "csstype": { + "version": "2.6.21", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.21.tgz", + "integrity": "sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==" + } + } + }, + "@material-ui/system": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@material-ui/system/-/system-4.12.2.tgz", + "integrity": "sha512-6CSKu2MtmiJgcCGf6nBQpM8fLkuB9F55EKfbdTC80NND5wpTmKzwdhLYLH3zL4cLlK0gVaaltW7/wMuyTnN0Lw==", + "requires": { + "@babel/runtime": "^7.4.4", + "@material-ui/utils": "^4.11.3", + "csstype": "^2.5.2", + "prop-types": "^15.7.2" + }, + "dependencies": { + "csstype": { + "version": "2.6.21", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.21.tgz", + "integrity": "sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==" + } + } + }, + "@material-ui/types": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@material-ui/types/-/types-5.1.0.tgz", + "integrity": "sha512-7cqRjrY50b8QzRSYyhSpx4WRw2YuO0KKIGQEVk5J8uoz2BanawykgZGoWEqKm7pVIbzFDN0SpPcVV4IhOFkl8A==" + }, + "@material-ui/utils": { + "version": "4.11.3", + "resolved": "https://registry.npmjs.org/@material-ui/utils/-/utils-4.11.3.tgz", + "integrity": "sha512-ZuQPV4rBK/V1j2dIkSSEcH5uT6AaHuKWFfotADHsC0wVL1NLd2WkFCm4ZZbX33iO4ydl6V0GPngKm8HZQ2oujg==", + "requires": { + "@babel/runtime": "^7.4.4", + "prop-types": "^15.7.2", + "react-is": "^16.8.0 || ^17.0.0" + } + }, "@mdn/browser-compat-data": { "version": "5.2.48", "dev": true @@ -59955,6 +60315,7 @@ "@emotion/react": "^11.7.1", "@emotion/styled": "^11.6.0", "@magicbell/magicbell-react": "^8.5.3", + "@material-ui/core": "^4.12.4", "@next/bundle-analyzer": "^13.3.0", "@storybook/addon-actions": "^6.4.19", "@storybook/addon-essentials": "^6.4.19", @@ -59976,6 +60337,7 @@ "@types/react-dom": "^18.0.5", "@types/underscore": "^1.11.4", "@types/uuid": "^9.0.1", + "audio-react-recorder": "^1.0.4", "axios": "^1.3.5", "bootstrap": "^5.1.3", "chatui": "*", @@ -60347,6 +60709,14 @@ "version": "2.1.2", "dev": true }, + "audio-react-recorder": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/audio-react-recorder/-/audio-react-recorder-1.0.4.tgz", + "integrity": "sha512-an7eX0yOGDbZOSu2LvnfWIsI41pkx9nXgtBVbI+9ByS91WKqoVGVb5pbmqHax5sZty2DjOIG/neuxcghIU/ucg==", + "requires": { + "prop-types": "^15.7.2" + } + }, "autoprefixer": { "version": "10.4.14", "requires": { @@ -63615,6 +63985,15 @@ } } }, + "css-vendor": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/css-vendor/-/css-vendor-2.0.8.tgz", + "integrity": "sha512-x9Aq0XTInxrkuFeHKbYC7zWY8ai7qJ04Kxd9MnvbC1uO5DagxoHQjm4JvG+vCdXOoFtCjbL2XSZfxmoYa9uQVQ==", + "requires": { + "@babel/runtime": "^7.8.3", + "is-in-browser": "^1.0.2" + } + }, "css-what": { "version": "6.1.0" }, @@ -67961,6 +68340,11 @@ "version": "1.0.4", "dev": true }, + "is-in-browser": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/is-in-browser/-/is-in-browser-1.1.3.tgz", + "integrity": "sha512-FeXIBgG/CPGd/WUxuEyvgGTEfwiG9Z4EKGxjNMRqviiIIfsmgrpnHLffEDdwUHqNva1VEW91o3xBT/m8Elgl9g==" + }, "is-installed-globally": { "version": "0.4.0", "dev": true, @@ -70527,6 +70911,84 @@ "verror": "1.10.0" } }, + "jss": { + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/jss/-/jss-10.10.0.tgz", + "integrity": "sha512-cqsOTS7jqPsPMjtKYDUpdFC0AbhYFLTcuGRqymgmdJIeQ8cH7+AgX7YSgQy79wXloZq2VvATYxUOUQEvS1V/Zw==", + "requires": { + "@babel/runtime": "^7.3.1", + "csstype": "^3.0.2", + "is-in-browser": "^1.1.3", + "tiny-warning": "^1.0.2" + } + }, + "jss-plugin-camel-case": { + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/jss-plugin-camel-case/-/jss-plugin-camel-case-10.10.0.tgz", + "integrity": "sha512-z+HETfj5IYgFxh1wJnUAU8jByI48ED+v0fuTuhKrPR+pRBYS2EDwbusU8aFOpCdYhtRc9zhN+PJ7iNE8pAWyPw==", + "requires": { + "@babel/runtime": "^7.3.1", + "hyphenate-style-name": "^1.0.3", + "jss": "10.10.0" + } + }, + "jss-plugin-default-unit": { + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/jss-plugin-default-unit/-/jss-plugin-default-unit-10.10.0.tgz", + "integrity": "sha512-SvpajxIECi4JDUbGLefvNckmI+c2VWmP43qnEy/0eiwzRUsafg5DVSIWSzZe4d2vFX1u9nRDP46WCFV/PXVBGQ==", + "requires": { + "@babel/runtime": "^7.3.1", + "jss": "10.10.0" + } + }, + "jss-plugin-global": { + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/jss-plugin-global/-/jss-plugin-global-10.10.0.tgz", + "integrity": "sha512-icXEYbMufiNuWfuazLeN+BNJO16Ge88OcXU5ZDC2vLqElmMybA31Wi7lZ3lf+vgufRocvPj8443irhYRgWxP+A==", + "requires": { + "@babel/runtime": "^7.3.1", + "jss": "10.10.0" + } + }, + "jss-plugin-nested": { + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/jss-plugin-nested/-/jss-plugin-nested-10.10.0.tgz", + "integrity": "sha512-9R4JHxxGgiZhurDo3q7LdIiDEgtA1bTGzAbhSPyIOWb7ZubrjQe8acwhEQ6OEKydzpl8XHMtTnEwHXCARLYqYA==", + "requires": { + "@babel/runtime": "^7.3.1", + "jss": "10.10.0", + "tiny-warning": "^1.0.2" + } + }, + "jss-plugin-props-sort": { + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/jss-plugin-props-sort/-/jss-plugin-props-sort-10.10.0.tgz", + "integrity": "sha512-5VNJvQJbnq/vRfje6uZLe/FyaOpzP/IH1LP+0fr88QamVrGJa0hpRRyAa0ea4U/3LcorJfBFVyC4yN2QC73lJg==", + "requires": { + "@babel/runtime": "^7.3.1", + "jss": "10.10.0" + } + }, + "jss-plugin-rule-value-function": { + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.10.0.tgz", + "integrity": "sha512-uEFJFgaCtkXeIPgki8ICw3Y7VMkL9GEan6SqmT9tqpwM+/t+hxfMUdU4wQ0MtOiMNWhwnckBV0IebrKcZM9C0g==", + "requires": { + "@babel/runtime": "^7.3.1", + "jss": "10.10.0", + "tiny-warning": "^1.0.2" + } + }, + "jss-plugin-vendor-prefixer": { + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.10.0.tgz", + "integrity": "sha512-UY/41WumgjW8r1qMCO8l1ARg7NHnfRVWRhZ2E2m0DMYsr2DD91qIXLyNhiX83hHswR7Wm4D+oDYNC1zWCJWtqg==", + "requires": { + "@babel/runtime": "^7.3.1", + "css-vendor": "^2.0.8", + "jss": "10.10.0" + } + }, "jsx-ast-utils": { "version": "3.3.3", "requires": { @@ -74370,6 +74832,11 @@ } } }, + "popper.js": { + "version": "1.16.1-lts", + "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1-lts.tgz", + "integrity": "sha512-Kjw8nKRl1m+VrSFCoVGPph93W/qrSO7ZkqPpTf7F4bk/sqcfWK019dWBUpE/fBOsOQY1dks/Bmcbfn1heM/IsA==" + }, "posix-character-classes": { "version": "0.1.1", "dev": true @@ -78322,6 +78789,11 @@ "tiny-invariant": { "version": "1.3.1" }, + "tiny-warning": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", + "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==" + }, "tinycolor2": { "version": "1.6.0" }, diff --git a/packages/chat-ui/dist/index.js b/packages/chat-ui/dist/index.js index e93de1db..c947732c 100644 --- a/packages/chat-ui/dist/index.js +++ b/packages/chat-ui/dist/index.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ChatUI={},e.React,e.ReactDOM)}(this,(function(e,t,n){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}e.version="0.0.0";var o=r(t),a=r(n);function i(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0}});else{var e=function(e){for(var t=window.document,n=o(t);n;)n=o(t=n.ownerDocument);return t}(),t=[],n=null,r=null;i.prototype.THROTTLE_TIMEOUT=100,i.prototype.POLL_INTERVAL=null,i.prototype.USE_MUTATION_OBSERVER=!0,i._setupCrossOriginUpdater=function(){return n||(n=function(e,n){r=e&&n?f(e,n):{top:0,bottom:0,left:0,right:0,width:0,height:0},t.forEach((function(e){e._checkForIntersections()}))}),n},i._resetCrossOriginUpdater=function(){n=null,r=null},i.prototype.observe=function(e){if(!this._observationTargets.some((function(t){return t.element==e}))){if(!e||1!=e.nodeType)throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:e,entry:null}),this._monitorIntersections(e.ownerDocument),this._checkForIntersections()}},i.prototype.unobserve=function(e){this._observationTargets=this._observationTargets.filter((function(t){return t.element!=e})),this._unmonitorIntersections(e.ownerDocument),0==this._observationTargets.length&&this._unregisterInstance()},i.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorAllIntersections(),this._unregisterInstance()},i.prototype.takeRecords=function(){var e=this._queuedEntries.slice();return this._queuedEntries=[],e},i.prototype._initThresholds=function(e){var t=e||[0];return Array.isArray(t)||(t=[t]),t.sort().filter((function(e,t,n){if("number"!=typeof e||isNaN(e)||e<0||e>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return e!==n[t-1]}))},i.prototype._parseRootMargin=function(e){var t=(e||"0px").split(/\s+/).map((function(e){var t=/^(-?\d*\.?\d+)(px|%)$/.exec(e);if(!t)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(t[1]),unit:t[2]}}));return t[1]=t[1]||t[0],t[2]=t[2]||t[0],t[3]=t[3]||t[1],t},i.prototype._monitorIntersections=function(t){var n=t.defaultView;if(n&&-1==this._monitoringDocuments.indexOf(t)){var r=this._checkForIntersections,a=null,i=null;this.POLL_INTERVAL?a=n.setInterval(r,this.POLL_INTERVAL):(c(n,"resize",r,!0),c(t,"scroll",r,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in n&&(i=new n.MutationObserver(r)).observe(t,{attributes:!0,childList:!0,characterData:!0,subtree:!0})),this._monitoringDocuments.push(t),this._monitoringUnsubscribes.push((function(){var e=t.defaultView;e&&(a&&e.clearInterval(a),u(e,"resize",r,!0)),u(t,"scroll",r,!0),i&&i.disconnect()}));var l=this.root&&(this.root.ownerDocument||this.root)||e;if(t!=l){var s=o(t);s&&this._monitorIntersections(s.ownerDocument)}}},i.prototype._unmonitorIntersections=function(t){var n=this._monitoringDocuments.indexOf(t);if(-1!=n){var r=this.root&&(this.root.ownerDocument||this.root)||e,a=this._observationTargets.some((function(e){var n=e.element.ownerDocument;if(n==t)return!0;for(;n&&n!=r;){var a=o(n);if((n=a&&a.ownerDocument)==t)return!0}return!1}));if(!a){var i=this._monitoringUnsubscribes[n];if(this._monitoringDocuments.splice(n,1),this._monitoringUnsubscribes.splice(n,1),i(),t!=r){var c=o(t);c&&this._unmonitorIntersections(c.ownerDocument)}}}},i.prototype._unmonitorAllIntersections=function(){var e=this._monitoringUnsubscribes.slice(0);this._monitoringDocuments.length=0,this._monitoringUnsubscribes.length=0;for(var t=0;t=0&&h>=0&&{top:u,bottom:s,left:d,right:m,width:v,height:h}||null),!g)break;y=y&&p(y)}return g}},i.prototype._getRootRect=function(){var t;if(this.root&&!m(this.root))t=l(this.root);else{var n=m(this.root)?this.root:e,r=n.documentElement,o=n.body;t={top:0,left:0,right:r.clientWidth||o.clientWidth,width:r.clientWidth||o.clientWidth,bottom:r.clientHeight||o.clientHeight,height:r.clientHeight||o.clientHeight}}return this._expandRectByRootMargin(t)},i.prototype._expandRectByRootMargin=function(e){var t=this._rootMarginValues.map((function(t,n){return"px"==t.unit?t.value:t.value*(n%2?e.width:e.height)/100})),n={top:e.top-t[0],right:e.right+t[1],bottom:e.bottom+t[2],left:e.left-t[3]};return n.width=n.right-n.left,n.height=n.bottom-n.top,n},i.prototype._hasCrossedThreshold=function(e,t){var n=e&&e.isIntersecting?e.intersectionRatio||0:-1,r=t.isIntersecting?t.intersectionRatio||0:-1;if(n!==r)for(var o=0;o1?n-1:0),o=1;o/gm),Z=b(/\${[\w\W]*}/gm),ee=b(/^data-[\-\w.\u00B7-\uFFFF]/),te=b(/^aria-[\-\w]+$/),ne=b(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),re=b(/^(?:\w+script|data):/i),oe=b(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ae=b(/^html$/i),ie=function(){return"undefined"==typeof window?null:window};var ce=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ie(),n=function(t){return e(t)};if(n.version="2.4.5",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;var r=t.document,o=t.document,a=t.DocumentFragment,i=t.HTMLTemplateElement,c=t.Node,l=t.Element,s=t.NodeFilter,d=t.NamedNodeMap,p=void 0===d?t.NamedNodeMap||t.MozNamedAttrMap:d,m=t.HTMLFormElement,v=t.DOMParser,h=t.trustedTypes,g=l.prototype,b=H(g,"cloneNode"),E=H(g,"nextSibling"),w=H(g,"childNodes"),x=H(g,"parentNode");if("function"==typeof i){var N=o.createElement("template");N.content&&N.content.ownerDocument&&(o=N.content.ownerDocument)}var S=function(e,t){if("object"!==u(e)||"function"!=typeof e.createPolicy)return null;var n=null,r="data-tt-policy-suffix";t.currentScript&&t.currentScript.hasAttribute(r)&&(n=t.currentScript.getAttribute(r));var o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:function(e){return e},createScriptURL:function(e){return e}})}catch(e){return null}}(h,r),P=S?S.createHTML(""):"",ce=o,ue=ce.implementation,le=ce.createNodeIterator,se=ce.createDocumentFragment,fe=ce.getElementsByTagName,de=r.importNode,pe={};try{pe=F(o).documentMode?o.documentMode:{}}catch(e){}var me={};n.isSupported="function"==typeof x&&ue&&void 0!==ue.createHTMLDocument&&9!==pe;var ve,he,ge=J,ye=Q,be=Z,Ee=ee,we=te,xe=re,Ne=oe,Se=ne,Te=null,Ce=D({},[].concat(f(B),f(U),f(z),f(V),f(Y))),Oe=null,Re=D({},[].concat(f(X),f(q),f($),f(K))),ke=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ie=null,Ae=null,Me=!0,_e=!0,Le=!1,je=!0,Pe=!1,De=!1,Fe=!1,He=!1,Be=!1,Ue=!1,ze=!1,Ge=!0,Ve=!1,We=!0,Ye=!1,Xe={},qe=null,$e=D({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Ke=null,Je=D({},["audio","video","img","source","image","track"]),Qe=null,Ze=D({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),et="http://www.w3.org/1998/Math/MathML",tt="http://www.w3.org/2000/svg",nt="http://www.w3.org/1999/xhtml",rt=nt,ot=!1,at=null,it=D({},[et,tt,nt],k),ct=["application/xhtml+xml","text/html"],ut=null,lt=o.createElement("form"),st=function(e){return e instanceof RegExp||e instanceof Function},ft=function(e){ut&&ut===e||(e&&"object"===u(e)||(e={}),e=F(e),ve=ve=-1===ct.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,he="application/xhtml+xml"===ve?k:R,Te="ALLOWED_TAGS"in e?D({},e.ALLOWED_TAGS,he):Ce,Oe="ALLOWED_ATTR"in e?D({},e.ALLOWED_ATTR,he):Re,at="ALLOWED_NAMESPACES"in e?D({},e.ALLOWED_NAMESPACES,k):it,Qe="ADD_URI_SAFE_ATTR"in e?D(F(Ze),e.ADD_URI_SAFE_ATTR,he):Ze,Ke="ADD_DATA_URI_TAGS"in e?D(F(Je),e.ADD_DATA_URI_TAGS,he):Je,qe="FORBID_CONTENTS"in e?D({},e.FORBID_CONTENTS,he):$e,Ie="FORBID_TAGS"in e?D({},e.FORBID_TAGS,he):{},Ae="FORBID_ATTR"in e?D({},e.FORBID_ATTR,he):{},Xe="USE_PROFILES"in e&&e.USE_PROFILES,Me=!1!==e.ALLOW_ARIA_ATTR,_e=!1!==e.ALLOW_DATA_ATTR,Le=e.ALLOW_UNKNOWN_PROTOCOLS||!1,je=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Pe=e.SAFE_FOR_TEMPLATES||!1,De=e.WHOLE_DOCUMENT||!1,Be=e.RETURN_DOM||!1,Ue=e.RETURN_DOM_FRAGMENT||!1,ze=e.RETURN_TRUSTED_TYPE||!1,He=e.FORCE_BODY||!1,Ge=!1!==e.SANITIZE_DOM,Ve=e.SANITIZE_NAMED_PROPS||!1,We=!1!==e.KEEP_CONTENT,Ye=e.IN_PLACE||!1,Se=e.ALLOWED_URI_REGEXP||Se,rt=e.NAMESPACE||nt,ke=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&st(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ke.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&st(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ke.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(ke.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Pe&&(_e=!1),Ue&&(Be=!0),Xe&&(Te=D({},f(Y)),Oe=[],!0===Xe.html&&(D(Te,B),D(Oe,X)),!0===Xe.svg&&(D(Te,U),D(Oe,q),D(Oe,K)),!0===Xe.svgFilters&&(D(Te,z),D(Oe,q),D(Oe,K)),!0===Xe.mathMl&&(D(Te,V),D(Oe,$),D(Oe,K))),e.ADD_TAGS&&(Te===Ce&&(Te=F(Te)),D(Te,e.ADD_TAGS,he)),e.ADD_ATTR&&(Oe===Re&&(Oe=F(Oe)),D(Oe,e.ADD_ATTR,he)),e.ADD_URI_SAFE_ATTR&&D(Qe,e.ADD_URI_SAFE_ATTR,he),e.FORBID_CONTENTS&&(qe===$e&&(qe=F(qe)),D(qe,e.FORBID_CONTENTS,he)),We&&(Te["#text"]=!0),De&&D(Te,["html","head","body"]),Te.table&&(D(Te,["tbody"]),delete Ie.tbody),y&&y(e),ut=e)},dt=D({},["mi","mo","mn","ms","mtext"]),pt=D({},["foreignobject","desc","title","annotation-xml"]),mt=D({},["title","style","font","a","script"]),vt=D({},U);D(vt,z),D(vt,G);var ht=D({},V);D(ht,W);var gt=function(e){O(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=P}catch(t){e.remove()}}},yt=function(e,t){try{O(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){O(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!Oe[e])if(Be||Ue)try{gt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},bt=function(e){var t,n;if(He)e=""+e;else{var r=I(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===ve&&rt===nt&&(e=''+e+"");var a=S?S.createHTML(e):e;if(rt===nt)try{t=(new v).parseFromString(a,ve)}catch(e){}if(!t||!t.documentElement){t=ue.createDocument(rt,"template",null);try{t.documentElement.innerHTML=ot?P:a}catch(e){}}var i=t.body||t.documentElement;return e&&n&&i.insertBefore(o.createTextNode(n),i.childNodes[0]||null),rt===nt?fe.call(t,De?"html":"body")[0]:De?t.documentElement:i},Et=function(e){return le.call(e.ownerDocument||e,e,s.SHOW_ELEMENT|s.SHOW_COMMENT|s.SHOW_TEXT,null,!1)},wt=function(e){return"object"===u(c)?e instanceof c:e&&"object"===u(e)&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},xt=function(e,t,r){me[e]&&T(me[e],(function(e){e.call(n,t,r,ut)}))},Nt=function(e){var t,r;if(xt("beforeSanitizeElements",e,null),(r=e)instanceof m&&("string"!=typeof r.nodeName||"string"!=typeof r.textContent||"function"!=typeof r.removeChild||!(r.attributes instanceof p)||"function"!=typeof r.removeAttribute||"function"!=typeof r.setAttribute||"string"!=typeof r.namespaceURI||"function"!=typeof r.insertBefore||"function"!=typeof r.hasChildNodes))return gt(e),!0;if(L(/[\u0080-\uFFFF]/,e.nodeName))return gt(e),!0;var o=he(e.nodeName);if(xt("uponSanitizeElement",e,{tagName:o,allowedTags:Te}),e.hasChildNodes()&&!wt(e.firstElementChild)&&(!wt(e.content)||!wt(e.content.firstElementChild))&&L(/<[/\w]/g,e.innerHTML)&&L(/<[/\w]/g,e.textContent))return gt(e),!0;if("select"===o&&L(/