{"version":3,"file":"main.D2Nehs.js","sources":["theme-14/virtual:theme","theme-14/discourse/initializers/discourse-twitter-native-embed.js","theme-14/virtual:entrypoint:main"],"sourcesContent":["import { getObjectForTheme } from \"discourse/lib/theme-settings-store\";\n\nexport const settings = getObjectForTheme(14);\n\nexport function themePrefix(key) {\n  return `theme_translations.14.${key}`;\n}\n","import { withPluginApi } from \"discourse/lib/plugin-api\";\n\n\nexport default {\n    name: \"discourse-twitter-native-embed\",\n    initialize() {\n        withPluginApi(\"1.0.0\", api => {\n\n            function getTwitterScript() {\n                var scriptnode = document.createElement(\"script\");\n                scriptnode.setAttribute(\"async\", \"\")\n                scriptnode.setAttribute(\"src\", \"https://platform.twitter.com/widgets.js\");\n                scriptnode.setAttribute(\"charset\", \"utf-8\");\n                document.head.appendChild(scriptnode);\n            }\n\n            api.decorateCookedElement((el, helper) => {\n                let hasQuote = false;\n                for (const the_musks_fxxking_url of [\"twitter.com\", \"x.com\"]) {\n                    for (const aa of el.querySelectorAll(`a.onebox[href^=\"https://${the_musks_fxxking_url}/\"][href*=status]`)) {\n                        const twitter_blockquoue = document.createElement(\"blockquote\");\n                        twitter_blockquoue.setAttribute(\"style\", \"display: none\");\n                        twitter_blockquoue.classList?.add(\"twitter-tweet\");\n                        const aaa = document.createElement(\"a\");\n                        aaa.setAttribute(\"href\", aa.href.replaceAll(\"https://x.com\", \"https://twitter.com\"));\n                        aaa.setAttribute(\"rel\", \"no-follow\");\n                        twitter_blockquoue.appendChild(aaa);\n                        aa.appendChild(twitter_blockquoue);\n                    }\n                }\n                for (const aa of el.querySelectorAll(\"aside.onebox.twitterstatus\")) {\n                    const twitter_blockquote = document.createElement(\"blockquote\");\n                    twitter_blockquote.setAttribute(\"style\", \"display: none\");\n                    twitter_blockquote.classList?.add(\"twitter-tweet\");\n                    const aaa = document.createElement(\"a\");\n                    const href = aa.getAttribute(\"data-onebox-src\").replaceAll(\"https://x.com\", \"https://twitter.com\")\n                    aaa.setAttribute(\"href\", href);\n                    aaa.setAttribute(\"rel\", \"no-follow\");\n                    twitter_blockquote.appendChild(aaa);\n                    aa.appendChild(twitter_blockquote);\n                    for (const oldEl of aa.querySelectorAll(\"header.source, article.onebox-body\")) {\n                        oldEl.setAttribute(\"style\", \"display: none\");\n                    }\n                }\n\n                for (const quote of el.getElementsByTagName(\"blockquote\")) {\n                    if (quote.querySelector(`blockquote a[href^=\"https://twitter.com/\"]`)) {\n                        quote.classList?.add(\"twitter-tweet\");\n                        hasQuote = true;\n                    }\n                }\n                if (hasQuote) {\n                    getTwitterScript();\n                }\n            }, {\n                id: \"discourse-twitter-native-embed\",\n                afterAdopt: true,\n                onlyStream: true,\n            });\n\n        });\n    }\n};\n\n","import * as Mod1 from \"./discourse/initializers/discourse-twitter-native-embed\";\nconst compatModules = {\n  \"discourse/initializers/discourse-twitter-native-embed\": Mod1,\n};\nexport { compatModules };\nexport default compatModules;\n"],"names":["getObjectForTheme","discourseTwitterNativeEmbed","name","initialize","withPluginApi","api","decorateCookedElement","el","helper","hasQuote","the_musks_fxxking_url","aa","querySelectorAll","twitter_blockquoue","document","createElement","setAttribute","classList","add","aaa","href","replaceAll","appendChild","twitter_blockquote","getAttribute","oldEl","quote","getElementsByTagName","querySelector","scriptnode","head","id","afterAdopt","onlyStream","compatModules"],"mappings":";AAEwBA,EAAkB;;ACC1C,IAAAC,EAAe,CACXC,KAAM,iCACNC,UAAAA;8BACIC,CAAc,QAASC,IAUnBA,EAAIC,sBAAsB,CAACC,EAAIC,KAC3B,IAAIC,GAAW;AACf,IAAK,MAAMC,IAAyB,CAAC,cAAe,SAChD,IAAK,MAAMC,KAAMJ,EAAGK,iBAAiB,2BAA2BF,sBAA2C,CACvG,MAAMG,EAAqBC,SAASC,cAAc;AAClDF,EAAmBG,aAAa,QAAS,iBACzCH,EAAmBI,WAAWC,IAAI;AAClC,MAAMC,EAAML,SAASC,cAAc;AACnCI,EAAIH,aAAa,OAAQL,EAAGS,KAAKC,WAAW,gBAAiB,wBAC7DF,EA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