1import{j as e,r as c}from"./vendor-motion-BHKvfdub.js";import{c as T,as as k,Z as N,aq as v,U as H,ao as ae,v as S,Y as _,B as b,at as te,g as O,p as re,I as Q,s as ne}from"./index-BDt3UX3X.js";import{L as U}from"./label-4q10JGVi.js";import{c as q,T as E,u as le,b as ie,d as ce,r as oe,B as L,a as de}from"./BarcampChrome-CC2g3qEh.js";import{b as me}from"./browser-CjSdxGTc.js";import{B as P}from"./badge-D5ubbIAJ.js";import{P as xe}from"./progress-CrUtevSF.js";import{C as K}from"./circle-check-Da912ANH.js";import{L as W}from"./lightbulb-DXiXNW4C.js";import{T as D}from"./trophy-D9cY-9mx.js";import{F as pe}from"./FormDialog-Cpd_33Kx.js";import{T as ue}from"./timer-D2W0huDi.js";import{P as V}from"./play-yFAuTw3r.js";import{E as he}from"./eye-DWzH4NQZ.js";import{R as be}from"./rotate-ccw-C_B4jste.js";import{L as je}from"./list-checks-tgFeuSTS.js";import{M as fe,a as ge}from"./minimize-2-DfU_esWt.js";import{P as ye}from"./presentation-r8EPdxPY.js";import"./vendor-recharts-DrQ74lLO.js";import"./vendor-supabase-DXfLReh3.js";import"./dialog-B50exQqv.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Ne=T("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const ve=T("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/** 12 * @license lucide-react v0.462.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const we=T("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]),ke=["A","B","C","D"];function Ce({index:t,answers:n,reveal:r,secondsLeft:a,totalPlayers:s}){const{t:h}=k(),l=q[t];if(!l)return null;const i=n.filter(j=>j.question_index===t),p=l.options.map((j,x)=>i.filter(u=>u.answer_index===x).length),f=Math.max(1,...p);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-6",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm uppercase tracking-widest text-muted-foreground",children:l.title}),e.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-gradient-primary mt-1",children:l.prompt})]}),a!==null&&!r&&e.jsx("div",{className:"shrink-0 text-6xl font-bold tabular-nums text-primary",children:a})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:l.options.map((j,x)=>{const u=r&&x===l.correct;return e.jsx(N,{className:u?"border-2 border-primary shadow-lg":"border border-border",children:e.jsxs(v,{className:"p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"shrink-0 h-9 w-9 rounded-xl bg-muted flex items-center justify-center font-bold",children:ke[x]}),e.jsx("span",{className:"text-lg leading-snug",children:j}),u&&e.jsx(K,{className:"h-6 w-6 text-primary shrink-0 ml-auto"})]}),e.jsx(xe,{value:p[x]/f*100,className:"h-2"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:h("barcamp.answerCount",{count:p[x]})})]})},x)})}),e.jsx("div",{className:"text-sm text-muted-foreground",children:h("barcamp.answeredOf",{given:i.length,total:s})}),r&&e.jsx(N,{className:"border-l-4 border-l-primary",children:e.jsxs(v,{className:"p-5 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 font-semibold",children:[e.jsx(W,{className:"h-5 w-5 text-primary"})," ",h("barcamp.resolution")]}),e.jsx("p",{className:"text-lg leading-relaxed",children:l.explanation})]})})]})}function Se({ranked:t}){const{t:n}=k(),r=t.slice(0,5);return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("h2",{className:"text-3xl md:text-4xl font-bold text-gradient-primary flex items-center gap-3",children:[e.jsx(D,{className:"h-9 w-9 text-primary"})," ",n("barcamp.podiumTitle")]}),r.length===0?e.jsx("p",{className:"text-muted-foreground",children:n("barcamp.noPlayersYet")}):e.jsx("div",{className:"space-y-3",children:r.map((a,s)=>e.jsx(N,{className:s===0?"border-2 border-primary":"",children:e.jsxs(v,{className:"p-4 flex items-center gap-4",children:[e.jsx("span",{className:"text-3xl font-bold w-12 text-center text-primary",children:s+1}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xl font-semibold truncate",children:a.display_name}),e.jsx("div",{className:"text-sm text-muted-foreground truncate",children:a.company||"â"})]}),e.jsxs("div",{className:"text-right text-sm",children:[e.jsx("div",{className:"text-xl font-bold",children:n("barcamp.pointsValue",{count:a.score})}),e.jsxs("div",{className:"text-muted-foreground",children:[n("barcamp.jokersValue",{count:a.jokers_used})," ·"," ",n("barcamp.secondsValue",{value:(a.total_ms/1e3).toFixed(1)})]})]})]})},a.id))})]})}const _e=["A","B","C","D"];function Me({open:t,onOpenChange:n}){const{t:r}=k();return e.jsx(pe,{open:t,onOpenChange:n,size:"lg",title:r("barcamp.catalogTitle",{total:E}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:r("barcamp.catalogDesc")}),q.map((a,s)=>e.jsx(N,{children:e.jsxs(v,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-widest text-muted-foreground",children:a.title}),e.jsx("div",{className:"font-semibold leading-snug mt-1",children:a.prompt})]}),e.jsxs(P,{variant:"outline",className:"shrink-0 gap-1",children:[e.jsx(ue,{className:"h-3 w-3"})," ",r("barcamp.secondsValue",{value:a.seconds})]})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:a.options.map((h,l)=>{const i=l===a.correct;return e.jsxs("div",{className:`flex items-start gap-2 rounded-lg border p-2 text-sm ${i?"border-primary bg-primary/5 font-medium":"border-border"}`,children:[e.jsx("span",{className:"shrink-0 h-6 w-6 rounded-md bg-muted flex items-center justify-center text-xs font-bold",children:_e[l]}),e.jsx("span",{className:"leading-snug",children:h}),i&&e.jsx(K,{className:"h-4 w-4 text-primary shrink-0 ml-auto"})]},l)})}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("span",{className:"font-medium",children:[r("barcamp.resolution"),": "]}),e.jsx("span",{className:"text-muted-foreground",children:a.explanation})]}),e.jsxs("div",{className:"flex items-start gap-2 text-sm rounded-lg bg-muted/50 p-2",children:[e.jsx(W,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),e.jsxs("span",{children:[e.jsxs("span",{className:"font-medium",children:[r("barcamp.catalogInsider"),": "]}),e.jsx("span",{className:"text-muted-foreground",children:a.insider})]})]})]})},s))]})})}const Le="mrchinasupply.de/barcamp";function Be({qr:t,joinCode:n,players:r}){const{t:a}=k();return e.jsx(N,{className:"overflow-hidden border-brand/30 bg-card/80 backdrop-blur",children:e.jsxs(v,{className:"space-y-6 p-5 sm:p-8",children:[e.jsxs("div",{className:"space-y-2 text-center lg:text-left",children:[e.jsx("p",{className:"text-[0.7rem] font-semibold uppercase tracking-[0.2em] text-brand sm:text-sm",children:a("barcamp.lobbyKicker")}),e.jsx("h2",{className:"text-balance text-[clamp(1.6rem,4.2vw,3.4rem)] font-extrabold leading-tight text-gradient-primary",children:a("barcamp.lobbyHeadline")}),e.jsx("p",{className:"text-balance text-[clamp(0.95rem,1.6vw,1.5rem)] text-muted-foreground",children:a("barcamp.lobbySub")})]}),e.jsxs("div",{className:"grid items-center gap-6 lg:grid-cols-[auto,1fr]",children:[e.jsx("div",{className:"mx-auto w-full max-w-[min(100%,24rem)]",children:t&&e.jsx("img",{src:t,alt:a("barcamp.qrAlt"),className:"mx-auto h-auto w-full max-w-[15rem] rounded-2xl border-4 border-brand/40 bg-white p-2 lg:max-w-[24rem]"})}),e.jsxs("div",{className:"min-w-0 space-y-4",children:[e.jsx(B,{icon:ve,title:a("barcamp.lobbyStep1"),value:a("barcamp.lobbyStep1Hint")}),e.jsx(B,{icon:Ne,title:a("barcamp.lobbyStep2"),value:Le,mono:!0}),e.jsx(B,{icon:D,title:a("barcamp.lobbyCode",{code:n}),value:a("barcamp.lobbyPrizes")}),e.jsxs("div",{className:"flex items-center justify-center gap-3 rounded-2xl border border-brand/40 bg-brand/10 px-4 py-3 lg:justify-start",children:[e.jsx(H,{className:"h-6 w-6 shrink-0 text-brand"}),e.jsx("span",{className:"text-[clamp(1.1rem,2.4vw,2.2rem)] font-extrabold leading-tight text-brand",children:a("barcamp.lobbyLive",{count:r})})]})]})]})]})})}function B({icon:t,title:n,value:r,mono:a}){return e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx("span",{className:"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-brand/15 text-brand",children:e.jsx(t,{className:"h-5 w-5"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[clamp(0.95rem,1.4vw,1.35rem)] font-bold leading-snug",children:n}),e.jsx("div",{className:`break-words text-[clamp(0.9rem,1.5vw,1.6rem)] leading-snug ${a?"font-mono font-bold text-foreground":"text-muted-foreground"}`,children:r})]})]})}function Ee(){const{t}
16=k(),[n]=ae(),r=n.get("event")??void 0,a=n.get("code")??(r?void 0:"BARCAMP26"),{session:s,loading:h,reload:l}=le({joinCode:a,eventId:r}),{participants:i}=ie(s==null?void 0:s.id),{answers:p}=ce(s==null?void 0:s.id),[f,j]=c.useState(""),[x,u]=c.useState(null),[o,y]=c.useState(!1),[Y,z]=c.useState(!1),[A,Z]=c.useState(!1);c.useEffect(()=>{const d=()=>Z(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",d),()=>document.removeEventListener("fullscreenchange",d)},[]);const J=()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen().catch(()=>{})},F=c.useMemo(()=>`${window.location.origin}/barcamp${s?`?code=${s.join_code}`:""}`,[s]);c.useEffect(()=>{me.toDataURL(F,{width:420,margin:1}).then(j)},[F]),c.useEffect(()=>{var I;if(!s||s.phase!=="question"||!s.question_started_at){u(null);return}const d=new Date(s.question_started_at).getTime(),g=((I=q[s.current_index])==null?void 0:I.seconds)??s.question_seconds,m=()=>u(Math.max(0,g-Math.floor((Date.now()-d)/1e3)));m();const M=window.setInterval(m,250);return()=>window.clearInterval(M)},[s]);const C=c.useCallback(async d=>{s&&(y(!0),await S.from("event_quiz_sessions").update(d).eq("id",s.id),await l(),y(!1))},[s,l]),G=c.useCallback(async()=>{s&&await Promise.all(i.map(d=>{const g=p.filter(m=>m.participant_id===d.id);return S.from("event_quiz_participants").update({score:g.filter(m=>m.is_correct).length,jokers_used:g.filter(m=>m.joker_used).length,total_ms:g.reduce((m,M)=>m+M.response_ms,0)}).eq("id",d.id)}))},[s,i,p]),R=d=>C({phase:"question",current_index:d,question_started_at:new Date().toISOString()}),X=async()=>{await G(),await C({phase:"reveal"})},ee=c.useMemo(()=>oe(i),[i]);if(h)return e.jsx("div",{className:"flex justify-center py-20",children:e.jsx(_,{className:"h-7 w-7 animate-spin text-muted-foreground"})});if(!s){const d=async()=>{y(!0);const g=Array.from(crypto.getRandomValues(new Uint8Array(6))).map(m=>"ABCDEFGHJKLMNPQRSTUVWXYZ23456789"[m%32]).join("");await S.from("event_quiz_sessions").insert({event_id:r??null,join_code:g,title:"Sourcing-Detektiv"}),await l(),y(!1)};return e.jsx(N,{children:e.jsxs(v,{className:"space-y-4 py-12 text-center text-sm text-muted-foreground",children:[e.jsx("p",{children:t("barcamp.noSession")}),r&&e.jsxs(b,{disabled:o,onClick:d,children:[o?e.jsx(_,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(V,{className:"mr-2 h-4 w-4"}),t("barcamp.createSession")]})]})})}const w=s.current_index,se=w>=E-1;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:t("barcamp.cockpitTitle")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("barcamp.cockpitDesc")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(P,{variant:"secondary",className:"gap-1",children:[e.jsx(H,{className:"h-3.5 w-3.5"})," ",t("barcamp.playersConnected",{count:i.length})]}),e.jsx(P,{variant:"outline",children:t("barcamp.roundOf",{current:Math.max(0,w+1),total:E})})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.phase==="lobby"||w<0?e.jsxs(b,{disabled:o,onClick:()=>R(0),children:[e.jsx(V,{className:"h-4 w-4 mr-1"})," ",t("barcamp.actionStart")]}):s.phase==="question"?e.jsxs(b,{disabled:o,onClick:X,children:[e.jsx(he,{className:"h-4 w-4 mr-1"})," ",t("barcamp.actionReveal")]}):s.phase==="reveal"&&!se?e.jsxs(b,{disabled:o,onClick:()=>R(w+1),children:[e.jsx(we,{className:"h-4 w-4 mr-1"})," ",t("barcamp.actionNext")]}):s.phase==="reveal"?e.jsxs(b,{disabled:o,onClick:()=>C({phase:"podium"}),children:[e.jsx(D,{className:"h-4 w-4 mr-1"})," ",t("barcamp.actionPodium")]}):null,e.jsxs(b,{variant:"outline",disabled:o,onClick:()=>C({phase:"lobby",current_index:-1,question_started_at:null}),children:[e.jsx(be,{className:"h-4 w-4 mr-1"})," ",t("barcamp.actionLobby")]}),e.jsxs(b,{variant:"outline",onClick:()=>z(!0),children:[e.jsx(je,{className:"h-4 w-4 mr-1"})," ",t("barcamp.catalogOpen")]}),e.jsxs(b,{variant:"outline",onClick:J,children:[A?e.jsx(fe,{className:"h-4 w-4 mr-1"}):e.jsx(ge,{className:"h-4 w-4 mr-1"}),t(A?"barcamp.fullscreenOff":"barcamp.fullscreenOn")]})]}),e.jsx(Me,{open:Y,onOpenChange:z}),s.phase==="lobby"?e.jsx(Be,{qr:f,joinCode:s.join_code,players:i.length}):s.phase==="podium"?e.jsx(Se,{ranked:ee}):e.jsx(Ce,{index:w,answers:p,reveal:s.phase==="reveal",secondsLeft:x,totalPlayers:i.length})]})}const $="@mrchinasupply.de";function Xe(){var u;const{user:t,loading:n}=te(),[r,a]=c.useState(""),[s,h]=c.useState(""),[l,i]=c.useState(!1),[p,f]=c.useState(null),j=!!((u=t==null?void 0:t.email)!=null&&u.toLowerCase().endsWith($)),x=async o=>{if(o.preventDefault(),f(null),!r.toLowerCase().trim().endsWith($)){f("Diese Bühne ist nur für das Team von Mr China Supply.");return}i(!0);const{error:y}=await S.auth.signInWithPassword({email:r.trim(),password:s});i(!1),y&&f("Anmeldung fehlgeschlagen. Bitte E-Mail und Passwort prüfen.")};return n?e.jsx(L,{children:e.jsx(_,{className:"h-8 w-8 animate-spin text-brand"})}
16):j?e.jsxs(L,{align:"top",children:[e.jsxs(O,{children:[e.jsx("title",{children:"Bühne · Sourcing-Detektiv"}),e.jsx("meta",{name:"robots",content:"noindex, nofollow"})]}),e.jsx("div",{className:"mx-auto w-full max-w-6xl p-2 md:p-6",children:e.jsx(Ee,{})})]}):e.jsxs(L,{children:[e.jsxs(O,{children:[e.jsx("title",{children:"Bühne · Sourcing-Detektiv"}),e.jsx("meta",{name:"robots",content:"noindex, nofollow"})]}),e.jsxs("form",{onSubmit:x,className:"w-full max-w-sm space-y-5 rounded-2xl border border-border/60 bg-card/80 p-6 backdrop-blur-xl",children:[e.jsxs("div",{className:"space-y-3 text-center",children:[e.jsx(de,{}),e.jsx("h1",{className:"text-3xl font-bold text-gradient-barcamp",children:"Bühne öffnen"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Kurz anmelden, dann erscheinen QR-Code, Zähler und Fragen."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(U,{htmlFor:"beamer-email",children:"E-Mail"}),e.jsxs("div",{className:"relative",children:[e.jsx(re,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(Q,{id:"beamer-email",type:"email",autoComplete:"email",className:"pl-9",value:r,onChange:o=>a(o.target.value),required:!0})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(U,{htmlFor:"beamer-password",children:"Passwort"}),e.jsxs("div",{className:"relative",children:[e.jsx(ne,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(Q,{id:"beamer-password",type:"password",autoComplete:"current-password",className:"pl-9",value:s,onChange:o=>h(o.target.value),required:!0})]})]}),p&&e.jsx("p",{className:"text-sm text-destructive",children:p}),e.jsxs(b,{type:"submit",disabled:l,className:"w-full bg-brand py-6 text-brand-foreground shadow-lg shadow-brand/25 hover:bg-brand/90",children:[l?e.jsx(_,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(ye,{className:"mr-2 h-4 w-4"}),"Bühne starten"]})]})]})}export{Xe 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.