import{u as g,r,c as b,g as h,j as e}from"./index-yD-5hMZV.js";function y(){const{settings:a}=g(),[t,l]=r.useState(null),[m,c]=r.useState(!0),[x,d]=r.useState(null),s=r.useRef(null);if(r.useEffect(()=>{if(!a.backstageCoordination){c(!1);return}(async()=>{try{c(!0),d(null);const n=await h();l(n||null)}catch(n){console.error("Error loading entrant readiness:",n),d("Failed to load entrant readiness data")}finally{c(!1)}})();try{const n=b.entrantReadiness.subscribe("*",i=>{console.log("Entrant readiness updated:",i),(i.action==="update"||i.action==="create")&&h().then(o=>{l(o)}).catch(o=>{console.error("Error refreshing entrant readiness:",o)})});s.current=n}catch(n){console.error("Error setting up entrant readiness subscription:",n),s.current=null}return()=>{s.current&&typeof s.current=="function"&&s.current()}},[a.backstageCoordination]),!a.backstageCoordination)return e.jsx("div",{className:"text-center p-6 flex flex-col items-center justify-center h-screen bg-gray-900 text-white text-4xl",children:"Backstage coordination is not enabled"});if(m)return e.jsx("div",{className:"p-4 flex flex-col items-center justify-center h-screen bg-gray-900 text-center",children:e.jsx("div",{className:"text-white text-2xl",children:"Loading entrant readiness..."})});if(x)return e.jsx("div",{className:"p-4 flex flex-col items-center justify-center h-screen bg-gray-900 text-center",children:e.jsxs("div",{className:"text-red-400 text-2xl",children:["Error: ",x]})});if(!t)return e.jsx("div",{className:"p-4 flex flex-col items-center justify-center h-screen text-center bg-gray-900",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-6xl font-bold text-white mb-4",children:"No Competitors"}),e.jsx("h2",{className:"text-4xl font-bold text-gray-400",children:"Upcoming"})]})});const u=t.panel_ready&&t.entrant_ready,f=t.entrant_name||"Unknown Group";return e.jsx("div",{className:`p-4 flex flex-col items-center justify-center h-screen text-center transition-colors duration-500 ${u?"bg-green-600":"bg-gray-900"}`,children:u?e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-5xl font-bold text-white mb-4",children:"Ready for"}),e.jsx("h2",{className:"text-6xl font-bold text-white",children:f})]}):e.jsxs("div",{className:"text-center max-w-2xl w-full",children:[e.jsxs("h1",{className:"text-4xl font-bold text-white mb-8",children:[e.jsx("span",{className:"text-gray-400 text-2xl",children:"Next Group:"}),e.jsx("br",{}),f]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("span",{className:"text-2xl text-white mb-3",children:"Panel Ready:"}),e.jsx("div",{className:`px-8 py-4 rounded-lg text-2xl font-bold w-full max-w-sm ${t.panel_ready?"bg-green-600 text-white":"bg-red-600 text-white"}`,children:t.panel_ready?"READY":"NOT READY"})]}),e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("span",{className:"text-2xl text-white mb-3",children:"Group Ready:"}),e.jsx("div",{className:`px-8 py-4 rounded-lg text-2xl font-bold w-full max-w-sm ${t.entrant_ready?"bg-green-600 text-white":"bg-red-600 text-white"}`,children:t.entrant_ready?"READY":"NOT READY"})]})]})]})})}export{y as default};
