import { a6 as escape_html, a9 as attr, ab as stringify, aa as attr_class, a8 as ensure_array_like, a1 as derived } from './index3-C4geC3K_.js'; import './root-D12ma0No.js'; import './utils-D_bK1W85.js'; import './exports-B5ORJhfK.js'; import './state.svelte-DvHRBIfo.js'; function _page($$renderer, $$props) { $$renderer.component(($$renderer2) => { let { data } = $$props; let m = derived(() => data.match); let p1 = derived(() => m().participants[0]); let p2 = derived(() => m().participants[1]); const config = derived(() => m().config); const winsNeeded = derived(() => Math.ceil(config().bestOf / 2)); const playedSlotIds = derived(() => new Set(m().games.map((g) => g.mappoolSlotId))); const sortedByPick = derived(() => [...m().participants].sort((a, b) => (a.pickOrder ?? 99) - (b.pickOrder ?? 99))); const expectedPickerIdx = derived(() => m().games.length % sortedByPick().length); const expectedPicker = derived(() => sortedByPick()[expectedPickerIdx()]); const canRoll = derived(() => m().state === "ROLLING" && m().participants.some((p) => p.rollValue === null)); const catColors = { NM: "bg-blue-500/20 text-blue-400 border-blue-500/30", HD: "bg-yellow-500/20 text-yellow-400 border-yellow-500/30", HR: "bg-red-500/20 text-red-400 border-red-500/30", DT: "bg-purple-500/20 text-purple-400 border-purple-500/30", FM: "bg-green-500/20 text-green-400 border-green-500/30", TB: "bg-pink-500/20 text-pink-400 border-pink-500/30" }; const groupedSlots = derived(() => () => { if (!m().mappool?.slots) return {}; const groups = {}; for (const slot of m().mappool.slots) { if (!groups[slot.category]) groups[slot.category] = []; groups[slot.category].push(slot); } for (const cat of Object.keys(groups)) { groups[cat].sort((a, b) => a.orderInCategory - b.orderInCategory); } return groups; }); let rolling = false; let picking = false; let forceStarting = false; function formatLength(seconds) { const mins = Math.floor(seconds / 60); const secs = seconds % 60; return `${mins}:${secs.toString().padStart(2, "0")}`; } function stateLabel(s) { return { CREATED: "Waiting", LOBBY: "In Lobby", ROLLING: "Rolling", PICKING: "Pick Phase", PLAYING: "Playing", FINISHED: "Finished", CANCELLED: "Cancelled" }[s] ?? s; } function stateBorder(s) { return { ROLLING: "border-yellow-500/30", PICKING: "border-blue-500/30", PLAYING: "border-green-500/30", FINISHED: "border-accent/30" }[s] ?? "border-border"; } $$renderer2.push(`
←

${escape_html(m().name || "Match")}

Best of ${escape_html(config().bestOf)} · First to ${escape_html(winsNeeded())} `); if (m().osuLobbyId) { $$renderer2.push(""); $$renderer2.push(`· osu! mp/${escape_html(m().osuLobbyId)}`); } else { $$renderer2.push(""); } $$renderer2.push(`

${escape_html(stateLabel(m().state))} `); if (!["FINISHED", "CANCELLED"].includes(m().state)) { $$renderer2.push(""); $$renderer2.push(`
`); } else { $$renderer2.push(""); } $$renderer2.push(`
`); if (p1() && p2()) { $$renderer2.push(""); $$renderer2.push(`
`); if (p1().team.avatarUrl) { $$renderer2.push(""); $$renderer2.push(``); } else { $$renderer2.push(""); } $$renderer2.push(`

${escape_html(p1().team.name)}

`); if (p1().rollValue != null) { $$renderer2.push(""); $$renderer2.push(`

Roll: ${escape_html(p1().rollValue)}${escape_html(p1().pickOrder === 1 ? " ★" : "")}

`); } else { $$renderer2.push(""); } $$renderer2.push(`
= winsNeeded() ? "text-green-400" : "text-text-primary")}`)}>${escape_html(p1().score)}
vs = winsNeeded() ? "text-green-400" : "text-text-primary")}`)}>${escape_html(p2().score)}

${escape_html(p2().team.name)}

`); if (p2().rollValue != null) { $$renderer2.push(""); $$renderer2.push(`

${escape_html(p2().pickOrder === 1 ? "★ " : "")}Roll: ${escape_html(p2().rollValue)}

`); } else { $$renderer2.push(""); } $$renderer2.push(`
`); if (p2().team.avatarUrl) { $$renderer2.push(""); $$renderer2.push(``); } else { $$renderer2.push(""); } $$renderer2.push(`
`); } else { $$renderer2.push(""); } $$renderer2.push(` `); if (["LOBBY", "ROLLING", "PICKING", "PLAYING"].includes(m().state)) { $$renderer2.push(""); $$renderer2.push(`
`); } else { $$renderer2.push(""); } $$renderer2.push(` `); if (m().state === "ROLLING") { $$renderer2.push(""); $$renderer2.push(`

🎲 Roll Phase

Highest roll picks first

`); const each_array = ensure_array_like(m().participants); for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) { let p = each_array[$$index]; $$renderer2.push(`

${escape_html(p.team.name)}

`); if (p.rollValue != null) { $$renderer2.push(""); $$renderer2.push(`

${escape_html(p.rollValue)}

`); } else { $$renderer2.push(""); $$renderer2.push(`

—

`); } $$renderer2.push(`
`); } $$renderer2.push(`
`); if (canRoll()) { $$renderer2.push(""); $$renderer2.push(`

or type !roll in osu! chat

`); } else { $$renderer2.push(""); $$renderer2.push(`

Waiting for all rolls...

`); } $$renderer2.push(`
`); } else { $$renderer2.push(""); } $$renderer2.push(` `); if (m().state === "PICKING") { $$renderer2.push(""); $$renderer2.push(`

🎯 Pick a Map

${escape_html(expectedPicker()?.team.name)}'s turn to pick

or type !pick NM1 in osu! chat

`); { $$renderer2.push(""); } $$renderer2.push(`
`); const each_array_1 = ensure_array_like(Object.entries(groupedSlots()())); for (let $$index_2 = 0, $$length = each_array_1.length; $$index_2 < $$length; $$index_2++) { let [category, slots] = each_array_1[$$index_2]; $$renderer2.push(`
${escape_html(category)}
`); const each_array_2 = ensure_array_like(slots); for (let i = 0, $$length2 = each_array_2.length; i < $$length2; i++) { let slot = each_array_2[i]; const bm = data.beatmapCache[slot.beatmapId]; const isPlayed = playedSlotIds().has(slot.id); $$renderer2.push(`
`); } $$renderer2.push(`
`); } $$renderer2.push(`
`); } else { $$renderer2.push(""); } $$renderer2.push(` `); if (m().state === "PLAYING") { $$renderer2.push(""); const currentGame = m().games[m().games.length - 1]; const bm = currentGame ? data.beatmapCache[currentGame.slot?.beatmapId] : null; $$renderer2.push(`
Now Playing
`); if (bm) { $$renderer2.push(""); $$renderer2.push(`

${escape_html(bm.artist)} - ${escape_html(bm.title)} [${escape_html(bm.version)}]

★${escape_html(bm.starRating.toFixed(1))} · ${escape_html(bm.bpm)}bpm · ${escape_html(formatLength(bm.totalLength))}

`); } else { $$renderer2.push(""); } $$renderer2.push(`

Waiting for players to ready up & play in osu!...

`); } else { $$renderer2.push(""); } $$renderer2.push(` `); if (m().state === "FINISHED") { $$renderer2.push(""); const winner = m().participants.find((p) => p.teamId === m().winnerId); $$renderer2.push(`
🏆

${escape_html(winner?.team.name)} wins!

${escape_html(p1()?.score)} – ${escape_html(p2()?.score)}

`); const each_array_3 = ensure_array_like(m().games); for (let $$index_3 = 0, $$length = each_array_3.length; $$index_3 < $$length; $$index_3++) { let game = each_array_3[$$index_3]; const bm = data.beatmapCache[game.slot?.beatmapId]; const winnerP = m().participants.find((p) => p.id === game.winnerParticipantId); $$renderer2.push(`
${escape_html(game.slot?.category)}${escape_html(game.slot?.orderInCategory)} ${escape_html(bm ? `${bm.artist} - ${bm.title}` : `#${game.slot?.beatmapId}`)} ${escape_html(winnerP?.team.name)}
`); } $$renderer2.push(`
Back to Dashboard
`); } else { $$renderer2.push(""); } $$renderer2.push(` `); if (m().games.length > 0) { $$renderer2.push(""); $$renderer2.push(`

Games Played

`); const each_array_4 = ensure_array_like(m().games); for (let $$index_4 = 0, $$length = each_array_4.length; $$index_4 < $$length; $$index_4++) { let game = each_array_4[$$index_4]; const bm = data.beatmapCache[game.slot?.beatmapId]; const pickerTeam = m().participants.find((p) => p.id === game.pickedByParticipantId)?.team; const winnerTeam = m().participants.find((p) => p.id === game.winnerParticipantId)?.team; $$renderer2.push(`
${escape_html(game.gameNumber)} `); if (bm?.listCoverUrl) { $$renderer2.push(""); $$renderer2.push(``); } else { $$renderer2.push(""); } $$renderer2.push(`
`); if (bm) { $$renderer2.push(""); $$renderer2.push(`

${escape_html(bm.artist)} - ${escape_html(bm.title)} [${escape_html(bm.version)}]

`); } else { $$renderer2.push(""); } $$renderer2.push(`
${escape_html(game.slot?.category)}${escape_html(game.slot?.orderInCategory)} `); if (pickerTeam) { $$renderer2.push(""); $$renderer2.push(`Picked by ${escape_html(pickerTeam.name)}`); } else { $$renderer2.push(""); } $$renderer2.push(`
`); if (game.state === "FINISHED" && p1() && p2()) { $$renderer2.push(""); const p1Score = game.scores.filter((s) => s.player?.participantId === p1().id).reduce((sum, s) => sum + s.score, 0); const p2Score = game.scores.filter((s) => s.player?.participantId === p2().id).reduce((sum, s) => sum + s.score, 0); $$renderer2.push(`
p2Score ? "font-700 text-green-400" : "text-text-secondary")}>${escape_html(p1Score.toLocaleString())} - p1Score ? "font-700 text-green-400" : "text-text-secondary")}>${escape_html(p2Score.toLocaleString())}
`); } else if (game.state === "PLAYING") { $$renderer2.push(""); $$renderer2.push(`Live`); } else { $$renderer2.push(""); } $$renderer2.push(` `); if (winnerTeam) { $$renderer2.push(""); $$renderer2.push(`✓ ${escape_html(winnerTeam.name)}`); } else { $$renderer2.push(""); } $$renderer2.push(`
`); } $$renderer2.push(`
`); } else { $$renderer2.push(""); } $$renderer2.push(` `); if (m().state === "CREATED") { $$renderer2.push(""); $$renderer2.push(`

Creating osu! lobby...

`); } else { $$renderer2.push(""); } $$renderer2.push(` `); if (m().state === "LOBBY") { $$renderer2.push(""); $$renderer2.push(`

Lobby created. Waiting for players to join...

`); if (m().osuLobbyId) { $$renderer2.push(""); $$renderer2.push(`

osu! mp/${escape_html(m().osuLobbyId)}

`); } else { $$renderer2.push(""); } $$renderer2.push(`
`); } else { $$renderer2.push(""); } $$renderer2.push(` `); if (m().state === "CANCELLED") { $$renderer2.push(""); $$renderer2.push(`

This match was cancelled.

`); } else { $$renderer2.push(""); } $$renderer2.push(``); }); } export { _page as default }; //# sourceMappingURL=_page.svelte-G6sWOX7O.js.map