{
  "version": 3,
  "sources": ["../../misc/browser_ext_link.tsx", "../../../lib.web.rich_text_editor/index.ts"],
  "sourcesContent": ["import * as React from \"react\"\n\nimport * as MDC from \"@cling/lib.web.mdc\"\nimport {i18n} from \"@cling/lib.web.i18n\"\nimport {classNames, running_on_mobile_device} from \"@cling/lib.web.utils\"\n\ndeclare const window: Window & {\n    chrome?: any\n    safari?: any\n}\n\ntype Browser = \"Chrome\" | \"Firefox\" | \"Edge\" | \"Safari\" | \"Other\"\n\nconst _browser: Browser = (function () {\n    const w = window\n    const n = navigator\n    if (w.chrome && n.userAgent.includes(\"Edg/\")) {\n        return \"Edge\"\n    }\n    if (w.chrome && n.userAgent.includes(\"Chrome/\")) {\n        return \"Chrome\"\n    }\n    if (n.userAgent.includes(\"Firefox/\")) {\n        return \"Firefox\"\n    }\n    if (!w.chrome && n.userAgent.includes(\"Safari/\")) {\n        return \"Safari\"\n    }\n    return \"Other\"\n})()\n\nexport function is_browser_ext_available() {\n    return _browser !== \"Other\"\n}\n\nexport const BrowserExtLink = ({\n    type,\n    onClick,\n    className,\n}: {\n    type: \"Link\" | \"ListItem\" | \"Button\"\n    onClick?: () => void\n    className?: string\n}) => {\n    const download = React.useCallback(\n        (e: React.SyntheticEvent<any>) => {\n            if (_browser === \"Chrome\") {\n                window.open(\n                    \"https://chrome.google.com/webstore/detail/cling/ejnnkeailcbcbglhmghhpfobjeioohcf\",\n                    \"_blank\",\n                    \"noopener\",\n                )\n            } else if (_browser === \"Edge\") {\n                window.open(\n                    \"https://microsoftedge.microsoft.com/addons/detail/fpdhlogbegnlbammfkhegdbdpidlnbfm\",\n                    \"_blank\",\n                    \"noopener\",\n                )\n            } else if (_browser === \"Safari\") {\n                window.open(\n                    \"https://apps.apple.com/de/app/cling-button/id6445855760?l=en&amp;mt=12\",\n                    \"_blank\",\n                    \"noopener\",\n                )\n            } else if (_browser === \"Firefox\") {\n                window.open(\n                    \"https://addons.mozilla.org/de/firefox/addon/cling-bookmark-button/\",\n                    \"_blank\",\n                    \"noopener\",\n                )\n            }\n            e.stopPropagation()\n            e.preventDefault()\n            if (onClick) {\n                onClick()\n            }\n        },\n        [onClick],\n    )\n    if (_browser === \"Other\" || running_on_mobile_device()) {\n        return null\n    }\n    if (type === \"Link\") {\n        return (\n            <a\n                href=\"#\"\n                className={classNames(\"mdcx-link--outgoing\", className)}\n                onClick={download}\n                draggable={false}\n            >\n                {_browser === \"Chrome\" && <span>{i18n.chrome_extension}</span>}\n                {_browser === \"Firefox\" && <span>{i18n.firefox_addon}</span>}\n                {_browser === \"Edge\" && <span>{i18n.edge_extension}</span>}\n                {_browser === \"Safari\" && <span>{i18n.safari_extension}</span>}\n            </a>\n        )\n    }\n    if (type === \"Button\") {\n        return (\n            <MDC.Button outlined className={className} onClick={download}>\n                {_browser === \"Chrome\" && i18n.chrome_extension}\n                {_browser === \"Firefox\" && i18n.firefox_addon}\n                {_browser === \"Edge\" && i18n.edge_extension}\n                {_browser === \"Safari\" && i18n.safari_extension}\n            </MDC.Button>\n        )\n    }\n    return (\n        <MDC.ListItem onClick={download}>\n            <MDC.Icon icon=\"extension\" outlined />\n            <div>\n                {_browser === \"Chrome\" && <span>{i18n.chrome_extension}</span>}\n                {_browser === \"Firefox\" && <span>{i18n.firefox_addon}</span>}\n                {_browser === \"Edge\" && <span>{i18n.edge_extension}</span>}\n                {_browser === \"Safari\" && <span>{i18n.safari_extension}</span>}\n            </div>\n        </MDC.ListItem>\n    )\n}\n", "export function is_elm_inside_an_active_rich_text_editor(elm?: HTMLElement): boolean {\n    if (!elm || !elm.closest) {\n        return false\n    }\n    const editor = elm.closest(\".ProseMirror\")\n    if (!editor) {\n        return false\n    }\n    return !!editor.getAttribute(\"contenteditable\")\n}\n"],
  "mappings": "0MAAAA,IAaA,IAAMC,EAAqB,UAAY,CACnC,IAAMC,EAAI,OACJC,EAAI,UACV,OAAID,EAAE,QAAUC,EAAE,UAAU,SAAS,MAAM,EAChC,OAEPD,EAAE,QAAUC,EAAE,UAAU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YAAME,EAAK,gBAAiB,EACtDf,IAAa,WAAaa,EAAC,YAAME,EAAK,aAAc,EACpDf,IAAa,QAAUa,EAAC,YAAME,EAAK,cAAe,EAClDf,IAAa,UAAYa,EAAC,YAAME,EAAK,gBAAiB,CAC3D,CACJ,CAER,EAnF8B,kBCnCvB,SAASI,EAAyCC,EAA4B,CACjF,GAAI,CAACA,GAAO,CAACA,EAAI,QACb,MAAO,GAEX,IAAMC,EAASD,EAAI,QAAQ,cAAc,EACzC,OAAKC,EAGE,CAAC,CAACA,EAAO,aAAa,iBAAiB,EAFnC,EAGf,CATgBC,EAAAH,EAAA",
  "names": ["init_compat_module", "_browser", "w", "n", "is_browser_ext_available", "__name", "BrowserExtLink", "type", "onClick", "className", "download", "q", "e", "running_on_mobile_device", "_", "classNames", "i18n", "Button", "ListItem", "Icon", "is_elm_inside_an_active_rich_text_editor", "elm", "editor", "__name"]
}