import{_ as x}from"./preload-helper-xg4QBr_M.js";const E=()=>{var t,r,e,s;typeof window!="undefined"&&(!window.React&&((t=window.wp)!=null&&t.element)&&(window.React=window.wp.element),!window.ReactDOM&&((e=(r=window.wp)==null?void 0:r.element)!=null&&e.createRoot)&&(window.ReactDOM={createRoot:window.wp.element.createRoot}),(s=window.wp)!=null&&s.element&&!window.wp.element.createRoot&&window.ReactDOM&&(window.ReactDOM.createRoot?window.wp.element.createRoot=window.ReactDOM.createRoot:window.ReactDOM.render&&(window.wp.element.createRoot=function(d){return{render:function(a){return window.ReactDOM.render(a,d)},unmount:function(){return window.ReactDOM.unmountComponentAtNode(d)}}})))},g=(t,r)=>{t&&(t.innerHTML=`
    <div style="padding: 16px; background: #fff3cd; border-left: 4px solid #ffc107; margin: 10px 0;">
      <p style="margin: 0; color: #856404;">
        <strong>ProRank SEO:</strong> ${r}
      </p>
      <p style="margin: 8px 0 0; font-size: 12px; color: #666;">
        Try refreshing the page. If the problem persists, check the browser console for details.
      </p>
    </div>
  `)},h=(t,r=50)=>{let e=0;const s=()=>{var c,i,m,f,u,l,n,o;e++,E();const d=(i=(c=window.wp)==null?void 0:c.components)==null?void 0:i.TabPanel,a=((f=(m=window.wp)==null?void 0:m.element)==null?void 0:f.createRoot)||((l=(u=window.wp)==null?void 0:u.element)==null?void 0:l.render),w=(o=(n=window.wp)==null?void 0:n.i18n)==null?void 0:o.__;if(d&&a&&w){t();return}if(e<r)setTimeout(s,100);else{console.warn("[ProRank SEO] WordPress not fully initialized after timeout");const p=document.getElementById("prorank-seo-metabox-root");g(p,"SEO meta box requires WordPress components. Please refresh the page.")}};s()},R=()=>{var l;const t=window.wp.element,{Component:r,createElement:e,lazy:s,Suspense:d}=t,{__:a=n=>n}=((l=window.wp)==null?void 0:l.i18n)||{},{Spinner:w}=window.wp.components,c=t.createRoot,i=document.getElementById("prorank-seo-metabox-root");if(!i)return;if(!c){g(i,"React rendering not available. Your WordPress version may not be supported.");return}class m extends r{constructor(o){super(o),this.state={hasError:!1,errorMessage:""}}static getDerivedStateFromError(o){return{hasError:!0,errorMessage:(o==null?void 0:o.message)||"Unknown error"}}componentDidCatch(o,p){console.warn("[ProRank SEO] Meta box error:",(o==null?void 0:o.message)||o),console.warn("[ProRank SEO] Component stack:",p==null?void 0:p.componentStack)}render(){return this.state.hasError?e("div",{style:{padding:"16px",background:"#fff3cd",borderLeft:"4px solid #ffc107",margin:"10px 0"}},e("p",{style:{margin:0,color:"#856404"}},e("strong",null,"ProRank SEO: "),a("SEO meta box encountered an error.","prorank-seo")),e("p",{style:{margin:"8px 0 0",fontSize:"12px",color:"#666"}},a("Try refreshing the page. Check the browser console for details.","prorank-seo"))):this.props.children}}const f=e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",gap:"10px"}},w&&e(w,null),e("span",null,a("Loading...","prorank-seo"))),u=s(()=>x(()=>import("./MetaBoxShell-B2BzmwP_.js"),[],import.meta.url).catch(n=>(console.error("[ProRank SEO] Failed to load MetaBoxShell:",n),{default:()=>e("div",{style:{padding:"16px",color:"#856404",background:"#fff3cd",borderLeft:"4px solid #ffc107"}},e("p",{style:{margin:0}},e("strong",null,"ProRank SEO: "),a("Failed to load SEO meta box. Please refresh the page.","prorank-seo")))})));try{c(i).render(e(m,null,e(d,{fallback:f},e(u,null))))}catch(n){console.error("[ProRank SEO] Failed to render meta box:",n),g(i,"Failed to initialize SEO meta box. Please refresh the page.")}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{h(R)}):h(R);
