phanpy-cz/assets/compose-Skgn-tKU.js.map

1 line
5.2 KiB
Plaintext
Raw Permalink Normal View History

2024-11-16 10:51:00 +00:00
{"version":3,"file":"compose-Skgn-tKU.js","sources":["../../src/compose.jsx"],"sourcesContent":["import './index.css';\nimport './app.css';\nimport './polyfills';\n\nimport { i18n } from '@lingui/core';\nimport { t, Trans } from '@lingui/macro';\nimport { I18nProvider } from '@lingui/react';\nimport { render } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\n\nimport ComposeSuspense from './components/compose-suspense';\nimport Loader from './components/loader';\nimport { initActivateLang } from './utils/lang';\nimport { initStates } from './utils/states';\nimport { getCurrentAccount, setCurrentAccountID } from './utils/store-utils';\nimport useTitle from './utils/useTitle';\n\ninitActivateLang();\n\nif (window.opener) {\n console = window.opener.console;\n}\n\nfunction App() {\n const [uiState, setUIState] = useState('default');\n const [isLoggedIn, setIsLoggedIn] = useState(null);\n\n const { editStatus, replyToStatus, draftStatus } = window.__COMPOSE__ || {};\n\n useTitle(\n editStatus\n ? t`Editing source status`\n : replyToStatus\n ? t`Replying to @${\n replyToStatus.account?.acct || replyToStatus.account?.username\n }`\n : t`Compose`,\n );\n\n useEffect(() => {\n const account = getCurrentAccount();\n setIsLoggedIn(!!account);\n if (account) {\n initStates();\n }\n }, []);\n\n useEffect(() => {\n if (uiState === 'closed') {\n try {\n // Focus parent window\n window.opener.focus();\n } catch (e) {}\n window.close();\n }\n }, [uiState]);\n\n if (uiState === 'closed') {\n return (\n <div class=\"box\">\n <p>\n <Trans>You may close this page now.</Trans>\n </p>\n <p>\n <button\n onClick={() => {\n window.close();\n }}\n >\n <Trans>Close window</Trans>\n </button>\n </p>\n </div>\n );\n }\n\n console.debug('OPEN COMPOSE');\n\n if (isLoggedIn === false) {\n return (\n <div class=\"box\">\n <h1>\n <Trans>Error</Trans>\n </h1>\n <p>\n <Trans>Login required.</Trans>\n </p>\n <p>\n <a href=\"/\">\n <Trans>Go home</Trans>\n </a>\n </p>\n </div>\n );\n }\n\n if (isLoggedIn) {\n return (\n <ComposeSuspense\n editStatus={editStatus}\n replyToStatus={replyToStatus}\n draftStatus={draftStatus}\n standalone\n hasOpener={window.opener}\n onClose={(results) => {\n const { newStatus, fn = () => {} } = results || {};\n try {\n if (newStatus) {\n window.opener.__STATES__.reloadStatusPage++;\n }\n fn();\n setUIState('closed');\n } catch (e) {}\n }}\n />\n );\n }\n\n return (\n <div class=\"box\">\n <Loader />\n </div>\n );\n}\n\nrender(\n <I18nProvider i18n={i18n}>\n <App />\n </I18nProvider>,\n document.getElementById('app-standalone'),\n);\n"],"names":["initActivateLang","window","opener","console","App","uiState","setUIState","useState","isLoggedIn","setIsLoggedIn","editStatus","replyToStatus","draftStatus","__COMPOSE__","useTitle","i18n","_","id","values","0","account","acct","username","useEffect","getCurrentAccount","initStates","focus","close","_jsxs","class","children","_jsx","Trans","onClick","href","ComposeSuspense","standalone","hasOpener","newStatus","results","fn","Loader","render","I18nProvider"],"mappings":"mIAiBAA,IAEIC,OAAOC,SACTC,QAAUF,OAAOC,OAAOC,SAG1B,SAASC,GAAM,SACb,KAAM,CAACC,EAASC,CAAU,EAAIC,EAAS,SAAS,EAC1C,CAACC,EAAYC,CAAa,EAAIF,EAAS,IAAI,EAE3C,CAAEG,WAAAA,EAAYC,cAAAA,EAAeC,YAAAA,CAAAA,EAAgBX,OAAOY,aAAe,GA8BzE,OA5BAC,EACEJ,EAAUK,EAAAC,EACN,CAAAC,GAAA,QAAuB,CAAA,EACvBN,EAAaI,EAAAC,EACb,CAAAC,GAAA,SAAAC,OAAA,CAAAC,IACER,EAAAA,EAAcS,UAAdT,YAAAA,EAAuBU,SAAQV,EAAAA,EAAcS,UAAdT,YAAAA,EAAuBW,SAAQ,CAC/D,GAACP,EAAAC,EACF,CAAAC,GAAA,QAAS,CAAA,CACf,EAEAM,EAAU,IAAM,CACd,MAAMH,EAAUI,IACFf,EAAA,CAAC,CAACW,CAAO