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ACAA,IAAAA,UACApH,IAAAA,wB,UAGF,SAACyH,EAAqB,OAExB,SAAC5H,MAAG,CACFC,UAAWC,IACTqH,IAAAA,SACAA,IAAAA,UACApH,IAAAA,kC,UAGF,SAAC0H,EAAAA,EAA8B,CAACC,YAAY,OAG9C,UAAC9H,MAAG,CACFC,UAAWC,IACTqH,IAAAA,SACAA,IAAAA,UACApH,IAAAA,kB,WAGF,SAACH,MAAG,CAACC,UAAWE,IAAAA,O,UACd,SAAC4H,EAAmB,CAAChH,WAAYtB,OAEnC,SAACO,MAAG,CAACC,UAAWE,IAAAA,O,UACd,SAACE,EAAAA,GAAM,CAACU,WAAYtB,EAAWa,QAAS8F,E,SACrCrG,EAAE,sC,kBCtIrBiI,EAAOC,QAAU,CAAC,eAAiB,4CAA4C,aAAe,0CAA0C,iBAAmB,8CAA8C,gBAAkB,+C,kBCA3ND,EAAOC,QAAU,CAAC,kBAAoB,iDAAiD,eAAiB,8CAA8C,oBAAsB,mDAAmD,UAAY,yCAAyC,OAAS,wC,kBCA7RD,EAAOC,QAAU,CAAC,aAAe,sD,kBCAjCD,EAAOC,QAAU,CAAC,UAAY,qCAAqC,OAAS,kCAAkC,UAAY,qCAAqC,YAAc,uCAAuC,oBAAsB,+CAA+C,UAAY,qCAAqC,YAAc,yC,kBCAxVD,EAAOC,QAAU,CAAC,UAAY,0BAA0B,cAAgB,8BAA8B,MAAQ,sBAAsB,OAAS,uBAAuB,UAAY,4B,kBCAhLD,EAAOC,QAAU,CAAC,UAAY,2BAA2B,iBAAmB,kCAAkC,eAAiB,gCAAgC,qBAAuB,sCAAsC,kBAAoB,mCAAmC,KAAO,sBAAsB,MAAQ,uBAAuB,iBAAmB,kCAAkC,OAAS,wBAAwB,uBAAyB,wCAAwC,iCAAmC,kDAAkD,wBAA0B,4C","sources":["webpack://_N_E/?bcf6","webpack://_N_E/./src/components/Auth/RedirectToLoginPage.tsx","webpack://_N_E/./src/components/Auth/withAuth.tsx","webpack://_N_E/./src/hooks/auth/useCurrentUser.ts","webpack://_N_E/./src/pages/_error.tsx","webpack://_N_E/./src/components/dls/SurahPreview/SurahPreview.tsx","webpack://_N_E/./src/components/Profile/DeleteAccountButton.tsx","webpack://_N_E/./src/components/Verses/RecentReadingSessionsSkeleton.tsx","webpack://_N_E/./src/components/dls/SurahPreview/SurahPreviewBlock.tsx","webpack://_N_E/./src/components/Verses/RecentReadingSessions.tsx","webpack://_N_E/./src/pages/profile.tsx","webpack://_N_E/./src/components/Profile/DeleteAccountButton.module.scss","webpack://_N_E/./src/components/Verses/RecentReadingSessions.module.scss","webpack://_N_E/./src/components/Verses/RecentReadingSessionsSkeleton.module.scss","webpack://_N_E/./src/components/dls/SurahPreview/SurahPreviewBlock.module.scss","webpack://_N_E/./src/pages/_error.module.scss","webpack://_N_E/./src/pages/profile.module.scss"],"sourcesContent":["\n (window.__NEXT_P = window.__NEXT_P || []).push([\n \"/profile\",\n function () {\n return require(\"private-next-pages/profile.tsx\");\n }\n ]);\n if(module.hot) {\n module.hot.dispose(function () {\n window.__NEXT_P.push([\"/profile\"])\n });\n }\n ","import React, { useEffect } from 'react';\n\nimport { useRouter } from 'next/router';\n\nimport { getLoginNavigationUrl } from '@/utils/navigation';\n\nconst RedirectToLoginPage = () => {\n const router = useRouter();\n useEffect(() => {\n const { asPath } = router;\n router.replace(getLoginNavigationUrl(asPath));\n }, [router]);\n\n return <></>;\n};\n\nexport default RedirectToLoginPage;\n","import { JSX, useEffect, useState } from 'react';\n\nimport RedirectToLoginPage from './RedirectToLoginPage';\n\nimport { isLoggedIn } from '@/utils/auth/login';\n/**\n * withAuth is a Higher-Order Component (HOC) that wraps a component and checks if the user is authenticated.\n * If the user is authenticated, it renders the wrapped component.\n * If the user is not authenticated, it redirects the user to the login page.\n *\n * @param {React.ComponentType} WrappedComponent - The component to wrap and protect with authentication check.\n *\n * @returns {React.ComponentType} If the user is authenticated, returns the WrappedComponent.\n * If not, returns RedirectToLoginPage component.\n *\n * @example\n * const ProtectedComponent = withAuth(MyComponent);\n */\nconst withAuth = (WrappedComponent: React.ComponentType): React.ComponentType => {\n const WithAuth = (props: JSX.IntrinsicAttributes) => {\n const [isReady, setIsReady] = useState(false);\n\n /**\n * we need to wait for the initial render to check if the user is authenticated\n * because when it's server-side rendered, the user is not authenticated yet\n */\n useEffect(() => {\n setIsReady(true);\n }, []);\n\n if (!isReady) {\n return null; // or return a loading spinner\n }\n\n return isLoggedIn() ? <WrappedComponent {...props} /> : <RedirectToLoginPage />;\n };\n\n return WithAuth;\n};\n\nexport default withAuth;\n","import useSWR from 'swr';\n\nimport { getUserProfile } from '@/utils/auth/api';\nimport { makeUserProfileUrl } from '@/utils/auth/apiPaths';\nimport { isLoggedIn } from '@/utils/auth/login';\n\nconst useCurrentUser = () => {\n const {\n data: userData,\n isValidating,\n error,\n } = useSWR(isLoggedIn() ? makeUserProfileUrl() : null, getUserProfile);\n\n return {\n user: userData || ({} as typeof userData),\n isLoading: isValidating && !userData,\n error,\n };\n};\n\nexport default useCurrentUser;\n","/* eslint-disable jsx-a11y/anchor-is-valid */\nimport classNames from 'classnames';\nimport { useRouter } from 'next/router';\nimport useTranslation from 'next-translate/useTranslation';\n\nimport styles from './_error.module.scss';\n\nimport Button from '@/dls/Button/Button';\nimport Link, { LinkVariant } from '@/dls/Link/Link';\n\n// reference: https://nextjs.org/docs/advanced-features/custom-error-page#more-advanced-error-page-customizing\ntype ErrorProps = {\n statusCode?: number;\n hasFullWidth?: boolean;\n};\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst Error = ({ statusCode, hasFullWidth = true }: ErrorProps) => {\n const { t } = useTranslation('error');\n const router = useRouter();\n\n // if previous page url exist, go back, otherwise go to home\n const onBackButtonClicked = () => {\n if (document && document.referrer) {\n router.back();\n return;\n }\n router.push('/'); // go to home\n };\n return (\n <div\n className={classNames(styles.container, {\n [styles.withFullWidth]: hasFullWidth,\n })}\n >\n <h1 className={styles.title}>{t('title')}</h1>\n <div className={styles.goBack}>\n <Button onClick={onBackButtonClicked}>{t('go-back')}</Button>\n </div>\n <p className={styles.reportBug}>\n {t('if-persist')}{' '}\n <Link href=\"https://feedback.quran.com/\" variant={LinkVariant.Highlight}>\n {t('report-cta')}\n </Link>\n </p>\n </div>\n );\n};\n\nexport default Error;\n","import SurahPreviewBlock from './SurahPreviewBlock';\nimport SurahPreviewRow from './SurahPreviewRow';\n\nexport enum SurahPreviewDisplay {\n Block = 'block',\n Row = 'row',\n}\n\ntype SurahProps = {\n surahNumber: number;\n surahName: string;\n translatedSurahName: string;\n chapterId: number;\n display?: SurahPreviewDisplay;\n description?: string;\n};\n\nconst SurahPreview = ({\n chapterId,\n surahName,\n surahNumber,\n translatedSurahName,\n description,\n display = SurahPreviewDisplay.Block,\n}: SurahProps) => {\n if (display === SurahPreviewDisplay.Block) {\n return (\n <SurahPreviewBlock\n chapterId={chapterId}\n surahName={surahName}\n surahNumber={surahNumber}\n translatedSurahName={translatedSurahName}\n description={description}\n />\n );\n }\n\n if (display === SurahPreviewDisplay.Row) {\n return (\n <SurahPreviewRow\n chapterId={chapterId}\n surahName={surahName}\n surahNumber={surahNumber}\n translatedSurahName={translatedSurahName}\n description={description}\n />\n );\n }\n\n throw new Error('display must be either block or row');\n};\n\nexport default SurahPreview;\n","import { useState } from 'react';\n\nimport router from 'next/router';\nimport Trans from 'next-translate/Trans';\nimport useTranslation from 'next-translate/useTranslation';\n\nimport Button, { ButtonType, ButtonVariant } from '../dls/Button/Button';\nimport Input from '../dls/Forms/Input';\nimport Modal from '../dls/Modal/Modal';\n\nimport styles from './DeleteAccountButton.module.scss';\n\nimport { deleteAccount } from '@/utils/auth/api';\nimport { removeLastSyncAt } from '@/utils/auth/userDataSync';\nimport { logButtonClick } from '@/utils/eventLogger';\n\ntype DeleteAccountButtonProps = {\n isDisabled?: boolean;\n};\nconst DeleteAccountButton = ({ isDisabled }: DeleteAccountButtonProps) => {\n const { t } = useTranslation('profile');\n const [isModalVisible, setIsModalVisible] = useState(false);\n const [confirmationText, setConfirmationText] = useState('');\n\n const closeModal = () => {\n setConfirmationText('');\n setIsModalVisible(false);\n };\n\n const onDeleteConfirmed = async () => {\n logButtonClick('profile_confirm_delete_account');\n closeModal();\n\n await deleteAccount();\n removeLastSyncAt();\n router.push('/');\n };\n\n const onDeleteAccountClicked = () => {\n logButtonClick('profile_delete_account');\n setIsModalVisible(true);\n };\n\n const CONFIRMATION_TEXT = t('delete-confirmation.confirmation-text');\n const canDeleteAccount = confirmationText.toLowerCase() === CONFIRMATION_TEXT.toLowerCase();\n\n return (\n <>\n <Button\n type={ButtonType.Error}\n variant={ButtonVariant.Ghost}\n onClick={onDeleteAccountClicked}\n isDisabled={isDisabled}\n >\n {t('delete-account')}\n </Button>\n <Modal isOpen={isModalVisible} onClickOutside={closeModal}>\n <Modal.Body>\n <Modal.Header>\n <Modal.Title>{t('delete-confirmation.title')}</Modal.Title>\n <Modal.Subtitle>{t('delete-confirmation.subtitle')}</Modal.Subtitle>\n\n <p className={styles.instructionText}>\n <Trans\n i18nKey=\"profile:delete-confirmation.instruction-text\"\n values={{ text: CONFIRMATION_TEXT }}\n components={{\n strong: <strong className={styles.confirmationText} />,\n }}\n />\n </p>\n <Input\n id=\"delete-account-confirmation\"\n value={confirmationText}\n onChange={setConfirmationText}\n fixedWidth={false}\n containerClassName={styles.inputContainer}\n />\n </Modal.Header>\n <Modal.Footer>\n <Button\n type={ButtonType.Error}\n variant={ButtonVariant.Outlined}\n className={styles.deleteButton}\n onClick={onDeleteConfirmed}\n isDisabled={!canDeleteAccount}\n >\n {t('delete-confirmation.action-text')}\n </Button>\n </Modal.Footer>\n </Modal.Body>\n </Modal>\n </>\n );\n};\n\nexport default DeleteAccountButton;\n","import { useContext, useMemo } from 'react';\n\nimport classNames from 'classnames';\nimport useTranslation from 'next-translate/useTranslation';\n\nimport styles from './RecentReadingSessions.module.scss';\nimport skeletonStyles from './RecentReadingSessionsSkeleton.module.scss';\n\nimport ChapterIconContainer, {\n ChapterIconsSize,\n} from '@/components/chapters/ChapterIcon/ChapterIconContainer';\nimport DataContext from '@/contexts/DataContext';\nimport Skeleton from '@/dls/Skeleton/Skeleton';\nimport surahPreviewStyles from '@/dls/SurahPreview/SurahPreviewBlock.module.scss';\nimport { getChapterData } from '@/utils/chapter';\nimport { shouldUseMinimalLayout, toLocalizedNumber } from '@/utils/locale';\nimport { getVerseAndChapterNumbersFromKey } from '@/utils/verse';\n\nconst VERSE_KEY = '19:1';\nconst RECENT_READING_SESSIONS_COUNT = 10;\nconst recentReadingSessionsArr = Array(RECENT_READING_SESSIONS_COUNT).fill(null);\n\nconst RecentReadingSessionsSkeleton = () => {\n const { t, lang } = useTranslation('home');\n const chaptersData = useContext(DataContext);\n\n const [chapterId, verseNumber] = getVerseAndChapterNumbersFromKey(VERSE_KEY);\n const surah = getChapterData(chaptersData, chapterId);\n const isMinimalLayout = shouldUseMinimalLayout(lang);\n const localizedSurahNumber = useMemo(() => {\n return toLocalizedNumber(Number(chapterId), lang);\n }, [lang, chapterId]);\n\n return (\n <>\n {recentReadingSessionsArr.map((k, i) => (\n <div\n className={classNames(styles.verseLink, skeletonStyles.skeletonItem)}\n // eslint-disable-next-line react/no-array-index-key\n key={`skeleton_${i}`}\n >\n <div className={surahPreviewStyles.container}>\n <div className={surahPreviewStyles.header}>\n <div>\n <Skeleton isActive>\n <div className={surahPreviewStyles.translatedSurahName}>\n {isMinimalLayout && <>{t('common:surah')} </>}\n {surah.translatedName as string}\n </div>\n </Skeleton>\n {!isMinimalLayout && (\n <Skeleton isActive>\n <div className={surahPreviewStyles.surahName}>\n {t('common:surah')} <br />\n {surah.transliteratedName}\n </div>\n </Skeleton>\n )}\n </div>\n <div className={surahPreviewStyles.surahNumber}>\n <Skeleton isActive>{localizedSurahNumber}</Skeleton>\n </div>\n </div>\n <Skeleton isActive>\n <div className={surahPreviewStyles.surahIcon}>\n <ChapterIconContainer\n chapterId={chapterId.toString()}\n hasSurahPrefix={false}\n size={ChapterIconsSize.Large}\n />\n <div className={surahPreviewStyles.description}>{`${t(\n 'common:ayah',\n )} ${toLocalizedNumber(Number(verseNumber), lang)}`}</div>\n </div>\n </Skeleton>\n </div>\n </div>\n ))}\n </>\n );\n};\n\nexport default RecentReadingSessionsSkeleton;\n","import { useMemo } from 'react';\n\nimport useTranslation from 'next-translate/useTranslation';\n\nimport styles from './SurahPreviewBlock.module.scss';\n\nimport ChapterIconContainer, {\n ChapterIconsSize,\n} from '@/components/chapters/ChapterIcon/ChapterIconContainer';\nimport { shouldUseMinimalLayout, toLocalizedNumber } from '@/utils/locale';\n\ntype SurahPreviewBlockProps = {\n surahNumber: number;\n surahName: string;\n translatedSurahName: string;\n chapterId: number;\n description?: string;\n};\n\nconst SurahPreviewBlock = ({\n chapterId,\n surahName,\n surahNumber,\n translatedSurahName,\n description,\n}: SurahPreviewBlockProps) => {\n const { t, lang } = useTranslation('common');\n const isMinimalLayout = shouldUseMinimalLayout(lang);\n const localizedSurahNumber = useMemo(() => {\n return toLocalizedNumber(surahNumber, lang);\n }, [lang, surahNumber]);\n return (\n <div className={styles.container}>\n <div className={styles.header}>\n <div>\n <div className={styles.translatedSurahName}>\n {isMinimalLayout && <>{t('surah')} </>}\n {translatedSurahName}\n </div>\n {!isMinimalLayout && (\n <div className={styles.surahName}>\n {t('surah')} <br />\n {surahName}\n </div>\n )}\n </div>\n <div className={styles.surahNumber}>{localizedSurahNumber}</div>\n </div>\n <div className={styles.surahIcon}>\n <ChapterIconContainer\n chapterId={chapterId.toString()}\n hasSurahPrefix={false}\n size={ChapterIconsSize.Large}\n />\n {description && <div className={styles.description}>{description}</div>}\n </div>\n </div>\n );\n};\n\nexport default SurahPreviewBlock;\n","import React, { useContext } from 'react';\n\nimport useTranslation from 'next-translate/useTranslation';\n\nimport Link from '../dls/Link/Link';\n\nimport styles from './RecentReadingSessions.module.scss';\nimport RecentReadingSessionsSkeleton from './RecentReadingSessionsSkeleton';\n\nimport SurahPreview, { SurahPreviewDisplay } from '@/dls/SurahPreview/SurahPreview';\nimport useGetRecentlyReadVerseKeys from '@/hooks/auth/useGetRecentlyReadVerseKeys';\nimport { getChapterData } from '@/utils/chapter';\nimport { logButtonClick } from '@/utils/eventLogger';\nimport { toLocalizedNumber } from '@/utils/locale';\nimport { getChapterWithStartingVerseUrl } from '@/utils/navigation';\nimport { getVerseAndChapterNumbersFromKey } from '@/utils/verse';\nimport DataContext from 'src/contexts/DataContext';\n\nconst RecentReadingSessions = () => {\n const { t, lang } = useTranslation('home');\n const chaptersData = useContext(DataContext);\n const { recentlyReadVerseKeys, isLoading } = useGetRecentlyReadVerseKeys();\n const onRecentReadingSessionClicked = () => {\n logButtonClick('recently_read_card');\n };\n\n if (isLoading) {\n return (\n <div className={styles.sessionsContainer} id=\"reading-sessions\">\n <p className={styles.sessionsHeader}>{t('recently-read')}</p>\n <div className={styles.verseLinksContainer}>\n <RecentReadingSessionsSkeleton />\n </div>\n </div>\n );\n }\n\n if (recentlyReadVerseKeys.length === 0) return null;\n\n return (\n <div className={styles.sessionsContainer} id=\"reading-sessions\">\n <p className={styles.sessionsHeader}>{t('recently-read')}</p>\n <div className={styles.verseLinksContainer}>\n {recentlyReadVerseKeys.map((verseKey) => {\n const [chapterId, verseNumber] = getVerseAndChapterNumbersFromKey(verseKey);\n const surah = getChapterData(chaptersData, chapterId);\n return (\n <div className={styles.verseLink} key={verseKey}>\n <Link\n href={getChapterWithStartingVerseUrl(verseKey)}\n onClick={onRecentReadingSessionClicked}\n >\n <SurahPreview\n display={SurahPreviewDisplay.Block}\n chapterId={Number(chapterId)}\n surahNumber={Number(chapterId)}\n translatedSurahName={surah.translatedName as string}\n surahName={surah.transliteratedName}\n description={`${t('common:ayah')} ${toLocalizedNumber(\n Number(verseNumber),\n lang,\n )}`}\n />\n </Link>\n </div>\n );\n })}\n </div>\n </div>\n );\n};\n\nexport default RecentReadingSessions;\n","/* eslint-disable max-lines */\nimport classNames from 'classnames';\nimport { NextPage, GetStaticProps } from 'next';\nimport { useRouter } from 'next/router';\nimport useTranslation from 'next-translate/useTranslation';\n\nimport layoutStyle from './index.module.scss';\nimport styles from './profile.module.scss';\n\nimport withAuth from '@/components/Auth/withAuth';\nimport NextSeoWrapper from '@/components/NextSeoWrapper';\nimport DeleteAccountButton from '@/components/Profile/DeleteAccountButton';\nimport BookmarksAndCollectionsSection from '@/components/Verses/BookmarksAndCollectionsSection';\nimport RecentReadingSessions from '@/components/Verses/RecentReadingSessions';\nimport Button from '@/dls/Button/Button';\nimport Skeleton from '@/dls/Skeleton/Skeleton';\nimport useCurrentUser from '@/hooks/auth/useCurrentUser';\nimport { logoutUser } from '@/utils/auth/api';\nimport { DEFAULT_PHOTO_URL } from '@/utils/auth/constants';\nimport { isLoggedIn } from '@/utils/auth/login';\nimport { removeLastSyncAt } from '@/utils/auth/userDataSync';\nimport { getAllChaptersData } from '@/utils/chapter';\nimport { logButtonClick } from '@/utils/eventLogger';\nimport { getLanguageAlternates } from '@/utils/locale';\nimport {\n getCanonicalUrl,\n getLoginNavigationUrl,\n getProfileNavigationUrl,\n} from '@/utils/navigation';\nimport Error from 'src/pages/_error';\nimport ChaptersData from 'types/ChaptersData';\n\ninterface Props {\n chaptersData?: ChaptersData;\n}\n\nconst nameSample = 'Mohammad Ali';\nconst emailSample = 'mohammadali@quran.com';\nconst ProfilePage: NextPage<Props> = () => {\n const { t, lang } = useTranslation();\n const router = useRouter();\n const { user, isLoading, error } = useCurrentUser();\n\n const onLogoutClicked = async () => {\n if (!isLoggedIn()) {\n return;\n }\n logButtonClick('profile_logout');\n\n await logoutUser();\n removeLastSyncAt();\n router.push(getLoginNavigationUrl());\n router.reload();\n };\n\n if (error) {\n return <Error statusCode={500} />;\n }\n\n const { email, firstName, lastName, photoUrl } = user;\n\n const profileSkeletonInfoSkeleton = (\n <div className={classNames(styles.profileInfoContainer, styles.skeletonContainer)}>\n <Skeleton>\n <h2 className={styles.name}>{nameSample}</h2>\n </Skeleton>\n <Skeleton>\n <div className={styles.email}>{emailSample}</div>\n </Skeleton>\n </div>\n );\n\n const profileInfo = (\n <div className={styles.profileInfoContainer}>\n <h2 className={styles.name}>{`${firstName} ${lastName}`}</h2>\n <div className={styles.email}>{email}</div>\n </div>\n );\n\n return (\n <>\n <NextSeoWrapper\n title={t('common:profile')}\n url={getCanonicalUrl(lang, getProfileNavigationUrl())}\n languageAlternates={getLanguageAlternates(getProfileNavigationUrl())}\n nofollow\n noindex\n />\n <div className={layoutStyle.pageContainer}>\n <div className={layoutStyle.flow}>\n <div className={styles.container}>\n <div className={classNames(layoutStyle.flowItem)}>\n <div className={styles.profileContainer}>\n <div className={styles.profilePicture}>\n {/* eslint-disable-next-line @next/next/no-img-element */}\n <img\n className={styles.profilePicture}\n alt=\"avatar\"\n src={photoUrl || DEFAULT_PHOTO_URL}\n />\n </div>\n {isLoading ? profileSkeletonInfoSkeleton : profileInfo}\n </div>\n </div>\n <div\n className={classNames(\n layoutStyle.flowItem,\n layoutStyle.fullWidth,\n styles.recentReadingContainer,\n )}\n >\n <RecentReadingSessions />\n </div>\n <div\n className={classNames(\n layoutStyle.flowItem,\n layoutStyle.fullWidth,\n styles.bookmarksAndCollectionsContainer,\n )}\n >\n <BookmarksAndCollectionsSection isHomepage={false} />\n </div>\n\n <div\n className={classNames(\n layoutStyle.flowItem,\n layoutStyle.fullWidth,\n styles.actionsContainer,\n )}\n >\n <div className={styles.action}>\n <DeleteAccountButton isDisabled={isLoading} />\n </div>\n <div className={styles.action}>\n <Button isDisabled={isLoading} onClick={onLogoutClicked}>\n {t('common:logout')}\n </Button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </>\n );\n};\n\nexport const getStaticProps: GetStaticProps = async ({ locale }) => {\n const allChaptersData = await getAllChaptersData(locale);\n\n return {\n props: {\n chaptersData: allChaptersData,\n },\n };\n};\n\nexport default withAuth(ProfilePage);\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"inputContainer\":\"DeleteAccountButton_inputContainer__XvfB_\",\"deleteButton\":\"DeleteAccountButton_deleteButton__N7Ex2\",\"confirmationText\":\"DeleteAccountButton_confirmationText__48miH\",\"instructionText\":\"DeleteAccountButton_instructionText__iVIlR\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"sessionsContainer\":\"RecentReadingSessions_sessionsContainer__mC450\",\"sessionsHeader\":\"RecentReadingSessions_sessionsHeader__lbyVl\",\"verseLinksContainer\":\"RecentReadingSessions_verseLinksContainer__18irS\",\"verseLink\":\"RecentReadingSessions_verseLink__Ky4p8\",\"button\":\"RecentReadingSessions_button__0mjNR\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"skeletonItem\":\"RecentReadingSessionsSkeleton_skeletonItem__73ehH\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"container\":\"SurahPreviewBlock_container__ME6vO\",\"header\":\"SurahPreviewBlock_header__Jg3cj\",\"surahIcon\":\"SurahPreviewBlock_surahIcon__IFm5J\",\"surahNumber\":\"SurahPreviewBlock_surahNumber__MEa5C\",\"translatedSurahName\":\"SurahPreviewBlock_translatedSurahName__ZZkwX\",\"surahName\":\"SurahPreviewBlock_surahName__MNieK\",\"description\":\"SurahPreviewBlock_description__bfpmJ\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"container\":\"_error_container__vJFnH\",\"withFullWidth\":\"_error_withFullWidth__VEzYc\",\"title\":\"_error_title__oLWAK\",\"goBack\":\"_error_goBack__U4WNd\",\"reportBug\":\"_error_reportBug__tsKmR\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"container\":\"profile_container__oyMiM\",\"profileContainer\":\"profile_profileContainer__F0pv4\",\"profilePicture\":\"profile_profilePicture__6x3ow\",\"profileInfoContainer\":\"profile_profileInfoContainer__Z9KlM\",\"skeletonContainer\":\"profile_skeletonContainer__gJPEf\",\"name\":\"profile_name__4_ocA\",\"email\":\"profile_email___dBtF\",\"actionsContainer\":\"profile_actionsContainer__Cjx1s\",\"action\":\"profile_action__OFH1d\",\"recentReadingContainer\":\"profile_recentReadingContainer__jsh_S\",\"bookmarksAndCollectionsContainer\":\"profile_bookmarksAndCollectionsContainer__YZ3c9\",\"collectionListContainer\":\"profile_collectionListContainer__p8_hb\"};"],"names":["window","__NEXT_P","push","router","useRouter","useEffect","asPath","replace","getLoginNavigationUrl","WrappedComponent","props","useState","isReady","setIsReady","isLoggedIn","RedirectToLoginPage","useSWR","makeUserProfileUrl","getUserProfile","data","user","userData","isLoading","isValidating","error","statusCode","hasFullWidth","useTranslation","t","div","className","classNames","styles","h1","Button","onClick","document","referrer","back","p","Link","href","variant","LinkVariant","isDisabled","isModalVisible","setIsModalVisible","confirmationText","setConfirmationText","closeModal","onDeleteConfirmed","logButtonClick","deleteAccount","removeLastSyncAt","CONFIRMATION_TEXT","canDeleteAccount","toLowerCase","type","ButtonType","ButtonVariant","Modal","isOpen","onClickOutside","Trans","i18nKey","values","text","components","strong","Input","id","value","onChange","fixedWidth","containerClassName","recentReadingSessionsArr","Array","fill","lang","chaptersData","useContext","DataContext","getVerseAndChapterNumbersFromKey","chapterId","verseNumber","surah","getChapterData","isMinimalLayout","shouldUseMinimalLayout","localizedSurahNumber","useMemo","toLocalizedNumber","Number","map","k","i","skeletonStyles","surahPreviewStyles","Skeleton","isActive","translatedName","br","transliteratedName","ChapterIconContainer","toString","hasSurahPrefix","size","ChapterIconsSize","surahName","surahNumber","translatedSurahName","description","SurahPreviewDisplay","display","Block","SurahPreviewBlock","Row","SurahPreviewRow","Error","useGetRecentlyReadVerseKeys","recentlyReadVerseKeys","onRecentReadingSessionClicked","RecentReadingSessionsSkeleton","length","verseKey","getChapterWithStartingVerseUrl","SurahPreview","withAuth","useCurrentUser","onLogoutClicked","logoutUser","reload","email","firstName","lastName","photoUrl","profileSkeletonInfoSkeleton","h2","profileInfo","NextSeoWrapper","title","url","getCanonicalUrl","getProfileNavigationUrl","languageAlternates","getLanguageAlternates","nofollow","noindex","layoutStyle","img","alt","src","DEFAULT_PHOTO_URL","RecentReadingSessions","BookmarksAndCollectionsSection","isHomepage","DeleteAccountButton","module","exports"],"sourceRoot":""}