1import{j as w}from"./framer-vendor-CmyO9YTp.js";import{r as n}from"./redux-vendor-DWORWaQR.js";import{q as A,g as R,w as T}from"./index-D9YmmtmV.js";function y({botName:c="MemeLabApp_bot",mode:a="login",onSuccess:u,onError:l,buttonSize:f="large"}){const o=n.useRef(null),g=A(),m=n.useRef(u),p=n.useRef(l),d=n.useRef(a);return m.current=u,p.current=l,d.current=a,n.useEffect(()=>{const t=o.current;if(!t)return;const e=()=>{t.querySelectorAll("iframe").forEach((i,s)=>{i.getAttribute("title")||i.setAttribute("title",s===0?"Telegram login":`Telegram login ${s+1}`)})};e();const r=new MutationObserver(()=>{e()});return r.observe(t,{childList:!0,subtree:!0}),()=>r.disconnect()},[c]),n.useEffect(()=>{const t=`onTelegramAuth_${a}`;window[t]=h=>{const i=d.current==="link"?"/auth/telegram/link":"/auth/telegram/callback";R.post(i,{...h,origin:window.location.origin}).then(()=>T(g)).then(()=>m.current?.()).catch(s=>{const b=s instanceof Error?s.message:"Telegram auth failed";p.current?.(b)})};const e=document.createElement("script");e.src="https://telegram.org/js/telegram-widget.js?22",e.setAttribute("data-telegram-login",c),e.setAttribute("data-size",f),e.setAttribute("data-onauth",`${t}(user)`),e.setAttribute("data-request-access","write"),e.async=!0;const r=o.current;return r?.appendChild(e),()=>{delete window[t],r&&(r.innerHTML="")}},[c,f,a,g]),w.jsx("div",{ref:o})}export{y as T};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.