(function run() { console.log("Craic", "loaded"); const script = document.createElement("script"); const callerScript = document.getElementById("craic-widget-script"); const baseUrlMatch = callerScript.src.match(/https:\/\/[^\/]+/); if (!baseUrlMatch) { console.error("Base URL not found in the script src."); return; } const currentUrl = window.location.href; const key = callerScript.src.split("key=")[1]; if (!key) { console.error("Craic", "key not found"); return; } script.src = `${baseUrlMatch[0]}/1.0.0/widget?rp=${btoa( currentUrl )}&key=${key}`; document.head.appendChild(script); })();