{"version":3,"file":"compose-Cvq_Pe8Z.js","sources":["../../src/compose.jsx"],"sourcesContent":["import './index.css';\n\nimport './app.css';\n\nimport { render } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\n\nimport Compose from './components/compose';\nimport useTitle from './utils/useTitle';\n\nif (window.opener) {\n console = window.opener.console;\n}\n\nfunction App() {\n const [uiState, setUIState] = useState('default');\n\n const { editStatus, replyToStatus, draftStatus } = window.__COMPOSE__ || {};\n\n useTitle(\n editStatus\n ? 'Editing source status'\n : replyToStatus\n ? `Replying to @${\n replyToStatus.account?.acct || replyToStatus.account?.username\n }`\n : 'Compose',\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
\n

You may close this page now.

\n

\n {\n window.close();\n }}\n >\n Close window\n \n

\n
\n );\n }\n\n console.debug('OPEN COMPOSE');\n\n return (\n {\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\nrender(, document.getElementById('app-standalone'));\n"],"names":["window","opener","console","App","uiState","setUIState","useState","editStatus","replyToStatus","draftStatus","__COMPOSE__","account","acct","username","useEffect","focus","close","_jsxs","class","children","_jsx","onClick","standalone","hasOpener","newStatus","results","fn","render"],"mappings":"gHAUIA,OAAOC,SACTC,QAAUF,OAAOC,OAAOC,SAG1B,SAASC,GAAM,SACb,KAAM,CAACC,EAASC,CAAU,EAAIC,EAAS,SAAS,EAE1C,CAAEC,WAAAA,EAAYC,cAAAA,EAAeC,YAAAA,CAAAA,EAAgBT,OAAOU,aAAe,GAsBzE,OAnBEH,EAAAA,EACI,wBACAC,EACC,kBACCA,EAAAA,EAAcG,UAAdH,YAAAA,EAAuBI,SAAQJ,EAAAA,EAAcG,UAAdH,YAAAA,EAAuBK,SACvD,GACD,SACN,EAEAC,EAAU,IAAM,CACd,GAAIV,IAAY,SAAU,CACpB,GAAA,CAEFJ,OAAOC,OAAOc,aACJ,CAAC,CACbf,OAAOgB,MAAM,CACf,CAAA,EACC,CAACZ,CAAO,CAAC,EAERA,IAAY,SAEZa,EAAA,MAAA,CAAKC,MAAM,MAAKC,UACdC,EAAA,IAAA,CAAAD,SAAG,8BAAA,CAA+B,EAClCC,EAAA,IAAA,CAAAD,SACEC,EAAA,SAAA,CACEC,QAASA,IAAM,CACbrB,OAAOgB,MAAM,CACf,EAAEG,SACH,cAAA,CAEO,CAAA,CACP,CAAC,CAAA,CACD,EAITjB,IAA4B,CAE5B,WAAAK,EAEIA,cAAAA,EACAC,YAAAA,EACAC,WAAAA,GACAa,UAAU,OAAA,OACVC,WAAkBtB,OAEV,UAAAuB,EAAEA,GAAAA,EAAAA,IAAAA,EAAsB,EAACC,GAAA,CAAA,EAAE,GAAIA,CACjCD,GACF,OAAe,OAAA,WAAA,mBAEfE,IACGrB,EAAA,QAAA,CACHA,MAAAA,EACW,CAAA,CACf,CAAA,CAGNsB,EAAAP,EAAAjB,EAAA,CAAA,CAAA,EAAA,SAAA,eAAA,gBAAA,CAAA"}