{"version":3,"file":"static/js/8450.b3269c51.chunk.js","mappings":"yLAMA,MA6BA,EA7BiCA,KAC/B,MAAMC,GAAmBC,EAAAA,EAAAA,QAAqB,IAAIC,EAAAA,KAC5C,sBAAEC,IAA0BC,EAAAA,EAAAA,MAE3BC,EAAaC,IAAkBC,EAAAA,EAAAA,WAAkB,GAkBxD,OAdAC,EAAAA,EAAAA,YAAU,KACRR,EAAiBS,QAAQC,IACvBP,EAAsBQ,WAAWC,IAC/BN,EAAeM,EAAI,EAAE,KAIzB,MAAMC,EAAsBb,EAAiBS,QAE7C,MAAO,KACLI,EAAoBC,aAAa,CAClC,GACA,CAACd,EAAkBG,KAGpBY,EAAAA,EAAAA,KAAA,OAAKC,UAAS,kBAAAC,OAAoBZ,EAAc,cAAgB,IAAKa,UACnEH,EAAAA,EAAAA,KAACI,EAAAA,EAAc,KACX,C","sources":["components/ui/LoadingAnimations/LoadingOverlay/LoadingOverlay.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { Subscription } from 'rxjs';\nimport LoadingSpinner from '../LoadingSpinner/LoadingSpinner';\nimport './LoadingOverlay.scss';\nimport { useLoadingOverlayContext } from './LoadingOverlayContext';\n\nconst LoadingOverlay: React.FC = () => {\n const allSubscriptions = useRef(new Subscription());\n const { loadingOverlaysCount$ } = useLoadingOverlayContext();\n\n const [isDisplayed, setIsDisplayed] = useState(false);\n\n // For performance, we utilize observables instead of state variables in a context because observables\n // are stable objects and don't trigger rerenders\n useEffect(() => {\n allSubscriptions.current.add(\n loadingOverlaysCount$.subscribe((v) => {\n setIsDisplayed(v > 0);\n })\n );\n\n const allSubscriptionsObj = allSubscriptions.current;\n\n return () => {\n allSubscriptionsObj.unsubscribe();\n };\n }, [allSubscriptions, loadingOverlaysCount$]);\n\n return (\n
\n \n
\n );\n};\n\nexport default LoadingOverlay;\n"],"names":["LoadingOverlay","allSubscriptions","useRef","Subscription","loadingOverlaysCount$","useLoadingOverlayContext","isDisplayed","setIsDisplayed","useState","useEffect","current","add","subscribe","v","allSubscriptionsObj","unsubscribe","_jsx","className","concat","children","LoadingSpinner"],"sourceRoot":""}