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C,oBAAsB,wCAAwC,mBAAqB,uCAAuC,mBAAqB,uCAAuC,mBAAqB,uCAAuC,cAAgB,kCAAkC,cAAgB,kCAAkC,mBAAqB,uCAAuC,iBAAmB,qCAAqC,oBAAsB,wCAAwC,oBAAsB,wCAAwC,oBAAsB,wCAAwC,wBAA0B,4CAA4C,kBAAoB,sCAAsC,qBAAqB,uCAAuC,qBAAqB,uCAAuC,qBAAqB,uCAAuC,qBAAqB,uCAAuC,qBAAqB,uCAAuC,qBAAqB,uCAAuC,qBAAqB,uCAAuC,qBAAqB,uCAAuC,qBAAqB,uCAAuC,sBAAsB","sources":["webpack://_N_E/./node_modules/lodash/uniq.js","webpack://_N_E/./src/components/QuranReader/TafsirView/SurahAndAyahSelection.tsx","webpack://_N_E/./src/components/QuranReader/TafsirView/LanguageAndTafsirSelection.tsx","webpack://_N_E/./src/components/QuranReader/TafsirView/TafsirMessage/index.tsx","webpack://_N_E/./src/components/QuranReader/TafsirView/TafsirGroupMessage.tsx","webpack://_N_E/./src/components/QuranReader/TafsirView/TafsirText/index.tsx","webpack://_N_E/./src/components/QuranReader/TafsirView/TafsirBody.tsx","webpack://_N_E/./src/utils/tafsir.ts","webpack://_N_E/./src/components/QuranReader/TafsirView/TafsirEndOfScrollingActions.tsx","webpack://_N_E/./src/components/QuranReader/TafsirView/TafsirSkeleton.tsx","webpack://_N_E/./src/components/QuranReader/VerseTextPreview/index.tsx","webpack://_N_E/./src/hooks/useQcfFont.ts","webpack://_N_E/./src/components/QuranReader/TafsirView/TafsirEndOfScrollingActions.module.scss","webpack://_N_E/./src/components/QuranReader/TafsirView/TafsirMessage/TafsirMessage.module.scss","webpack://_N_E/./src/components/QuranReader/TafsirView/TafsirText/TafsirText.module.scss","webpack://_N_E/./src/components/QuranReader/TafsirView/TafsirView.module.scss"],"sourcesContent":["var baseUniq = require('./_baseUniq');\n\n/**\n * Creates a duplicate-free version of an array, using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons, in which only the first occurrence of each element\n * is kept. The order of result values is determined by the order they occur\n * in the array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniq([2, 1, 2]);\n * // => [2, 1]\n */\nfunction uniq(array) {\n return (array && array.length) ? baseUniq(array) : [];\n}\n\nmodule.exports = uniq;\n","import { useContext, useMemo } from 'react';\n\nimport useTranslation from 'next-translate/useTranslation';\n\nimport styles from './TafsirView.module.scss';\n\nimport Select, { SelectSize } from '@/dls/Forms/Select';\nimport { toLocalizedNumber } from '@/utils/locale';\nimport { generateChapterVersesKeys, getVerseNumberFromKey } from '@/utils/verse';\nimport DataContext from 'src/contexts/DataContext';\n\nconst SurahAndAyahSelection = ({\n selectedChapterId,\n selectedVerseNumber,\n onChapterIdChange,\n onVerseNumberChange,\n}) => {\n const { lang } = useTranslation();\n const chaptersData = useContext(DataContext);\n const verses = generateChapterVersesKeys(chaptersData, selectedChapterId);\n const surahOptions = useMemo(\n () =>\n Object.entries(chaptersData).map(([id, chapter]) => ({\n label: chapter.transliteratedName,\n value: id,\n })),\n [chaptersData],\n );\n const ayahOptions = useMemo(\n () =>\n verses.map((verseKey) => {\n const verseNumber = getVerseNumberFromKey(verseKey).toString();\n return {\n label: toLocalizedNumber(Number(verseNumber), lang),\n value: verseNumber,\n };\n }),\n [lang, verses],\n );\n\n return (\n <div className={styles.surahAndAyahSelectionContainer}>\n <Select\n size={SelectSize.Small}\n id=\"surah-selection\"\n name=\"surah-selection\"\n options={surahOptions}\n onChange={onChapterIdChange}\n value={selectedChapterId}\n />\n <div className={styles.selectionItem}>\n <Select\n className={styles.ayahSelection}\n size={SelectSize.Small}\n id=\"ayah-selection\"\n name=\"ayah-selection\"\n options={ayahOptions}\n onChange={onVerseNumberChange}\n value={selectedVerseNumber}\n />\n </div>\n </div>\n );\n};\n\nexport default SurahAndAyahSelection;\n","import classNames from 'classnames';\n\nimport styles from './TafsirView.module.scss';\n\nimport Button, { ButtonSize } from '@/dls/Button/Button';\nimport Select, { SelectSize } from '@/dls/Forms/Select';\nimport Skeleton from '@/dls/Skeleton/Skeleton';\nimport SpinnerContainer from '@/dls/Spinner/SpinnerContainer';\nimport { getLocaleNameByFullName } from '@/utils/locale';\nimport { TafsirsResponse } from 'types/ApiResponses';\n\ntype LanguageAndTafsirSelectionProps = {\n selectedTafsirIdOrSlug: number | string;\n onTafsirSelected: (tafsirId: number, tafsirSlug: string) => void;\n selectedLanguage: string;\n onSelectLanguage: (lang: string) => void;\n languageOptions: string[];\n data: TafsirsResponse;\n isLoading: boolean;\n};\nconst LanguageAndTafsirSelection = ({\n selectedTafsirIdOrSlug,\n onTafsirSelected,\n selectedLanguage,\n onSelectLanguage,\n languageOptions,\n data,\n isLoading,\n}: LanguageAndTafsirSelectionProps) => {\n if (!data) {\n return (\n <Skeleton className={classNames(styles.tafsirSkeletonItem, styles.tafsirSelectionSkeleton)} />\n );\n }\n return (\n <SpinnerContainer isLoading={isLoading}>\n <div className={styles.tafsirSelectionContainer}>\n <Select\n className={styles.languageSelection}\n size={SelectSize.Small}\n id=\"lang-selection\"\n name=\"lang-selection\"\n options={languageOptions.map((lng) => ({\n label: getLocaleNameByFullName(lng),\n value: lng,\n }))}\n onChange={onSelectLanguage}\n value={selectedLanguage}\n />\n {data.tafsirs\n .filter(\n (tafsir) =>\n tafsir.languageName === selectedLanguage ||\n selectedTafsirIdOrSlug === tafsir.slug ||\n Number(selectedTafsirIdOrSlug) === tafsir.id,\n )\n .map((tafsir) => {\n const selected =\n selectedTafsirIdOrSlug === tafsir.slug ||\n Number(selectedTafsirIdOrSlug) === tafsir.id;\n return (\n <Button\n onClick={() => onTafsirSelected(tafsir.id, tafsir.slug)}\n size={ButtonSize.Small}\n key={tafsir.id}\n className={classNames(styles.tafsirSelectionItem, {\n [styles.tafsirItemSelected]: selected,\n })}\n >\n {tafsir.translatedName.name}\n </Button>\n );\n })}\n </div>\n </SpinnerContainer>\n );\n};\n\nexport default LanguageAndTafsirSelection;\n","import React from 'react';\n\nimport styles from './TafsirMessage.module.scss';\n\ntype Props = {\n children: React.ReactNode;\n};\n\nconst TafsirMessage: React.FC<Props> = ({ children }) => {\n return <div className={styles.tafsirMessage}>{children}</div>;\n};\n\nexport default TafsirMessage;\n","import useTranslation from 'next-translate/useTranslation';\n\nimport TafsirMessage from './TafsirMessage';\n\ntype TafsirGroupMessageProps = {\n from: string;\n to: string;\n};\n\nconst TafsirGroupMessage = ({ from, to }: TafsirGroupMessageProps) => {\n const { t } = useTranslation('common');\n return (\n <TafsirMessage>\n {t('tafsir.group-message', {\n from,\n to,\n })}\n </TafsirMessage>\n );\n};\n\nexport default TafsirGroupMessage;\n","/* eslint-disable react/no-danger */\nimport React from 'react';\n\nimport { Action } from '@reduxjs/toolkit';\nimport { useSelector } from 'react-redux';\n\nimport styles from './TafsirText.module.scss';\n\nimport Counter from '@/dls/Counter/Counter';\nimport SpinnerContainer from '@/dls/Spinner/SpinnerContainer';\nimport usePersistPreferenceGroup from '@/hooks/auth/usePersistPreferenceGroup';\nimport {\n MAXIMUM_TAFSIR_FONT_STEP,\n MINIMUM_FONT_STEP,\n selectQuranReaderStyles,\n increaseTafsirFontScale,\n decreaseTafsirFontScale,\n} from '@/redux/slices/QuranReader/styles';\nimport { logValueChange } from '@/utils/eventLogger';\nimport PreferenceGroup from 'types/auth/PreferenceGroup';\n\ntype TafsirTextProps = {\n direction: string;\n languageCode: string;\n text: string;\n};\n\nconst FONT_SIZE_CLASS_MAP = {\n 1: styles.xs,\n 2: styles.sm,\n 3: styles.md,\n 4: styles.lg,\n 5: styles.xl,\n};\n\nconst TafsirText: React.FC<TafsirTextProps> = ({ direction, languageCode, text }) => {\n const quranReaderStyles = useSelector(selectQuranReaderStyles);\n const {\n actions: { onSettingsChange },\n isLoading,\n } = usePersistPreferenceGroup();\n const { tafsirFontScale } = quranReaderStyles;\n\n /**\n * Persist settings in the DB if the user is logged in before dispatching\n * Redux action, otherwise just dispatch it.\n *\n * @param {string} key\n * @param {number} value\n * @param {Action} action\n */\n const onTafsirsSettingsChange = (\n key: string,\n value: number,\n action: Action,\n undoAction: Action,\n ) => {\n onSettingsChange(key, value, action, undoAction, PreferenceGroup.QURAN_READER_STYLES);\n };\n\n const onFontScaleDecreaseClicked = () => {\n const newValue = tafsirFontScale - 1;\n logValueChange('tafsir_font_scale', tafsirFontScale, newValue);\n onTafsirsSettingsChange(\n 'tafsirFontScale',\n newValue,\n decreaseTafsirFontScale(),\n increaseTafsirFontScale(),\n );\n };\n\n const onFontScaleIncreaseClicked = () => {\n const newValue = tafsirFontScale + 1;\n logValueChange('tafsir_font_scale', tafsirFontScale, newValue);\n onTafsirsSettingsChange(\n 'tafsirFontScale',\n newValue,\n increaseTafsirFontScale(),\n decreaseTafsirFontScale(),\n );\n };\n return (\n <>\n <div dir={direction} className={styles.counter}>\n <SpinnerContainer isLoading={isLoading}>\n <Counter\n count={tafsirFontScale}\n onDecrement={tafsirFontScale === MINIMUM_FONT_STEP ? null : onFontScaleDecreaseClicked}\n onIncrement={\n tafsirFontScale === MAXIMUM_TAFSIR_FONT_STEP ? null : onFontScaleIncreaseClicked\n }\n />\n </SpinnerContainer>\n </div>\n <div\n className={FONT_SIZE_CLASS_MAP[tafsirFontScale]}\n dir={direction}\n lang={languageCode}\n dangerouslySetInnerHTML={{ __html: text }}\n />\n </>\n );\n};\nexport default TafsirText;\n","/* eslint-disable react-func/max-lines-per-function */\n/* eslint-disable max-lines */\n/* eslint-disable i18next/no-literal-string */\nimport React, { useCallback, useContext, useEffect, useState } from 'react';\n\nimport classNames from 'classnames';\nimport useTranslation from 'next-translate/useTranslation';\nimport { useSelector, shallowEqual } from 'react-redux';\nimport useSWR from 'swr/immutable';\n\nimport VerseTextPreview from '../VerseTextPreview';\n\nimport LanguageAndTafsirSelection from './LanguageAndTafsirSelection';\nimport SurahAndAyahSelection from './SurahAndAyahSelection';\nimport TafsirEndOfScrollingActions from './TafsirEndOfScrollingActions';\nimport TafsirGroupMessage from './TafsirGroupMessage';\nimport TafsirMessage from './TafsirMessage';\nimport TafsirSkeleton from './TafsirSkeleton';\nimport TafsirText from './TafsirText';\nimport styles from './TafsirView.module.scss';\n\nimport DataFetcher from '@/components/DataFetcher';\nimport Separator from '@/dls/Separator/Separator';\nimport usePersistPreferenceGroup from '@/hooks/auth/usePersistPreferenceGroup';\nimport { selectQuranReaderStyles } from '@/redux/slices/QuranReader/styles';\nimport { selectTafsirs, setSelectedTafsirs } from '@/redux/slices/QuranReader/tafsirs';\nimport { makeTafsirContentUrl, makeTafsirsUrl } from '@/utils/apiPaths';\nimport {\n logButtonClick,\n logEvent,\n logItemSelectionChange,\n logValueChange,\n} from '@/utils/eventLogger';\nimport { getLanguageDataById } from '@/utils/locale';\nimport { fakeNavigate, getVerseSelectedTafsirNavigationUrl } from '@/utils/navigation';\nimport {\n getFirstTafsirOfLanguage,\n getSelectedTafsirLanguage,\n getTafsirsLanguageOptions,\n} from '@/utils/tafsir';\nimport {\n getVerseNumberFromKey,\n getFirstAndLastVerseKeys,\n makeVerseKey,\n isLastVerseOfSurah,\n getVerseAndChapterNumbersFromKey,\n} from '@/utils/verse';\nimport { fetcher } from 'src/api';\nimport DataContext from 'src/contexts/DataContext';\nimport { TafsirContentResponse, TafsirsResponse } from 'types/ApiResponses';\nimport PreferenceGroup from 'types/auth/PreferenceGroup';\n\ntype TafsirBodyProps = {\n initialChapterId: string;\n initialVerseNumber: string;\n initialTafsirIdOrSlug?: number | string;\n scrollToTop: () => void;\n shouldRender?: boolean;\n render: (renderProps: {\n surahAndAyahSelection: JSX.Element;\n languageAndTafsirSelection: JSX.Element;\n body: JSX.Element;\n }) => JSX.Element;\n};\n\nconst TafsirBody = ({\n initialChapterId,\n initialVerseNumber,\n initialTafsirIdOrSlug,\n render,\n scrollToTop,\n shouldRender,\n}: TafsirBodyProps) => {\n const quranReaderStyles = useSelector(selectQuranReaderStyles, shallowEqual);\n const { lang, t } = useTranslation('common');\n const tafsirsState = useSelector(selectTafsirs);\n const { selectedTafsirs: userPreferredTafsirIds } = tafsirsState;\n const chaptersData = useContext(DataContext);\n const {\n actions: { onSettingsChange },\n isLoading,\n } = usePersistPreferenceGroup();\n\n const [selectedChapterId, setSelectedChapterId] = useState(initialChapterId);\n const [selectedVerseNumber, setSelectedVerseNumber] = useState(initialVerseNumber);\n const [selectedLanguage, setSelectedLanguage] = useState('');\n const selectedVerseKey = makeVerseKey(Number(selectedChapterId), Number(selectedVerseNumber));\n const [selectedTafsirIdOrSlug, setSelectedTafsirIdOrSlug] = useState<number | string>(\n initialTafsirIdOrSlug || userPreferredTafsirIds?.[0],\n );\n\n // if user opened tafsirBody via a url, we will have initialTafsirIdOrSlug\n // we need to set this `initialTafsirIdOrSlug` as a selectedTafsirIdOrSlug\n // we did not use `useState(initialTafsirIdOrSlug)` because `useRouter`'s query string is undefined on first render\n useEffect(() => {\n if (initialTafsirIdOrSlug) {\n logEvent('tafsir_url_access');\n setSelectedTafsirIdOrSlug(initialTafsirIdOrSlug);\n }\n }, [initialTafsirIdOrSlug]);\n\n const onTafsirSelected = useCallback(\n (id: number, slug: string) => {\n logItemSelectionChange('tafsir', id);\n setSelectedTafsirIdOrSlug(slug);\n fakeNavigate(\n getVerseSelectedTafsirNavigationUrl(\n Number(selectedChapterId),\n Number(selectedVerseNumber),\n slug,\n ),\n lang,\n );\n onSettingsChange(\n 'selectedTafsirs',\n [slug],\n setSelectedTafsirs({\n tafsirs: [slug],\n locale: lang,\n }),\n setSelectedTafsirs({\n tafsirs: tafsirsState.selectedTafsirs,\n locale: lang,\n }),\n PreferenceGroup.TAFSIRS,\n );\n },\n [lang, onSettingsChange, selectedChapterId, selectedVerseNumber, tafsirsState],\n );\n\n const { data: tafsirSelectionList } = useSWR<TafsirsResponse>(\n shouldRender ? makeTafsirsUrl(lang) : null,\n fetcher,\n );\n\n // selectedLanguage is based on selectedTafsir's language\n // but we need to fetch the data from the API first to know what is the language of `selectedTafsirIdOrSlug`\n // so we get the data from the API and set the selectedLanguage once it is loaded\n useEffect(() => {\n if (tafsirSelectionList) {\n setSelectedLanguage((prevSelectedLanguage) => {\n // if we haven't set the language already, we need to detect which language the current tafsir is in.\n return (\n prevSelectedLanguage ||\n getSelectedTafsirLanguage(tafsirSelectionList, selectedTafsirIdOrSlug)\n );\n });\n }\n }, [onTafsirSelected, selectedTafsirIdOrSlug, tafsirSelectionList]);\n\n // there's no 1:1 data that can map our locale options to the tafsir language options\n // so we're using options that's available from tafsir for now\n // TODO: update language options, to use the same options as our LanguageSelector\n const languageOptions = tafsirSelectionList\n ? getTafsirsLanguageOptions(tafsirSelectionList.tafsirs)\n : [];\n\n /**\n * Handle when the language of the Tafsir is changed. When it does,\n * we auto-select the first Tafsir of the new language based on the\n * response from BE.\n *\n * @param {string} newLang\n */\n const onLanguageSelected = (newLang: string) => {\n logValueChange('tafsir_locale', selectedLanguage, newLang);\n setSelectedLanguage(newLang);\n\n if (tafsirSelectionList) {\n const firstTafsirOfLanguage = getFirstTafsirOfLanguage(tafsirSelectionList, newLang);\n if (firstTafsirOfLanguage) {\n const { id, slug } = firstTafsirOfLanguage;\n onTafsirSelected(id, slug);\n }\n }\n };\n\n const renderTafsir = useCallback(\n (data: TafsirContentResponse) => {\n if (!data || !data.tafsir) return <TafsirSkeleton />;\n\n const { verses, text, languageId } = data.tafsir;\n const langData = getLanguageDataById(languageId);\n\n const [firstVerseKey, lastVerseKey] = getFirstAndLastVerseKeys(verses);\n const [chapterNumber, verseNumber] = getVerseAndChapterNumbersFromKey(lastVerseKey);\n const hasNextVerseGroup = !isLastVerseOfSurah(\n chaptersData,\n chapterNumber,\n Number(verseNumber),\n );\n const hasPrevVerseGroup = getVerseNumberFromKey(firstVerseKey) !== 1;\n\n const loadNextVerseGroup = () => {\n logButtonClick('tafsir_next_verse');\n scrollToTop();\n const newVerseNumber = String(Number(getVerseNumberFromKey(lastVerseKey)) + 1);\n fakeNavigate(\n getVerseSelectedTafsirNavigationUrl(\n Number(selectedChapterId),\n Number(newVerseNumber),\n selectedTafsirIdOrSlug,\n ),\n lang,\n );\n setSelectedVerseNumber(newVerseNumber);\n };\n\n const loadPrevVerseGroup = () => {\n const newVerseNumber = String(Number(getVerseNumberFromKey(firstVerseKey)) - 1);\n logButtonClick('tafsir_prev_verse');\n scrollToTop();\n fakeNavigate(\n getVerseSelectedTafsirNavigationUrl(\n Number(selectedChapterId),\n Number(newVerseNumber),\n selectedTafsirIdOrSlug,\n ),\n lang,\n );\n setSelectedVerseNumber(newVerseNumber);\n };\n\n return (\n <div>\n {!text && (\n <TafsirMessage>\n {t('tafsir.no-text', {\n tafsirName: data.tafsir.translatedName.name,\n })}\n </TafsirMessage>\n )}\n {Object.values(verses).length > 1 && !!text && (\n <TafsirGroupMessage from={firstVerseKey} to={lastVerseKey} />\n )}\n <div className={styles.verseTextContainer}>\n <VerseTextPreview verses={Object.values(verses)} />\n </div>\n <div className={styles.separatorContainer}>\n <Separator />\n </div>\n {!!text && (\n <TafsirText direction={langData.direction} languageCode={langData.code} text={text} />\n )}\n <TafsirEndOfScrollingActions\n hasNextVerseGroup={hasNextVerseGroup}\n hasPrevVerseGroup={hasPrevVerseGroup}\n onNextButtonClicked={loadNextVerseGroup}\n onPreviousButtonClicked={loadPrevVerseGroup}\n />\n </div>\n );\n },\n [chaptersData, lang, scrollToTop, selectedChapterId, selectedTafsirIdOrSlug, t],\n );\n\n const onChapterIdChange = (newChapterId) => {\n logItemSelectionChange('tafsir_chapter_id', newChapterId);\n fakeNavigate(\n getVerseSelectedTafsirNavigationUrl(Number(newChapterId), Number(1), selectedTafsirIdOrSlug),\n lang,\n );\n setSelectedChapterId(newChapterId.toString());\n setSelectedVerseNumber('1'); // reset verse number to 1 every time chapter changes\n };\n\n const onVerseNumberChange = (newVerseNumber) => {\n logItemSelectionChange('tafsir_verse_number', newVerseNumber);\n setSelectedVerseNumber(newVerseNumber);\n fakeNavigate(\n getVerseSelectedTafsirNavigationUrl(\n Number(selectedChapterId),\n Number(newVerseNumber),\n selectedTafsirIdOrSlug,\n ),\n lang,\n );\n };\n\n const surahAndAyahSelection = (\n <SurahAndAyahSelection\n selectedChapterId={selectedChapterId}\n selectedVerseNumber={selectedVerseNumber}\n onChapterIdChange={onChapterIdChange}\n onVerseNumberChange={onVerseNumberChange}\n />\n );\n\n const languageAndTafsirSelection = (\n <LanguageAndTafsirSelection\n selectedTafsirIdOrSlug={selectedTafsirIdOrSlug}\n selectedLanguage={selectedLanguage}\n onTafsirSelected={onTafsirSelected}\n onSelectLanguage={onLanguageSelected}\n languageOptions={languageOptions}\n data={tafsirSelectionList}\n isLoading={isLoading}\n />\n );\n\n const body = (\n <div\n className={classNames(\n styles.tafsirContainer,\n styles[`tafsir-font-size-${quranReaderStyles.tafsirFontScale}`],\n )}\n // disable browser translation for tafsir content\n // @see {https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/translate}\n translate=\"no\"\n >\n <DataFetcher\n loading={TafsirSkeleton}\n queryKey={makeTafsirContentUrl(selectedTafsirIdOrSlug, selectedVerseKey, {\n lang,\n quranFont: quranReaderStyles.quranFont,\n mushafLines: quranReaderStyles.mushafLines,\n })}\n render={renderTafsir}\n />\n </div>\n );\n\n return render({ surahAndAyahSelection, languageAndTafsirSelection, body });\n};\n\nexport default TafsirBody;\n","import uniq from 'lodash/uniq';\n\nimport TafsirInfo from '@/types/TafsirInfo';\nimport { TafsirsResponse } from 'types/ApiResponses';\nimport Tafsir from 'types/Tafsir';\n\n/**\n * Get the language of the selected Tafsir.\n *\n * @param {TafsirsResponse} tafsirListData\n * @param {number|string} selectedTafsirIdOrSlug\n * @returns {string}\n */\nexport const getSelectedTafsirLanguage = (\n tafsirListData: TafsirsResponse,\n selectedTafsirIdOrSlug: number | string,\n): string => {\n const selectedTafsir = tafsirListData?.tafsirs.find(\n (tafsir) =>\n tafsir.slug === selectedTafsirIdOrSlug || tafsir.id === Number(selectedTafsirIdOrSlug),\n );\n return selectedTafsir?.languageName;\n};\n\n/**\n * Get the first Tafsir of a language.\n *\n * @param {TafsirsResponse} tafsirListData\n * @param {string} language\n * @returns {TafsirInfo}\n */\nexport const getFirstTafsirOfLanguage = (\n tafsirListData: TafsirsResponse,\n language: string,\n): TafsirInfo => {\n const selectedTafsir = tafsirListData?.tafsirs.find((tafsir) => tafsir.languageName === language);\n return selectedTafsir;\n};\n\n/**\n * Given list of tafsirs, get all available language options\n *\n * @param {Tafsir[]} tafsirs\n * @returns {string[]} list of available language options\n */\nexport const getTafsirsLanguageOptions = (tafsirs: Tafsir[]): string[] =>\n uniq(tafsirs.map((tafsir) => tafsir.languageName));\n","import useTranslation from 'next-translate/useTranslation';\n\nimport styles from './TafsirEndOfScrollingActions.module.scss';\n\nimport Button, { ButtonType } from '@/dls/Button/Button';\n\ntype TafsirEndOfScrollingActionsProps = {\n hasNextVerseGroup: boolean;\n hasPrevVerseGroup: boolean;\n onNextButtonClicked: () => void;\n onPreviousButtonClicked: () => void;\n};\n\nconst TafsirEndOfScrollingActions = ({\n hasNextVerseGroup,\n hasPrevVerseGroup,\n onNextButtonClicked,\n onPreviousButtonClicked,\n}: TafsirEndOfScrollingActionsProps) => {\n const { t } = useTranslation('common');\n return (\n <div className={styles.container}>\n <div>\n {hasPrevVerseGroup && (\n <Button type={ButtonType.Secondary} onClick={onPreviousButtonClicked}>\n {t('previous-ayah')}\n </Button>\n )}\n </div>\n <div>\n {hasNextVerseGroup && (\n <Button type={ButtonType.Secondary} onClick={onNextButtonClicked}>\n {t('next-ayah')}\n </Button>\n )}\n </div>\n </div>\n );\n};\n\nexport default TafsirEndOfScrollingActions;\n","import classNames from 'classnames';\nimport range from 'lodash/range';\n\nimport styles from './TafsirView.module.scss';\n\nimport Skeleton from '@/dls/Skeleton/Skeleton';\n\nconst TafsirSkeleton = () => {\n return (\n <>\n <Skeleton className={(styles.tafsirSkeletonItem, styles.ayahSekletonItem)} />\n {range(1, 15).map((i) => (\n <Skeleton\n key={i}\n className={classNames(styles.tafsirSkeletonItem, {\n [styles.tafsirSkeletonItem1]: i % 1 === 0,\n [styles.tafsirSkeletonItem2]: i % 2 === 0,\n [styles.tafsirSkeletonItem3]: i % 3 === 0,\n })}\n />\n ))}\n </>\n );\n};\n\nexport default TafsirSkeleton;\n","import React, { useMemo } from 'react';\n\nimport { shallowEqual, useSelector } from 'react-redux';\n\nimport PlainVerseText from '@/components/Verse/PlainVerseText';\nimport useQcfFont from '@/hooks/useQcfFont';\nimport { selectQuranReaderStyles } from '@/redux/slices/QuranReader/styles';\nimport { getVerseWords } from '@/utils/verse';\nimport Verse from 'types/Verse';\n\ninterface Props {\n verses: Verse[];\n fontScale?: number;\n}\n\nconst VerseTextPreview: React.FC<Props> = ({ verses, fontScale }) => {\n const { quranFont } = useSelector(selectQuranReaderStyles, shallowEqual);\n const tafsirVerses = useMemo(\n () =>\n Object.values(verses).map((verse) => ({\n ...verse,\n pageNumber: verse.words[0].pageNumber,\n })),\n [verses],\n );\n useQcfFont(quranFont, tafsirVerses);\n const words = useMemo(() => verses.map((verse) => getVerseWords(verse)).flat(), [verses]);\n return <PlainVerseText fontScale={fontScale} words={words} />;\n};\n\nexport default VerseTextPreview;\n","import { useEffect, useCallback, useRef } from 'react';\n\nimport { useDispatch, useSelector } from 'react-redux';\n\nimport { selectLoadedFontFaces, addLoadedFontFace } from '@/redux/slices/QuranReader/font-faces';\nimport { removeItemFromArray } from '@/utils/array';\nimport {\n getFontFaceNameForPage,\n getV1OrV2FontFaceSource,\n getPagesByVerses,\n isQCFFont,\n} from '@/utils/fontFaceHelper';\nimport { QuranFont } from 'types/QuranReader';\nimport Verse from 'types/Verse';\n\n/**\n * This hook manually request the browser to download the font for each page\n * of QCF's V1 and V2 Mushafs. After each resource has been downloaded, we\n * store it in redux so that VerseText can use it to determine whether the fallback\n * text and font should be font or not.\n *\n * Notes, loaded font is reset every time the user switch the font\n * see src/components/Navbar/SettingsDrawer/QuranFontSection.tsx\n *\n * @param {QuranFont} quranFont\n * @param {Verse[]} verses\n */\nconst useQcfFont = (quranFont: QuranFont, verses: Verse[]) => {\n const currentlyFetchingFonts = useRef([]);\n const dispatch = useDispatch();\n const isFontQCF = isQCFFont(quranFont);\n const loadedFonts = useSelector(selectLoadedFontFaces);\n const onFontLoaded = useCallback(\n (fontFace: string) => {\n dispatch(addLoadedFontFace(fontFace));\n },\n [dispatch],\n );\n\n // listen to changes in verses (this is due to infinite scrolling fetching more verses).\n useEffect(() => {\n if (isFontQCF && verses.length > 0) {\n // loop through unique page numbers of the current verses\n getPagesByVerses(verses).forEach((pageNumber) => {\n const isV1 = quranFont === QuranFont.MadaniV1;\n const fontFaceName = getFontFaceNameForPage(isV1, pageNumber);\n const fontFace = new FontFace(fontFaceName, getV1OrV2FontFaceSource(isV1, pageNumber));\n // we only want to load fonts that were not loaded and also are not currently being loaded\n if (\n !currentlyFetchingFonts.current.includes(fontFaceName) &&\n !loadedFonts.includes(fontFaceName)\n ) {\n currentlyFetchingFonts.current = [...currentlyFetchingFonts.current, fontFaceName];\n fontFace.display = 'block';\n document.fonts.add(fontFace);\n // load the font-face programmatically\n fontFace\n .load()\n .then(() => {\n // store the font face in Redux slice\n onFontLoaded(fontFaceName);\n })\n .finally(() => {\n // whether we failed or succeeded to fetch the fontFace, we remove it from currently fetching array\n currentlyFetchingFonts.current = removeItemFromArray(\n fontFaceName,\n currentlyFetchingFonts.current,\n );\n });\n }\n });\n }\n }, [quranFont, verses, loadedFonts, isFontQCF, currentlyFetchingFonts, onFontLoaded]);\n};\n\nexport default useQcfFont;\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"container\":\"TafsirEndOfScrollingActions_container__tcWLj\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"tafsirMessage\":\"TafsirMessage_tafsirMessage__Gr_S9\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"counter\":\"TafsirText_counter__xlNaF\",\"xs\":\"TafsirText_xs__P5Qjv\",\"sm\":\"TafsirText_sm__BbfQ0\",\"md\":\"TafsirText_md__mJWtv\",\"lg\":\"TafsirText_lg__t_oGB\",\"xl\":\"TafsirText_xl__3hmwr\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"container\":\"TafsirView_container__R9G7I\",\"tafsirName\":\"TafsirView_tafsirName__QPOiO\",\"tafsirContainer\":\"TafsirView_tafsirContainer__g2rhW\",\"rtl\":\"TafsirView_rtl__8pRLP\",\"surahAndAyahSelectionContainer\":\"TafsirView_surahAndAyahSelectionContainer__W96nf\",\"tafsirSelectionContainer\":\"TafsirView_tafsirSelectionContainer__QSkE3\",\"tafsirSelectionItem\":\"TafsirView_tafsirSelectionItem__GTJvw\",\"tafsirItemSelected\":\"TafsirView_tafsirItemSelected__SXceL\",\"separatorContainer\":\"TafsirView_separatorContainer__diS8n\",\"verseTextContainer\":\"TafsirView_verseTextContainer__A7tZ_\",\"selectionItem\":\"TafsirView_selectionItem__FJdhi\",\"ayahSelection\":\"TafsirView_ayahSelection__jWULb\",\"tafsirSkeletonItem\":\"TafsirView_tafsirSkeletonItem__q5sNk\",\"ayahSekletonItem\":\"TafsirView_ayahSekletonItem__B_nJN\",\"tafsirSkeletonItem1\":\"TafsirView_tafsirSkeletonItem1__nLGRk\",\"tafsirSkeletonItem2\":\"TafsirView_tafsirSkeletonItem2__aaEJy\",\"tafsirSkeletonItem3\":\"TafsirView_tafsirSkeletonItem3__NqYKV\",\"tafsirSelectionSkeleton\":\"TafsirView_tafsirSelectionSkeleton__3oq7k\",\"languageSelection\":\"TafsirView_languageSelection__8EFqZ\",\"tafsir-font-size-1\":\"TafsirView_tafsir-font-size-1__sLRnq\",\"tafsir-font-size-2\":\"TafsirView_tafsir-font-size-2__JLiR2\",\"tafsir-font-size-3\":\"TafsirView_tafsir-font-size-3__K0LBa\",\"tafsir-font-size-4\":\"TafsirView_tafsir-font-size-4__KrD1k\",\"tafsir-font-size-5\":\"TafsirView_tafsir-font-size-5__ri_Mr\",\"tafsir-font-size-6\":\"TafsirView_tafsir-font-size-6__FvBko\",\"tafsir-font-size-7\":\"TafsirView_tafsir-font-size-7__oS0XU\",\"tafsir-font-size-8\":\"TafsirView_tafsir-font-size-8__1U_43\",\"tafsir-font-size-9\":\"TafsirView_tafsir-font-size-9__6VJC2\",\"tafsir-font-size-10\":\"TafsirView_tafsir-font-size-10__zRYWI\"};"],"names":["baseUniq","module","exports","array","length","selectedChapterId","selectedVerseNumber","onChapterIdChange","onVerseNumberChange","useTranslation","lang","chaptersData","useContext","DataContext","verses","generateChapterVersesKeys","surahOptions","useMemo","Object","entries","map","id","label","transliteratedName","value","ayahOptions","verseKey","verseNumber","getVerseNumberFromKey","toString","toLocalizedNumber","Number","div","className","styles","Select","size","SelectSize","name","options","onChange","selectedTafsirIdOrSlug","onTafsirSelected","selectedLanguage","onSelectLanguage","languageOptions","data","isLoading","SpinnerContainer","lng","getLocaleNameByFullName","tafsirs","filter","tafsir","languageName","slug","selected","Button","onClick","ButtonSize","classNames","translatedName","Skeleton","children","from","to","t","TafsirMessage","FONT_SIZE_CLASS_MAP","direction","languageCode","text","quranReaderStyles","useSelector","selectQuranReaderStyles","usePersistPreferenceGroup","actions","onSettingsChange","tafsirFontScale","onTafsirsSettingsChange","key","action","undoAction","PreferenceGroup","dir","Counter","count","onDecrement","MINIMUM_FONT_STEP","newValue","logValueChange","decreaseTafsirFontScale","increaseTafsirFontScale","onIncrement","MAXIMUM_TAFSIR_FONT_STEP","dangerouslySetInnerHTML","__html","initialChapterId","initialVerseNumber","initialTafsirIdOrSlug","render","scrollToTop","shouldRender","shallowEqual","tafsirsState","selectTafsirs","selectedTafsirs","useState","setSelectedChapterId","setSelectedVerseNumber","setSelectedLanguage","selectedVerseKey","makeVerseKey","userPreferredTafsirIds","setSelectedTafsirIdOrSlug","useEffect","logEvent","useCallback","logItemSelectionChange","fakeNavigate","getVerseSelectedTafsirNavigationUrl","setSelectedTafsirs","locale","useSWR","makeTafsirsUrl","fetcher","tafsirSelectionList","prevSelectedLanguage","tafsirListData","selectedTafsir","find","getSelectedTafsirLanguage","uniq","getTafsirsLanguageOptions","renderTafsir","TafsirSkeleton","languageId","langData","getLanguageDataById","getFirstAndLastVerseKeys","firstVerseKey","lastVerseKey","getVerseAndChapterNumbersFromKey","chapterNumber","hasNextVerseGroup","isLastVerseOfSurah","hasPrevVerseGroup","tafsirName","values","TafsirGroupMessage","VerseTextPreview","Separator","TafsirText","code","TafsirEndOfScrollingActions","onNextButtonClicked","logButtonClick","newVerseNumber","String","onPreviousButtonClicked","surahAndAyahSelection","SurahAndAyahSelection","newChapterId","languageAndTafsirSelection","LanguageAndTafsirSelection","newLang","firstTafsirOfLanguage","language","body","translate","DataFetcher","loading","queryKey","makeTafsirContentUrl","quranFont","mushafLines","type","ButtonType","range","i","fontScale","tafsirVerses","verse","pageNumber","words","useQcfFont","getVerseWords","flat","PlainVerseText","currentlyFetchingFonts","useRef","dispatch","useDispatch","isFontQCF","isQCFFont","loadedFonts","selectLoadedFontFaces","onFontLoaded","fontFace","addLoadedFontFace","getPagesByVerses","forEach","isV1","QuranFont","fontFaceName","getFontFaceNameForPage","FontFace","getV1OrV2FontFaceSource","current","includes","display","document","fonts","add","load","then","finally","removeItemFromArray"],"sourceRoot":""}
|