fix: update match configuration to bestOf 5 and scoringType to score_v2

This commit is contained in:
2026-02-28 06:38:05 +01:00
parent e99444b157
commit fb9140a03f
555 changed files with 124715 additions and 1 deletions

View File

@@ -0,0 +1,9 @@
const index = 0;
let component_cache;
const component = async () => component_cache ??= (await import('./layout.svelte-UxsTmhKc.js')).default;
const imports = ["_app/immutable/nodes/0.9C686m9W.js","_app/immutable/chunks/DsnmJJEf.js","_app/immutable/chunks/BxEwC6Zc.js","_app/immutable/chunks/CyUoLS3q.js","_app/immutable/chunks/kALFGdUG.js"];
const stylesheets = [];
const fonts = [];
export { component, fonts, imports, index, stylesheets };
//# sourceMappingURL=0-BWa0n_wG.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"0-BWa0n_wG.js","sources":["../../../.svelte-kit/adapter-node/nodes/0.js"],"sourcesContent":["\n\nexport const index = 0;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/fallbacks/layout.svelte.js')).default;\nexport const imports = [\"_app/immutable/nodes/0.9C686m9W.js\",\"_app/immutable/chunks/DsnmJJEf.js\",\"_app/immutable/chunks/BxEwC6Zc.js\",\"_app/immutable/chunks/CyUoLS3q.js\",\"_app/immutable/chunks/kALFGdUG.js\"];\nexport const stylesheets = [];\nexport const fonts = [];\n"],"names":[],"mappings":"AAEY,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,6BAAuC,CAAC,EAAE;AACrG,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC;AAChM,MAAC,WAAW,GAAG;AACf,MAAC,KAAK,GAAG;;;;"}

View File

@@ -0,0 +1,9 @@
const index = 1;
let component_cache;
const component = async () => component_cache ??= (await import('./_error.svelte-Szt4-wKI.js')).default;
const imports = ["_app/immutable/nodes/1.RyK1bdTz.js","_app/immutable/chunks/DsnmJJEf.js","_app/immutable/chunks/TpZZa089.js","_app/immutable/chunks/BxEwC6Zc.js","_app/immutable/chunks/DoLu9QLy.js","_app/immutable/chunks/BQKoxf2Q.js","_app/immutable/chunks/kALFGdUG.js","_app/immutable/chunks/D2SGgx9j.js","_app/immutable/chunks/DAtZQVjv.js","_app/immutable/chunks/CvGSsBh3.js","_app/immutable/chunks/BkIq08el.js"];
const stylesheets = [];
const fonts = [];
export { component, fonts, imports, index, stylesheets };
//# sourceMappingURL=1-dOPiiXyK.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"1-dOPiiXyK.js","sources":["../../../.svelte-kit/adapter-node/nodes/1.js"],"sourcesContent":["\n\nexport const index = 1;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/_error.svelte.js')).default;\nexport const imports = [\"_app/immutable/nodes/1.RyK1bdTz.js\",\"_app/immutable/chunks/DsnmJJEf.js\",\"_app/immutable/chunks/TpZZa089.js\",\"_app/immutable/chunks/BxEwC6Zc.js\",\"_app/immutable/chunks/DoLu9QLy.js\",\"_app/immutable/chunks/BQKoxf2Q.js\",\"_app/immutable/chunks/kALFGdUG.js\",\"_app/immutable/chunks/D2SGgx9j.js\",\"_app/immutable/chunks/DAtZQVjv.js\",\"_app/immutable/chunks/CvGSsBh3.js\",\"_app/immutable/chunks/BkIq08el.js\"];\nexport const stylesheets = [];\nexport const fonts = [];\n"],"names":[],"mappings":"AAEY,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,6BAAmC,CAAC,EAAE;AACjG,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC;AACxZ,MAAC,WAAW,GAAG;AACf,MAAC,KAAK,GAAG;;;;"}

View File

@@ -0,0 +1,103 @@
import { d as db, e as eq, t as team, j as teamMember, u as user } from './index2-B7hVh_Qf.js';
import { r as redirect } from './index-B2LGyy1l.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const load = async ({ locals }) => {
if (!locals.user) redirect(302, "/");
const teams = await db.query.team.findMany({
with: {
members: true
},
orderBy: (t, { desc }) => [desc(t.createdAt)]
});
const teamsWithUsers = await Promise.all(
teams.map(async (t) => {
const membersWithUsers = await Promise.all(
t.members.map(async (m) => {
const u = await db.query.user.findFirst({
where: eq(user.id, m.userId)
});
return { ...m, user: u ? { id: u.id, name: u.name, image: u.image } : null };
})
);
return { ...t, members: membersWithUsers };
})
);
return { teams: teamsWithUsers, userId: locals.user.id };
};
const actions = {
create: async ({ request, locals }) => {
if (!locals.user) redirect(302, "/");
const form = await request.formData();
const name = form.get("name")?.toString()?.trim();
if (!name) return { error: "Team name is required" };
const [created] = await db.insert(team).values({
name,
ownerId: locals.user.id,
isPersonal: false
}).returning();
await db.insert(teamMember).values({
teamId: created.id,
userId: locals.user.id,
role: "captain"
});
return { success: true };
},
addMember: async ({ request, locals }) => {
if (!locals.user) redirect(302, "/");
const form = await request.formData();
const teamId = form.get("teamId")?.toString();
const username = form.get("username")?.toString()?.trim();
if (!teamId || !username) return { error: "Team and username are required" };
const u = await db.query.user.findFirst({
where: eq(user.name, username)
});
if (!u) return { error: `User "${username}" not found. They need to log in first.` };
const existing = await db.query.teamMember.findFirst({
where: (m, { and, eq: eq2 }) => and(eq2(m.teamId, teamId), eq2(m.userId, u.id))
});
if (existing) return { error: `${username} is already on this team` };
await db.insert(teamMember).values({
teamId,
userId: u.id,
role: "member"
});
return { success: true };
},
removeMember: async ({ request, locals }) => {
if (!locals.user) redirect(302, "/");
const form = await request.formData();
const memberId = form.get("memberId")?.toString();
if (!memberId) return { error: "Missing member ID" };
await db.delete(teamMember).where(eq(teamMember.id, memberId));
return { success: true };
},
deleteTeam: async ({ request, locals }) => {
if (!locals.user) redirect(302, "/");
const form = await request.formData();
const teamId = form.get("teamId")?.toString();
if (!teamId) return { error: "Missing team ID" };
const t = await db.query.team.findFirst({ where: eq(team.id, teamId) });
if (!t || t.ownerId !== locals.user.id) return { error: "Not authorized" };
await db.delete(team).where(eq(team.id, teamId));
return { success: true };
}
};
var _page_server_ts = /*#__PURE__*/Object.freeze({
__proto__: null,
actions: actions,
load: load
});
const index = 10;
let component_cache;
const component = async () => component_cache ??= (await import('./_page.svelte-B33-skqO.js')).default;
const server_id = "src/routes/(app)/teams/+page.server.ts";
const imports = ["_app/immutable/nodes/10.BPlEN6_G.js","_app/immutable/chunks/DsnmJJEf.js","_app/immutable/chunks/BxEwC6Zc.js","_app/immutable/chunks/DoLu9QLy.js","_app/immutable/chunks/BQKoxf2Q.js","_app/immutable/chunks/kALFGdUG.js","_app/immutable/chunks/BLQQas77.js","_app/immutable/chunks/BAocuFgQ.js","_app/immutable/chunks/BkIq08el.js","_app/immutable/chunks/CvGSsBh3.js","_app/immutable/chunks/DAtZQVjv.js","_app/immutable/chunks/BnX5ZnVA.js","_app/immutable/chunks/BqOsL1Vv.js","_app/immutable/chunks/CAkKRSSs.js"];
const stylesheets = [];
const fonts = [];
export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
//# sourceMappingURL=10-BGqcbnOp.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,9 @@
const index = 11;
let component_cache;
const component = async () => component_cache ??= (await import('./_page.svelte-C5eWfXqa.js')).default;
const imports = ["_app/immutable/nodes/11.DR1Vz7m0.js","_app/immutable/chunks/DsnmJJEf.js","_app/immutable/chunks/TpZZa089.js","_app/immutable/chunks/BxEwC6Zc.js","_app/immutable/chunks/BnX5ZnVA.js","_app/immutable/chunks/DAtZQVjv.js","_app/immutable/chunks/CvGSsBh3.js","_app/immutable/chunks/DoLu9QLy.js"];
const stylesheets = [];
const fonts = [];
export { component, fonts, imports, index, stylesheets };
//# sourceMappingURL=11-DB2oh-6z.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"11-DB2oh-6z.js","sources":["../../../.svelte-kit/adapter-node/nodes/11.js"],"sourcesContent":["\n\nexport const index = 11;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/demo/_page.svelte.js')).default;\nexport const imports = [\"_app/immutable/nodes/11.DR1Vz7m0.js\",\"_app/immutable/chunks/DsnmJJEf.js\",\"_app/immutable/chunks/TpZZa089.js\",\"_app/immutable/chunks/BxEwC6Zc.js\",\"_app/immutable/chunks/BnX5ZnVA.js\",\"_app/immutable/chunks/DAtZQVjv.js\",\"_app/immutable/chunks/CvGSsBh3.js\",\"_app/immutable/chunks/DoLu9QLy.js\"];\nexport const stylesheets = [];\nexport const fonts = [];\n"],"names":[],"mappings":"AAEY,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,4BAAuC,CAAC,EAAE;AACrG,MAAC,OAAO,GAAG,CAAC,qCAAqC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC;AAC7S,MAAC,WAAW,GAAG;AACf,MAAC,KAAK,GAAG;;;;"}

View File

@@ -0,0 +1,42 @@
import { r as redirect } from './index-B2LGyy1l.js';
import { a as auth } from './auth-CAP7sZek.js';
import './shared-server-DaWdgxVh.js';
import './root-D12ma0No.js';
import './index3-C4geC3K_.js';
import './utils-D_bK1W85.js';
import './shared-DWC9PG0H.js';
import './index2-B7hVh_Qf.js';
import 'postgres';
import './aggregate-CrXc04Dg.js';
const load = async (event) => {
if (!event.locals.user) {
return redirect(302, "/demo/better-auth/login");
}
return { user: event.locals.user };
};
const actions = {
signOut: async (event) => {
await auth.api.signOut({
headers: event.request.headers
});
return redirect(302, "/demo/better-auth/login");
}
};
var _page_server_ts = /*#__PURE__*/Object.freeze({
__proto__: null,
actions: actions,
load: load
});
const index = 12;
let component_cache;
const component = async () => component_cache ??= (await import('./_page.svelte-Ctzd-tuM.js')).default;
const server_id = "src/routes/demo/better-auth/+page.server.ts";
const imports = ["_app/immutable/nodes/12.C9UZWAjJ.js","_app/immutable/chunks/DsnmJJEf.js","_app/immutable/chunks/BxEwC6Zc.js","_app/immutable/chunks/DoLu9QLy.js","_app/immutable/chunks/BAocuFgQ.js","_app/immutable/chunks/BkIq08el.js","_app/immutable/chunks/CvGSsBh3.js","_app/immutable/chunks/DAtZQVjv.js"];
const stylesheets = [];
const fonts = [];
export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
//# sourceMappingURL=12-3YbOOB0i.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"12-3YbOOB0i.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/demo/better-auth/_page.server.ts.js","../../../.svelte-kit/adapter-node/nodes/12.js"],"sourcesContent":["import { redirect } from \"@sveltejs/kit\";\nimport { a as auth } from \"../../../../chunks/auth.js\";\nconst load = async (event) => {\n if (!event.locals.user) {\n return redirect(302, \"/demo/better-auth/login\");\n }\n return { user: event.locals.user };\n};\nconst actions = {\n signOut: async (event) => {\n await auth.api.signOut({\n headers: event.request.headers\n });\n return redirect(302, \"/demo/better-auth/login\");\n }\n};\nexport {\n actions,\n load\n};\n","import * as server from '../entries/pages/demo/better-auth/_page.server.ts.js';\n\nexport const index = 12;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/demo/better-auth/_page.svelte.js')).default;\nexport { server };\nexport const server_id = \"src/routes/demo/better-auth/+page.server.ts\";\nexport const imports = [\"_app/immutable/nodes/12.C9UZWAjJ.js\",\"_app/immutable/chunks/DsnmJJEf.js\",\"_app/immutable/chunks/BxEwC6Zc.js\",\"_app/immutable/chunks/DoLu9QLy.js\",\"_app/immutable/chunks/BAocuFgQ.js\",\"_app/immutable/chunks/BkIq08el.js\",\"_app/immutable/chunks/CvGSsBh3.js\",\"_app/immutable/chunks/DAtZQVjv.js\"];\nexport const stylesheets = [];\nexport const fonts = [];\n"],"names":[],"mappings":";;;;;;;;;;;AAEA,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK;AAC9B,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE;AAC1B,IAAI,OAAO,QAAQ,CAAC,GAAG,EAAE,yBAAyB,CAAC;AACnD,EAAE;AACF,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE;AACpC,CAAC;AACD,MAAM,OAAO,GAAG;AAChB,EAAE,OAAO,EAAE,OAAO,KAAK,KAAK;AAC5B,IAAI,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;AAC3B,MAAM,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;AAC7B,KAAK,CAAC;AACN,IAAI,OAAO,QAAQ,CAAC,GAAG,EAAE,yBAAyB,CAAC;AACnD,EAAE;AACF,CAAC;;;;;;;;ACbW,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,4BAAmD,CAAC,EAAE;AAEjH,MAAC,SAAS,GAAG;AACb,MAAC,OAAO,GAAG,CAAC,qCAAqC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC;AAC7S,MAAC,WAAW,GAAG;AACf,MAAC,KAAK,GAAG;;;;"}

View File

@@ -0,0 +1,93 @@
import { r as redirect, f as fail } from './index-B2LGyy1l.js';
import { a as auth, A as APIError } from './auth-CAP7sZek.js';
import './shared-server-DaWdgxVh.js';
import './root-D12ma0No.js';
import './index3-C4geC3K_.js';
import './utils-D_bK1W85.js';
import './shared-DWC9PG0H.js';
import './index2-B7hVh_Qf.js';
import 'postgres';
import './aggregate-CrXc04Dg.js';
const load = async (event) => {
if (event.locals.user) {
return redirect(302, "/demo/better-auth");
}
return {};
};
const actions = {
signInEmail: async (event) => {
const formData = await event.request.formData();
const email = formData.get("email")?.toString() ?? "";
const password = formData.get("password")?.toString() ?? "";
try {
await auth.api.signInEmail({
body: {
email,
password,
callbackURL: "/auth/verification-success"
}
});
} catch (error) {
if (error instanceof APIError) {
return fail(400, { message: error.message || "Signin failed" });
}
return fail(500, { message: "Unexpected error" });
}
return redirect(302, "/demo/better-auth");
},
signUpEmail: async (event) => {
const formData = await event.request.formData();
const email = formData.get("email")?.toString() ?? "";
const password = formData.get("password")?.toString() ?? "";
const name = formData.get("name")?.toString() ?? "";
try {
await auth.api.signUpEmail({
body: {
email,
password,
name,
callbackURL: "/auth/verification-success"
}
});
} catch (error) {
if (error instanceof APIError) {
return fail(400, { message: error.message || "Registration failed" });
}
return fail(500, { message: "Unexpected error" });
}
return redirect(302, "/demo/better-auth");
},
signInSocial: async (event) => {
const formData = await event.request.formData();
const provider = formData.get("provider")?.toString() ?? "osu";
const callbackURL = formData.get("callbackURL")?.toString() ?? "/demo/better-auth";
const result = await auth.api.signInSocial({
body: {
provider,
callbackURL
}
});
if (result.url) {
return redirect(302, result.url);
}
return fail(400, { message: "Social sign-in failed" });
}
};
var _page_server_ts = /*#__PURE__*/Object.freeze({
__proto__: null,
actions: actions,
load: load
});
const index = 13;
let component_cache;
const component = async () => component_cache ??= (await import('./_page.svelte-ad4cZnqC.js')).default;
const server_id = "src/routes/demo/better-auth/login/+page.server.ts";
const imports = ["_app/immutable/nodes/13.CyZ4e6yK.js","_app/immutable/chunks/DsnmJJEf.js","_app/immutable/chunks/BxEwC6Zc.js","_app/immutable/chunks/DoLu9QLy.js","_app/immutable/chunks/BAocuFgQ.js","_app/immutable/chunks/BkIq08el.js","_app/immutable/chunks/CvGSsBh3.js","_app/immutable/chunks/DAtZQVjv.js"];
const stylesheets = [];
const fonts = [];
export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
//# sourceMappingURL=13-CyOLqwjC.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,36 @@
import { r as redirect } from './index-B2LGyy1l.js';
import { a as auth } from './auth-CAP7sZek.js';
import './shared-server-DaWdgxVh.js';
import './root-D12ma0No.js';
import './index3-C4geC3K_.js';
import './utils-D_bK1W85.js';
import './shared-DWC9PG0H.js';
import './index2-B7hVh_Qf.js';
import 'postgres';
import './aggregate-CrXc04Dg.js';
const load = async (event) => {
if (event.locals.user) redirect(302, "/");
const result = await auth.api.signInSocial({
body: {
provider: "osu",
callbackURL: "/"
}
});
if (result.url) redirect(302, result.url);
return {};
};
var _page_server_ts = /*#__PURE__*/Object.freeze({
__proto__: null,
load: load
});
const index = 14;
const server_id = "src/routes/login/+page.server.ts";
const imports = [];
const stylesheets = [];
const fonts = [];
export { fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
//# sourceMappingURL=14-BMPOArNY.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"14-BMPOArNY.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/login/_page.server.ts.js","../../../.svelte-kit/adapter-node/nodes/14.js"],"sourcesContent":["import { redirect } from \"@sveltejs/kit\";\nimport { a as auth } from \"../../../chunks/auth.js\";\nconst load = async (event) => {\n if (event.locals.user) redirect(302, \"/\");\n const result = await auth.api.signInSocial({\n body: {\n provider: \"osu\",\n callbackURL: \"/\"\n }\n });\n if (result.url) redirect(302, result.url);\n return {};\n};\nexport {\n load\n};\n","import * as server from '../entries/pages/login/_page.server.ts.js';\n\nexport const index = 14;\nexport { server };\nexport const server_id = \"src/routes/login/+page.server.ts\";\nexport const imports = [];\nexport const stylesheets = [];\nexport const fonts = [];\n"],"names":[],"mappings":";;;;;;;;;;;AAEA,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK;AAC9B,EAAE,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;AAC3C,EAAE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC;AAC7C,IAAI,IAAI,EAAE;AACV,MAAM,QAAQ,EAAE,KAAK;AACrB,MAAM,WAAW,EAAE;AACnB;AACA,GAAG,CAAC;AACJ,EAAE,IAAI,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC;AAC3C,EAAE,OAAO,EAAE;AACX,CAAC;;;;;;;ACVW,MAAC,KAAK,GAAG;AAET,MAAC,SAAS,GAAG;AACb,MAAC,OAAO,GAAG;AACX,MAAC,WAAW,GAAG;AACf,MAAC,KAAK,GAAG;;;;"}

View File

@@ -0,0 +1,27 @@
const load = async ({ locals }) => {
return {
user: locals.user ? {
id: locals.user.id,
name: locals.user.name,
email: locals.user.email,
image: locals.user.image,
role: locals.user.role ?? "player"
} : null
};
};
var _layout_server_ts = /*#__PURE__*/Object.freeze({
__proto__: null,
load: load
});
const index = 2;
let component_cache;
const component = async () => component_cache ??= (await import('./_layout.svelte-BV7ZtoED.js')).default;
const server_id = "src/routes/(app)/+layout.server.ts";
const imports = ["_app/immutable/nodes/2.BsR2_q_w.js","_app/immutable/chunks/DsnmJJEf.js","_app/immutable/chunks/BxEwC6Zc.js","_app/immutable/chunks/CyUoLS3q.js","_app/immutable/chunks/kALFGdUG.js","_app/immutable/chunks/BQKoxf2Q.js","_app/immutable/chunks/DoLu9QLy.js","_app/immutable/chunks/BLQQas77.js","_app/immutable/chunks/BnX5ZnVA.js","_app/immutable/chunks/BqOsL1Vv.js","_app/immutable/chunks/D2SGgx9j.js","_app/immutable/chunks/DAtZQVjv.js","_app/immutable/chunks/CvGSsBh3.js","_app/immutable/chunks/BkIq08el.js","_app/immutable/chunks/BAocuFgQ.js"];
const stylesheets = ["_app/immutable/assets/2.Dv2no-8m.css"];
const fonts = [];
export { component, fonts, imports, index, _layout_server_ts as server, server_id, stylesheets };
//# sourceMappingURL=2-BiADR-CH.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"2-BiADR-CH.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/(app)/_layout.server.ts.js","../../../.svelte-kit/adapter-node/nodes/2.js"],"sourcesContent":["const load = async ({ locals }) => {\n return {\n user: locals.user ? {\n id: locals.user.id,\n name: locals.user.name,\n email: locals.user.email,\n image: locals.user.image,\n role: locals.user.role ?? \"player\"\n } : null\n };\n};\nexport {\n load\n};\n","import * as server from '../entries/pages/(app)/_layout.server.ts.js';\n\nexport const index = 2;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/(app)/_layout.svelte.js')).default;\nexport { server };\nexport const server_id = \"src/routes/(app)/+layout.server.ts\";\nexport const imports = [\"_app/immutable/nodes/2.BsR2_q_w.js\",\"_app/immutable/chunks/DsnmJJEf.js\",\"_app/immutable/chunks/BxEwC6Zc.js\",\"_app/immutable/chunks/CyUoLS3q.js\",\"_app/immutable/chunks/kALFGdUG.js\",\"_app/immutable/chunks/BQKoxf2Q.js\",\"_app/immutable/chunks/DoLu9QLy.js\",\"_app/immutable/chunks/BLQQas77.js\",\"_app/immutable/chunks/BnX5ZnVA.js\",\"_app/immutable/chunks/BqOsL1Vv.js\",\"_app/immutable/chunks/D2SGgx9j.js\",\"_app/immutable/chunks/DAtZQVjv.js\",\"_app/immutable/chunks/CvGSsBh3.js\",\"_app/immutable/chunks/BkIq08el.js\",\"_app/immutable/chunks/BAocuFgQ.js\"];\nexport const stylesheets = [\"_app/immutable/assets/2.Dv2no-8m.css\"];\nexport const fonts = [];\n"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,OAAO,EAAE,MAAM,EAAE,KAAK;AACnC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,MAAM,CAAC,IAAI,GAAG;AACxB,MAAM,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE;AACxB,MAAM,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI;AAC5B,MAAM,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK;AAC9B,MAAM,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK;AAC9B,MAAM,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI;AAChC,KAAK,GAAG;AACR,GAAG;AACH,CAAC;;;;;;;ACRW,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,8BAA0C,CAAC,EAAE;AAExG,MAAC,SAAS,GAAG;AACb,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC;AACxiB,MAAC,WAAW,GAAG,CAAC,sCAAsC;AACtD,MAAC,KAAK,GAAG;;;;"}

View File

@@ -0,0 +1,55 @@
import { d as db, a as desc, m as match, i as inArray, t as team, b as mappool, e as eq } from './index2-B7hVh_Qf.js';
import { c as count } from './aggregate-CrXc04Dg.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const load = async ({ locals }) => {
if (!locals.user) {
return {
authenticated: false,
recentMatches: [],
liveMatches: [],
stats: { matches: 0, finished: 0, teams: 0, mappools: 0 }
};
}
const recentMatches = await db.query.match.findMany({
with: { participants: { with: { team: true } } },
orderBy: desc(match.createdAt),
limit: 5
});
const liveMatches = await db.query.match.findMany({
with: { participants: { with: { team: true } } },
where: inArray(match.state, ["LOBBY", "ROLLING", "PICKING", "PLAYING"])
});
const [matchCount] = await db.select({ count: count() }).from(match);
const [teamCount] = await db.select({ count: count() }).from(team);
const [poolCount] = await db.select({ count: count() }).from(mappool);
const [finishedCount] = await db.select({ count: count() }).from(match).where(eq(match.state, "FINISHED"));
return {
authenticated: true,
recentMatches,
liveMatches,
stats: {
matches: matchCount.count,
finished: finishedCount.count,
teams: teamCount.count,
mappools: poolCount.count
}
};
};
var _page_server_ts = /*#__PURE__*/Object.freeze({
__proto__: null,
load: load
});
const index = 3;
let component_cache;
const component = async () => component_cache ??= (await import('./_page.svelte-C-71W7Xe.js')).default;
const server_id = "src/routes/(app)/+page.server.ts";
const imports = ["_app/immutable/nodes/3.CMuy9Bx3.js","_app/immutable/chunks/DsnmJJEf.js","_app/immutable/chunks/BxEwC6Zc.js","_app/immutable/chunks/DoLu9QLy.js","_app/immutable/chunks/BQKoxf2Q.js","_app/immutable/chunks/kALFGdUG.js","_app/immutable/chunks/BLQQas77.js","_app/immutable/chunks/BnX5ZnVA.js","_app/immutable/chunks/BqOsL1Vv.js"];
const stylesheets = [];
const fonts = [];
export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
//# sourceMappingURL=3-BPD8edaL.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"3-BPD8edaL.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/(app)/_page.server.ts.js","../../../.svelte-kit/adapter-node/nodes/3.js"],"sourcesContent":["import { d as db, b as match, c as team, m as mappool } from \"../../../chunks/index2.js\";\nimport { desc, inArray, count, eq } from \"drizzle-orm\";\nconst load = async ({ locals }) => {\n if (!locals.user) {\n return {\n authenticated: false,\n recentMatches: [],\n liveMatches: [],\n stats: { matches: 0, finished: 0, teams: 0, mappools: 0 }\n };\n }\n const recentMatches = await db.query.match.findMany({\n with: { participants: { with: { team: true } } },\n orderBy: desc(match.createdAt),\n limit: 5\n });\n const liveMatches = await db.query.match.findMany({\n with: { participants: { with: { team: true } } },\n where: inArray(match.state, [\"LOBBY\", \"ROLLING\", \"PICKING\", \"PLAYING\"])\n });\n const [matchCount] = await db.select({ count: count() }).from(match);\n const [teamCount] = await db.select({ count: count() }).from(team);\n const [poolCount] = await db.select({ count: count() }).from(mappool);\n const [finishedCount] = await db.select({ count: count() }).from(match).where(eq(match.state, \"FINISHED\"));\n return {\n authenticated: true,\n recentMatches,\n liveMatches,\n stats: {\n matches: matchCount.count,\n finished: finishedCount.count,\n teams: teamCount.count,\n mappools: poolCount.count\n }\n };\n};\nexport {\n load\n};\n","import * as server from '../entries/pages/(app)/_page.server.ts.js';\n\nexport const index = 3;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/(app)/_page.svelte.js')).default;\nexport { server };\nexport const server_id = \"src/routes/(app)/+page.server.ts\";\nexport const imports = [\"_app/immutable/nodes/3.CMuy9Bx3.js\",\"_app/immutable/chunks/DsnmJJEf.js\",\"_app/immutable/chunks/BxEwC6Zc.js\",\"_app/immutable/chunks/DoLu9QLy.js\",\"_app/immutable/chunks/BQKoxf2Q.js\",\"_app/immutable/chunks/kALFGdUG.js\",\"_app/immutable/chunks/BLQQas77.js\",\"_app/immutable/chunks/BnX5ZnVA.js\",\"_app/immutable/chunks/BqOsL1Vv.js\"];\nexport const stylesheets = [];\nexport const fonts = [];\n"],"names":[],"mappings":";;;;;AAEA,MAAM,IAAI,GAAG,OAAO,EAAE,MAAM,EAAE,KAAK;AACnC,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;AACpB,IAAI,OAAO;AACX,MAAM,aAAa,EAAE,KAAK;AAC1B,MAAM,aAAa,EAAE,EAAE;AACvB,MAAM,WAAW,EAAE,EAAE;AACrB,MAAM,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC;AAC7D,KAAK;AACL,EAAE;AACF,EAAE,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC;AACtD,IAAI,IAAI,EAAE,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE;AACpD,IAAI,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;AAClC,IAAI,KAAK,EAAE;AACX,GAAG,CAAC;AACJ,EAAE,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC;AACpD,IAAI,IAAI,EAAE,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE;AACpD,IAAI,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;AAC1E,GAAG,CAAC;AACJ,EAAE,MAAM,CAAC,UAAU,CAAC,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;AACtE,EAAE,MAAM,CAAC,SAAS,CAAC,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;AACpE,EAAE,MAAM,CAAC,SAAS,CAAC,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;AACvE,EAAE,MAAM,CAAC,aAAa,CAAC,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AAC5G,EAAE,OAAO;AACT,IAAI,aAAa,EAAE,IAAI;AACvB,IAAI,aAAa;AACjB,IAAI,WAAW;AACf,IAAI,KAAK,EAAE;AACX,MAAM,OAAO,EAAE,UAAU,CAAC,KAAK;AAC/B,MAAM,QAAQ,EAAE,aAAa,CAAC,KAAK;AACnC,MAAM,KAAK,EAAE,SAAS,CAAC,KAAK;AAC5B,MAAM,QAAQ,EAAE,SAAS,CAAC;AAC1B;AACA,GAAG;AACH,CAAC;;;;;;;ACjCW,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,4BAAwC,CAAC,EAAE;AAEtG,MAAC,SAAS,GAAG;AACb,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC;AAChV,MAAC,WAAW,GAAG;AACf,MAAC,KAAK,GAAG;;;;"}

View File

@@ -0,0 +1,85 @@
import { d as db, a as desc, u as user, e as eq, p as playerRating } from './index2-B7hVh_Qf.js';
import { e as error } from './index-B2LGyy1l.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const ROLE_HIERARCHY = {
player: 0,
referee: 1,
admin: 2
};
function hasRole(userRole, minRole) {
const level = ROLE_HIERARCHY[userRole] ?? 0;
const required = ROLE_HIERARCHY[minRole];
return level >= required;
}
function requireRole(locals, minRole, message = "Insufficient permissions") {
if (!locals.user) {
error(401, "Not logged in");
}
if (!hasRole(locals.user.role, minRole)) {
error(403, message);
}
}
async function setUserRole(userId, role) {
await db.update(user).set({ role }).where(eq(user.id, userId));
}
const load = async ({ locals }) => {
requireRole(locals, "admin");
const users = await db.query.user.findMany({
orderBy: desc(user.createdAt)
});
const usersWithRatings = await Promise.all(
users.map(async (u) => {
const rating = await db.query.playerRating.findFirst({
where: eq(playerRating.userId, u.id)
});
return {
id: u.id,
name: u.name,
email: u.email,
image: u.image,
role: u.role ?? "player",
createdAt: u.createdAt,
elo: rating?.elo ?? 1e3,
wins: rating?.wins ?? 0,
losses: rating?.losses ?? 0
};
})
);
return { users: usersWithRatings };
};
const actions = {
setRole: async ({ request, locals }) => {
requireRole(locals, "admin");
const form = await request.formData();
const userId = form.get("userId")?.toString();
const role = form.get("role")?.toString();
if (!userId || !role) return { error: "User ID and role are required" };
if (!["player", "referee", "admin"].includes(role)) {
return { error: "Invalid role" };
}
if (userId === locals.user.id && role !== "admin") {
return { error: "You can't demote yourself" };
}
await setUserRole(userId, role);
return { success: true };
}
};
var _page_server_ts = /*#__PURE__*/Object.freeze({
__proto__: null,
actions: actions,
load: load
});
const index = 4;
let component_cache;
const component = async () => component_cache ??= (await import('./_page.svelte-6xWa24o9.js')).default;
const server_id = "src/routes/(app)/admin/+page.server.ts";
const imports = ["_app/immutable/nodes/4.BdC-uDW-.js","_app/immutable/chunks/DsnmJJEf.js","_app/immutable/chunks/BxEwC6Zc.js","_app/immutable/chunks/DoLu9QLy.js","_app/immutable/chunks/BQKoxf2Q.js","_app/immutable/chunks/kALFGdUG.js","_app/immutable/chunks/BLQQas77.js","_app/immutable/chunks/BAocuFgQ.js","_app/immutable/chunks/BkIq08el.js","_app/immutable/chunks/CvGSsBh3.js","_app/immutable/chunks/DAtZQVjv.js","_app/immutable/chunks/BnX5ZnVA.js","_app/immutable/chunks/BqOsL1Vv.js","_app/immutable/chunks/Cy2QBcXt.js"];
const stylesheets = [];
const fonts = [];
export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
//# sourceMappingURL=4-CQssXWUd.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,40 @@
import { d as db, b as mappool } from './index2-B7hVh_Qf.js';
import { r as redirect } from './index-B2LGyy1l.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const load = async ({ locals }) => {
if (!locals.user) redirect(302, "/");
const mappools = await db.query.mappool.findMany({
with: { slots: true },
orderBy: (m, { desc }) => [desc(m.createdAt)]
});
return { mappools };
};
const actions = {
create: async ({ request, locals }) => {
if (!locals.user) redirect(302, "/");
const form = await request.formData();
const name = form.get("name")?.toString()?.trim();
if (!name) return { error: "Name is required" };
const [created] = await db.insert(mappool).values({ name, createdBy: locals.user.id }).returning();
redirect(303, `/mappools/${created.id}`);
}
};
var _page_server_ts = /*#__PURE__*/Object.freeze({
__proto__: null,
actions: actions,
load: load
});
const index = 5;
let component_cache;
const component = async () => component_cache ??= (await import('./_page.svelte-ijSwFWFX.js')).default;
const server_id = "src/routes/(app)/mappools/+page.server.ts";
const imports = ["_app/immutable/nodes/5.CyqZcxti.js","_app/immutable/chunks/DsnmJJEf.js","_app/immutable/chunks/BxEwC6Zc.js","_app/immutable/chunks/DoLu9QLy.js","_app/immutable/chunks/BQKoxf2Q.js","_app/immutable/chunks/kALFGdUG.js","_app/immutable/chunks/BLQQas77.js","_app/immutable/chunks/BAocuFgQ.js","_app/immutable/chunks/BkIq08el.js","_app/immutable/chunks/CvGSsBh3.js","_app/immutable/chunks/DAtZQVjv.js","_app/immutable/chunks/BnX5ZnVA.js"];
const stylesheets = [];
const fonts = [];
export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
//# sourceMappingURL=5-Dk6CJpPs.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"5-Dk6CJpPs.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/(app)/mappools/_page.server.ts.js","../../../.svelte-kit/adapter-node/nodes/5.js"],"sourcesContent":["import { d as db, m as mappool } from \"../../../../chunks/index2.js\";\nimport { redirect } from \"@sveltejs/kit\";\nconst load = async ({ locals }) => {\n if (!locals.user) redirect(302, \"/\");\n const mappools = await db.query.mappool.findMany({\n with: { slots: true },\n orderBy: (m, { desc }) => [desc(m.createdAt)]\n });\n return { mappools };\n};\nconst actions = {\n create: async ({ request, locals }) => {\n if (!locals.user) redirect(302, \"/\");\n const form = await request.formData();\n const name = form.get(\"name\")?.toString()?.trim();\n if (!name) return { error: \"Name is required\" };\n const [created] = await db.insert(mappool).values({ name, createdBy: locals.user.id }).returning();\n redirect(303, `/mappools/${created.id}`);\n }\n};\nexport {\n actions,\n load\n};\n","import * as server from '../entries/pages/(app)/mappools/_page.server.ts.js';\n\nexport const index = 5;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/(app)/mappools/_page.svelte.js')).default;\nexport { server };\nexport const server_id = \"src/routes/(app)/mappools/+page.server.ts\";\nexport const imports = [\"_app/immutable/nodes/5.CyqZcxti.js\",\"_app/immutable/chunks/DsnmJJEf.js\",\"_app/immutable/chunks/BxEwC6Zc.js\",\"_app/immutable/chunks/DoLu9QLy.js\",\"_app/immutable/chunks/BQKoxf2Q.js\",\"_app/immutable/chunks/kALFGdUG.js\",\"_app/immutable/chunks/BLQQas77.js\",\"_app/immutable/chunks/BAocuFgQ.js\",\"_app/immutable/chunks/BkIq08el.js\",\"_app/immutable/chunks/CvGSsBh3.js\",\"_app/immutable/chunks/DAtZQVjv.js\",\"_app/immutable/chunks/BnX5ZnVA.js\"];\nexport const stylesheets = [];\nexport const fonts = [];\n"],"names":[],"mappings":";;;;;AAEA,MAAM,IAAI,GAAG,OAAO,EAAE,MAAM,EAAE,KAAK;AACnC,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;AACtC,EAAE,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;AACnD,IAAI,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;AACzB,IAAI,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AAChD,GAAG,CAAC;AACJ,EAAE,OAAO,EAAE,QAAQ,EAAE;AACrB,CAAC;AACD,MAAM,OAAO,GAAG;AAChB,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK;AACzC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;AACxC,IAAI,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,QAAQ,EAAE;AACzC,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE;AACrD,IAAI,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE;AACnD,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,EAAE;AACtG,IAAI,QAAQ,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5C,EAAE;AACF,CAAC;;;;;;;;ACjBW,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,4BAAiD,CAAC,EAAE;AAE/G,MAAC,SAAS,GAAG;AACb,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC;AAC5b,MAAC,WAAW,GAAG;AACf,MAAC,KAAK,GAAG;;;;"}

View File

@@ -0,0 +1,115 @@
import { d as db, b as mappool, e as eq, c as mappoolSlot, f as and } from './index2-B7hVh_Qf.js';
import { r as redirect, e as error } from './index-B2LGyy1l.js';
import { g as getBeatmap } from './api-DYV1cRWY.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const load = async ({ params, locals }) => {
if (!locals.user) redirect(302, "/");
const pool = await db.query.mappool.findFirst({
where: eq(mappool.id, params.id),
with: {
slots: {
orderBy: (s, { asc }) => [asc(s.category), asc(s.orderInCategory)]
}
}
});
if (!pool) error(404, "Mappool not found");
const slotsWithBeatmaps = await Promise.all(
pool.slots.map(async (slot) => {
try {
const beatmap = await getBeatmap(slot.beatmapId);
return {
...slot,
beatmap: {
title: beatmap.beatmapset.title,
artist: beatmap.beatmapset.artist,
version: beatmap.version,
starRating: beatmap.difficulty_rating,
bpm: beatmap.bpm,
totalLength: beatmap.total_length,
coverUrl: beatmap.beatmapset.covers["card@2x"],
url: beatmap.url
}
};
} catch {
return {
...slot,
beatmap: null
};
}
})
);
return {
pool: { ...pool, slots: slotsWithBeatmaps }
};
};
const actions = {
addSlot: async ({ params, request, locals }) => {
if (!locals.user) redirect(302, "/");
const form = await request.formData();
let beatmapId = form.get("beatmapId")?.toString()?.trim();
const category = form.get("category")?.toString()?.trim()?.toUpperCase();
if (!beatmapId || !category) {
return { error: "Beatmap ID and category are required" };
}
const urlMatch = beatmapId.match(/beatmaps\/(\d+)/);
const setMatch = beatmapId.match(/beatmapsets\/\d+#\w+\/(\d+)/);
if (urlMatch) beatmapId = urlMatch[1];
else if (setMatch) beatmapId = setMatch[1];
if (!/^\d+$/.test(beatmapId)) {
return { error: "Invalid beatmap ID" };
}
let beatmap;
try {
beatmap = await getBeatmap(beatmapId);
} catch {
return { error: "Beatmap not found on osu!" };
}
const existing = await db.query.mappoolSlot.findMany({
where: and(
eq(mappoolSlot.mappoolId, params.id),
eq(mappoolSlot.category, category)
)
});
await db.insert(mappoolSlot).values({
mappoolId: params.id,
beatmapId,
category,
orderInCategory: existing.length + 1,
starRating: beatmap.difficulty_rating,
mods: category === "NM" || category === "TB" || category === "FM" ? [] : [category]
});
return { success: true };
},
removeSlot: async ({ request, locals }) => {
if (!locals.user) redirect(302, "/");
const form = await request.formData();
const slotId = form.get("slotId")?.toString();
if (!slotId) return { error: "Missing slot ID" };
await db.delete(mappoolSlot).where(eq(mappoolSlot.id, slotId));
return { success: true };
},
deletePool: async ({ params, locals }) => {
if (!locals.user) redirect(302, "/");
await db.delete(mappool).where(eq(mappool.id, params.id));
redirect(303, "/mappools");
}
};
var _page_server_ts = /*#__PURE__*/Object.freeze({
__proto__: null,
actions: actions,
load: load
});
const index = 6;
let component_cache;
const component = async () => component_cache ??= (await import('./_page.svelte-Be6BiSzg.js')).default;
const server_id = "src/routes/(app)/mappools/[id]/+page.server.ts";
const imports = ["_app/immutable/nodes/6.CEe0czaO.js","_app/immutable/chunks/DsnmJJEf.js","_app/immutable/chunks/BxEwC6Zc.js","_app/immutable/chunks/DoLu9QLy.js","_app/immutable/chunks/BQKoxf2Q.js","_app/immutable/chunks/kALFGdUG.js","_app/immutable/chunks/BLQQas77.js","_app/immutable/chunks/BAocuFgQ.js","_app/immutable/chunks/BkIq08el.js","_app/immutable/chunks/CvGSsBh3.js","_app/immutable/chunks/DAtZQVjv.js","_app/immutable/chunks/BnX5ZnVA.js","_app/immutable/chunks/BqOsL1Vv.js","_app/immutable/chunks/CAkKRSSs.js","_app/immutable/chunks/Cy2QBcXt.js"];
const stylesheets = [];
const fonts = [];
export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
//# sourceMappingURL=6-CW5Wcf44.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,73 @@
import { d as db, a as desc, m as match } from './index2-B7hVh_Qf.js';
import { r as redirect } from './index-B2LGyy1l.js';
import { c as createMatch } from './engine-DiCmv1C-.js';
import { i as initMatchLobby } from './orchestrator-BMt7lT0G.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const load = async ({ locals }) => {
if (!locals.user) redirect(302, "/");
const matches = await db.query.match.findMany({
with: { participants: { with: { team: true } } },
orderBy: desc(match.createdAt),
limit: 50
});
const teams = await db.query.team.findMany({
orderBy: (t, { asc }) => [asc(t.name)]
});
const mappools = await db.query.mappool.findMany({
with: { slots: true },
orderBy: (m, { desc: desc2 }) => [desc2(m.createdAt)]
});
return { matches, teams, mappools };
};
const actions = {
createMatch: async ({ request, locals }) => {
if (!locals.user) redirect(302, "/");
const form = await request.formData();
const name = form.get("name")?.toString()?.trim() || "Custom Match";
const team1Id = form.get("team1")?.toString();
const team2Id = form.get("team2")?.toString();
const mappoolId = form.get("mappool")?.toString();
const bestOf = parseInt(form.get("bestOf")?.toString() ?? "7");
console.log("[Matches] CREATE:", { name, team1Id, team2Id, mappoolId, bestOf });
if (!team1Id || !team2Id || !mappoolId) {
return { error: "All fields are required" };
}
let result;
try {
result = await createMatch({
name,
config: { bestOf, teamSize: 1, scoringType: "score" },
mappoolId,
teams: [team1Id, team2Id],
createdBy: locals.user.id
});
console.log("[Matches] Created:", result.id);
} catch (e) {
console.error("[Matches] Error:", e);
return { error: e.message };
}
initMatchLobby(result.id).catch((err) => {
console.error("[Matches] IRC lobby failed:", err.message);
});
redirect(303, `/matches/${result.id}`);
}
};
var _page_server_ts = /*#__PURE__*/Object.freeze({
__proto__: null,
actions: actions,
load: load
});
const index = 7;
let component_cache;
const component = async () => component_cache ??= (await import('./_page.svelte-Bj4oURhW.js')).default;
const server_id = "src/routes/(app)/matches/+page.server.ts";
const imports = ["_app/immutable/nodes/7._nuD3LlN.js","_app/immutable/chunks/DsnmJJEf.js","_app/immutable/chunks/BxEwC6Zc.js","_app/immutable/chunks/DoLu9QLy.js","_app/immutable/chunks/BQKoxf2Q.js","_app/immutable/chunks/kALFGdUG.js","_app/immutable/chunks/BLQQas77.js","_app/immutable/chunks/BAocuFgQ.js","_app/immutable/chunks/BkIq08el.js","_app/immutable/chunks/CvGSsBh3.js","_app/immutable/chunks/DAtZQVjv.js","_app/immutable/chunks/BnX5ZnVA.js","_app/immutable/chunks/BqOsL1Vv.js"];
const stylesheets = [];
const fonts = [];
export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
//# sourceMappingURL=7-DLfylrWu.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,144 @@
import { d as db, e as eq, u as user } from './index2-B7hVh_Qf.js';
import { a as cancelMatch, g as getMatchFull, p as pickMap, s as submitRoll } from './engine-DiCmv1C-.js';
import { c as closeLobby, f as forceStartGame, p as playPickedMap, g as getLobby } from './orchestrator-BMt7lT0G.js';
import { r as redirect, e as error } from './index-B2LGyy1l.js';
import { g as getBeatmap } from './api-DYV1cRWY.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const load = async ({ params, locals }) => {
if (!locals.user) redirect(302, "/");
let m;
try {
m = await getMatchFull(params.id);
} catch {
error(404, "Match not found");
}
const beatmapCache = {};
if (m.mappool?.slots) {
await Promise.allSettled(
m.mappool.slots.map(async (slot) => {
try {
const bm = await getBeatmap(slot.beatmapId);
beatmapCache[slot.beatmapId] = {
title: bm.beatmapset.title,
artist: bm.beatmapset.artist,
version: bm.version,
starRating: bm.difficulty_rating,
bpm: bm.bpm,
totalLength: bm.total_length,
coverUrl: bm.beatmapset.covers["card@2x"],
listCoverUrl: bm.beatmapset.covers["list@2x"]
};
} catch {
}
})
);
}
return { match: m, beatmapCache, userId: locals.user.id };
};
const actions = {
reinvite: async ({ params, locals }) => {
if (!locals.user) redirect(302, "/");
const lobby = getLobby(params.id);
if (!lobby) return { error: "No active IRC lobby for this match" };
const m = await getMatchFull(params.id);
const invited = [];
for (const p of m.participants) {
for (const pl of p.players) {
const u = await db.query.user.findFirst({ where: eq(user.id, pl.userId) });
if (u?.name) {
await lobby.invite(u.name);
invited.push(u.name);
}
}
}
return { reinvited: invited };
},
roll: async ({ params, locals }) => {
if (!locals.user) redirect(302, "/");
const m = await getMatchFull(params.id);
let myParticipant = m.participants.find(
(p) => p.players.some((pl) => pl.userId === locals.user.id)
);
if (!myParticipant) {
return { error: "You are not in this match" };
}
if (myParticipant.rollValue !== null) {
const unrolled = m.participants.find((p) => p.rollValue === null);
if (unrolled) {
myParticipant = unrolled;
} else {
return { error: "All participants have already rolled" };
}
}
const value = Math.floor(Math.random() * 100) + 1;
await submitRoll(params.id, myParticipant.id, value);
const lobby = getLobby(params.id);
if (lobby) {
lobby.chat(`${myParticipant.team?.name ?? "Player"} rolled ${value} (via web)`).catch(() => {
});
const updated = await getMatchFull(params.id);
if (updated.state === "PICKING") {
const sorted = [...updated.participants].sort(
(a, b) => (a.pickOrder ?? 99) - (b.pickOrder ?? 99)
);
lobby.chat(
`Rolls complete! ${sorted[0]?.team.name} picks first. Use !pick <slot> (e.g. !pick NM1) or pick in web UI.`
).catch(() => {
});
}
}
return { rolled: value, participantId: myParticipant.id };
},
pick: async ({ params, request, locals }) => {
if (!locals.user) redirect(302, "/");
const form = await request.formData();
const slotId = form.get("slotId")?.toString();
if (!slotId) return { error: "No map selected" };
const m = await getMatchFull(params.id);
const sorted = [...m.participants].sort(
(a, b) => (a.pickOrder ?? 99) - (b.pickOrder ?? 99)
);
const expectedIdx = m.games.length % sorted.length;
const expectedPicker = sorted[expectedIdx];
if (!expectedPicker) return { error: "Cannot determine picker" };
try {
const game = await pickMap(params.id, expectedPicker.id, slotId);
playPickedMap(params.id, game.id).catch(
(err) => console.error("[Match] IRC play failed:", err.message)
);
return { picked: true, gameId: game.id };
} catch (e) {
return { error: e.message };
}
},
forceStart: async ({ params, locals }) => {
if (!locals.user) redirect(302, "/");
await forceStartGame(params.id);
return { started: true };
},
cancel: async ({ params, locals }) => {
if (!locals.user) redirect(302, "/");
await cancelMatch(params.id);
await closeLobby(params.id);
redirect(303, "/matches");
}
};
var _page_server_ts = /*#__PURE__*/Object.freeze({
__proto__: null,
actions: actions,
load: load
});
const index = 8;
let component_cache;
const component = async () => component_cache ??= (await import('./_page.svelte-G6sWOX7O.js')).default;
const server_id = "src/routes/(app)/matches/[id]/+page.server.ts";
const imports = ["_app/immutable/nodes/8.CkbqikZq.js","_app/immutable/chunks/DsnmJJEf.js","_app/immutable/chunks/BxEwC6Zc.js","_app/immutable/chunks/DoLu9QLy.js","_app/immutable/chunks/BQKoxf2Q.js","_app/immutable/chunks/kALFGdUG.js","_app/immutable/chunks/BLQQas77.js","_app/immutable/chunks/BAocuFgQ.js","_app/immutable/chunks/BkIq08el.js","_app/immutable/chunks/CvGSsBh3.js","_app/immutable/chunks/DAtZQVjv.js","_app/immutable/chunks/BnX5ZnVA.js","_app/immutable/chunks/BqOsL1Vv.js"];
const stylesheets = [];
const fonts = [];
export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
//# sourceMappingURL=8-Cct4CuMl.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,57 @@
import { r as redirect } from './index-B2LGyy1l.js';
import { a as auth } from './auth-CAP7sZek.js';
import { d as db, e as eq, p as playerRating, f as and, h as account } from './index2-B7hVh_Qf.js';
import './shared-server-DaWdgxVh.js';
import './root-D12ma0No.js';
import './index3-C4geC3K_.js';
import './utils-D_bK1W85.js';
import './shared-DWC9PG0H.js';
import './aggregate-CrXc04Dg.js';
import 'postgres';
const load = async ({ locals }) => {
if (!locals.user) redirect(302, "/");
const rating = await db.query.playerRating.findFirst({
where: eq(playerRating.userId, locals.user.id)
});
const osuAccount = await db.query.account.findFirst({
where: and(eq(account.userId, locals.user.id), eq(account.providerId, "osu"))
});
return {
profile: {
id: locals.user.id,
name: locals.user.name,
email: locals.user.email,
image: locals.user.image,
role: locals.user.role ?? "player",
createdAt: locals.user.createdAt
},
rating: rating ? { elo: rating.elo, wins: rating.wins, losses: rating.losses } : { elo: 1e3, wins: 0, losses: 0 },
hasOsuLinked: !!osuAccount
};
};
const actions = {
logout: async (event) => {
await auth.api.signOut({
headers: event.request.headers
});
redirect(302, "/");
}
};
var _page_server_ts = /*#__PURE__*/Object.freeze({
__proto__: null,
actions: actions,
load: load
});
const index = 9;
let component_cache;
const component = async () => component_cache ??= (await import('./_page.svelte-D23V0tpa.js')).default;
const server_id = "src/routes/(app)/settings/+page.server.ts";
const imports = ["_app/immutable/nodes/9.BTBc_Eli.js","_app/immutable/chunks/DsnmJJEf.js","_app/immutable/chunks/BxEwC6Zc.js","_app/immutable/chunks/DoLu9QLy.js","_app/immutable/chunks/BQKoxf2Q.js","_app/immutable/chunks/kALFGdUG.js","_app/immutable/chunks/BAocuFgQ.js","_app/immutable/chunks/BkIq08el.js","_app/immutable/chunks/CvGSsBh3.js","_app/immutable/chunks/DAtZQVjv.js","_app/immutable/chunks/BnX5ZnVA.js","_app/immutable/chunks/BqOsL1Vv.js"];
const stylesheets = [];
const fonts = [];
export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
//# sourceMappingURL=9-DztSgTEC.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"9-DztSgTEC.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/(app)/settings/_page.server.ts.js","../../../.svelte-kit/adapter-node/nodes/9.js"],"sourcesContent":["import { redirect } from \"@sveltejs/kit\";\nimport { a as auth } from \"../../../../chunks/auth.js\";\nimport { d as db, p as playerRating, j as account } from \"../../../../chunks/index2.js\";\nimport { eq, and } from \"drizzle-orm\";\nconst load = async ({ locals }) => {\n if (!locals.user) redirect(302, \"/\");\n const rating = await db.query.playerRating.findFirst({\n where: eq(playerRating.userId, locals.user.id)\n });\n const osuAccount = await db.query.account.findFirst({\n where: and(eq(account.userId, locals.user.id), eq(account.providerId, \"osu\"))\n });\n return {\n profile: {\n id: locals.user.id,\n name: locals.user.name,\n email: locals.user.email,\n image: locals.user.image,\n role: locals.user.role ?? \"player\",\n createdAt: locals.user.createdAt\n },\n rating: rating ? { elo: rating.elo, wins: rating.wins, losses: rating.losses } : { elo: 1e3, wins: 0, losses: 0 },\n hasOsuLinked: !!osuAccount\n };\n};\nconst actions = {\n logout: async (event) => {\n await auth.api.signOut({\n headers: event.request.headers\n });\n redirect(302, \"/\");\n }\n};\nexport {\n actions,\n load\n};\n","import * as server from '../entries/pages/(app)/settings/_page.server.ts.js';\n\nexport const index = 9;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/(app)/settings/_page.svelte.js')).default;\nexport { server };\nexport const server_id = \"src/routes/(app)/settings/+page.server.ts\";\nexport const imports = [\"_app/immutable/nodes/9.BTBc_Eli.js\",\"_app/immutable/chunks/DsnmJJEf.js\",\"_app/immutable/chunks/BxEwC6Zc.js\",\"_app/immutable/chunks/DoLu9QLy.js\",\"_app/immutable/chunks/BQKoxf2Q.js\",\"_app/immutable/chunks/kALFGdUG.js\",\"_app/immutable/chunks/BAocuFgQ.js\",\"_app/immutable/chunks/BkIq08el.js\",\"_app/immutable/chunks/CvGSsBh3.js\",\"_app/immutable/chunks/DAtZQVjv.js\",\"_app/immutable/chunks/BnX5ZnVA.js\",\"_app/immutable/chunks/BqOsL1Vv.js\"];\nexport const stylesheets = [];\nexport const fonts = [];\n"],"names":[],"mappings":";;;;;;;;;;;AAIA,MAAM,IAAI,GAAG,OAAO,EAAE,MAAM,EAAE,KAAK;AACnC,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;AACtC,EAAE,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC;AACvD,IAAI,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE;AACjD,GAAG,CAAC;AACJ,EAAE,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;AACtD,IAAI,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC;AAChF,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,OAAO,EAAE;AACb,MAAM,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE;AACxB,MAAM,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI;AAC5B,MAAM,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK;AAC9B,MAAM,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK;AAC9B,MAAM,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,QAAQ;AACxC,MAAM,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC;AAC7B,KAAK;AACL,IAAI,MAAM,EAAE,MAAM,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;AACrH,IAAI,YAAY,EAAE,CAAC,CAAC;AACpB,GAAG;AACH,CAAC;AACD,MAAM,OAAO,GAAG;AAChB,EAAE,MAAM,EAAE,OAAO,KAAK,KAAK;AAC3B,IAAI,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;AAC3B,MAAM,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;AAC7B,KAAK,CAAC;AACN,IAAI,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;AACtB,EAAE;AACF,CAAC;;;;;;;;AC9BW,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,4BAAiD,CAAC,EAAE;AAE/G,MAAC,SAAS,GAAG;AACb,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC;AAC5b,MAAC,WAAW,GAAG;AACf,MAAC,KAAK,GAAG;;;;"}

View File

@@ -0,0 +1,30 @@
import { a6 as escape_html } from './index3-C4geC3K_.js';
import { p as page } from './index4-B8FtU3M-.js';
import './state.svelte-DvHRBIfo.js';
import './root-D12ma0No.js';
import './utils-D_bK1W85.js';
import './index-MqY7A75_.js';
import './exports-B5ORJhfK.js';
function _error($$renderer, $$props) {
$$renderer.component(($$renderer2) => {
$$renderer2.push(`<div class="flex min-h-dvh items-center justify-center bg-surface-900"><div class="text-center"><p class="text-6xl font-800 text-accent">${escape_html(page.status)}</p> <h1 class="mt-4 text-xl font-700 text-text-primary">`);
if (page.status === 404) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`Page not found`);
} else if (page.status === 403) {
$$renderer2.push("<!--[1-->");
$$renderer2.push(`Access denied`);
} else if (page.status === 401) {
$$renderer2.push("<!--[2-->");
$$renderer2.push(`Not logged in`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`Something went wrong`);
}
$$renderer2.push(`<!--]--></h1> <p class="mt-2 text-sm text-text-secondary">${escape_html(page.error?.message ?? "An unexpected error occurred.")}</p> <a href="/" class="mt-6 inline-block rounded-md bg-accent px-5 py-2.5 text-sm font-600 text-surface-900 transition-colors hover:bg-accent-hover">Back to Dashboard</a></div></div>`);
});
}
export { _error as default };
//# sourceMappingURL=_error.svelte-Szt4-wKI.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_error.svelte-Szt4-wKI.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/_error.svelte.js"],"sourcesContent":["import { e as escape_html } from \"../../chunks/index3.js\";\nimport \"clsx\";\nimport { p as page } from \"../../chunks/index4.js\";\nfunction _error($$renderer, $$props) {\n $$renderer.component(($$renderer2) => {\n $$renderer2.push(`<div class=\"flex min-h-dvh items-center justify-center bg-surface-900\"><div class=\"text-center\"><p class=\"text-6xl font-800 text-accent\">${escape_html(page.status)}</p> <h1 class=\"mt-4 text-xl font-700 text-text-primary\">`);\n if (page.status === 404) {\n $$renderer2.push(\"<!--[-->\");\n $$renderer2.push(`Page not found`);\n } else if (page.status === 403) {\n $$renderer2.push(\"<!--[1-->\");\n $$renderer2.push(`Access denied`);\n } else if (page.status === 401) {\n $$renderer2.push(\"<!--[2-->\");\n $$renderer2.push(`Not logged in`);\n } else {\n $$renderer2.push(\"<!--[!-->\");\n $$renderer2.push(`Something went wrong`);\n }\n $$renderer2.push(`<!--]--></h1> <p class=\"mt-2 text-sm text-text-secondary\">${escape_html(page.error?.message ?? \"An unexpected error occurred.\")}</p> <a href=\"/\" class=\"mt-6 inline-block rounded-md bg-accent px-5 py-2.5 text-sm font-600 text-surface-900 transition-colors hover:bg-accent-hover\">Back to Dashboard</a></div></div>`);\n });\n}\nexport {\n _error as default\n};\n"],"names":[],"mappings":";;;;;;;;AAGA,SAAS,MAAM,CAAC,UAAU,EAAE,OAAO,EAAE;AACrC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,WAAW,KAAK;AACxC,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,yIAAyI,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,yDAAyD,CAAC,CAAC;AACrP,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,GAAG,EAAE;AAC7B,MAAM,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC;AAClC,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC,cAAc,CAAC,CAAC;AACxC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,GAAG,EAAE;AACpC,MAAM,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC;AACnC,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,CAAC;AACvC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,GAAG,EAAE;AACpC,MAAM,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC;AACnC,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,CAAC;AACvC,IAAI,CAAC,MAAM;AACX,MAAM,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC;AACnC,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC,oBAAoB,CAAC,CAAC;AAC9C,IAAI;AACJ,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,0DAA0D,EAAE,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,IAAI,+BAA+B,CAAC,CAAC,uLAAuL,CAAC,CAAC;AAC/U,EAAE,CAAC,CAAC;AACJ;;;;"}

View File

@@ -0,0 +1,96 @@
import { a1 as derived, a8 as ensure_array_like, a9 as attr, aa as attr_class, ab as stringify, a6 as escape_html } from './index3-C4geC3K_.js';
import { p as page } from './index4-B8FtU3M-.js';
import './root-D12ma0No.js';
import './utils-D_bK1W85.js';
import './exports-B5ORJhfK.js';
import './state.svelte-DvHRBIfo.js';
import './index-MqY7A75_.js';
function Sidebar($$renderer, $$props) {
$$renderer.component(($$renderer2) => {
const user = derived(() => page.data?.user);
const nav = [
{ href: "/", label: "Dashboard", icon: "⌂" },
{ href: "/matches", label: "Matches", icon: "⚔" },
{ href: "/mappools", label: "Mappools", icon: "♫" },
{ href: "/teams", label: "Teams", icon: "⚑" }
];
function isActive(href) {
if (href === "/") return page.url.pathname === "/";
return page.url.pathname.startsWith(href);
}
const isAdmin = derived(() => user()?.role === "admin");
$$renderer2.push(`<aside class="fixed top-0 left-0 z-40 flex h-full w-56 flex-col border-r border-border bg-surface-800"><a href="/" class="flex items-center gap-2.5 px-5 py-5"><div class="font-800 flex h-8 w-8 items-center justify-center rounded-md bg-accent text-sm text-surface-900">V</div> <span class="font-700 text-base tracking-tight text-text-primary">Vash Esports</span></a> <nav class="mt-2 flex flex-1 flex-col gap-0.5 px-3"><!--[-->`);
const each_array = ensure_array_like(nav);
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
let item = each_array[$$index];
$$renderer2.push(`<a${attr("href", item.href)}${attr_class(`font-500 flex items-center gap-3 rounded-md px-3 py-2 text-sm transition-colors ${stringify(isActive(item.href) ? "bg-accent-dim text-accent" : "text-text-secondary hover:bg-surface-700 hover:text-text-primary")}`)}><span class="text-base">${escape_html(item.icon)}</span> ${escape_html(item.label)}</a>`);
}
$$renderer2.push(`<!--]--> `);
if (isAdmin()) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="mt-4 mb-1 px-3"><p class="text-[10px] font-600 text-text-secondary uppercase tracking-widest">Staff</p></div> <a href="/admin"${attr_class(`font-500 flex items-center gap-3 rounded-md px-3 py-2 text-sm transition-colors ${stringify(isActive("/admin") ? "bg-red-500/10 text-red-400" : "text-text-secondary hover:bg-surface-700 hover:text-text-primary")}`)}><span class="text-base">⚡</span> Admin</a>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></nav> <div class="border-t border-border p-3"><a href="/settings"${attr_class(`font-500 flex items-center gap-3 rounded-md px-3 py-2 text-sm text-text-secondary transition-colors hover:bg-surface-700 hover:text-text-primary ${stringify(isActive("/settings") ? "bg-accent-dim text-accent" : "")}`)}><span class="text-base">⚙</span> Settings</a></div></aside>`);
});
}
function Header($$renderer, $$props) {
$$renderer.component(($$renderer2) => {
const user = derived(() => page.data?.user);
const roleBadge = {
referee: { label: "REF", color: "bg-yellow-500/20 text-yellow-400" },
admin: { label: "ADMIN", color: "bg-red-500/20 text-red-400" }
};
const badge = derived(() => user()?.role ? roleBadge[user().role] : null);
$$renderer2.push(`<header class="sticky top-0 z-30 flex h-14 items-center justify-between border-b border-border bg-surface-900/80 px-6 backdrop-blur-md"><div></div> <div class="flex items-center gap-4">`);
if (user()) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="flex items-center gap-3">`);
if (badge()) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<span${attr_class(`rounded px-1.5 py-0.5 text-[10px] font-700 ${stringify(badge().color)}`)}>${escape_html(badge().label)}</span>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> `);
if (user().image) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<img${attr("src", user().image)}${attr("alt", user().name)} class="h-7 w-7 rounded-full"/>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> <span class="font-500 text-sm text-text-primary">${escape_html(user().name)}</span> <form method="post" action="/settings?/logout"><button type="submit" class="rounded-md border border-border px-2.5 py-1 text-xs text-text-secondary transition-colors hover:border-red-500/30 hover:text-red-400">Logout</button></form></div>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<a href="/login" class="font-600 rounded-md bg-accent px-3.5 py-1.5 text-sm text-surface-900 transition-colors hover:bg-accent-hover">Sign in with osu!</a>`);
}
$$renderer2.push(`<!--]--></div></header>`);
});
}
function _layout($$renderer, $$props) {
$$renderer.component(($$renderer2) => {
let { children } = $$props;
const user = derived(() => page.data?.user);
if (user()) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="flex min-h-dvh">`);
Sidebar($$renderer2);
$$renderer2.push(`<!----> <div class="ml-56 flex flex-1 flex-col">`);
Header($$renderer2);
$$renderer2.push(`<!----> <main class="flex-1 p-6">`);
children($$renderer2);
$$renderer2.push(`<!----></main></div></div>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<div class="min-h-dvh"><header class="flex h-14 items-center justify-between border-b border-border bg-surface-900/80 px-6 backdrop-blur-md"><a href="/" class="flex items-center gap-2.5"><div class="font-800 flex h-8 w-8 items-center justify-center rounded-md bg-accent text-sm text-surface-900">V</div> <span class="font-700 text-base tracking-tight text-text-primary">Vash Esports</span></a> <a href="/login" class="font-600 rounded-md bg-accent px-3.5 py-1.5 text-sm text-surface-900 transition-colors hover:bg-accent-hover">Sign in with osu!</a></header> <main class="p-6">`);
children($$renderer2);
$$renderer2.push(`<!----></main></div>`);
}
$$renderer2.push(`<!--]-->`);
});
}
export { _layout as default };
//# sourceMappingURL=_layout.svelte-BV7ZtoED.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,68 @@
import { a6 as escape_html, a8 as ensure_array_like, a9 as attr, ab as stringify } 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;
const roleBadge = {
player: {
label: "Player",
color: "bg-surface-600 text-text-secondary border-border"
},
referee: {
label: "Referee",
color: "bg-yellow-500/20 text-yellow-400 border-yellow-500/30"
},
admin: {
label: "Admin",
color: "bg-red-500/20 text-red-400 border-red-500/30"
}
};
$$renderer2.push(`<div class="mx-auto max-w-4xl"><div><h1 class="text-2xl font-700 tracking-tight">Admin Panel</h1> <p class="mt-1 text-sm text-text-secondary">${escape_html(data.users.length)} registered user${escape_html(data.users.length !== 1 ? "s" : "")}</p></div> `);
{
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> <div class="mt-6 rounded-lg border border-border bg-surface-800"><div class="grid grid-cols-[auto_1fr_auto_auto_auto] gap-4 border-b border-border px-4 py-3"><span class="text-xs font-600 text-text-secondary">Avatar</span> <span class="text-xs font-600 text-text-secondary">User</span> <span class="text-xs font-600 text-text-secondary">ELO</span> <span class="text-xs font-600 text-text-secondary">W/L</span> <span class="text-xs font-600 text-text-secondary">Role</span></div> <!--[-->`);
const each_array = ensure_array_like(data.users);
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
let u = each_array[$$index];
const badge = roleBadge[u.role] ?? roleBadge.player;
$$renderer2.push(`<div class="grid grid-cols-[auto_1fr_auto_auto_auto] items-center gap-4 border-b border-border/50 px-4 py-3 last:border-b-0">`);
if (u.image) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<img${attr("src", u.image)} alt="" class="h-8 w-8 rounded-full"/>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<div class="flex h-8 w-8 items-center justify-center rounded-full bg-surface-600 text-xs font-700 text-text-secondary">${escape_html(u.name.charAt(0).toUpperCase())}</div>`);
}
$$renderer2.push(`<!--]--> <div class="min-w-0"><p class="truncate text-sm font-500">${escape_html(u.name)}</p> <p class="truncate text-xs text-text-secondary">${escape_html(u.email)}</p></div> <span class="text-sm font-600 tabular-nums text-text-primary">${escape_html(u.elo)}</span> <span class="text-xs tabular-nums text-text-secondary"><span class="text-green-400">${escape_html(u.wins)}W</span> / <span class="text-red-400">${escape_html(u.losses)}L</span></span> <form method="post" action="?/setRole" class="flex items-center gap-2"><input type="hidden" name="userId"${attr("value", u.id)}/> `);
$$renderer2.select(
{
name: "role",
value: u.role,
onchange: (e) => e.currentTarget.form?.requestSubmit(),
class: `rounded-md border px-2 py-1 text-xs font-500 ${stringify(badge.color)} cursor-pointer bg-transparent focus:outline-none`
},
($$renderer3) => {
$$renderer3.option({ value: "player", class: "bg-surface-800 text-text-primary" }, ($$renderer4) => {
$$renderer4.push(`Player`);
});
$$renderer3.option({ value: "referee", class: "bg-surface-800 text-text-primary" }, ($$renderer4) => {
$$renderer4.push(`Referee`);
});
$$renderer3.option({ value: "admin", class: "bg-surface-800 text-text-primary" }, ($$renderer4) => {
$$renderer4.push(`Admin`);
});
}
);
$$renderer2.push(`</form></div>`);
}
$$renderer2.push(`<!--]--></div></div>`);
});
}
export { _page as default };
//# sourceMappingURL=_page.svelte-6xWa24o9.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,136 @@
import { a6 as escape_html, a8 as ensure_array_like, a9 as attr, aa as attr_class, ab as stringify, 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 expandedTeam = null;
let addingMemberTo = null;
let memberUsername = "";
const myTeams = derived(() => data.teams.filter((t) => t.members.some((m) => m.userId === data.userId)));
const otherTeams = derived(() => data.teams.filter((t) => !t.members.some((m) => m.userId === data.userId)));
function isOwner(t) {
return t.ownerId === data.userId;
}
$$renderer2.push(`<div class="mx-auto max-w-4xl"><div class="flex items-center justify-between"><div><h1 class="text-2xl font-700 tracking-tight">Teams</h1> <p class="mt-1 text-sm text-text-secondary">${escape_html(data.teams.length)} team${escape_html(data.teams.length !== 1 ? "s" : "")}</p></div> <button class="rounded-md bg-accent px-4 py-2 text-sm font-600 text-surface-900 transition-colors hover:bg-accent-hover">${escape_html("New Team")}</button></div> `);
{
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> `);
{
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> `);
if (myTeams().length > 0) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="mt-6"><h2 class="text-sm font-600 text-text-secondary">My Teams</h2> <div class="mt-3 flex flex-col gap-3"><!--[-->`);
const each_array = ensure_array_like(myTeams());
for (let $$index_1 = 0, $$length = each_array.length; $$index_1 < $$length; $$index_1++) {
let t = each_array[$$index_1];
$$renderer2.push(`<div class="rounded-lg border border-border bg-surface-800 transition-colors"><button class="flex w-full items-center gap-4 p-4 text-left transition-colors hover:bg-surface-700">`);
if (t.avatarUrl) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<img${attr("src", t.avatarUrl)} alt="" class="h-10 w-10 rounded-full"/>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<div class="flex h-10 w-10 items-center justify-center rounded-full bg-surface-600 text-sm font-700 text-text-secondary">${escape_html(t.name.charAt(0).toUpperCase())}</div>`);
}
$$renderer2.push(`<!--]--> <div class="flex-1"><div class="flex items-center gap-2"><span class="text-sm font-600">${escape_html(t.name)}</span> `);
if (t.isPersonal) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<span class="rounded bg-surface-600 px-1.5 py-0.5 text-[10px] font-500 text-text-secondary">solo</span>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div> <p class="mt-0.5 text-xs text-text-secondary">${escape_html(t.members.length)} member${escape_html(t.members.length !== 1 ? "s" : "")}</p></div> <span${attr_class(`text-sm text-text-secondary transition-transform ${stringify(expandedTeam === t.id ? "rotate-90" : "")}`)}>›</span></button> `);
if (expandedTeam === t.id) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="border-t border-border px-4 pb-4 pt-3"><div class="flex flex-col gap-2"><!--[-->`);
const each_array_1 = ensure_array_like(t.members);
for (let $$index = 0, $$length2 = each_array_1.length; $$index < $$length2; $$index++) {
let member = each_array_1[$$index];
$$renderer2.push(`<div class="flex items-center gap-3 rounded-md bg-surface-700 px-3 py-2">`);
if (member.user?.image) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<img${attr("src", member.user.image)} alt="" class="h-6 w-6 rounded-full"/>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<div class="h-6 w-6 rounded-full bg-surface-600"></div>`);
}
$$renderer2.push(`<!--]--> <span class="flex-1 text-sm">${escape_html(member.user?.name ?? "Unknown")}</span> <span class="text-xs text-text-secondary">${escape_html(member.role)}</span> `);
if (isOwner(t) && member.userId !== data.userId) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<form method="post" action="?/removeMember"><input type="hidden" name="memberId"${attr("value", member.id)}/> <button type="submit" class="text-xs text-red-400 opacity-50 transition-opacity hover:opacity-100">×</button></form>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div>`);
}
$$renderer2.push(`<!--]--></div> `);
if (isOwner(t) && !t.isPersonal) {
$$renderer2.push("<!--[-->");
if (addingMemberTo === t.id) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<form method="post" action="?/addMember" class="mt-3 flex gap-2"><input type="hidden" name="teamId"${attr("value", t.id)}/> <input type="text" name="username"${attr("value", memberUsername)} placeholder="osu! username" required="" class="flex-1 rounded-md border border-border bg-surface-600 px-3 py-1.5 text-sm text-text-primary placeholder:text-text-secondary/50 focus:border-accent focus:outline-none"/> <button type="submit" class="rounded-md bg-accent px-3 py-1.5 text-xs font-600 text-surface-900 hover:bg-accent-hover">Add</button> <button type="button" class="rounded-md border border-border px-3 py-1.5 text-xs text-text-secondary hover:bg-surface-600">Cancel</button></form>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<button class="mt-3 w-full rounded-md border border-dashed border-border py-2 text-xs text-text-secondary transition-colors hover:border-accent/40 hover:text-accent">+ Add Member</button>`);
}
$$renderer2.push(`<!--]-->`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> `);
if (isOwner(t) && !t.isPersonal) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<form method="post" action="?/deleteTeam"><input type="hidden" name="teamId"${attr("value", t.id)}/> <button type="submit" class="mt-3 text-xs text-red-400 opacity-50 transition-opacity hover:opacity-100">Delete team</button></form>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div>`);
}
$$renderer2.push(`<!--]--></div></div>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> `);
if (otherTeams().length > 0) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="mt-6"><h2 class="text-sm font-600 text-text-secondary">Other Teams</h2> <div class="mt-3 flex flex-col gap-2"><!--[-->`);
const each_array_2 = ensure_array_like(otherTeams());
for (let $$index_2 = 0, $$length = each_array_2.length; $$index_2 < $$length; $$index_2++) {
let t = each_array_2[$$index_2];
$$renderer2.push(`<div class="flex items-center gap-4 rounded-lg border border-border bg-surface-800 p-3">`);
if (t.avatarUrl) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<img${attr("src", t.avatarUrl)} alt="" class="h-8 w-8 rounded-full"/>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<div class="flex h-8 w-8 items-center justify-center rounded-full bg-surface-600 text-xs font-700 text-text-secondary">${escape_html(t.name.charAt(0).toUpperCase())}</div>`);
}
$$renderer2.push(`<!--]--> <div class="flex-1"><span class="text-sm font-600">${escape_html(t.name)}</span> <p class="text-xs text-text-secondary">${escape_html(t.members.length)} member${escape_html(t.members.length !== 1 ? "s" : "")}</p></div></div>`);
}
$$renderer2.push(`<!--]--></div></div>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> `);
if (data.teams.length === 0) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="mt-6 rounded-lg border border-dashed border-border py-12 text-center"><p class="text-sm text-text-secondary">No teams yet. Your personal team is created when you sign in.</p></div>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div>`);
});
}
export { _page as default };
//# sourceMappingURL=_page.svelte-B33-skqO.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,96 @@
import { a6 as escape_html, a8 as ensure_array_like, a9 as attr, aa as attr_class, a1 as derived, ab as stringify } 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;
const categories = ["NM", "HD", "HR", "DT", "FM", "TB"];
let addingCategory = "NM";
let beatmapInput = "";
const grouped = derived(() => () => {
const groups = {};
for (const cat of categories) {
const slots = data.pool.slots.filter((s) => s.category === cat);
if (slots.length > 0) groups[cat] = slots;
}
return groups;
});
function formatLength(seconds) {
const m = Math.floor(seconds / 60);
const s = seconds % 60;
return `${m}:${s.toString().padStart(2, "0")}`;
}
const categoryColors = {
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"
};
$$renderer2.push(`<div class="mx-auto max-w-4xl"><div class="flex items-center justify-between"><div class="flex items-center gap-3"><a href="/mappools" class="text-text-secondary transition-colors hover:text-text-primary">←</a> <div><h1 class="text-2xl font-700 tracking-tight">${escape_html(data.pool.name)}</h1> <p class="mt-1 text-sm text-text-secondary">${escape_html(data.pool.slots.length)} map${escape_html(data.pool.slots.length !== 1 ? "s" : "")}</p></div></div> <form method="post" action="?/deletePool"><button type="submit" class="rounded-md border border-red-500/30 px-3 py-1.5 text-sm text-red-400 transition-colors hover:bg-red-500/10">Delete Pool</button></form></div> <form method="post" action="?/addSlot" class="mt-6 rounded-lg border border-border bg-surface-800 p-4"><h2 class="text-sm font-600">Add Map</h2> <div class="mt-3 flex gap-3">`);
$$renderer2.select(
{
name: "category",
value: addingCategory,
class: "rounded-md border border-border bg-surface-700 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none"
},
($$renderer3) => {
$$renderer3.push(`<!--[-->`);
const each_array = ensure_array_like(categories);
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
let cat = each_array[$$index];
$$renderer3.option({ value: cat }, ($$renderer4) => {
$$renderer4.push(`${escape_html(cat)}`);
});
}
$$renderer3.push(`<!--]-->`);
}
);
$$renderer2.push(` <input type="text" name="beatmapId"${attr("value", beatmapInput)} placeholder="Beatmap ID or URL (e.g. 75 or https://osu.ppy.sh/beatmaps/75)" class="flex-1 rounded-md border border-border bg-surface-700 px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary/50 focus:border-accent focus:outline-none"/> <button type="submit"${attr("disabled", !beatmapInput.trim(), true)} class="rounded-md bg-accent px-4 py-2 text-sm font-600 text-surface-900 transition-colors hover:bg-accent-hover disabled:opacity-50">${escape_html("Add")}</button></div> `);
{
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></form> <div class="mt-6 flex flex-col gap-6">`);
const each_array_1 = ensure_array_like(Object.entries(grouped()()));
if (each_array_1.length !== 0) {
$$renderer2.push("<!--[-->");
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(`<div><div class="mb-2 flex items-center gap-2"><span${attr_class(`rounded border px-2 py-0.5 text-xs font-600 ${stringify(categoryColors[category] ?? "bg-surface-600 text-text-secondary border-border")}`)}>${escape_html(category)}</span> <span class="text-xs text-text-secondary">${escape_html(slots.length)} map${escape_html(slots.length !== 1 ? "s" : "")}</span></div> <div class="flex flex-col gap-2"><!--[-->`);
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];
$$renderer2.push(`<div class="group flex items-center gap-3 rounded-lg border border-border bg-surface-800 p-2 transition-colors hover:border-accent/30">`);
if (slot.beatmap?.coverUrl) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<img${attr("src", slot.beatmap.coverUrl)} alt="" class="h-12 w-24 rounded object-cover"/>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<div class="flex h-12 w-24 items-center justify-center rounded bg-surface-700 text-xs text-text-secondary">No cover</div>`);
}
$$renderer2.push(`<!--]--> <div class="min-w-0 flex-1">`);
if (slot.beatmap) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<a${attr("href", slot.beatmap.url)} target="_blank" rel="noopener" class="truncate text-sm font-500 hover:text-accent">${escape_html(slot.beatmap.artist)} - ${escape_html(slot.beatmap.title)}</a> <div class="mt-0.5 flex items-center gap-3 text-xs text-text-secondary"><span>[${escape_html(slot.beatmap.version)}]</span> <span>★ ${escape_html(slot.beatmap.starRating.toFixed(2))}</span> <span>${escape_html(slot.beatmap.bpm)} BPM</span> <span>${escape_html(formatLength(slot.beatmap.totalLength))}</span></div>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<p class="text-sm text-text-secondary">Beatmap #${escape_html(slot.beatmapId)}</p>`);
}
$$renderer2.push(`<!--]--></div> <span class="text-xs font-600 text-text-secondary">${escape_html(category)}${escape_html(i + 1)}</span> <form method="post" action="?/removeSlot"><input type="hidden" name="slotId"${attr("value", slot.id)}/> <button type="submit" class="rounded p-1 text-text-secondary opacity-0 transition-all hover:bg-red-500/10 hover:text-red-400 group-hover:opacity-100">✕</button></form></div>`);
}
$$renderer2.push(`<!--]--></div></div>`);
}
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<div class="rounded-lg border border-dashed border-border py-12 text-center"><p class="text-sm text-text-secondary">No maps yet. Add your first map above.</p></div>`);
}
$$renderer2.push(`<!--]--></div></div>`);
});
}
export { _page as default };
//# sourceMappingURL=_page.svelte-Be6BiSzg.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,162 @@
import { a6 as escape_html, a8 as ensure_array_like, a9 as attr, ab as stringify, aa as attr_class, 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;
const stateConfig = {
CREATED: { label: "Created", color: "text-text-secondary border-border" },
LOBBY: {
label: "In Lobby",
color: "text-yellow-400 border-yellow-500/30"
},
ROLLING: {
label: "Rolling",
color: "text-yellow-400 border-yellow-500/30",
dot: "bg-yellow-400"
},
PICKING: {
label: "Picking",
color: "text-blue-400 border-blue-500/30",
dot: "bg-blue-400"
},
PLAYING: {
label: "Live",
color: "text-green-400 border-green-500/30",
dot: "bg-green-400"
},
FINISHED: {
label: "Finished",
color: "text-text-secondary border-border"
},
CANCELLED: { label: "Cancelled", color: "text-red-400 border-red-500/30" }
};
const liveStates = ["LOBBY", "ROLLING", "PICKING", "PLAYING"];
const liveMatches = derived(() => data.matches.filter((m) => liveStates.includes(m.state)));
const recentMatches = derived(() => data.matches.filter((m) => !liveStates.includes(m.state)));
function teamDisplay(m) {
const p1 = m.participants[0];
const p2 = m.participants[1];
return { p1, p2 };
}
function timeAgo(date) {
const d = new Date(date);
const diff = Date.now() - d.getTime();
const mins = Math.floor(diff / 6e4);
if (mins < 1) return "just now";
if (mins < 60) return `${mins}m ago`;
const hours = Math.floor(mins / 60);
if (hours < 24) return `${hours}h ago`;
const days = Math.floor(hours / 24);
return `${days}d ago`;
}
$$renderer2.push(`<div class="mx-auto max-w-5xl"><div class="flex items-center justify-between"><div><h1 class="text-2xl font-700 tracking-tight">Matches</h1> <p class="mt-1 text-sm text-text-secondary">${escape_html(data.matches.length)} match${escape_html(data.matches.length !== 1 ? "es" : "")} `);
if (liveMatches().length > 0) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`· <span class="text-green-400">${escape_html(liveMatches().length)} live</span>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></p></div> <button class="rounded-md bg-accent px-4 py-2 text-sm font-600 text-surface-900 transition-colors hover:bg-accent-hover">${escape_html("New Match")}</button></div> `);
{
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> `);
if (liveMatches().length > 0) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="mt-6"><h2 class="flex items-center gap-2 text-sm font-600"><div class="relative h-2 w-2"><div class="absolute inset-0 animate-ping rounded-full bg-green-400 opacity-75"></div> <div class="relative h-2 w-2 rounded-full bg-green-400"></div></div> Live Now</h2> <div class="mt-3 flex flex-col gap-2"><!--[-->`);
const each_array_4 = ensure_array_like(liveMatches());
for (let $$index_4 = 0, $$length = each_array_4.length; $$index_4 < $$length; $$index_4++) {
let m = each_array_4[$$index_4];
const { p1, p2 } = teamDisplay(m);
const sc = stateConfig[m.state];
$$renderer2.push(`<a${attr("href", `/matches/${stringify(m.id)}`)} class="group flex items-center gap-4 rounded-lg border border-green-500/20 bg-surface-800 p-4 transition-all hover:border-green-500/40 hover:bg-surface-700"><div class="flex flex-1 items-center gap-3">`);
if (p1?.team.avatarUrl) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<img${attr("src", p1.team.avatarUrl)} alt="" class="h-8 w-8 rounded-full"/>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> <span class="text-sm font-600">${escape_html(p1?.team.name ?? "?")}</span></div> <div class="flex items-center gap-3"><span class="text-xl font-800 tabular-nums">${escape_html(p1?.score ?? 0)}</span> <span class="text-xs font-600 text-text-secondary">vs</span> <span class="text-xl font-800 tabular-nums">${escape_html(p2?.score ?? 0)}</span></div> <div class="flex flex-1 items-center justify-end gap-3"><span class="text-sm font-600">${escape_html(p2?.team.name ?? "?")}</span> `);
if (p2?.team.avatarUrl) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<img${attr("src", p2.team.avatarUrl)} alt="" class="h-8 w-8 rounded-full"/>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div> <span${attr_class(`flex items-center gap-1.5 rounded border px-2 py-0.5 text-xs font-500 ${stringify(sc?.color ?? "border-border")}`)}>`);
if (sc?.dot) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<span${attr_class(`h-1.5 w-1.5 rounded-full ${stringify(sc.dot)}`)}></span>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> ${escape_html(sc?.label ?? m.state)}</span></a>`);
}
$$renderer2.push(`<!--]--></div></div>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> <div class="mt-6">`);
if (liveMatches().length > 0) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<h2 class="text-sm font-600 text-text-secondary">Past Matches</h2>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> <div class="mt-3 flex flex-col gap-2">`);
const each_array_5 = ensure_array_like(recentMatches());
if (each_array_5.length !== 0) {
$$renderer2.push("<!--[-->");
for (let $$index_5 = 0, $$length = each_array_5.length; $$index_5 < $$length; $$index_5++) {
let m = each_array_5[$$index_5];
const { p1, p2 } = teamDisplay(m);
const config = m.config;
const sc = stateConfig[m.state];
$$renderer2.push(`<a${attr("href", `/matches/${stringify(m.id)}`)} class="group flex items-center gap-4 rounded-lg border border-border bg-surface-800 p-3 transition-colors hover:border-accent/30 hover:bg-surface-700"><div class="min-w-0 flex-1"><div class="flex items-center gap-2"><span class="text-sm font-600">${escape_html(p1?.team.name ?? "?")}</span> `);
if (m.state === "FINISHED") {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<span${attr_class(`text-xs font-700 tabular-nums ${stringify((p1?.score ?? 0) > (p2?.score ?? 0) ? "text-green-400" : "text-text-secondary")}`)}>${escape_html(p1?.score ?? 0)}</span> <span class="text-xs text-text-secondary">-</span> <span${attr_class(`text-xs font-700 tabular-nums ${stringify((p2?.score ?? 0) > (p1?.score ?? 0) ? "text-green-400" : "text-text-secondary")}`)}>${escape_html(p2?.score ?? 0)}</span>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<span class="text-xs text-text-secondary">vs</span>`);
}
$$renderer2.push(`<!--]--> <span class="text-sm font-600">${escape_html(p2?.team.name ?? "?")}</span></div> <p class="mt-0.5 text-xs text-text-secondary">${escape_html(m.name ? `${m.name} · ` : "")}BO${escape_html(config.bestOf)} `);
if (m.finishedAt) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`· ${escape_html(timeAgo(m.finishedAt))}`);
} else if (m.createdAt) {
$$renderer2.push("<!--[1-->");
$$renderer2.push(`· ${escape_html(timeAgo(m.createdAt))}`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></p></div> `);
if (m.state === "FINISHED" && m.winnerId) {
$$renderer2.push("<!--[-->");
const winner = m.participants.find((p) => p.teamId === m.winnerId);
$$renderer2.push(`<span class="text-xs font-500 text-green-400">🏆 ${escape_html(winner?.team.name)}</span>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> <span${attr_class(`rounded border px-2 py-0.5 text-xs font-500 ${stringify(sc?.color ?? "border-border")}`)}>${escape_html(sc?.label ?? m.state)}</span></a>`);
}
} else {
$$renderer2.push("<!--[!-->");
if (liveMatches().length === 0) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="rounded-lg border border-dashed border-border py-12 text-center"><p class="text-sm text-text-secondary">No matches yet. Create one to get started.</p></div>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]-->`);
}
$$renderer2.push(`<!--]--></div></div></div>`);
});
}
export { _page as default };
//# sourceMappingURL=_page.svelte-Bj4oURhW.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,119 @@
import { a6 as escape_html, a8 as ensure_array_like, a9 as attr, ab as stringify, aa as attr_class } from './index3-C4geC3K_.js';
function _page($$renderer, $$props) {
$$renderer.component(($$renderer2) => {
let { data } = $$props;
const stateConfig = {
CREATED: { label: "Created", color: "text-text-secondary" },
LOBBY: { label: "In Lobby", color: "text-yellow-400" },
ROLLING: {
label: "Rolling",
color: "text-yellow-400",
dot: "bg-yellow-400"
},
PICKING: { label: "Picking", color: "text-blue-400", dot: "bg-blue-400" },
PLAYING: { label: "Live", color: "text-green-400", dot: "bg-green-400" },
FINISHED: { label: "Finished", color: "text-text-secondary" },
CANCELLED: { label: "Cancelled", color: "text-red-400" }
};
let queueLoading = false;
function timeAgo(date) {
const d = new Date(date);
const diff = Date.now() - d.getTime();
const mins = Math.floor(diff / 6e4);
if (mins < 1) return "just now";
if (mins < 60) return `${mins}m ago`;
const hours = Math.floor(mins / 60);
if (hours < 24) return `${hours}h ago`;
const days = Math.floor(hours / 24);
return `${days}d ago`;
}
if (!data.user) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="flex min-h-[70vh] flex-col items-center justify-center text-center"><div class="font-800 mb-6 flex h-16 w-16 items-center justify-center rounded-xl bg-accent text-2xl text-surface-900">V</div> <h1 class="text-4xl font-800 tracking-tight">Welcome to <span class="text-accent">Vash Esports</span></h1> <p class="mt-3 max-w-md text-text-secondary">Automated tournament match management for osu! — lobbies, mappools, picks, bans, and
ELO tracking all in one place.</p> <a href="/login" class="font-600 mt-8 rounded-lg bg-accent px-6 py-3 text-surface-900 transition-colors hover:bg-accent-hover">Sign in with osu!</a> <p class="mt-4 text-xs text-text-secondary">Uses your osu! account. No extra registration needed.</p></div>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<div class="mx-auto max-w-5xl"><div><h1 class="text-2xl font-700 tracking-tight">Welcome back, <span class="text-accent">${escape_html(data.user.name)}</span></h1> <p class="mt-1 text-sm text-text-secondary">Automated esports match management for osu!</p></div> <div class="mt-6 grid grid-cols-2 gap-3 sm:grid-cols-4"><div class="rounded-lg border border-border bg-surface-800 p-4"><p class="text-2xl font-800 tabular-nums text-text-primary">${escape_html(data.stats.matches)}</p> <p class="mt-1 text-xs text-text-secondary">Total Matches</p></div> <div class="rounded-lg border border-border bg-surface-800 p-4"><p class="text-2xl font-800 tabular-nums text-green-400">${escape_html(data.stats.finished)}</p> <p class="mt-1 text-xs text-text-secondary">Completed</p></div> <div class="rounded-lg border border-border bg-surface-800 p-4"><p class="text-2xl font-800 tabular-nums text-text-primary">${escape_html(data.stats.teams)}</p> <p class="mt-1 text-xs text-text-secondary">Teams</p></div> <div class="rounded-lg border border-border bg-surface-800 p-4"><p class="text-2xl font-800 tabular-nums text-text-primary">${escape_html(data.stats.mappools)}</p> <p class="mt-1 text-xs text-text-secondary">Mappools</p></div></div> `);
if (data.liveMatches.length > 0) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="mt-8"><div class="flex items-center gap-2"><div class="relative h-2 w-2"><div class="absolute inset-0 animate-ping rounded-full bg-green-400 opacity-75"></div> <div class="relative h-2 w-2 rounded-full bg-green-400"></div></div> <h2 class="text-sm font-600">Live Now</h2></div> <div class="mt-3 flex flex-col gap-2"><!--[-->`);
const each_array = ensure_array_like(data.liveMatches);
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
let m = each_array[$$index];
const p1 = m.participants[0];
const p2 = m.participants[1];
const sc = stateConfig[m.state];
$$renderer2.push(`<a${attr("href", `/matches/${stringify(m.id)}`)} class="flex items-center gap-4 rounded-lg border border-green-500/20 bg-surface-800 p-4 transition-all hover:border-green-500/40 hover:bg-surface-700"><div class="flex flex-1 items-center gap-3">`);
if (p1?.team.avatarUrl) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<img${attr("src", p1.team.avatarUrl)} alt="" class="h-8 w-8 rounded-full"/>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> <span class="text-sm font-600">${escape_html(p1?.team.name ?? "?")}</span></div> <div class="flex items-center gap-3"><span class="text-xl font-800 tabular-nums">${escape_html(p1?.score ?? 0)}</span> <span class="text-xs text-text-secondary">vs</span> <span class="text-xl font-800 tabular-nums">${escape_html(p2?.score ?? 0)}</span></div> <div class="flex flex-1 items-center justify-end gap-3"><span class="text-sm font-600">${escape_html(p2?.team.name ?? "?")}</span> `);
if (p2?.team.avatarUrl) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<img${attr("src", p2.team.avatarUrl)} alt="" class="h-8 w-8 rounded-full"/>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div> <span${attr_class(`flex items-center gap-1.5 text-xs font-500 ${stringify(sc?.color ?? "")}`)}>`);
if (sc?.dot) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<span${attr_class(`h-1.5 w-1.5 rounded-full ${stringify(sc.dot)}`)}></span>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> ${escape_html(sc?.label)}</span></a>`);
}
$$renderer2.push(`<!--]--></div></div>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> <div class="mt-6 rounded-lg border border-border bg-surface-800 p-5"><div class="flex items-center justify-between"><div><h2 class="text-sm font-600">Ranked Queue</h2> <p class="mt-0.5 text-xs text-text-secondary">Find a match at your skill level</p></div> `);
{
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<button${attr("disabled", queueLoading, true)} class="rounded-md bg-accent px-4 py-2 text-sm font-600 text-surface-900 transition-colors hover:bg-accent-hover disabled:opacity-50">${escape_html("Find Match")}</button>`);
}
$$renderer2.push(`<!--]--></div></div> <div class="mt-8 grid gap-4 lg:grid-cols-3"><div class="lg:col-span-1"><h2 class="text-sm font-600">Quick Actions</h2> <div class="mt-3 flex flex-col gap-2"><a href="/matches" class="flex items-center gap-3 rounded-lg border border-border bg-surface-800 p-3 transition-colors hover:border-accent/40 hover:bg-surface-700"><span class="flex h-8 w-8 items-center justify-center rounded-md bg-accent/10 text-accent">⚔</span> <div><p class="text-sm font-600">New Match</p> <p class="text-xs text-text-secondary">Start a 1v1</p></div></a> <a href="/mappools" class="flex items-center gap-3 rounded-lg border border-border bg-surface-800 p-3 transition-colors hover:border-accent/40 hover:bg-surface-700"><span class="flex h-8 w-8 items-center justify-center rounded-md bg-purple-500/10 text-purple-400">♫</span> <div><p class="text-sm font-600">Mappools</p> <p class="text-xs text-text-secondary">Build a pool</p></div></a> <a href="/teams" class="flex items-center gap-3 rounded-lg border border-border bg-surface-800 p-3 transition-colors hover:border-accent/40 hover:bg-surface-700"><span class="flex h-8 w-8 items-center justify-center rounded-md bg-blue-500/10 text-blue-400">⚑</span> <div><p class="text-sm font-600">Teams</p> <p class="text-xs text-text-secondary">Manage rosters</p></div></a></div></div> <div class="lg:col-span-2"><h2 class="text-sm font-600">Recent Matches</h2> <div class="mt-3 flex flex-col gap-2">`);
const each_array_1 = ensure_array_like(data.recentMatches);
if (each_array_1.length !== 0) {
$$renderer2.push("<!--[-->");
for (let $$index_1 = 0, $$length = each_array_1.length; $$index_1 < $$length; $$index_1++) {
let m = each_array_1[$$index_1];
const p1 = m.participants[0];
const p2 = m.participants[1];
const config = m.config;
const sc = stateConfig[m.state];
$$renderer2.push(`<a${attr("href", `/matches/${stringify(m.id)}`)} class="flex items-center gap-3 rounded-lg border border-border bg-surface-800 p-3 transition-colors hover:border-accent/30 hover:bg-surface-700"><div class="min-w-0 flex-1"><div class="flex items-center gap-2"><span class="text-sm font-600">${escape_html(p1?.team.name ?? "?")}</span> `);
if (m.state === "FINISHED") {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<span${attr_class(`text-xs font-700 tabular-nums ${stringify((p1?.score ?? 0) > (p2?.score ?? 0) ? "text-green-400" : "text-text-secondary")}`)}>${escape_html(p1?.score ?? 0)}</span> <span class="text-xs text-text-secondary">-</span> <span${attr_class(`text-xs font-700 tabular-nums ${stringify((p2?.score ?? 0) > (p1?.score ?? 0) ? "text-green-400" : "text-text-secondary")}`)}>${escape_html(p2?.score ?? 0)}</span>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<span class="text-xs text-text-secondary">vs</span>`);
}
$$renderer2.push(`<!--]--> <span class="text-sm font-600">${escape_html(p2?.team.name ?? "?")}</span></div> <p class="mt-0.5 text-xs text-text-secondary">${escape_html(m.name ? `${m.name} · ` : "")}BO${escape_html(config.bestOf)}
· ${escape_html(timeAgo(m.finishedAt ?? m.createdAt))}</p></div> `);
if (m.state === "FINISHED" && m.winnerId) {
$$renderer2.push("<!--[-->");
const winner = m.participants.find((p) => p.teamId === m.winnerId);
$$renderer2.push(`<span class="text-xs text-green-400">🏆 ${escape_html(winner?.team.name)}</span>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> <span${attr_class(`text-xs ${stringify(sc?.color ?? "text-text-secondary")}`)}>${escape_html(sc?.label)}</span></a>`);
}
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<div class="rounded-lg border border-dashed border-border py-8 text-center"><p class="text-sm text-text-secondary">No matches yet. <a href="/matches" class="text-accent hover:underline">Create one</a></p></div>`);
}
$$renderer2.push(`<!--]--></div></div></div></div>`);
}
$$renderer2.push(`<!--]-->`);
});
}
export { _page as default };
//# sourceMappingURL=_page.svelte-C-71W7Xe.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
import { a9 as attr } from './index3-C4geC3K_.js';
import { e as resolve_route, i as initial_base, b as base } from './routing-NqiTWnxU.js';
import { t as try_get_request_store } from './root-D12ma0No.js';
function resolve(id, params) {
const resolved = resolve_route(
id,
/** @type {Record<string, string>} */
params
);
{
const store = try_get_request_store();
if (store && !store.state.prerendering?.fallback) {
const after_base = store.event.url.pathname.slice(initial_base.length);
const segments = after_base.split("/").slice(2);
const prefix = segments.map(() => "..").join("/") || ".";
return prefix + resolved;
}
}
return base + resolved;
}
function _page($$renderer, $$props) {
$$renderer.component(($$renderer2) => {
$$renderer2.push(`<a${attr("href", resolve("/demo/better-auth"))}>better-auth</a>`);
});
}
export { _page as default };
//# sourceMappingURL=_page.svelte-C5eWfXqa.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_page.svelte-C5eWfXqa.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/demo/_page.svelte.js"],"sourcesContent":["import { b as attr } from \"../../../chunks/index3.js\";\nimport { i as initial_base, b as base } from \"../../../chunks/server.js\";\nimport { r as resolve_route } from \"../../../chunks/routing.js\";\nimport \"../../../chunks/url.js\";\nimport { try_get_request_store } from \"@sveltejs/kit/internal/server\";\nimport \"../../../chunks/root.js\";\nfunction resolve(id, params) {\n const resolved = resolve_route(\n id,\n /** @type {Record<string, string>} */\n params\n );\n {\n const store = try_get_request_store();\n if (store && !store.state.prerendering?.fallback) {\n const after_base = store.event.url.pathname.slice(initial_base.length);\n const segments = after_base.split(\"/\").slice(2);\n const prefix = segments.map(() => \"..\").join(\"/\") || \".\";\n return prefix + resolved;\n }\n }\n return base + resolved;\n}\nfunction _page($$renderer, $$props) {\n $$renderer.component(($$renderer2) => {\n $$renderer2.push(`<a${attr(\"href\", resolve(\"/demo/better-auth\"))}>better-auth</a>`);\n });\n}\nexport {\n _page as default\n};\n"],"names":[],"mappings":";;;;AAMA,SAAS,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE;AAC7B,EAAE,MAAM,QAAQ,GAAG,aAAa;AAChC,IAAI,EAAE;AACN;AACA,IAAI;AACJ,GAAG;AACH,EAAE;AACF,IAAI,MAAM,KAAK,GAAG,qBAAqB,EAAE;AACzC,IAAI,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,EAAE,QAAQ,EAAE;AACtD,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC;AAC5E,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AACrD,MAAM,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG;AAC9D,MAAM,OAAO,MAAM,GAAG,QAAQ;AAC9B,IAAI;AACJ,EAAE;AACF,EAAE,OAAO,IAAI,GAAG,QAAQ;AACxB;AACA,SAAS,KAAK,CAAC,UAAU,EAAE,OAAO,EAAE;AACpC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,WAAW,KAAK;AACxC,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;AACvF,EAAE,CAAC,CAAC;AACJ;;;;"}

View File

@@ -0,0 +1,15 @@
import { a6 as escape_html } 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;
$$renderer2.push(`<h1>Hi, ${escape_html(data.user.name)}!</h1> <p>Your user ID is ${escape_html(data.user.id)}.</p> <form method="post" action="?/signOut"><button class="rounded-md bg-blue-600 px-4 py-2 text-white transition hover:bg-blue-700">Sign out</button></form>`);
});
}
export { _page as default };
//# sourceMappingURL=_page.svelte-Ctzd-tuM.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_page.svelte-Ctzd-tuM.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/demo/better-auth/_page.svelte.js"],"sourcesContent":["import { e as escape_html } from \"../../../../chunks/index3.js\";\nimport \"clsx\";\nimport \"@sveltejs/kit/internal\";\nimport \"../../../../chunks/url.js\";\nimport \"../../../../chunks/utils.js\";\nimport \"@sveltejs/kit/internal/server\";\nimport \"../../../../chunks/root.js\";\nimport \"../../../../chunks/exports.js\";\nimport \"../../../../chunks/state.svelte.js\";\nfunction _page($$renderer, $$props) {\n $$renderer.component(($$renderer2) => {\n let { data } = $$props;\n $$renderer2.push(`<h1>Hi, ${escape_html(data.user.name)}!</h1> <p>Your user ID is ${escape_html(data.user.id)}.</p> <form method=\"post\" action=\"?/signOut\"><button class=\"rounded-md bg-blue-600 px-4 py-2 text-white transition hover:bg-blue-700\">Sign out</button></form>`);\n });\n}\nexport {\n _page as default\n};\n"],"names":[],"mappings":";;;;;;AASA,SAAS,KAAK,CAAC,UAAU,EAAE,OAAO,EAAE;AACpC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,WAAW,KAAK;AACxC,IAAI,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO;AAC1B,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,0BAA0B,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,8JAA8J,CAAC,CAAC;AAClR,EAAE,CAAC,CAAC;AACJ;;;;"}

View File

@@ -0,0 +1,46 @@
import { a9 as attr, a6 as escape_html, aa as attr_class, ab as stringify, 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;
const roleBadge = {
player: { label: "Player", color: "bg-surface-600 text-text-secondary" },
referee: { label: "Referee", color: "bg-yellow-500/20 text-yellow-400" },
admin: { label: "Admin", color: "bg-red-500/20 text-red-400" }
};
const badge = derived(() => roleBadge[data.profile.role] ?? roleBadge.player);
const winRate = derived(() => data.rating.wins + data.rating.losses > 0 ? (data.rating.wins / (data.rating.wins + data.rating.losses) * 100).toFixed(1) : "—");
$$renderer2.push(`<div class="mx-auto max-w-2xl"><h1 class="text-2xl font-700 tracking-tight">Settings</h1> <p class="mt-1 text-sm text-text-secondary">Your profile and account settings</p> <div class="mt-6 rounded-lg border border-border bg-surface-800 p-6"><div class="flex items-center gap-4">`);
if (data.profile.image) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<img${attr("src", data.profile.image)}${attr("alt", data.profile.name)} class="h-16 w-16 rounded-full"/>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<div class="flex h-16 w-16 items-center justify-center rounded-full bg-surface-600 text-xl font-700 text-text-secondary">${escape_html(data.profile.name.charAt(0).toUpperCase())}</div>`);
}
$$renderer2.push(`<!--]--> <div class="flex-1"><div class="flex items-center gap-2"><h2 class="text-lg font-700">${escape_html(data.profile.name)}</h2> <span${attr_class(`rounded px-2 py-0.5 text-xs font-600 ${stringify(badge().color)}`)}>${escape_html(badge().label)}</span></div> <p class="mt-0.5 text-sm text-text-secondary">${escape_html(data.profile.email)}</p></div></div> <div class="mt-6 border-t border-border pt-4"><h3 class="text-xs font-600 text-text-secondary uppercase tracking-wider">Connected Accounts</h3> <div class="mt-3 flex items-center gap-3 rounded-md bg-surface-700 px-4 py-3"><span class="text-lg">🎮</span> <div class="flex-1"><p class="text-sm font-500">osu!</p> <p class="text-xs text-text-secondary">`);
if (data.hasOsuLinked) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`Connected as ${escape_html(data.profile.name)}`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`Not connected`);
}
$$renderer2.push(`<!--]--></p></div> `);
if (data.hasOsuLinked) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<span class="rounded bg-green-500/20 px-2 py-0.5 text-xs font-500 text-green-400">Linked</span>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<a href="/api/auth/osu/login" class="rounded bg-accent px-3 py-1 text-xs font-600 text-surface-900 hover:bg-accent-hover">Connect</a>`);
}
$$renderer2.push(`<!--]--></div></div></div> <div class="mt-4 rounded-lg border border-border bg-surface-800 p-6"><h3 class="text-xs font-600 text-text-secondary uppercase tracking-wider">Ranked Stats</h3> <div class="mt-4 grid grid-cols-4 gap-4"><div><p class="text-2xl font-800 tabular-nums text-accent">${escape_html(data.rating.elo)}</p> <p class="mt-1 text-xs text-text-secondary">ELO Rating</p></div> <div><p class="text-2xl font-800 tabular-nums text-green-400">${escape_html(data.rating.wins)}</p> <p class="mt-1 text-xs text-text-secondary">Wins</p></div> <div><p class="text-2xl font-800 tabular-nums text-red-400">${escape_html(data.rating.losses)}</p> <p class="mt-1 text-xs text-text-secondary">Losses</p></div> <div><p class="text-2xl font-800 tabular-nums text-text-primary">${escape_html(winRate())}${escape_html(winRate() !== "—" ? "%" : "")}</p> <p class="mt-1 text-xs text-text-secondary">Win Rate</p></div></div></div> <div class="mt-4 rounded-lg border border-border bg-surface-800 p-6"><h3 class="text-xs font-600 text-red-400 uppercase tracking-wider">Account</h3> <div class="mt-4"><form method="post" action="?/logout"><button type="submit" class="rounded-md border border-red-500/30 px-4 py-2 text-sm font-500 text-red-400 transition-colors hover:bg-red-500/10">Sign Out</button></form></div></div></div>`);
});
}
export { _page as default };
//# sourceMappingURL=_page.svelte-D23V0tpa.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,321 @@
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(`<div class="mx-auto max-w-5xl"><div class="flex items-center gap-3"><a href="/matches" class="text-text-secondary transition-colors hover:text-text-primary">←</a> <div class="flex-1"><h1 class="text-xl font-700 tracking-tight">${escape_html(m().name || "Match")}</h1> <p class="mt-0.5 text-xs text-text-secondary">Best of ${escape_html(config().bestOf)} · First to ${escape_html(winsNeeded())} `);
if (m().osuLobbyId) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`· <a${attr("href", `https://osu.ppy.sh/mp/${stringify(m().osuLobbyId)}`)} target="_blank" class="text-accent hover:underline">osu! mp/${escape_html(m().osuLobbyId)}</a>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></p></div> <span${attr_class(`rounded border px-2.5 py-1 text-xs font-600 ${stringify(stateBorder(m().state))}`)}>${escape_html(stateLabel(m().state))}</span> `);
if (!["FINISHED", "CANCELLED"].includes(m().state)) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<form method="post" action="?/cancel"><button type="submit" class="rounded-md border border-red-500/30 px-3 py-1.5 text-xs text-red-400 hover:bg-red-500/10">Cancel</button></form>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div> `);
if (p1() && p2()) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="mt-6 flex items-center gap-4"><div${attr_class(`flex flex-1 items-center gap-4 rounded-lg border p-4 ${stringify(m().winnerId === p1().teamId ? "border-green-500/40 bg-green-500/5" : "border-border bg-surface-800")}`)}>`);
if (p1().team.avatarUrl) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<img${attr("src", p1().team.avatarUrl)} alt="" class="h-10 w-10 rounded-full"/>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> <div class="flex-1"><p class="text-sm font-600">${escape_html(p1().team.name)}</p> `);
if (p1().rollValue != null) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<p class="text-xs text-text-secondary">Roll: ${escape_html(p1().rollValue)}${escape_html(p1().pickOrder === 1 ? " ★" : "")}</p>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div> <span${attr_class(`text-3xl font-800 tabular-nums ${stringify(p1().score >= winsNeeded() ? "text-green-400" : "text-text-primary")}`)}>${escape_html(p1().score)}</span></div> <span class="text-lg font-700 text-text-secondary">vs</span> <div${attr_class(`flex flex-1 items-center gap-4 rounded-lg border p-4 ${stringify(m().winnerId === p2().teamId ? "border-green-500/40 bg-green-500/5" : "border-border bg-surface-800")}`)}><span${attr_class(`text-3xl font-800 tabular-nums ${stringify(p2().score >= winsNeeded() ? "text-green-400" : "text-text-primary")}`)}>${escape_html(p2().score)}</span> <div class="flex-1 text-right"><p class="text-sm font-600">${escape_html(p2().team.name)}</p> `);
if (p2().rollValue != null) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<p class="text-xs text-text-secondary">${escape_html(p2().pickOrder === 1 ? "★ " : "")}Roll: ${escape_html(p2().rollValue)}</p>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div> `);
if (p2().team.avatarUrl) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<img${attr("src", p2().team.avatarUrl)} alt="" class="h-10 w-10 rounded-full"/>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div></div>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> `);
if (["LOBBY", "ROLLING", "PICKING", "PLAYING"].includes(m().state)) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="mt-3 flex justify-center"><form method="post" action="?/reinvite"><button type="submit" class="rounded-md border border-border px-3 py-1.5 text-xs text-text-secondary transition-colors hover:border-accent/40 hover:text-accent">📨 Re-invite players to lobby</button></form></div>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> `);
if (m().state === "ROLLING") {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-sm"><div class="w-full max-w-md rounded-xl border border-yellow-500/30 bg-surface-800 p-8 text-center shadow-2xl"><h2 class="text-lg font-700">🎲 Roll Phase</h2> <p class="mt-2 text-sm text-text-secondary">Highest roll picks first</p> <div class="mt-6 flex justify-center gap-6"><!--[-->`);
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(`<div class="rounded-lg border border-border bg-surface-700 px-6 py-4"><p class="text-xs text-text-secondary">${escape_html(p.team.name)}</p> `);
if (p.rollValue != null) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<p class="mt-1 text-2xl font-800 text-yellow-400">${escape_html(p.rollValue)}</p>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<p class="mt-1 text-2xl font-800 text-text-secondary/30">—</p>`);
}
$$renderer2.push(`<!--]--></div>`);
}
$$renderer2.push(`<!--]--></div> `);
if (canRoll()) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<form method="post" action="?/roll"><button type="submit"${attr("disabled", rolling, true)} class="mt-6 rounded-md bg-accent px-8 py-3 text-sm font-600 text-surface-900 transition-colors hover:bg-accent-hover disabled:opacity-50">${escape_html("🎲 Roll!")}</button></form> <p class="mt-3 text-xs text-text-secondary">or type <code class="rounded bg-surface-700 px-1.5 py-0.5 font-mono text-accent">!roll</code> in osu! chat</p>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<p class="mt-6 text-sm text-text-secondary animate-pulse">Waiting for all rolls...</p>`);
}
$$renderer2.push(`<!--]--></div></div>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> `);
if (m().state === "PICKING") {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-sm"><div class="w-full max-w-3xl max-h-[80vh] overflow-y-auto rounded-xl border border-blue-500/30 bg-surface-800 p-6 shadow-2xl"><div class="text-center"><h2 class="text-lg font-700">🎯 Pick a Map</h2> <p class="mt-1 text-sm"><span class="font-600 text-accent">${escape_html(expectedPicker()?.team.name)}</span>'s turn to pick</p> <p class="mt-1 text-xs text-text-secondary">or type <code class="rounded bg-surface-700 px-1.5 py-0.5 font-mono text-accent">!pick NM1</code> in osu! chat</p></div> `);
{
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> <div class="mt-6 flex flex-col gap-4"><!--[-->`);
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(`<div><span${attr_class(`mb-2 inline-block rounded border px-2 py-0.5 text-xs font-600 ${stringify(catColors[category] ?? "border-border")}`)}>${escape_html(category)}</span> <div class="grid grid-cols-1 gap-2 sm:grid-cols-2"><!--[-->`);
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(`<form method="post" action="?/pick"><input type="hidden" name="slotId"${attr("value", slot.id)}/> <button type="submit"${attr("disabled", isPlayed || picking, true)}${attr_class(`flex w-full items-center gap-3 rounded-lg border p-2 text-left transition-all ${stringify(isPlayed ? "border-border/50 bg-surface-900 opacity-30 cursor-not-allowed" : "border-border bg-surface-700 hover:border-accent hover:bg-surface-600 cursor-pointer")}`)}>`);
if (bm?.listCoverUrl) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<img${attr("src", bm.listCoverUrl)} alt="" class="h-10 w-20 rounded object-cover"/>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<div class="flex h-10 w-20 items-center justify-center rounded bg-surface-600 text-xs text-text-secondary">?</div>`);
}
$$renderer2.push(`<!--]--> <div class="min-w-0 flex-1">`);
if (bm) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<p class="truncate text-xs font-500">${escape_html(bm.artist)} - ${escape_html(bm.title)}</p> <p class="text-xs text-text-secondary">[${escape_html(bm.version)}] · ★${escape_html(bm.starRating.toFixed(1))} · ${escape_html(bm.bpm)}bpm</p>`);
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<p class="text-xs text-text-secondary">#${escape_html(slot.beatmapId)}</p>`);
}
$$renderer2.push(`<!--]--></div> <span class="text-xs font-600 text-text-secondary">${escape_html(category)}${escape_html(slot.orderInCategory)}</span> `);
if (isPlayed) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<span class="text-xs text-text-secondary">✓</span>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></button></form>`);
}
$$renderer2.push(`<!--]--></div></div>`);
}
$$renderer2.push(`<!--]--></div></div></div>`);
} 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(`<div class="mt-6 rounded-lg border border-green-500/30 bg-green-500/5 p-5 text-center"><div class="flex items-center justify-center gap-2"><div class="relative h-3 w-3"><div class="absolute inset-0 animate-ping rounded-full bg-green-400 opacity-75"></div> <div class="relative h-3 w-3 rounded-full bg-green-400"></div></div> <span class="text-sm font-600 text-green-400">Now Playing</span></div> `);
if (bm) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<p class="mt-2 text-sm">${escape_html(bm.artist)} - ${escape_html(bm.title)} <span class="text-text-secondary">[${escape_html(bm.version)}]</span></p> <p class="mt-1 text-xs text-text-secondary">★${escape_html(bm.starRating.toFixed(1))} · ${escape_html(bm.bpm)}bpm · ${escape_html(formatLength(bm.totalLength))}</p>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> <p class="mt-3 text-xs text-text-secondary animate-pulse">Waiting for players to ready up &amp; play in osu!...</p> <form method="post" action="?/forceStart"><button type="submit"${attr("disabled", forceStarting, true)} class="mt-4 rounded-md border border-yellow-500/30 px-4 py-2 text-xs font-600 text-yellow-400 transition-colors hover:bg-yellow-500/10 disabled:opacity-50">${escape_html("Force Start (skip ready)")}</button></form></div>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> `);
if (m().state === "FINISHED") {
$$renderer2.push("<!--[-->");
const winner = m().participants.find((p) => p.teamId === m().winnerId);
$$renderer2.push(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-sm"><div class="w-full max-w-md rounded-xl border border-accent/30 bg-surface-800 p-8 text-center shadow-2xl"><div class="text-4xl">🏆</div> <h2 class="mt-4 text-2xl font-800"><span class="text-accent">${escape_html(winner?.team.name)}</span> wins!</h2> <p class="mt-2 text-lg font-700 tabular-nums text-text-secondary">${escape_html(p1()?.score)} – ${escape_html(p2()?.score)}</p> <div class="mt-6 flex flex-col gap-1"><!--[-->`);
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(`<div class="flex items-center gap-2 rounded bg-surface-700 px-3 py-1.5 text-xs"><span${attr_class(`font-600 ${stringify(catColors[game.slot?.category]?.split(" ")[1] ?? "text-text-secondary")}`)}>${escape_html(game.slot?.category)}${escape_html(game.slot?.orderInCategory)}</span> <span class="flex-1 truncate text-text-secondary">${escape_html(bm ? `${bm.artist} - ${bm.title}` : `#${game.slot?.beatmapId}`)}</span> <span${attr_class(`font-600 ${stringify(winnerP?.id === p1()?.id ? "text-blue-400" : "text-red-400")}`)}>${escape_html(winnerP?.team.name)}</span></div>`);
}
$$renderer2.push(`<!--]--></div> <a href="/" class="mt-6 inline-block rounded-md bg-accent px-6 py-2.5 text-sm font-600 text-surface-900 transition-colors hover:bg-accent-hover">Back to Dashboard</a></div></div>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> `);
if (m().games.length > 0) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="mt-6"><h2 class="text-sm font-600">Games Played</h2> <div class="mt-3 flex flex-col gap-2"><!--[-->`);
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(`<div class="flex items-center gap-3 rounded-lg border border-border bg-surface-800 p-3"><span class="w-6 text-center text-xs font-600 text-text-secondary">${escape_html(game.gameNumber)}</span> `);
if (bm?.listCoverUrl) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<img${attr("src", bm.listCoverUrl)} alt="" class="h-8 w-16 rounded object-cover"/>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> <div class="min-w-0 flex-1">`);
if (bm) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<p class="truncate text-sm font-500">${escape_html(bm.artist)} - ${escape_html(bm.title)} <span class="text-text-secondary">[${escape_html(bm.version)}]</span></p>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> <div class="flex items-center gap-2 text-xs text-text-secondary"><span${attr_class(`rounded border px-1.5 py-0.5 ${stringify(catColors[game.slot?.category] ?? "border-border")}`)}>${escape_html(game.slot?.category)}${escape_html(game.slot?.orderInCategory)}</span> `);
if (pickerTeam) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<span>Picked by ${escape_html(pickerTeam.name)}</span>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div></div> `);
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(`<div class="flex items-center gap-2 font-mono text-sm tabular-nums"><span${attr_class(p1Score > p2Score ? "font-700 text-green-400" : "text-text-secondary")}>${escape_html(p1Score.toLocaleString())}</span> <span class="text-text-secondary">-</span> <span${attr_class(p2Score > p1Score ? "font-700 text-green-400" : "text-text-secondary")}>${escape_html(p2Score.toLocaleString())}</span></div>`);
} else if (game.state === "PLAYING") {
$$renderer2.push("<!--[1-->");
$$renderer2.push(`<span class="text-xs text-green-400 animate-pulse">Live</span>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> `);
if (winnerTeam) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<span class="text-xs text-green-400">✓ ${escape_html(winnerTeam.name)}</span>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div>`);
}
$$renderer2.push(`<!--]--></div></div>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> `);
if (m().state === "CREATED") {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="mt-6 rounded-lg border border-border bg-surface-800 p-6 text-center"><p class="text-sm text-text-secondary animate-pulse">Creating osu! lobby...</p></div>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> `);
if (m().state === "LOBBY") {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="mt-6 rounded-lg border border-yellow-500/30 bg-yellow-500/5 p-6 text-center"><p class="text-sm text-text-secondary">Lobby created. Waiting for players to join...</p> `);
if (m().osuLobbyId) {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<p class="mt-2 text-xs text-text-secondary"><a${attr("href", `https://osu.ppy.sh/mp/${stringify(m().osuLobbyId)}`)} target="_blank" class="text-accent hover:underline">osu! mp/${escape_html(m().osuLobbyId)}</a></p>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> `);
if (m().state === "CANCELLED") {
$$renderer2.push("<!--[-->");
$$renderer2.push(`<div class="mt-6 rounded-lg border border-red-500/30 bg-red-500/5 p-6 text-center"><p class="text-sm text-red-400">This match was cancelled.</p></div>`);
} else {
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--></div>`);
});
}
export { _page as default };
//# sourceMappingURL=_page.svelte-G6sWOX7O.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,15 @@
import { a6 as escape_html } 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 { form } = $$props;
$$renderer2.push(`<h1>Login</h1> <form method="post" action="?/signInEmail"><label>Email <input type="email" name="email" class="mt-1 rounded-md border border-gray-300 bg-white px-3 py-2 shadow-sm focus:border-blue-500 focus:ring-2 focus:ring-blue-500 focus:outline-none"/></label> <label>Password <input type="password" name="password" class="mt-1 rounded-md border border-gray-300 bg-white px-3 py-2 shadow-sm focus:border-blue-500 focus:ring-2 focus:ring-blue-500 focus:outline-none"/></label> <label>Name (for registration) <input name="name" class="mt-1 rounded-md border border-gray-300 bg-white px-3 py-2 shadow-sm focus:border-blue-500 focus:ring-2 focus:ring-blue-500 focus:outline-none"/></label> <button class="rounded-md bg-blue-600 px-4 py-2 text-white transition hover:bg-blue-700">Login</button> <button formaction="?/signUpEmail" class="rounded-md bg-blue-600 px-4 py-2 text-white transition hover:bg-blue-700">Register</button></form> <p class="text-red-500">${escape_html(form?.message ?? "")}</p> <hr class="my-4"/> <form method="post" action="?/signInSocial"><input type="hidden" name="provider" value="osu"/> <input type="hidden" name="callbackURL" value="/demo/better-auth"/> <button class="rounded-md bg-blue-600 px-4 py-2 text-white transition hover:bg-blue-700">Sign in with osu!</button></form>`);
});
}
export { _page as default };
//# sourceMappingURL=_page.svelte-ad4cZnqC.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_page.svelte-ad4cZnqC.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/demo/better-auth/login/_page.svelte.js"],"sourcesContent":["import { e as escape_html } from \"../../../../../chunks/index3.js\";\nimport \"clsx\";\nimport \"@sveltejs/kit/internal\";\nimport \"../../../../../chunks/url.js\";\nimport \"../../../../../chunks/utils.js\";\nimport \"@sveltejs/kit/internal/server\";\nimport \"../../../../../chunks/root.js\";\nimport \"../../../../../chunks/exports.js\";\nimport \"../../../../../chunks/state.svelte.js\";\nfunction _page($$renderer, $$props) {\n $$renderer.component(($$renderer2) => {\n let { form } = $$props;\n $$renderer2.push(`<h1>Login</h1> <form method=\"post\" action=\"?/signInEmail\"><label>Email <input type=\"email\" name=\"email\" class=\"mt-1 rounded-md border border-gray-300 bg-white px-3 py-2 shadow-sm focus:border-blue-500 focus:ring-2 focus:ring-blue-500 focus:outline-none\"/></label> <label>Password <input type=\"password\" name=\"password\" class=\"mt-1 rounded-md border border-gray-300 bg-white px-3 py-2 shadow-sm focus:border-blue-500 focus:ring-2 focus:ring-blue-500 focus:outline-none\"/></label> <label>Name (for registration) <input name=\"name\" class=\"mt-1 rounded-md border border-gray-300 bg-white px-3 py-2 shadow-sm focus:border-blue-500 focus:ring-2 focus:ring-blue-500 focus:outline-none\"/></label> <button class=\"rounded-md bg-blue-600 px-4 py-2 text-white transition hover:bg-blue-700\">Login</button> <button formaction=\"?/signUpEmail\" class=\"rounded-md bg-blue-600 px-4 py-2 text-white transition hover:bg-blue-700\">Register</button></form> <p class=\"text-red-500\">${escape_html(form?.message ?? \"\")}</p> <hr class=\"my-4\"/> <form method=\"post\" action=\"?/signInSocial\"><input type=\"hidden\" name=\"provider\" value=\"osu\"/> <input type=\"hidden\" name=\"callbackURL\" value=\"/demo/better-auth\"/> <button class=\"rounded-md bg-blue-600 px-4 py-2 text-white transition hover:bg-blue-700\">Sign in with osu!</button></form>`);\n });\n}\nexport {\n _page as default\n};\n"],"names":[],"mappings":";;;;;;AASA,SAAS,KAAK,CAAC,UAAU,EAAE,OAAO,EAAE;AACpC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,WAAW,KAAK;AACxC,IAAI,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO;AAC1B,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,87BAA87B,EAAE,WAAW,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC,qTAAqT,CAAC,CAAC;AAC9yC,EAAE,CAAC,CAAC;AACJ;;;;"}

View File

@@ -0,0 +1,32 @@
import { a6 as escape_html, a8 as ensure_array_like, a9 as attr, ab as stringify } 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;
$$renderer2.push(`<div class="mx-auto max-w-4xl"><div class="flex items-center justify-between"><div><h1 class="text-2xl font-700 tracking-tight">Mappools</h1> <p class="mt-1 text-sm text-text-secondary">Create and manage your beatmap pools</p></div> <button class="rounded-md bg-accent px-4 py-2 text-sm font-600 text-surface-900 transition-colors hover:bg-accent-hover">${escape_html("New Pool")}</button></div> `);
{
$$renderer2.push("<!--[!-->");
}
$$renderer2.push(`<!--]--> <div class="mt-6 flex flex-col gap-3">`);
const each_array = ensure_array_like(data.mappools);
if (each_array.length !== 0) {
$$renderer2.push("<!--[-->");
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
let pool = each_array[$$index];
$$renderer2.push(`<a${attr("href", `/mappools/${stringify(pool.id)}`)} class="group flex items-center justify-between rounded-lg border border-border bg-surface-800 p-4 transition-colors hover:border-accent/40 hover:bg-surface-700"><div><h2 class="text-sm font-600">${escape_html(pool.name)}</h2> <p class="mt-1 text-xs text-text-secondary">${escape_html(pool.slots.length)} map${escape_html(pool.slots.length !== 1 ? "s" : "")}
· Created ${escape_html(new Date(pool.createdAt).toLocaleDateString())}</p></div> <span class="text-text-secondary transition-colors group-hover:text-accent">→</span></a>`);
}
} else {
$$renderer2.push("<!--[!-->");
$$renderer2.push(`<div class="rounded-lg border border-dashed border-border py-12 text-center"><p class="text-sm text-text-secondary">No mappools yet. Create one to get started.</p></div>`);
}
$$renderer2.push(`<!--]--></div></div>`);
});
}
export { _page as default };
//# sourceMappingURL=_page.svelte-ijSwFWFX.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_page.svelte-ijSwFWFX.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/(app)/mappools/_page.svelte.js"],"sourcesContent":["import { e as escape_html, a as ensure_array_like, b as attr, s as stringify } from \"../../../../chunks/index3.js\";\nimport \"@sveltejs/kit/internal\";\nimport \"../../../../chunks/url.js\";\nimport \"../../../../chunks/utils.js\";\nimport \"@sveltejs/kit/internal/server\";\nimport \"../../../../chunks/root.js\";\nimport \"../../../../chunks/exports.js\";\nimport \"../../../../chunks/state.svelte.js\";\nfunction _page($$renderer, $$props) {\n $$renderer.component(($$renderer2) => {\n let { data } = $$props;\n $$renderer2.push(`<div class=\"mx-auto max-w-4xl\"><div class=\"flex items-center justify-between\"><div><h1 class=\"text-2xl font-700 tracking-tight\">Mappools</h1> <p class=\"mt-1 text-sm text-text-secondary\">Create and manage your beatmap pools</p></div> <button class=\"rounded-md bg-accent px-4 py-2 text-sm font-600 text-surface-900 transition-colors hover:bg-accent-hover\">${escape_html(\"New Pool\")}</button></div> `);\n {\n $$renderer2.push(\"<!--[!-->\");\n }\n $$renderer2.push(`<!--]--> <div class=\"mt-6 flex flex-col gap-3\">`);\n const each_array = ensure_array_like(data.mappools);\n if (each_array.length !== 0) {\n $$renderer2.push(\"<!--[-->\");\n for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {\n let pool = each_array[$$index];\n $$renderer2.push(`<a${attr(\"href\", `/mappools/${stringify(pool.id)}`)} class=\"group flex items-center justify-between rounded-lg border border-border bg-surface-800 p-4 transition-colors hover:border-accent/40 hover:bg-surface-700\"><div><h2 class=\"text-sm font-600\">${escape_html(pool.name)}</h2> <p class=\"mt-1 text-xs text-text-secondary\">${escape_html(pool.slots.length)} map${escape_html(pool.slots.length !== 1 ? \"s\" : \"\")}\n\t\t\t\t\t\t· Created ${escape_html(new Date(pool.createdAt).toLocaleDateString())}</p></div> <span class=\"text-text-secondary transition-colors group-hover:text-accent\">→</span></a>`);\n }\n } else {\n $$renderer2.push(\"<!--[!-->\");\n $$renderer2.push(`<div class=\"rounded-lg border border-dashed border-border py-12 text-center\"><p class=\"text-sm text-text-secondary\">No mappools yet. Create one to get started.</p></div>`);\n }\n $$renderer2.push(`<!--]--></div></div>`);\n });\n}\nexport {\n _page as default\n};\n"],"names":[],"mappings":";;;;;;AAQA,SAAS,KAAK,CAAC,UAAU,EAAE,OAAO,EAAE;AACpC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,WAAW,KAAK;AACxC,IAAI,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO;AAC1B,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,kWAAkW,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAAC;AACpa,IAAI;AACJ,MAAM,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC;AACnC,IAAI;AACJ,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,+CAA+C,CAAC,CAAC;AACvE,IAAI,MAAM,UAAU,GAAG,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC;AACvD,IAAI,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;AACjC,MAAM,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC;AAClC,MAAM,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,QAAQ,EAAE,OAAO,EAAE,EAAE;AACzF,QAAQ,IAAI,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC;AACtC,QAAQ,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,oMAAoM,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,kDAAkD,EAAE,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;AACnb,gBAAgB,EAAE,WAAW,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC,mGAAmG,CAAC,CAAC;AAClL,MAAM;AACN,IAAI,CAAC,MAAM;AACX,MAAM,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC;AACnC,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC,yKAAyK,CAAC,CAAC;AACnM,IAAI;AACJ,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,oBAAoB,CAAC,CAAC;AAC5C,EAAE,CAAC,CAAC;AACJ;;;;"}

View File

@@ -0,0 +1,39 @@
import { e as error, j as json } from './index-B2LGyy1l.js';
import { d as db } from './index2-B7hVh_Qf.js';
import { c as createMatch } from './engine-DiCmv1C-.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const GET = async ({ locals }) => {
if (!locals.user) error(401, "Not logged in");
const matches = await db.query.match.findMany({
with: {
participants: { with: { team: true } }
},
orderBy: (m, { desc }) => [desc(m.createdAt)]
});
return json(matches);
};
const POST = async ({ request, locals }) => {
if (!locals.user) error(401, "Not logged in");
const body = await request.json();
const { name, config, mappoolId, teams } = body;
if (!name || !config || !mappoolId || !teams?.length) {
error(400, "Missing required fields");
}
try {
const result = await createMatch({
name,
config,
mappoolId,
teams,
createdBy: locals.user.id
});
return json(result, { status: 201 });
} catch (e) {
error(400, e.message);
}
};
export { GET, POST };
//# sourceMappingURL=_server.ts-BEoJR5yQ.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_server.ts-BEoJR5yQ.js","sources":["../../../.svelte-kit/adapter-node/entries/endpoints/api/matches/_server.ts.js"],"sourcesContent":["import { error, json } from \"@sveltejs/kit\";\nimport { d as db } from \"../../../../chunks/index2.js\";\nimport { c as createMatch } from \"../../../../chunks/engine.js\";\nconst GET = async ({ locals }) => {\n if (!locals.user) error(401, \"Not logged in\");\n const matches = await db.query.match.findMany({\n with: {\n participants: { with: { team: true } }\n },\n orderBy: (m, { desc }) => [desc(m.createdAt)]\n });\n return json(matches);\n};\nconst POST = async ({ request, locals }) => {\n if (!locals.user) error(401, \"Not logged in\");\n const body = await request.json();\n const { name, config, mappoolId, teams } = body;\n if (!name || !config || !mappoolId || !teams?.length) {\n error(400, \"Missing required fields\");\n }\n try {\n const result = await createMatch({\n name,\n config,\n mappoolId,\n teams,\n createdBy: locals.user.id\n });\n return json(result, { status: 201 });\n } catch (e) {\n error(400, e.message);\n }\n};\nexport {\n GET,\n POST\n};\n"],"names":[],"mappings":";;;;;;AAGK,MAAC,GAAG,GAAG,OAAO,EAAE,MAAM,EAAE,KAAK;AAClC,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC;AAC/C,EAAE,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC;AAChD,IAAI,IAAI,EAAE;AACV,MAAM,YAAY,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;AAC1C,KAAK;AACL,IAAI,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AAChD,GAAG,CAAC;AACJ,EAAE,OAAO,IAAI,CAAC,OAAO,CAAC;AACtB;AACK,MAAC,IAAI,GAAG,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK;AAC5C,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC;AAC/C,EAAE,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE;AACnC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI;AACjD,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE;AACxD,IAAI,KAAK,CAAC,GAAG,EAAE,yBAAyB,CAAC;AACzC,EAAE;AACF,EAAE,IAAI;AACN,IAAI,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC;AACrC,MAAM,IAAI;AACV,MAAM,MAAM;AACZ,MAAM,SAAS;AACf,MAAM,KAAK;AACX,MAAM,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC;AAC7B,KAAK,CAAC;AACN,IAAI,OAAO,IAAI,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AACxC,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE;AACd,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC;AACzB,EAAE;AACF;;;;"}

View File

@@ -0,0 +1,22 @@
import { e as error, j as json } from './index-B2LGyy1l.js';
import { p as pickMap } from './engine-DiCmv1C-.js';
import './index2-B7hVh_Qf.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const POST = async ({ params, request, locals }) => {
if (!locals.user) error(401, "Not logged in");
const { participantId, mappoolSlotId } = await request.json();
if (!participantId || !mappoolSlotId) {
error(400, "participantId and mappoolSlotId required");
}
try {
const game = await pickMap(params.id, participantId, mappoolSlotId);
return json(game);
} catch (e) {
error(400, e.message);
}
};
export { POST };
//# sourceMappingURL=_server.ts-BKWDSPwT.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_server.ts-BKWDSPwT.js","sources":["../../../.svelte-kit/adapter-node/entries/endpoints/api/matches/_id_/pick/_server.ts.js"],"sourcesContent":["import { error, json } from \"@sveltejs/kit\";\nimport { p as pickMap } from \"../../../../../../chunks/engine.js\";\nconst POST = async ({ params, request, locals }) => {\n if (!locals.user) error(401, \"Not logged in\");\n const { participantId, mappoolSlotId } = await request.json();\n if (!participantId || !mappoolSlotId) {\n error(400, \"participantId and mappoolSlotId required\");\n }\n try {\n const game = await pickMap(params.id, participantId, mappoolSlotId);\n return json(game);\n } catch (e) {\n error(400, e.message);\n }\n};\nexport {\n POST\n};\n"],"names":[],"mappings":";;;;;;AAEK,MAAC,IAAI,GAAG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK;AACpD,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC;AAC/C,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE;AAC/D,EAAE,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,EAAE;AACxC,IAAI,KAAK,CAAC,GAAG,EAAE,0CAA0C,CAAC;AAC1D,EAAE;AACF,EAAE,IAAI;AACN,IAAI,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,aAAa,EAAE,aAAa,CAAC;AACvE,IAAI,OAAO,IAAI,CAAC,IAAI,CAAC;AACrB,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE;AACd,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC;AACzB,EAAE;AACF;;;;"}

View File

@@ -0,0 +1,22 @@
import { e as error, j as json } from './index-B2LGyy1l.js';
import { b as submitGameScores } from './engine-DiCmv1C-.js';
import './index2-B7hVh_Qf.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const POST = async ({ request, locals }) => {
if (!locals.user) error(401, "Not logged in");
const { matchGameId, scores } = await request.json();
if (!matchGameId || !scores?.length) {
error(400, "matchGameId and scores required");
}
try {
const m = await submitGameScores(matchGameId, scores);
return json(m);
} catch (e) {
error(400, e.message);
}
};
export { POST };
//# sourceMappingURL=_server.ts-C5pGCspz.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_server.ts-C5pGCspz.js","sources":["../../../.svelte-kit/adapter-node/entries/endpoints/api/matches/_id_/score/_server.ts.js"],"sourcesContent":["import { error, json } from \"@sveltejs/kit\";\nimport { d as submitGameScores } from \"../../../../../../chunks/engine.js\";\nconst POST = async ({ request, locals }) => {\n if (!locals.user) error(401, \"Not logged in\");\n const { matchGameId, scores } = await request.json();\n if (!matchGameId || !scores?.length) {\n error(400, \"matchGameId and scores required\");\n }\n try {\n const m = await submitGameScores(matchGameId, scores);\n return json(m);\n } catch (e) {\n error(400, e.message);\n }\n};\nexport {\n POST\n};\n"],"names":[],"mappings":";;;;;;AAEK,MAAC,IAAI,GAAG,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK;AAC5C,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC;AAC/C,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE;AACtD,EAAE,IAAI,CAAC,WAAW,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE;AACvC,IAAI,KAAK,CAAC,GAAG,EAAE,iCAAiC,CAAC;AACjD,EAAE;AACF,EAAE,IAAI;AACN,IAAI,MAAM,CAAC,GAAG,MAAM,gBAAgB,CAAC,WAAW,EAAE,MAAM,CAAC;AACzD,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC;AAClB,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE;AACd,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC;AACzB,EAAE;AACF;;;;"}

View File

@@ -0,0 +1,25 @@
import { e as error, j as json } from './index-B2LGyy1l.js';
import { d as db, b as mappool, e as eq, c as mappoolSlot } from './index2-B7hVh_Qf.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const GET = async ({ params, locals }) => {
if (!locals.user) error(401, "Not logged in");
const pool = await db.query.mappool.findFirst({
where: eq(mappool.id, params.id)
});
if (!pool) error(404, "Mappool not found");
const slots = await db.query.mappoolSlot.findMany({
where: eq(mappoolSlot.mappoolId, params.id),
orderBy: (s, { asc }) => [asc(s.category), asc(s.orderInCategory)]
});
return json({ ...pool, slots });
};
const DELETE = async ({ params, locals }) => {
if (!locals.user) error(401, "Not logged in");
await db.delete(mappool).where(eq(mappool.id, params.id));
return json({ ok: true });
};
export { DELETE, GET };
//# sourceMappingURL=_server.ts-CYhG9EuN.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_server.ts-CYhG9EuN.js","sources":["../../../.svelte-kit/adapter-node/entries/endpoints/api/mappools/_id_/_server.ts.js"],"sourcesContent":["import { error, json } from \"@sveltejs/kit\";\nimport { d as db, m as mappool, a as mappoolSlot } from \"../../../../../chunks/index2.js\";\nimport { eq } from \"drizzle-orm\";\nconst GET = async ({ params, locals }) => {\n if (!locals.user) error(401, \"Not logged in\");\n const pool = await db.query.mappool.findFirst({\n where: eq(mappool.id, params.id)\n });\n if (!pool) error(404, \"Mappool not found\");\n const slots = await db.query.mappoolSlot.findMany({\n where: eq(mappoolSlot.mappoolId, params.id),\n orderBy: (s, { asc }) => [asc(s.category), asc(s.orderInCategory)]\n });\n return json({ ...pool, slots });\n};\nconst DELETE = async ({ params, locals }) => {\n if (!locals.user) error(401, \"Not logged in\");\n await db.delete(mappool).where(eq(mappool.id, params.id));\n return json({ ok: true });\n};\nexport {\n DELETE,\n GET\n};\n"],"names":[],"mappings":";;;;;AAGK,MAAC,GAAG,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK;AAC1C,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC;AAC/C,EAAE,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;AAChD,IAAI,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE;AACnC,GAAG,CAAC;AACJ,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,mBAAmB,CAAC;AAC5C,EAAE,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC;AACpD,IAAI,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC;AAC/C,IAAI,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC;AACrE,GAAG,CAAC;AACJ,EAAE,OAAO,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC;AACjC;AACK,MAAC,MAAM,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK;AAC7C,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC;AAC/C,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;AAC3D,EAAE,OAAO,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AAC3B;;;;"}

View File

@@ -0,0 +1,19 @@
import { e as error, j as json } from './index-B2LGyy1l.js';
import { m as moveToLobby } from './engine-DiCmv1C-.js';
import './index2-B7hVh_Qf.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const POST = async ({ params, request, locals }) => {
if (!locals.user) error(401, "Not logged in");
const body = await request.json().catch(() => ({}));
try {
const m = await moveToLobby(params.id, body.osuLobbyId);
return json(m);
} catch (e) {
error(400, e.message);
}
};
export { POST };
//# sourceMappingURL=_server.ts-CgeuSTTA.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_server.ts-CgeuSTTA.js","sources":["../../../.svelte-kit/adapter-node/entries/endpoints/api/matches/_id_/lobby/_server.ts.js"],"sourcesContent":["import { error, json } from \"@sveltejs/kit\";\nimport { m as moveToLobby } from \"../../../../../../chunks/engine.js\";\nconst POST = async ({ params, request, locals }) => {\n if (!locals.user) error(401, \"Not logged in\");\n const body = await request.json().catch(() => ({}));\n try {\n const m = await moveToLobby(params.id, body.osuLobbyId);\n return json(m);\n } catch (e) {\n error(400, e.message);\n }\n};\nexport {\n POST\n};\n"],"names":[],"mappings":";;;;;;AAEK,MAAC,IAAI,GAAG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK;AACpD,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC;AAC/C,EAAE,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;AACrD,EAAE,IAAI;AACN,IAAI,MAAM,CAAC,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC;AAC3D,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC;AAClB,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE;AACd,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC;AACzB,EAAE;AACF;;;;"}

View File

@@ -0,0 +1,29 @@
import { e as error, j as json } from './index-B2LGyy1l.js';
import { d as db, f as and, e as eq, c as mappoolSlot } from './index2-B7hVh_Qf.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const POST = async ({ params, request, locals }) => {
if (!locals.user) error(401, "Not logged in");
const { beatmapId, category, mods } = await request.json();
if (!beatmapId || !category) {
error(400, "beatmapId and category are required");
}
const existing = await db.query.mappoolSlot.findMany({
where: and(
eq(mappoolSlot.mappoolId, params.id),
eq(mappoolSlot.category, category.toUpperCase())
)
});
const [created] = await db.insert(mappoolSlot).values({
mappoolId: params.id,
beatmapId: String(beatmapId),
category: category.toUpperCase(),
orderInCategory: existing.length + 1,
mods: mods ?? []
}).returning();
return json(created, { status: 201 });
};
export { POST };
//# sourceMappingURL=_server.ts-Chr3sGwY.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_server.ts-Chr3sGwY.js","sources":["../../../.svelte-kit/adapter-node/entries/endpoints/api/mappools/_id_/slots/_server.ts.js"],"sourcesContent":["import { error, json } from \"@sveltejs/kit\";\nimport { d as db, a as mappoolSlot } from \"../../../../../../chunks/index2.js\";\nimport { and, eq } from \"drizzle-orm\";\nconst POST = async ({ params, request, locals }) => {\n if (!locals.user) error(401, \"Not logged in\");\n const { beatmapId, category, mods } = await request.json();\n if (!beatmapId || !category) {\n error(400, \"beatmapId and category are required\");\n }\n const existing = await db.query.mappoolSlot.findMany({\n where: and(\n eq(mappoolSlot.mappoolId, params.id),\n eq(mappoolSlot.category, category.toUpperCase())\n )\n });\n const [created] = await db.insert(mappoolSlot).values({\n mappoolId: params.id,\n beatmapId: String(beatmapId),\n category: category.toUpperCase(),\n orderInCategory: existing.length + 1,\n mods: mods ?? []\n }).returning();\n return json(created, { status: 201 });\n};\nexport {\n POST\n};\n"],"names":[],"mappings":";;;;;AAGK,MAAC,IAAI,GAAG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK;AACpD,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC;AAC/C,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE;AAC5D,EAAE,IAAI,CAAC,SAAS,IAAI,CAAC,QAAQ,EAAE;AAC/B,IAAI,KAAK,CAAC,GAAG,EAAE,qCAAqC,CAAC;AACrD,EAAE;AACF,EAAE,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC;AACvD,IAAI,KAAK,EAAE,GAAG;AACd,MAAM,EAAE,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC;AAC1C,MAAM,EAAE,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC,WAAW,EAAE;AACrD;AACA,GAAG,CAAC;AACJ,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC;AACxD,IAAI,SAAS,EAAE,MAAM,CAAC,EAAE;AACxB,IAAI,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC;AAChC,IAAI,QAAQ,EAAE,QAAQ,CAAC,WAAW,EAAE;AACpC,IAAI,eAAe,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC;AACxC,IAAI,IAAI,EAAE,IAAI,IAAI;AAClB,GAAG,CAAC,CAAC,SAAS,EAAE;AAChB,EAAE,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AACvC;;;;"}

View File

@@ -0,0 +1,25 @@
import { e as error, j as json } from './index-B2LGyy1l.js';
import { d as db, b as mappool } from './index2-B7hVh_Qf.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const GET = async ({ locals }) => {
if (!locals.user) error(401, "Not logged in");
const mappools = await db.query.mappool.findMany({
orderBy: (m, { desc }) => [desc(m.createdAt)]
});
return json(mappools);
};
const POST = async ({ request, locals }) => {
if (!locals.user) error(401, "Not logged in");
const { name } = await request.json();
if (!name?.trim()) error(400, "Name is required");
const [created] = await db.insert(mappool).values({
name: name.trim(),
createdBy: locals.user.id
}).returning();
return json(created, { status: 201 });
};
export { GET, POST };
//# sourceMappingURL=_server.ts-CknVZIWY.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_server.ts-CknVZIWY.js","sources":["../../../.svelte-kit/adapter-node/entries/endpoints/api/mappools/_server.ts.js"],"sourcesContent":["import { error, json } from \"@sveltejs/kit\";\nimport { d as db, m as mappool } from \"../../../../chunks/index2.js\";\nconst GET = async ({ locals }) => {\n if (!locals.user) error(401, \"Not logged in\");\n const mappools = await db.query.mappool.findMany({\n orderBy: (m, { desc }) => [desc(m.createdAt)]\n });\n return json(mappools);\n};\nconst POST = async ({ request, locals }) => {\n if (!locals.user) error(401, \"Not logged in\");\n const { name } = await request.json();\n if (!name?.trim()) error(400, \"Name is required\");\n const [created] = await db.insert(mappool).values({\n name: name.trim(),\n createdBy: locals.user.id\n }).returning();\n return json(created, { status: 201 });\n};\nexport {\n GET,\n POST\n};\n"],"names":[],"mappings":";;;;;AAEK,MAAC,GAAG,GAAG,OAAO,EAAE,MAAM,EAAE,KAAK;AAClC,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC;AAC/C,EAAE,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;AACnD,IAAI,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AAChD,GAAG,CAAC;AACJ,EAAE,OAAO,IAAI,CAAC,QAAQ,CAAC;AACvB;AACK,MAAC,IAAI,GAAG,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK;AAC5C,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC;AAC/C,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE;AACvC,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,GAAG,EAAE,kBAAkB,CAAC;AACnD,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;AACpD,IAAI,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;AACrB,IAAI,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC;AAC3B,GAAG,CAAC,CAAC,SAAS,EAAE;AAChB,EAAE,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AACvC;;;;"}

View File

@@ -0,0 +1,27 @@
import { j as json } from './index-B2LGyy1l.js';
import { d as db, x as sql } from './index2-B7hVh_Qf.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const GET = async () => {
try {
await db.execute(sql`SELECT 1`);
return json({
status: "ok",
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
uptime: process.uptime()
});
} catch (e) {
return json(
{
status: "error",
error: "Database connection failed",
timestamp: (/* @__PURE__ */ new Date()).toISOString()
},
{ status: 503 }
);
}
};
export { GET };
//# sourceMappingURL=_server.ts-Cp6RS2Xl.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_server.ts-Cp6RS2Xl.js","sources":["../../../.svelte-kit/adapter-node/entries/endpoints/api/health/_server.ts.js"],"sourcesContent":["import { json } from \"@sveltejs/kit\";\nimport { d as db } from \"../../../../chunks/index2.js\";\nimport { sql } from \"drizzle-orm\";\nconst GET = async () => {\n try {\n await db.execute(sql`SELECT 1`);\n return json({\n status: \"ok\",\n timestamp: (/* @__PURE__ */ new Date()).toISOString(),\n uptime: process.uptime()\n });\n } catch (e) {\n return json(\n {\n status: \"error\",\n error: \"Database connection failed\",\n timestamp: (/* @__PURE__ */ new Date()).toISOString()\n },\n { status: 503 }\n );\n }\n};\nexport {\n GET\n};\n"],"names":[],"mappings":";;;;;AAGK,MAAC,GAAG,GAAG,YAAY;AACxB,EAAE,IAAI;AACN,IAAI,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACnC,IAAI,OAAO,IAAI,CAAC;AAChB,MAAM,MAAM,EAAE,IAAI;AAClB,MAAM,SAAS,EAAE,iBAAiB,IAAI,IAAI,EAAE,EAAE,WAAW,EAAE;AAC3D,MAAM,MAAM,EAAE,OAAO,CAAC,MAAM;AAC5B,KAAK,CAAC;AACN,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE;AACd,IAAI,OAAO,IAAI;AACf,MAAM;AACN,QAAQ,MAAM,EAAE,OAAO;AACvB,QAAQ,KAAK,EAAE,4BAA4B;AAC3C,QAAQ,SAAS,EAAE,iBAAiB,IAAI,IAAI,EAAE,EAAE,WAAW;AAC3D,OAAO;AACP,MAAM,EAAE,MAAM,EAAE,GAAG;AACnB,KAAK;AACL,EAAE;AACF;;;;"}

View File

@@ -0,0 +1,18 @@
import { e as error, j as json } from './index-B2LGyy1l.js';
import { g as getBeatmap } from './api-DYV1cRWY.js';
import './shared-server-DaWdgxVh.js';
import './index2-B7hVh_Qf.js';
import 'postgres';
const GET = async ({ params, locals }) => {
if (!locals.user) error(401, "Not logged in");
try {
const beatmap = await getBeatmap(params.id);
return json(beatmap);
} catch {
error(404, "Beatmap not found");
}
};
export { GET };
//# sourceMappingURL=_server.ts-DLwKwHxp.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_server.ts-DLwKwHxp.js","sources":["../../../.svelte-kit/adapter-node/entries/endpoints/api/osu/beatmap/_id_/_server.ts.js"],"sourcesContent":["import { error, json } from \"@sveltejs/kit\";\nimport { g as getBeatmap } from \"../../../../../../chunks/api.js\";\nconst GET = async ({ params, locals }) => {\n if (!locals.user) error(401, \"Not logged in\");\n try {\n const beatmap = await getBeatmap(params.id);\n return json(beatmap);\n } catch {\n error(404, \"Beatmap not found\");\n }\n};\nexport {\n GET\n};\n"],"names":[],"mappings":";;;;;;AAEK,MAAC,GAAG,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK;AAC1C,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC;AAC/C,EAAE,IAAI;AACN,IAAI,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;AAC/C,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC;AACxB,EAAE,CAAC,CAAC,MAAM;AACV,IAAI,KAAK,CAAC,GAAG,EAAE,mBAAmB,CAAC;AACnC,EAAE;AACF;;;;"}

View File

@@ -0,0 +1,36 @@
import { e as error, j as json } from './index-B2LGyy1l.js';
import { l as leaveQueue, e as getQueueStatus, j as joinQueue } from './engine-DiCmv1C-.js';
import { d as db, e as eq, j as teamMember } from './index2-B7hVh_Qf.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const GET = async ({ locals }) => {
if (!locals.user) error(401, "Not logged in");
const status = await getQueueStatus(locals.user.id);
return json(status);
};
const POST = async ({ locals }) => {
if (!locals.user) error(401, "Not logged in");
const membership = await db.query.teamMember.findFirst({
where: eq(teamMember.userId, locals.user.id),
with: { team: true }
});
const personalTeam = membership?.team;
if (!personalTeam?.isPersonal) {
error(400, "No personal team found");
}
try {
const result = await joinQueue(locals.user.id, personalTeam.id);
return json({ matched: !!result, match: result });
} catch (e) {
error(400, e.message);
}
};
const DELETE = async ({ locals }) => {
if (!locals.user) error(401, "Not logged in");
await leaveQueue(locals.user.id);
return json({ ok: true });
};
export { DELETE, GET, POST };
//# sourceMappingURL=_server.ts-DRKvzZ51.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_server.ts-DRKvzZ51.js","sources":["../../../.svelte-kit/adapter-node/entries/endpoints/api/queue/_server.ts.js"],"sourcesContent":["import { error, json } from \"@sveltejs/kit\";\nimport { l as leaveQueue, e as getQueueStatus, j as joinQueue } from \"../../../../chunks/engine.js\";\nimport { d as db, t as teamMember } from \"../../../../chunks/index2.js\";\nimport { eq } from \"drizzle-orm\";\nconst GET = async ({ locals }) => {\n if (!locals.user) error(401, \"Not logged in\");\n const status = await getQueueStatus(locals.user.id);\n return json(status);\n};\nconst POST = async ({ locals }) => {\n if (!locals.user) error(401, \"Not logged in\");\n const membership = await db.query.teamMember.findFirst({\n where: eq(teamMember.userId, locals.user.id),\n with: { team: true }\n });\n const personalTeam = membership?.team;\n if (!personalTeam?.isPersonal) {\n error(400, \"No personal team found\");\n }\n try {\n const result = await joinQueue(locals.user.id, personalTeam.id);\n return json({ matched: !!result, match: result });\n } catch (e) {\n error(400, e.message);\n }\n};\nconst DELETE = async ({ locals }) => {\n if (!locals.user) error(401, \"Not logged in\");\n await leaveQueue(locals.user.id);\n return json({ ok: true });\n};\nexport {\n DELETE,\n GET,\n POST\n};\n"],"names":[],"mappings":";;;;;;AAIK,MAAC,GAAG,GAAG,OAAO,EAAE,MAAM,EAAE,KAAK;AAClC,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC;AAC/C,EAAE,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;AACrD,EAAE,OAAO,IAAI,CAAC,MAAM,CAAC;AACrB;AACK,MAAC,IAAI,GAAG,OAAO,EAAE,MAAM,EAAE,KAAK;AACnC,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC;AAC/C,EAAE,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC;AACzD,IAAI,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;AAChD,IAAI,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI;AACtB,GAAG,CAAC;AACJ,EAAE,MAAM,YAAY,GAAG,UAAU,EAAE,IAAI;AACvC,EAAE,IAAI,CAAC,YAAY,EAAE,UAAU,EAAE;AACjC,IAAI,KAAK,CAAC,GAAG,EAAE,wBAAwB,CAAC;AACxC,EAAE;AACF,EAAE,IAAI;AACN,IAAI,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,YAAY,CAAC,EAAE,CAAC;AACnE,IAAI,OAAO,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AACrD,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE;AACd,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC;AACzB,EAAE;AACF;AACK,MAAC,MAAM,GAAG,OAAO,EAAE,MAAM,EAAE,KAAK;AACrC,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC;AAC/C,EAAE,MAAM,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;AAClC,EAAE,OAAO,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AAC3B;;;;"}

View File

@@ -0,0 +1,27 @@
import { e as error, j as json } from './index-B2LGyy1l.js';
import { a as cancelMatch, g as getMatchFull } from './engine-DiCmv1C-.js';
import './index2-B7hVh_Qf.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const GET = async ({ params, locals }) => {
if (!locals.user) error(401, "Not logged in");
try {
const m = await getMatchFull(params.id);
return json(m);
} catch (e) {
error(404, e.message);
}
};
const DELETE = async ({ params, locals }) => {
if (!locals.user) error(401, "Not logged in");
try {
const m = await cancelMatch(params.id);
return json(m);
} catch (e) {
error(400, e.message);
}
};
export { DELETE, GET };
//# sourceMappingURL=_server.ts-KSG0NbEr.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_server.ts-KSG0NbEr.js","sources":["../../../.svelte-kit/adapter-node/entries/endpoints/api/matches/_id_/_server.ts.js"],"sourcesContent":["import { error, json } from \"@sveltejs/kit\";\nimport { a as cancelMatch, g as getMatchFull } from \"../../../../../chunks/engine.js\";\nconst GET = async ({ params, locals }) => {\n if (!locals.user) error(401, \"Not logged in\");\n try {\n const m = await getMatchFull(params.id);\n return json(m);\n } catch (e) {\n error(404, e.message);\n }\n};\nconst DELETE = async ({ params, locals }) => {\n if (!locals.user) error(401, \"Not logged in\");\n try {\n const m = await cancelMatch(params.id);\n return json(m);\n } catch (e) {\n error(400, e.message);\n }\n};\nexport {\n DELETE,\n GET\n};\n"],"names":[],"mappings":";;;;;;AAEK,MAAC,GAAG,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK;AAC1C,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC;AAC/C,EAAE,IAAI;AACN,IAAI,MAAM,CAAC,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;AAC3C,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC;AAClB,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE;AACd,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC;AACzB,EAAE;AACF;AACK,MAAC,MAAM,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK;AAC7C,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC;AAC/C,EAAE,IAAI;AACN,IAAI,MAAM,CAAC,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;AAC1C,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC;AAClB,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE;AACd,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC;AACzB,EAAE;AACF;;;;"}

View File

@@ -0,0 +1,18 @@
import { e as error, j as json } from './index-B2LGyy1l.js';
import { d as moveToRolling } from './engine-DiCmv1C-.js';
import './index2-B7hVh_Qf.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const POST = async ({ params, locals }) => {
if (!locals.user) error(401, "Not logged in");
try {
const m = await moveToRolling(params.id);
return json(m);
} catch (e) {
error(400, e.message);
}
};
export { POST };
//# sourceMappingURL=_server.ts-M_0oeLSe.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_server.ts-M_0oeLSe.js","sources":["../../../.svelte-kit/adapter-node/entries/endpoints/api/matches/_id_/rolling/_server.ts.js"],"sourcesContent":["import { error, json } from \"@sveltejs/kit\";\nimport { b as moveToRolling } from \"../../../../../../chunks/engine.js\";\nconst POST = async ({ params, locals }) => {\n if (!locals.user) error(401, \"Not logged in\");\n try {\n const m = await moveToRolling(params.id);\n return json(m);\n } catch (e) {\n error(400, e.message);\n }\n};\nexport {\n POST\n};\n"],"names":[],"mappings":";;;;;;AAEK,MAAC,IAAI,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK;AAC3C,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC;AAC/C,EAAE,IAAI;AACN,IAAI,MAAM,CAAC,GAAG,MAAM,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;AAC5C,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC;AAClB,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE;AACd,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC;AACzB,EAAE;AACF;;;;"}

View File

@@ -0,0 +1,22 @@
import { e as error, j as json } from './index-B2LGyy1l.js';
import { s as submitRoll } from './engine-DiCmv1C-.js';
import './index2-B7hVh_Qf.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const POST = async ({ params, request, locals }) => {
if (!locals.user) error(401, "Not logged in");
const { participantId, value } = await request.json();
if (!participantId || value == null) {
error(400, "participantId and value required");
}
try {
const m = await submitRoll(params.id, participantId, value);
return json(m);
} catch (e) {
error(400, e.message);
}
};
export { POST };
//# sourceMappingURL=_server.ts-kIjYmsyw.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_server.ts-kIjYmsyw.js","sources":["../../../.svelte-kit/adapter-node/entries/endpoints/api/matches/_id_/roll/_server.ts.js"],"sourcesContent":["import { error, json } from \"@sveltejs/kit\";\nimport { s as submitRoll } from \"../../../../../../chunks/engine.js\";\nconst POST = async ({ params, request, locals }) => {\n if (!locals.user) error(401, \"Not logged in\");\n const { participantId, value } = await request.json();\n if (!participantId || value == null) {\n error(400, \"participantId and value required\");\n }\n try {\n const m = await submitRoll(params.id, participantId, value);\n return json(m);\n } catch (e) {\n error(400, e.message);\n }\n};\nexport {\n POST\n};\n"],"names":[],"mappings":";;;;;;AAEK,MAAC,IAAI,GAAG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK;AACpD,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC;AAC/C,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE;AACvD,EAAE,IAAI,CAAC,aAAa,IAAI,KAAK,IAAI,IAAI,EAAE;AACvC,IAAI,KAAK,CAAC,GAAG,EAAE,kCAAkC,CAAC;AAClD,EAAE;AACF,EAAE,IAAI;AACN,IAAI,MAAM,CAAC,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,EAAE,EAAE,aAAa,EAAE,KAAK,CAAC;AAC/D,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC;AAClB,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE;AACd,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC;AACzB,EAAE;AACF;;;;"}

View File

@@ -0,0 +1,13 @@
import { e as error, j as json } from './index-B2LGyy1l.js';
import { d as db, c as mappoolSlot, e as eq } from './index2-B7hVh_Qf.js';
import 'postgres';
import './shared-server-DaWdgxVh.js';
const DELETE = async ({ params, locals }) => {
if (!locals.user) error(401, "Not logged in");
await db.delete(mappoolSlot).where(eq(mappoolSlot.id, params.slotId));
return json({ ok: true });
};
export { DELETE };
//# sourceMappingURL=_server.ts-wwm7Wb6_.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_server.ts-wwm7Wb6_.js","sources":["../../../.svelte-kit/adapter-node/entries/endpoints/api/mappools/_id_/slots/_slotId_/_server.ts.js"],"sourcesContent":["import { error, json } from \"@sveltejs/kit\";\nimport { d as db, a as mappoolSlot } from \"../../../../../../../chunks/index2.js\";\nimport { eq } from \"drizzle-orm\";\nconst DELETE = async ({ params, locals }) => {\n if (!locals.user) error(401, \"Not logged in\");\n await db.delete(mappoolSlot).where(eq(mappoolSlot.id, params.slotId));\n return json({ ok: true });\n};\nexport {\n DELETE\n};\n"],"names":[],"mappings":";;;;;AAGK,MAAC,MAAM,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK;AAC7C,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,CAAC;AAC/C,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;AACvE,EAAE,OAAO,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AAC3B;;;;"}

View File

@@ -0,0 +1,8 @@
import { x as sql } from './index2-B7hVh_Qf.js';
function count(expression) {
return sql`count(${sql.raw("*")})`.mapWith(Number);
}
export { count as c };
//# sourceMappingURL=aggregate-CrXc04Dg.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"aggregate-CrXc04Dg.js","sources":["../../../node_modules/drizzle-orm/sql/functions/aggregate.js"],"sourcesContent":["import { Column } from \"../../column.js\";\nimport { is } from \"../../entity.js\";\nimport { sql } from \"../sql.js\";\nfunction count(expression) {\n return sql`count(${expression || sql.raw(\"*\")})`.mapWith(Number);\n}\nfunction countDistinct(expression) {\n return sql`count(distinct ${expression})`.mapWith(Number);\n}\nfunction avg(expression) {\n return sql`avg(${expression})`.mapWith(String);\n}\nfunction avgDistinct(expression) {\n return sql`avg(distinct ${expression})`.mapWith(String);\n}\nfunction sum(expression) {\n return sql`sum(${expression})`.mapWith(String);\n}\nfunction sumDistinct(expression) {\n return sql`sum(distinct ${expression})`.mapWith(String);\n}\nfunction max(expression) {\n return sql`max(${expression})`.mapWith(is(expression, Column) ? expression : String);\n}\nfunction min(expression) {\n return sql`min(${expression})`.mapWith(is(expression, Column) ? expression : String);\n}\nexport {\n avg,\n avgDistinct,\n count,\n countDistinct,\n max,\n min,\n sum,\n sumDistinct\n};\n//# sourceMappingURL=aggregate.js.map"],"names":[],"mappings":";;AAGA,SAAS,KAAK,CAAC,UAAU,EAAE;AAC3B,EAAE,OAAO,GAAG,CAAC,MAAM,EAAgB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;AAClE;;;;","x_google_ignoreList":[0]}

View File

@@ -0,0 +1,70 @@
import { b as private_env } from './shared-server-DaWdgxVh.js';
import './index2-B7hVh_Qf.js';
const CACHE_TTL = 10 * 60 * 1e3;
const MAX_ENTRIES = 500;
const cache = /* @__PURE__ */ new Map();
function getCached(key) {
const entry = cache.get(key);
if (!entry) return null;
if (Date.now() > entry.expiresAt) {
cache.delete(key);
return null;
}
return entry.data;
}
function setCache(key, data, ttl = CACHE_TTL) {
if (cache.size >= MAX_ENTRIES) {
const firstKey = cache.keys().next().value;
if (firstKey) cache.delete(firstKey);
}
cache.set(key, { data, expiresAt: Date.now() + ttl });
}
let clientToken = null;
let clientTokenExpiresAt = 0;
async function getClientToken() {
if (clientToken && Date.now() < clientTokenExpiresAt - 6e4) {
return clientToken;
}
const res = await fetch("https://osu.ppy.sh/oauth/token", {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/x-www-form-urlencoded"
},
body: new URLSearchParams({
client_id: private_env.OSU_CLIENT_ID,
client_secret: private_env.OSU_CLIENT_SECRET,
grant_type: "client_credentials",
scope: "identify public"
})
});
if (!res.ok) {
throw new Error(`Failed to get osu! client token: ${res.status} ${res.statusText}`);
}
const data = await res.json();
clientToken = data.access_token;
clientTokenExpiresAt = Date.now() + data.expires_in * 1e3;
return clientToken;
}
async function osuFetch(path, token) {
const t = await getClientToken();
const res = await fetch(`https://osu.ppy.sh/api/v2${path}`, {
headers: { Authorization: `Bearer ${t}` }
});
if (!res.ok) {
throw new Error(`osu! API ${path}: ${res.status} ${res.statusText}`);
}
return res.json();
}
async function getBeatmap(beatmapId) {
const cacheKey = `beatmap:${beatmapId}`;
const cached = getCached(cacheKey);
if (cached) return cached;
const data = await osuFetch(`/beatmaps/${beatmapId}`);
setCache(cacheKey, data);
return data;
}
export { getBeatmap as g };
//# sourceMappingURL=api-DYV1cRWY.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"api-DYV1cRWY.js","sources":["../../../.svelte-kit/adapter-node/chunks/api.js"],"sourcesContent":["import { b as private_env } from \"./shared-server.js\";\nimport \"./index2.js\";\nconst CACHE_TTL = 10 * 60 * 1e3;\nconst MAX_ENTRIES = 500;\nconst cache = /* @__PURE__ */ new Map();\nfunction getCached(key) {\n const entry = cache.get(key);\n if (!entry) return null;\n if (Date.now() > entry.expiresAt) {\n cache.delete(key);\n return null;\n }\n return entry.data;\n}\nfunction setCache(key, data, ttl = CACHE_TTL) {\n if (cache.size >= MAX_ENTRIES) {\n const firstKey = cache.keys().next().value;\n if (firstKey) cache.delete(firstKey);\n }\n cache.set(key, { data, expiresAt: Date.now() + ttl });\n}\nlet clientToken = null;\nlet clientTokenExpiresAt = 0;\nasync function getClientToken() {\n if (clientToken && Date.now() < clientTokenExpiresAt - 6e4) {\n return clientToken;\n }\n const res = await fetch(\"https://osu.ppy.sh/oauth/token\", {\n method: \"POST\",\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\"\n },\n body: new URLSearchParams({\n client_id: private_env.OSU_CLIENT_ID,\n client_secret: private_env.OSU_CLIENT_SECRET,\n grant_type: \"client_credentials\",\n scope: \"identify public\"\n })\n });\n if (!res.ok) {\n throw new Error(`Failed to get osu! client token: ${res.status} ${res.statusText}`);\n }\n const data = await res.json();\n clientToken = data.access_token;\n clientTokenExpiresAt = Date.now() + data.expires_in * 1e3;\n return clientToken;\n}\nasync function osuFetch(path, token) {\n const t = await getClientToken();\n const res = await fetch(`https://osu.ppy.sh/api/v2${path}`, {\n headers: { Authorization: `Bearer ${t}` }\n });\n if (!res.ok) {\n throw new Error(`osu! API ${path}: ${res.status} ${res.statusText}`);\n }\n return res.json();\n}\nasync function getBeatmap(beatmapId) {\n const cacheKey = `beatmap:${beatmapId}`;\n const cached = getCached(cacheKey);\n if (cached) return cached;\n const data = await osuFetch(`/beatmaps/${beatmapId}`);\n setCache(cacheKey, data);\n return data;\n}\nexport {\n getBeatmap as g\n};\n"],"names":[],"mappings":";;;AAEA,MAAM,SAAS,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG;AAC/B,MAAM,WAAW,GAAG,GAAG;AACvB,MAAM,KAAK,mBAAmB,IAAI,GAAG,EAAE;AACvC,SAAS,SAAS,CAAC,GAAG,EAAE;AACxB,EAAE,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;AAC9B,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,IAAI;AACzB,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,SAAS,EAAE;AACpC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;AACrB,IAAI,OAAO,IAAI;AACf,EAAE;AACF,EAAE,OAAO,KAAK,CAAC,IAAI;AACnB;AACA,SAAS,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,SAAS,EAAE;AAC9C,EAAE,IAAI,KAAK,CAAC,IAAI,IAAI,WAAW,EAAE;AACjC,IAAI,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK;AAC9C,IAAI,IAAI,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;AACxC,EAAE;AACF,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC;AACvD;AACA,IAAI,WAAW,GAAG,IAAI;AACtB,IAAI,oBAAoB,GAAG,CAAC;AAC5B,eAAe,cAAc,GAAG;AAChC,EAAE,IAAI,WAAW,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,oBAAoB,GAAG,GAAG,EAAE;AAC9D,IAAI,OAAO,WAAW;AACtB,EAAE;AACF,EAAE,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,gCAAgC,EAAE;AAC5D,IAAI,MAAM,EAAE,MAAM;AAClB,IAAI,OAAO,EAAE;AACb,MAAM,MAAM,EAAE,kBAAkB;AAChC,MAAM,cAAc,EAAE;AACtB,KAAK;AACL,IAAI,IAAI,EAAE,IAAI,eAAe,CAAC;AAC9B,MAAM,SAAS,EAAE,WAAW,CAAC,aAAa;AAC1C,MAAM,aAAa,EAAE,WAAW,CAAC,iBAAiB;AAClD,MAAM,UAAU,EAAE,oBAAoB;AACtC,MAAM,KAAK,EAAE;AACb,KAAK;AACL,GAAG,CAAC;AACJ,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE;AACf,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,iCAAiC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;AACvF,EAAE;AACF,EAAE,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE;AAC/B,EAAE,WAAW,GAAG,IAAI,CAAC,YAAY;AACjC,EAAE,oBAAoB,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,UAAU,GAAG,GAAG;AAC3D,EAAE,OAAO,WAAW;AACpB;AACA,eAAe,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE;AACrC,EAAE,MAAM,CAAC,GAAG,MAAM,cAAc,EAAE;AAClC,EAAE,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,CAAC,yBAAyB,EAAE,IAAI,CAAC,CAAC,EAAE;AAC9D,IAAI,OAAO,EAAE,EAAE,aAAa,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AAC3C,GAAG,CAAC;AACJ,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE;AACf,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;AACxE,EAAE;AACF,EAAE,OAAO,GAAG,CAAC,IAAI,EAAE;AACnB;AACA,eAAe,UAAU,CAAC,SAAS,EAAE;AACrC,EAAE,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AACzC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC;AACpC,EAAE,IAAI,MAAM,EAAE,OAAO,MAAM;AAC3B,EAAE,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC;AACvD,EAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;AAC1B,EAAE,OAAO,IAAI;AACb;;;;"}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,165 @@
import { C as CompiledQuery, D as DefaultQueryCompiler, e as DEFAULT_MIGRATION_TABLE, f as DEFAULT_MIGRATION_LOCK_TABLE, d as sql } from './auth-CAP7sZek.js';
import './shared-server-DaWdgxVh.js';
import './root-D12ma0No.js';
import './index3-C4geC3K_.js';
import './utils-D_bK1W85.js';
import './index-B2LGyy1l.js';
import './shared-DWC9PG0H.js';
import './index2-B7hVh_Qf.js';
import 'postgres';
import './aggregate-CrXc04Dg.js';
var BunSqliteAdapter = class {
get supportsCreateIfNotExists() {
return true;
}
get supportsTransactionalDdl() {
return false;
}
get supportsReturning() {
return true;
}
async acquireMigrationLock() {
}
async releaseMigrationLock() {
}
get supportsOutput() {
return true;
}
};
var BunSqliteDriver = class {
#config;
#connectionMutex = new ConnectionMutex();
#db;
#connection;
constructor(config) {
this.#config = { ...config };
}
async init() {
this.#db = this.#config.database;
this.#connection = new BunSqliteConnection(this.#db);
if (this.#config.onCreateConnection) await this.#config.onCreateConnection(this.#connection);
}
async acquireConnection() {
await this.#connectionMutex.lock();
return this.#connection;
}
async beginTransaction(connection) {
await connection.executeQuery(CompiledQuery.raw("begin"));
}
async commitTransaction(connection) {
await connection.executeQuery(CompiledQuery.raw("commit"));
}
async rollbackTransaction(connection) {
await connection.executeQuery(CompiledQuery.raw("rollback"));
}
async releaseConnection() {
this.#connectionMutex.unlock();
}
async destroy() {
this.#db?.close();
}
};
var BunSqliteConnection = class {
#db;
constructor(db) {
this.#db = db;
}
executeQuery(compiledQuery) {
const { sql: sql$1, parameters } = compiledQuery;
const stmt = this.#db.prepare(sql$1);
return Promise.resolve({ rows: stmt.all(parameters) });
}
async *streamQuery() {
throw new Error("Streaming query is not supported by SQLite driver.");
}
};
var ConnectionMutex = class {
#promise;
#resolve;
async lock() {
while (await this.#promise) await this.#promise;
this.#promise = new Promise((resolve) => {
this.#resolve = resolve;
});
}
unlock() {
const resolve = this.#resolve;
this.#promise = void 0;
this.#resolve = void 0;
resolve?.();
}
};
var BunSqliteIntrospector = class {
#db;
constructor(db) {
this.#db = db;
}
async getSchemas() {
return [];
}
async getTables(options = { withInternalKyselyTables: false }) {
let query = this.#db.selectFrom("sqlite_schema").where("type", "=", "table").where("name", "not like", "sqlite_%").select("name").$castTo();
if (!options.withInternalKyselyTables) query = query.where("name", "!=", DEFAULT_MIGRATION_TABLE).where("name", "!=", DEFAULT_MIGRATION_LOCK_TABLE);
const tables = await query.execute();
return Promise.all(tables.map(({ name }) => this.#getTableMetadata(name)));
}
async getMetadata(options) {
return { tables: await this.getTables(options) };
}
async #getTableMetadata(table) {
const db = this.#db;
const autoIncrementCol = (await db.selectFrom("sqlite_master").where("name", "=", table).select("sql").$castTo().execute())[0]?.sql?.split(/[\(\),]/)?.find((it) => it.toLowerCase().includes("autoincrement"))?.split(/\s+/)?.[0]?.replace(/["`]/g, "");
return {
name: table,
columns: (await db.selectFrom(sql`pragma_table_info(${table})`.as("table_info")).select([
"name",
"type",
"notnull",
"dflt_value"
]).execute()).map((col) => ({
name: col.name,
dataType: col.type,
isNullable: !col.notnull,
isAutoIncrementing: col.name === autoIncrementCol,
hasDefaultValue: col.dflt_value != null
})),
isView: true
};
}
};
var BunSqliteQueryCompiler = class extends DefaultQueryCompiler {
getCurrentParameterPlaceholder() {
return "?";
}
getLeftIdentifierWrapper() {
return '"';
}
getRightIdentifierWrapper() {
return '"';
}
getAutoIncrement() {
return "autoincrement";
}
};
var BunSqliteDialect = class {
#config;
constructor(config) {
this.#config = { ...config };
}
createDriver() {
return new BunSqliteDriver(this.#config);
}
createQueryCompiler() {
return new BunSqliteQueryCompiler();
}
createAdapter() {
return new BunSqliteAdapter();
}
createIntrospector(db) {
return new BunSqliteIntrospector(db);
}
};
export { BunSqliteDialect };
//# sourceMappingURL=bun-sqlite-dialect-C-rWaXX0.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,339 @@
import { d as db, m as match, y as matchParticipant, e as eq, j as teamMember, z as matchParticipantPlayer, g as matchGame, A as matchGameScore, B as matchQueue, x as sql, p as playerRating, k as asc } from './index2-B7hVh_Qf.js';
const MATCH_STATES = {
CREATED: "CREATED",
LOBBY: "LOBBY",
ROLLING: "ROLLING",
PICKING: "PICKING",
PLAYING: "PLAYING",
FINISHED: "FINISHED",
CANCELLED: "CANCELLED"
};
const GAME_STATES = {
PLAYING: "PLAYING",
FINISHED: "FINISHED"
};
async function joinQueue(userId, teamId) {
let rating = await db.query.playerRating.findFirst({
where: eq(playerRating.userId, userId)
});
if (!rating) {
[rating] = await db.insert(playerRating).values({ userId, elo: 1e3 }).returning();
}
const existing = await db.query.matchQueue.findFirst({
where: eq(matchQueue.userId, userId)
});
if (existing) throw new Error("Already in queue");
await db.insert(matchQueue).values({
userId,
teamId,
elo: rating.elo
});
return tryMatchFromQueue();
}
async function leaveQueue(userId) {
await db.delete(matchQueue).where(eq(matchQueue.userId, userId));
}
async function getQueueStatus(userId) {
const entry = await db.query.matchQueue.findFirst({
where: eq(matchQueue.userId, userId)
});
const count = await db.select({ count: sql`count(*)` }).from(matchQueue);
return {
inQueue: !!entry,
queueSize: Number(count[0].count),
joinedAt: entry?.joinedAt ?? null
};
}
async function tryMatchFromQueue() {
const queue = await db.query.matchQueue.findMany({
orderBy: asc(matchQueue.elo)
});
if (queue.length < 2) return null;
let bestPair = null;
let smallestGap = Infinity;
for (let i = 0; i < queue.length - 1; i++) {
const gap = Math.abs(queue[i].elo - queue[i + 1].elo);
if (gap < smallestGap) {
smallestGap = gap;
bestPair = [queue[i], queue[i + 1]];
}
}
if (!bestPair) return null;
const avgElo = (bestPair[0].elo + bestPair[1].elo) / 2;
const selectedPool = await selectMappoolForRating(avgElo);
if (!selectedPool) throw new Error("No mappools available");
await db.delete(matchQueue).where(eq(matchQueue.userId, bestPair[0].userId));
await db.delete(matchQueue).where(eq(matchQueue.userId, bestPair[1].userId));
const created = await createMatch({
name: "Ranked Match",
config: { bestOf: 7, teamSize: 1, scoringType: "score" },
mappoolId: selectedPool.id,
teams: [bestPair[0].teamId, bestPair[1].teamId],
createdBy: "system"
});
return created;
}
async function selectMappoolForRating(avgElo) {
const pools = await db.query.mappool.findMany({
with: { slots: true }
});
if (pools.length === 0) return null;
const targetStars = 3 + (avgElo - 800) / 400 * 4;
const clampedTarget = Math.max(2, Math.min(8, targetStars));
let bestPool = pools[0];
let bestDiff = Infinity;
for (const pool of pools) {
if (pool.slots.length === 0) continue;
const avgStars = pool.slots.reduce((sum, s) => sum + (s.starRating ?? 0), 0) / pool.slots.length;
const diff = Math.abs(avgStars - clampedTarget);
if (diff < bestDiff) {
bestDiff = diff;
bestPool = pool;
}
}
return bestPool;
}
async function createMatch(opts) {
const { name, config, mappoolId, teams, createdBy } = opts;
const [created] = await db.insert(match).values({
name,
config,
mappoolId,
createdBy,
state: MATCH_STATES.CREATED
}).returning();
for (let i = 0; i < teams.length; i++) {
const [participant] = await db.insert(matchParticipant).values({
matchId: created.id,
teamId: teams[i],
slot: i + 1
}).returning();
const members = await db.query.teamMember.findMany({
where: eq(teamMember.teamId, teams[i])
});
for (const member of members) {
await db.insert(matchParticipantPlayer).values({
participantId: participant.id,
userId: member.userId
});
}
}
return getMatchFull(created.id);
}
async function moveToLobby(matchId, osuLobbyId) {
const m = await getMatchOrThrow(matchId);
assertState(m.state, MATCH_STATES.CREATED);
await db.update(match).set({
state: MATCH_STATES.LOBBY,
osuLobbyId: osuLobbyId ?? null,
startedAt: /* @__PURE__ */ new Date()
}).where(eq(match.id, matchId));
return getMatchFull(matchId);
}
async function moveToRolling(matchId) {
const m = await getMatchOrThrow(matchId);
assertState(m.state, MATCH_STATES.LOBBY);
await db.update(match).set({ state: MATCH_STATES.ROLLING }).where(eq(match.id, matchId));
return getMatchFull(matchId);
}
async function submitRoll(matchId, participantId, value) {
const m = await getMatchOrThrow(matchId);
assertState(m.state, MATCH_STATES.ROLLING);
await db.update(matchParticipant).set({ rollValue: value }).where(eq(matchParticipant.id, participantId));
const participants = await db.query.matchParticipant.findMany({
where: eq(matchParticipant.matchId, matchId)
});
const allRolled = participants.every(
(p) => p.id === participantId ? true : p.rollValue !== null
);
if (allRolled) {
const sorted = [...participants].map((p) => ({
...p,
rollValue: p.id === participantId ? value : p.rollValue
})).sort((a, b) => b.rollValue - a.rollValue);
for (let i = 0; i < sorted.length; i++) {
await db.update(matchParticipant).set({ pickOrder: i + 1 }).where(eq(matchParticipant.id, sorted[i].id));
}
await db.update(match).set({ state: MATCH_STATES.PICKING }).where(eq(match.id, matchId));
}
return getMatchFull(matchId);
}
async function pickMap(matchId, participantId, mappoolSlotId) {
const m = await getMatchOrThrow(matchId);
assertState(m.state, MATCH_STATES.PICKING);
const participants = await db.query.matchParticipant.findMany({
where: eq(matchParticipant.matchId, matchId)
});
const totalGames = await db.query.matchGame.findMany({
where: eq(matchGame.matchId, matchId)
});
const expectedPicker = getExpectedPicker(participants, totalGames.length);
if (expectedPicker.id !== participantId) {
throw new Error("Not your turn to pick");
}
const alreadyPlayed = totalGames.some((g) => g.mappoolSlotId === mappoolSlotId);
if (alreadyPlayed) {
throw new Error("This map has already been played");
}
const [game] = await db.insert(matchGame).values({
matchId,
gameNumber: totalGames.length + 1,
mappoolSlotId,
pickedByParticipantId: participantId,
state: GAME_STATES.PLAYING,
startedAt: /* @__PURE__ */ new Date()
}).returning();
await db.update(match).set({ state: MATCH_STATES.PLAYING }).where(eq(match.id, matchId));
return game;
}
async function submitGameScores(matchGameId, scores) {
const game = await db.query.matchGame.findFirst({
where: eq(matchGame.id, matchGameId)
});
if (!game) throw new Error("Game not found");
if (game.state !== GAME_STATES.PLAYING) throw new Error(`Game is ${game.state}, not PLAYING`);
for (const s of scores) {
await db.insert(matchGameScore).values({
matchGameId,
playerId: s.playerId,
score: s.score,
accuracy: s.accuracy ?? 0,
maxCombo: s.maxCombo ?? 0,
count300: s.count300 ?? 0,
count100: s.count100 ?? 0,
count50: s.count50 ?? 0,
countMiss: s.countMiss ?? 0,
mods: s.mods ?? [],
passed: s.passed ?? true
});
}
const allScores = await db.query.matchGameScore.findMany({
where: eq(matchGameScore.matchGameId, matchGameId),
with: { player: true }
});
const participantScores = /* @__PURE__ */ new Map();
for (const s of allScores) {
const pid = s.player.participantId;
participantScores.set(pid, (participantScores.get(pid) ?? 0) + s.score);
}
let winnerId = null;
let highScore = -1;
for (const [pid, total] of participantScores) {
if (total > highScore) {
highScore = total;
winnerId = pid;
}
}
await db.update(matchGame).set({
state: GAME_STATES.FINISHED,
winnerParticipantId: winnerId,
finishedAt: /* @__PURE__ */ new Date()
}).where(eq(matchGame.id, matchGameId));
if (winnerId) {
const participant = await db.query.matchParticipant.findFirst({
where: eq(matchParticipant.id, winnerId)
});
if (participant) {
await db.update(matchParticipant).set({ score: participant.score + 1 }).where(eq(matchParticipant.id, winnerId));
}
}
const m = await getMatchOrThrow(game.matchId);
const config = m.config;
const winsNeeded = Math.ceil(config.bestOf / 2);
const participants = await db.query.matchParticipant.findMany({
where: eq(matchParticipant.matchId, game.matchId)
});
const matchWinner = participants.find((p) => p.score >= winsNeeded);
if (matchWinner) {
await db.update(match).set({
state: MATCH_STATES.FINISHED,
winnerId: matchWinner.teamId,
finishedAt: /* @__PURE__ */ new Date()
}).where(eq(match.id, game.matchId));
await updateElo(participants, matchWinner.id);
} else {
await db.update(match).set({ state: MATCH_STATES.PICKING }).where(eq(match.id, game.matchId));
}
return getMatchFull(game.matchId);
}
async function updateElo(participants, winnerId) {
for (const p of participants) {
const players = await db.query.matchParticipantPlayer.findMany({
where: eq(matchParticipantPlayer.participantId, p.id)
});
const isWinner = p.id === winnerId;
for (const player of players) {
let rating = await db.query.playerRating.findFirst({
where: eq(playerRating.userId, player.userId)
});
if (!rating) {
[rating] = await db.insert(playerRating).values({ userId: player.userId, elo: 1e3 }).returning();
}
const K = 32;
const expected = 0.5;
const actual = isWinner ? 1 : 0;
const newElo = Math.round(rating.elo + K * (actual - expected));
await db.update(playerRating).set({
elo: newElo,
wins: isWinner ? rating.wins + 1 : rating.wins,
losses: isWinner ? rating.losses : rating.losses + 1,
updatedAt: /* @__PURE__ */ new Date()
}).where(eq(playerRating.userId, player.userId));
}
}
}
async function cancelMatch(matchId) {
await db.update(match).set({
state: MATCH_STATES.CANCELLED,
finishedAt: /* @__PURE__ */ new Date()
}).where(eq(match.id, matchId));
return getMatchFull(matchId);
}
function getExpectedPicker(participants, gameCount) {
const sorted = [...participants].sort((a, b) => (a.pickOrder ?? 99) - (b.pickOrder ?? 99));
const pickerIndex = gameCount % sorted.length;
return sorted[pickerIndex];
}
async function getMatchFull(matchId) {
const m = await db.query.match.findFirst({
where: eq(match.id, matchId),
with: {
mappool: {
with: { slots: true }
},
participants: {
with: {
team: true,
players: true
}
},
games: {
with: {
slot: true,
scores: {
with: { player: true }
}
},
orderBy: (g, { asc: asc2 }) => [asc2(g.gameNumber)]
}
}
});
if (!m) throw new Error("Match not found");
return m;
}
async function getMatchOrThrow(matchId) {
const m = await db.query.match.findFirst({
where: eq(match.id, matchId)
});
if (!m) throw new Error("Match not found");
return m;
}
function assertState(current, expected) {
if (current !== expected) {
throw new Error(`Match is ${current}, expected ${expected}`);
}
}
export { MATCH_STATES as M, cancelMatch as a, submitGameScores as b, createMatch as c, moveToRolling as d, getQueueStatus as e, getMatchFull as g, joinQueue as j, leaveQueue as l, moveToLobby as m, pickMap as p, submitRoll as s };
//# sourceMappingURL=engine-DiCmv1C-.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,65 @@
function validator(expected) {
function validate(module, file) {
if (!module) return;
for (const key in module) {
if (key[0] === "_" || expected.has(key)) continue;
const values = [...expected.values()];
const hint = hint_for_supported_files(key, file?.slice(file.lastIndexOf("."))) ?? `valid exports are ${values.join(", ")}, or anything with a '_' prefix`;
throw new Error(`Invalid export '${key}'${file ? ` in ${file}` : ""} (${hint})`);
}
}
return validate;
}
function hint_for_supported_files(key, ext = ".js") {
const supported_files = [];
if (valid_layout_exports.has(key)) {
supported_files.push(`+layout${ext}`);
}
if (valid_page_exports.has(key)) {
supported_files.push(`+page${ext}`);
}
if (valid_layout_server_exports.has(key)) {
supported_files.push(`+layout.server${ext}`);
}
if (valid_page_server_exports.has(key)) {
supported_files.push(`+page.server${ext}`);
}
if (valid_server_exports.has(key)) {
supported_files.push(`+server${ext}`);
}
if (supported_files.length > 0) {
return `'${key}' is a valid export in ${supported_files.slice(0, -1).join(", ")}${supported_files.length > 1 ? " or " : ""}${supported_files.at(-1)}`;
}
}
const valid_layout_exports = /* @__PURE__ */ new Set([
"load",
"prerender",
"csr",
"ssr",
"trailingSlash",
"config"
]);
const valid_page_exports = /* @__PURE__ */ new Set([...valid_layout_exports, "entries"]);
const valid_layout_server_exports = /* @__PURE__ */ new Set([...valid_layout_exports]);
const valid_page_server_exports = /* @__PURE__ */ new Set([...valid_layout_server_exports, "actions", "entries"]);
const valid_server_exports = /* @__PURE__ */ new Set([
"GET",
"POST",
"PATCH",
"PUT",
"DELETE",
"OPTIONS",
"HEAD",
"fallback",
"prerender",
"trailingSlash",
"config",
"entries"
]);
const validate_layout_exports = validator(valid_layout_exports);
const validate_page_exports = validator(valid_page_exports);
const validate_layout_server_exports = validator(valid_layout_server_exports);
const validate_page_server_exports = validator(valid_page_server_exports);
export { validate_layout_exports as a, validate_page_server_exports as b, validate_page_exports as c, validate_layout_server_exports as v };
//# sourceMappingURL=exports-B5ORJhfK.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,31 @@
import { a as auth, s as svelteKitHandler } from './auth-CAP7sZek.js';
import { d as db, e as eq, u as user } from './index2-B7hVh_Qf.js';
import './shared-server-DaWdgxVh.js';
import './root-D12ma0No.js';
import './index3-C4geC3K_.js';
import './utils-D_bK1W85.js';
import './index-B2LGyy1l.js';
import './shared-DWC9PG0H.js';
import './aggregate-CrXc04Dg.js';
import 'postgres';
let building = false;
const handleBetterAuth = async ({ event, resolve }) => {
const session = await auth.api.getSession({ headers: event.request.headers });
if (session) {
event.locals.session = session.session;
const dbUser = await db.query.user.findFirst({
where: eq(user.id, session.user.id)
});
event.locals.user = {
...session.user,
role: dbUser?.role ?? "player"
};
}
return svelteKitHandler({ event, resolve, auth, building });
};
const handle = handleBetterAuth;
export { handle };
//# sourceMappingURL=hooks.server-g13gcBbX.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"hooks.server-g13gcBbX.js","sources":["../../../.svelte-kit/adapter-node/chunks/environment.js","../../../.svelte-kit/adapter-node/entries/hooks.server.js"],"sourcesContent":["let building = false;\nlet prerendering = false;\nfunction set_building() {\n building = true;\n}\nfunction set_prerendering() {\n prerendering = true;\n}\nexport {\n set_prerendering as a,\n building as b,\n prerendering as p,\n set_building as s\n};\n","import { b as building } from \"../chunks/environment.js\";\nimport { a as auth, s as svelteKitHandler } from \"../chunks/auth.js\";\nimport { d as db, u as user } from \"../chunks/index2.js\";\nimport { eq } from \"drizzle-orm\";\nconst handleBetterAuth = async ({ event, resolve }) => {\n const session = await auth.api.getSession({ headers: event.request.headers });\n if (session) {\n event.locals.session = session.session;\n const dbUser = await db.query.user.findFirst({\n where: eq(user.id, session.user.id)\n });\n event.locals.user = {\n ...session.user,\n role: dbUser?.role ?? \"player\"\n };\n }\n return svelteKitHandler({ event, resolve, auth, building });\n};\nconst handle = handleBetterAuth;\nexport {\n handle\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAAA,IAAI,QAAQ,GAAG,KAAK;;ACIpB,MAAM,gBAAgB,GAAG,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK;AACvD,EAAE,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;AAC/E,EAAE,IAAI,OAAO,EAAE;AACf,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO;AAC1C,IAAI,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;AACjD,MAAM,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE;AACxC,KAAK,CAAC;AACN,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,GAAG;AACxB,MAAM,GAAG,OAAO,CAAC,IAAI;AACrB,MAAM,IAAI,EAAE,MAAM,EAAE,IAAI,IAAI;AAC5B,KAAK;AACL,EAAE;AACF,EAAE,OAAO,gBAAgB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAC7D,CAAC;AACI,MAAC,MAAM,GAAG;;;;"}

View File

@@ -0,0 +1,247 @@
/** @import { StandardSchemaV1 } from '@standard-schema/spec' */
class HttpError {
/**
* @param {number} status
* @param {{message: string} extends App.Error ? (App.Error | string | undefined) : App.Error} body
*/
constructor(status, body) {
this.status = status;
if (typeof body === 'string') {
this.body = { message: body };
} else if (body) {
this.body = body;
} else {
this.body = { message: `Error: ${status}` };
}
}
toString() {
return JSON.stringify(this.body);
}
}
class Redirect {
/**
* @param {300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308} status
* @param {string} location
*/
constructor(status, location) {
this.status = status;
this.location = location;
}
}
/**
* An error that was thrown from within the SvelteKit runtime that is not fatal and doesn't result in a 500, such as a 404.
* `SvelteKitError` goes through `handleError`.
* @extends Error
*/
class SvelteKitError extends Error {
/**
* @param {number} status
* @param {string} text
* @param {string} message
*/
constructor(status, text, message) {
super(message);
this.status = status;
this.text = text;
}
}
/**
* @template [T=undefined]
*/
class ActionFailure {
/**
* @param {number} status
* @param {T} data
*/
constructor(status, data) {
this.status = status;
this.data = data;
}
}
const text_encoder = new TextEncoder();
new TextDecoder();
/** @import { StandardSchemaV1 } from '@standard-schema/spec' */
// TODO 3.0: remove these types as they are not used anymore (we can't remove them yet because that would be a breaking change)
/**
* @template {number} TNumber
* @template {any[]} [TArray=[]]
* @typedef {TNumber extends TArray['length'] ? TArray[number] : LessThan<TNumber, [...TArray, TArray['length']]>} LessThan
*/
/**
* @template {number} TStart
* @template {number} TEnd
* @typedef {Exclude<TEnd | LessThan<TEnd>, LessThan<TStart>>} NumericRange
*/
// Keep the status codes as `number` because restricting to certain numbers makes it unnecessarily hard to use compared to the benefits
// (we have runtime errors already to check for invalid codes). Also see https://github.com/sveltejs/kit/issues/11780
// we have to repeat the JSDoc because the display for function overloads is broken
// see https://github.com/microsoft/TypeScript/issues/55056
/**
* Throws an error with a HTTP status code and an optional message.
* When called during request handling, this will cause SvelteKit to
* return an error response without invoking `handleError`.
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
* @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
* @param {App.Error} body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
* @overload
* @param {number} status
* @param {App.Error} body
* @return {never}
* @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
* @throws {Error} If the provided status is invalid (not between 400 and 599).
*/
/**
* Throws an error with a HTTP status code and an optional message.
* When called during request handling, this will cause SvelteKit to
* return an error response without invoking `handleError`.
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
* @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
* @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} [body] An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
* @overload
* @param {number} status
* @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} [body]
* @return {never}
* @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
* @throws {Error} If the provided status is invalid (not between 400 and 599).
*/
/**
* Throws an error with a HTTP status code and an optional message.
* When called during request handling, this will cause SvelteKit to
* return an error response without invoking `handleError`.
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
* @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
* @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
* @return {never}
* @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
* @throws {Error} If the provided status is invalid (not between 400 and 599).
*/
function error(status, body) {
if ((isNaN(status) || status < 400 || status > 599)) {
throw new Error(`HTTP error status codes must be between 400 and 599 — ${status} is invalid`);
}
throw new HttpError(status, body);
}
/**
* Redirect a request. When called during request handling, SvelteKit will return a redirect response.
* Make sure you're not catching the thrown redirect, which would prevent SvelteKit from handling it.
*
* Most common status codes:
* * `303 See Other`: redirect as a GET request (often used after a form POST request)
* * `307 Temporary Redirect`: redirect will keep the request method
* * `308 Permanent Redirect`: redirect will keep the request method, SEO will be transferred to the new page
*
* [See all redirect status codes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages)
*
* @param {300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | ({} & number)} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages). Must be in the range 300-308.
* @param {string | URL} location The location to redirect to.
* @throws {Redirect} This error instructs SvelteKit to redirect to the specified location.
* @throws {Error} If the provided status is invalid.
* @return {never}
*/
function redirect(status, location) {
if ((isNaN(status) || status < 300 || status > 308)) {
throw new Error('Invalid status code');
}
throw new Redirect(
// @ts-ignore
status,
location.toString()
);
}
/**
* Create a JSON `Response` object from the supplied data.
* @param {any} data The value that will be serialized as JSON.
* @param {ResponseInit} [init] Options such as `status` and `headers` that will be added to the response. `Content-Type: application/json` and `Content-Length` headers will be added automatically.
*/
function json(data, init) {
// TODO deprecate this in favour of `Response.json` when it's
// more widely supported
const body = JSON.stringify(data);
// we can't just do `text(JSON.stringify(data), init)` because
// it will set a default `content-type` header. duplicated code
// means less duplicated work
const headers = new Headers(init?.headers);
if (!headers.has('content-length')) {
headers.set('content-length', text_encoder.encode(body).byteLength.toString());
}
if (!headers.has('content-type')) {
headers.set('content-type', 'application/json');
}
return new Response(body, {
...init,
headers
});
}
/**
* Create a `Response` object from the supplied body.
* @param {string} body The value that will be used as-is.
* @param {ResponseInit} [init] Options such as `status` and `headers` that will be added to the response. A `Content-Length` header will be added automatically.
*/
function text(body, init) {
const headers = new Headers(init?.headers);
if (!headers.has('content-length')) {
const encoded = text_encoder.encode(body);
headers.set('content-length', encoded.byteLength.toString());
return new Response(encoded, {
...init,
headers
});
}
return new Response(body, {
...init,
headers
});
}
/**
* Create an `ActionFailure` object. Call when form submission fails.
* @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
* @overload
* @param {number} status
* @returns {import('./public.js').ActionFailure<undefined>}
*/
/**
* Create an `ActionFailure` object. Call when form submission fails.
* @template [T=undefined]
* @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
* @param {T} data Data associated with the failure (e.g. validation errors)
* @overload
* @param {number} status
* @param {T} data
* @returns {import('./public.js').ActionFailure<T>}
*/
/**
* Create an `ActionFailure` object. Call when form submission fails.
* @param {number} status
* @param {any} [data]
* @returns {import('./public.js').ActionFailure<any>}
*/
function fail(status, data) {
// @ts-expect-error unique symbol missing
return new ActionFailure(status, data);
}
export { ActionFailure as A, HttpError as H, Redirect as R, SvelteKitError as S, error as e, fail as f, json as j, redirect as r, text as t };
//# sourceMappingURL=index-B2LGyy1l.js.map

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More