1import{r as _,j as l}from"./vendor-react-DiJp4Ids.js";import{d as b,e as v,b as x}from"./vendor-router-BQ9A5i6-.js";import{O as k}from"./oauthService-Bz1WGeUR.js";import{g as P}from"./i18n-translations-TdFnI7jD.js";import"./index-DV0CPbmh.js";import"./vendor-capacitor-Brsuti7y.js";import"./vendor-tanstack-Bh8mR0Am.js";import"./vendor-ui-CKX6mHe-.js";import"./vendor-radix-DA_kJhMJ.js";import"./vendor-datefns-Bq6ooyM0.js";import"./vendor-shared-SwkB51P9.js";import"./vendor-icons-Dp3csqOa.js";import"./vendor-firebase-TSmD8Bmi.js";import"./vendor-firebase-core-4rc3q345.js";import"./vendor-firestore-ClmovigS.js";import"./vendor-motion-WsbK-hjl.js";const d=o=>{let t="en";try{const r=localStorage.getItem("app_language");(r==="es"||r==="fr"||r==="en")&&(t=r)}catch{}const e=P(o,t);return Array.isArray(e)?e.join(" "):e},w=o=>k.includes(o),S=(o,t)=>{if(o){if(o==="google")return"google_business";if(w(o))return o}if(t){const e=t.match(/^oauth_(.+)_\d+$/),r=e==null?void 0:e[1];if(r&&w(r))return r}return null},J=()=>{const{platform:o}=b(),[t]=v(),e=x();return _.useEffect(()=>{const r=t.get("code"),u=t.get("error"),g=t.get("error_description"),a=t.get("state"),p=t.get("oauth_token"),c=t.get("oauth_verifier"),s=S(o,a)||(p?"twitter":null),n=localStorage.getItem("oauth_return_path")||"/accounts",f=i=>{localStorage.setItem("pending_oauth",JSON.stringify(i)),sessionStorage.setItem("pending_oauth",JSON.stringify(i))};if(!s){console.error("Platform not specified in callback"),window.opener?window.close():e(n,{replace:!0});return}if(u){console.error(`OAuth error for ${s}:`,u);const i={platform:s,code:"",state:a||"",error:u,errorDescription:g||""};f(i),window.opener?(window.opener.postMessage({type:"oauth_callback",payload:i},window.location.origin),window.close()):e(n,{replace:!0});return}if(!r){if(p&&c){localStorage.setItem("twitter_oauth_verifier",c);const i={platform:"twitter",code:p,state:a||"",oauthVerifier:c};f(i);const y=!!window.opener||window.outerWidth<600&&window.outerHeight<700;window.opener&&window.opener.postMessage({type:"oauth_callback",payload:{...i,oauthVerifier:c}},window.location.origin),y?setTimeout(()=>{try{window.close()}catch{}window.closed||e(n,{replace:!0})},600):e(n,{replace:!0});return}console.error(`No code received for ${s}`),window.opener?window.close():e(n,{replace:!0});return}const m={platform:s,code:r,state:a||""};f(m);const h=!!window.opener||window.outerWidth<600&&window.outerHeight<700;window.opener&&window.opener.postMessage({type:"oauth_callback",payload:m},window.location.origin),h?(setTimeout(()=>{try{window.close()}catch{}},600),setTimeout(()=>{if(!window.closed){const i=n.startsWith("/")?n:"/accounts";document.body.innerHTML=` 2 <div style="display:flex;align-items:center;justify-content:center;min-height:100vh;font-family:system-ui,sans-serif;background:#f8fafc;color:#1e293b;text-align:center;padding:2rem;"> 3 <div> 4 <div style="font-size:3rem;margin-bottom:1rem;">â </div> 5 <h2 style="font-size:1.25rem;font-weight:600;margin:0 0 0.5rem;">${d("oauth_authorization_complete")}</h2> 6 <p style="color:#64748b;margin:0 0 1.25rem;">${d("oauth_close_window")}</p> 7 <a href="${i.replace(/["'<>]/g,"")}" style="display:inline-block;background:#0f172a;color:#fff;padding:0.6rem 1.2rem;border-radius:0.5rem;text-decoration:none;font-weight:500;">${d("oauth_back_to_publisher")}</a> 8 </div> 9 </div> 10 `}},2e3)):e(n,{replace:!0})},[o,t,e]),l.jsx("div",{className:"flex items-center justify-center min-h-screen bg-background",children:l.jsxs("div",{className:"text-center space-y-4",children:[l.jsx("div",{className:"h-8 w-8 border-4 border-primary border-t-transparent rounded-full animate-spin mx-auto"}),l.jsx("p",{className:"text-muted-foreground",children:d("oauth_authorizing")})]})})};export{J as default};
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.