hashquiz 1.0.0-beta.12 → 1.0.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -49,17 +49,28 @@ from the environment:
|
|
|
49
49
|
| `HASHQUIZ_PLAYER_URL` | Optional player URL for the host's solo links (default: same origin) |
|
|
50
50
|
| `HASHQUIZ_SITE_URL` | Public URL of the site (e.g. `https://hashquiz.ai`): canonical, `og:url`, absolute `og:image`, sitemap line of `robots.txt` |
|
|
51
51
|
| `HASHQUIZ_LANG` | `<html lang>` of the player page, e.g. `fr` (default `en`) |
|
|
52
|
-
| `HASHQUIZ_INDEXABLE` | `true` lets search engines index the player page
|
|
52
|
+
| `HASHQUIZ_INDEXABLE` | `true` lets search engines index the player page and the host pages `/host/` and `/host/tag/<tag>` (default: `noindex`) |
|
|
53
53
|
| `HASHQUIZ_CATALOG` | `true` writes the public quiz catalogue (below). Off by default: each deploy decides to list its decks |
|
|
54
54
|
|
|
55
55
|
### Search engines and link previews
|
|
56
56
|
|
|
57
57
|
The player page ships a description, Open Graph tags and a 1200×630 `og.png`, a web app manifest and its icons.
|
|
58
|
-
`build` also writes a `robots.txt` that keeps `/host` out of search engines
|
|
58
|
+
`build` also writes a `robots.txt` that keeps `/host` out of search engines, except its list and tag pages with
|
|
59
|
+
`HASHQUIZ_INDEXABLE=true` (`Allow: /host/$`, `Allow: /host/tag/`; the app's scripts stay disallowed, so crawlers
|
|
60
|
+
index the static HTML).
|
|
61
|
+
|
|
62
|
+
The host list `/host/` and the host tag pages `/host/tag/<tag>` (`host/tag/<slug>/index.html`, slug as in the
|
|
63
|
+
catalogue: `Gen AI` → `gen-ai`) carry their title, description and the deck titles and descriptions in the HTML,
|
|
64
|
+
readable without JavaScript; never a question. Tag pages are files, so the links open on any static host without a
|
|
65
|
+
rewrite rule. They are `noindex` unless `HASHQUIZ_INDEXABLE=true`; game screens are states of the same app, never
|
|
66
|
+
pages of their own. Old `/host/#/tag/<tag>` links are rewritten in place.
|
|
67
|
+
|
|
68
|
+
With `HASHQUIZ_SITE_URL` set, `build` writes a `sitemap.xml` of the indexable pages: the home page and the host
|
|
69
|
+
pages with `HASHQUIZ_INDEXABLE=true`, the catalogue pages with `HASHQUIZ_CATALOG=true`.
|
|
59
70
|
|
|
60
71
|
Files in `public/` (or the folder given with `--public`) are copied to the site root last, so a decks repository
|
|
61
72
|
can add `llms.txt` or `sitemap.xml`, or replace `og.png` and `robots.txt`. The `Sitemap:` line of the generated
|
|
62
|
-
`robots.txt` appears
|
|
73
|
+
`robots.txt` appears when there is a `sitemap.xml` (generated or in `public/`) and `HASHQUIZ_SITE_URL` is set.
|
|
63
74
|
With `HASHQUIZ_CATALOG=true`, `build` also writes a public catalogue in plain HTML, readable by search engines and
|
|
64
75
|
AI assistants without JavaScript:
|
|
65
76
|
|
|
@@ -69,7 +80,7 @@ AI assistants without JavaScript:
|
|
|
69
80
|
| `/quiz/<slug>/` | One deck: description, author, tags, difficulty, links to host it and play it solo (`solo: true`) |
|
|
70
81
|
| `/quiz/tag/<tag>/` | The decks carrying a tag |
|
|
71
82
|
| `/404.html` | Not-found page linking to the catalogue |
|
|
72
|
-
| `/sitemap.xml` | Every catalogue page, when `HASHQUIZ_SITE_URL` is set (a `public/sitemap.xml` replaces it) |
|
|
83
|
+
| `/sitemap.xml` | Every catalogue page (with the other indexable pages above), when `HASHQUIZ_SITE_URL` is set (a `public/sitemap.xml` replaces it) |
|
|
73
84
|
|
|
74
85
|
No page shows a question or an answer. The pages carry JSON-LD (`ItemList`, `Quiz`, `BreadcrumbList`).
|
|
75
86
|
The slug comes from the deck folder (`decks/docker-basics/index.hashquiz.md` → `docker-basics`).
|
package/bin/hashquiz.js
CHANGED
|
@@ -4553,6 +4553,7 @@ function deckSlug(id) {
|
|
|
4553
4553
|
const path = id.replace(/(^|\/)index\.hashquiz\.md$/, "").replace(/\.hashquiz\.md$/, "");
|
|
4554
4554
|
return path.split("/").map(slugify).filter(Boolean).join("/") || "quiz";
|
|
4555
4555
|
}
|
|
4556
|
+
var tagSlug = (tag) => slugify(tag) || encodeURIComponent(tag.toLowerCase());
|
|
4556
4557
|
function deckSlugs(ids) {
|
|
4557
4558
|
const used = new Set;
|
|
4558
4559
|
const slugs = new Map;
|
|
@@ -5470,7 +5471,13 @@ function applySeo(html, settings) {
|
|
|
5470
5471
|
return out;
|
|
5471
5472
|
}
|
|
5472
5473
|
function renderRobots(settings, hasSitemap) {
|
|
5473
|
-
const lines = [
|
|
5474
|
+
const lines = [
|
|
5475
|
+
"# Written by `hashquiz build`. Ship your own public/robots.txt to replace it.",
|
|
5476
|
+
"User-agent: *",
|
|
5477
|
+
...settings.indexable ? ["Allow: /host/$", "Allow: /host/tag/"] : [],
|
|
5478
|
+
"Disallow: /host",
|
|
5479
|
+
""
|
|
5480
|
+
];
|
|
5474
5481
|
if (hasSitemap && settings.siteUrl)
|
|
5475
5482
|
lines.push(`Sitemap: ${settings.siteUrl}/sitemap.xml`, "");
|
|
5476
5483
|
return lines.join(`
|
|
@@ -5519,8 +5526,6 @@ var TEXT = {
|
|
|
5519
5526
|
function catalogEnabled(env) {
|
|
5520
5527
|
return ["1", "true", "yes"].includes((env.HASHQUIZ_CATALOG ?? "").trim().toLowerCase());
|
|
5521
5528
|
}
|
|
5522
|
-
var slugify2 = (s) => s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
5523
|
-
var tagSlug = (tag) => slugify2(tag) || encodeURIComponent(tag.toLowerCase());
|
|
5524
5529
|
function catalogDecks(entries) {
|
|
5525
5530
|
const slugs = deckSlugs(entries.map((e) => e.id));
|
|
5526
5531
|
return entries.map(({ id, content }) => ({ id, slug: slugs.get(id), quiz: parseQuizFile(content) })).sort((a, b) => (a.quiz.meta.title || a.id).localeCompare(b.quiz.meta.title || b.id));
|
|
@@ -5642,8 +5647,22 @@ function quizLd(ctx, d, path) {
|
|
|
5642
5647
|
...meta.author && { author: { "@type": "Person", name: meta.author } }
|
|
5643
5648
|
};
|
|
5644
5649
|
}
|
|
5650
|
+
var tagDescription = (lang, label, tagged) => `${TEXT[lang].tag(label)} : ${tagged.map((d) => d.quiz.meta.title || d.id).join(", ")}`;
|
|
5651
|
+
function decksByTag(decks) {
|
|
5652
|
+
const byTag = new Map;
|
|
5653
|
+
for (const d of decks) {
|
|
5654
|
+
for (const tag of new Set(d.quiz.meta.tags)) {
|
|
5655
|
+
const key = tagSlug(tag);
|
|
5656
|
+
const entry = byTag.get(key) ?? { label: tag, decks: [] };
|
|
5657
|
+
entry.decks.push(d);
|
|
5658
|
+
byTag.set(key, entry);
|
|
5659
|
+
}
|
|
5660
|
+
}
|
|
5661
|
+
return byTag;
|
|
5662
|
+
}
|
|
5663
|
+
var langOf = (seo) => seo.lang?.toLowerCase().startsWith("fr") ? "fr" : "en";
|
|
5645
5664
|
function renderCatalog(decks, seo) {
|
|
5646
|
-
const lang = seo
|
|
5665
|
+
const lang = langOf(seo);
|
|
5647
5666
|
const ctx = { lang, langTag: seo.lang ?? "en", ...seo.siteUrl && { siteUrl: seo.siteUrl } };
|
|
5648
5667
|
const t = TEXT[lang];
|
|
5649
5668
|
const files = [];
|
|
@@ -5697,16 +5716,7 @@ ${actions}`,
|
|
|
5697
5716
|
})
|
|
5698
5717
|
});
|
|
5699
5718
|
}
|
|
5700
|
-
const
|
|
5701
|
-
for (const d of decks) {
|
|
5702
|
-
for (const tag of new Set(d.quiz.meta.tags)) {
|
|
5703
|
-
const key = tagSlug(tag);
|
|
5704
|
-
const entry = byTag.get(key) ?? { label: tag, decks: [] };
|
|
5705
|
-
entry.decks.push(d);
|
|
5706
|
-
byTag.set(key, entry);
|
|
5707
|
-
}
|
|
5708
|
-
}
|
|
5709
|
-
for (const [key, { label, decks: tagged }] of byTag) {
|
|
5719
|
+
for (const [key, { label, decks: tagged }] of decksByTag(decks)) {
|
|
5710
5720
|
const path = `/quiz/tag/${key}/`;
|
|
5711
5721
|
const c = crumbs(ctx, [home, { name: `#${label}`, path }]);
|
|
5712
5722
|
files.push({
|
|
@@ -5714,7 +5724,7 @@ ${actions}`,
|
|
|
5714
5724
|
content: page(ctx, {
|
|
5715
5725
|
path,
|
|
5716
5726
|
title: `${t.tag(label)} \xB7 HashQuiz`,
|
|
5717
|
-
description:
|
|
5727
|
+
description: tagDescription(lang, label, tagged),
|
|
5718
5728
|
body: `${c.html}
|
|
5719
5729
|
<h1>${esc(t.tag(label))}</h1>
|
|
5720
5730
|
<ul class="grid">${tagged.map((d) => deckCard(ctx, d)).join(`
|
|
@@ -5736,22 +5746,12 @@ ${actions}`,
|
|
|
5736
5746
|
}).replace('<meta name="theme-color"', `<meta name="robots" content="noindex">
|
|
5737
5747
|
<meta name="theme-color"`)
|
|
5738
5748
|
});
|
|
5739
|
-
if (seo.siteUrl) {
|
|
5740
|
-
const urls = files.filter((f) => f.path.endsWith("index.html")).map((f) => `${seo.siteUrl}/${f.path.replace(/index\.html$/, "").split("/").map(encodeURIComponent).join("/")}`);
|
|
5741
|
-
files.push({
|
|
5742
|
-
path: "sitemap.xml",
|
|
5743
|
-
content: `<?xml version="1.0" encoding="UTF-8"?>
|
|
5744
|
-
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
5745
|
-
${urls.map((u) => ` <url><loc>${esc(u)}</loc></url>`).join(`
|
|
5746
|
-
`)}
|
|
5747
|
-
</urlset>
|
|
5748
|
-
`
|
|
5749
|
-
});
|
|
5750
|
-
}
|
|
5751
5749
|
return files;
|
|
5752
5750
|
}
|
|
5753
5751
|
function writeCatalog(outDir, entries, seo) {
|
|
5754
|
-
|
|
5752
|
+
return writeFiles(outDir, renderCatalog(catalogDecks(entries), seo));
|
|
5753
|
+
}
|
|
5754
|
+
function writeFiles(outDir, files) {
|
|
5755
5755
|
for (const f of files) {
|
|
5756
5756
|
const target = resolve5(outDir, f.path);
|
|
5757
5757
|
mkdirSync2(dirname3(target), { recursive: true });
|
|
@@ -5759,6 +5759,65 @@ function writeCatalog(outDir, entries, seo) {
|
|
|
5759
5759
|
}
|
|
5760
5760
|
return files.map((f) => f.path);
|
|
5761
5761
|
}
|
|
5762
|
+
function renderHostPages(hostHtml, entries, seo) {
|
|
5763
|
+
const lang = langOf(seo);
|
|
5764
|
+
const t = TEXT[lang];
|
|
5765
|
+
const decks = catalogDecks(entries);
|
|
5766
|
+
const byTag = decksByTag(decks);
|
|
5767
|
+
const cards = (list) => `<ul>${list.map((d) => `<li><h2>${esc(d.quiz.meta.title || d.id)}</h2>${d.quiz.meta.description ? `<p>${esc(d.quiz.meta.description.trim())}</p>` : ""}</li>`).join("")}</ul>`;
|
|
5768
|
+
const hostPage = (o) => {
|
|
5769
|
+
const url = seo.siteUrl ? `${seo.siteUrl}${o.path}` : null;
|
|
5770
|
+
const head = [
|
|
5771
|
+
`<meta property="og:type" content="website">`,
|
|
5772
|
+
`<meta property="og:site_name" content="HashQuiz">`,
|
|
5773
|
+
`<meta property="og:title" content="${esc(o.title)}">`,
|
|
5774
|
+
`<meta property="og:description" content="${esc(o.description)}">`,
|
|
5775
|
+
...url ? [`<link rel="canonical" href="${esc(url)}">`, `<meta property="og:url" content="${esc(url)}">`] : []
|
|
5776
|
+
].map((l) => ` ${l}
|
|
5777
|
+
`).join("");
|
|
5778
|
+
let html = hostHtml.replace(/<title>[^<]*<\/title>/, `<title>${esc(o.title)}</title>`).replace(/<meta name="description" content="[^"]*">/, `<meta name="description" content="${esc(o.description)}">`).replace("</head>", `${head}</head>`).replace('<div id="app"></div>', `<div id="app"><main>${o.body}</main></div>`);
|
|
5779
|
+
if (seo.lang)
|
|
5780
|
+
html = html.replace(/<html lang="[^"]*">/, `<html lang="${esc(seo.lang)}">`);
|
|
5781
|
+
if (seo.indexable)
|
|
5782
|
+
html = html.replace(/[ \t]*<!--[^>]*-->\n(?=[ \t]*<meta name="robots")/, "").replace(/[ \t]*<meta name="robots" content="[^"]*">\n?/, "");
|
|
5783
|
+
return { path: `${o.path.slice(1).replace(/\/?$/, "/")}index.html`, content: html };
|
|
5784
|
+
};
|
|
5785
|
+
const tagLinks = [...byTag].map(([key, { label }]) => `<li><a href="/host/tag/${key}">#${esc(label)}</a></li>`).join("");
|
|
5786
|
+
const files = [
|
|
5787
|
+
hostPage({
|
|
5788
|
+
path: "/host/",
|
|
5789
|
+
title: `${t.catalogTitle} \xB7 HashQuiz`,
|
|
5790
|
+
description: t.catalogIntro,
|
|
5791
|
+
body: `<h1>${esc(t.catalogTitle)}</h1><p>${esc(t.catalogIntro)}</p>${cards(decks)}${tagLinks ? `<ul>${tagLinks}</ul>` : ""}`
|
|
5792
|
+
})
|
|
5793
|
+
];
|
|
5794
|
+
for (const [key, { label, decks: tagged }] of byTag) {
|
|
5795
|
+
files.push(hostPage({
|
|
5796
|
+
path: `/host/tag/${key}`,
|
|
5797
|
+
title: `${t.tag(label)} \xB7 HashQuiz`,
|
|
5798
|
+
description: tagDescription(lang, label, tagged),
|
|
5799
|
+
body: `<a href="/host/">\u2190 ${esc(t.catalogTitle)}</a><h1>#${esc(label)}</h1>${cards(tagged)}`
|
|
5800
|
+
}));
|
|
5801
|
+
}
|
|
5802
|
+
return files;
|
|
5803
|
+
}
|
|
5804
|
+
function renderSitemap(siteUrl, paths) {
|
|
5805
|
+
const urls = paths.map((p) => `${siteUrl}${p.split("/").map((s) => encodeURIComponent(decodeURIComponentSafe(s))).join("/")}`);
|
|
5806
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
5807
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
5808
|
+
${urls.map((u) => ` <url><loc>${esc(u)}</loc></url>`).join(`
|
|
5809
|
+
`)}
|
|
5810
|
+
</urlset>
|
|
5811
|
+
`;
|
|
5812
|
+
}
|
|
5813
|
+
function decodeURIComponentSafe(s) {
|
|
5814
|
+
try {
|
|
5815
|
+
return decodeURIComponent(s);
|
|
5816
|
+
} catch {
|
|
5817
|
+
return s;
|
|
5818
|
+
}
|
|
5819
|
+
}
|
|
5820
|
+
var pagePath = (file) => file.startsWith("host/tag/") ? `/${file.replace(/\/index\.html$/, "")}` : `/${file.replace(/index\.html$/, "")}`;
|
|
5762
5821
|
|
|
5763
5822
|
// packages/server/src/build.ts
|
|
5764
5823
|
function buildSite({ decksDir, outDir, publicDir, env = process.env }) {
|
|
@@ -5803,20 +5862,22 @@ function buildSite({ decksDir, outDir, publicDir, env = process.env }) {
|
|
|
5803
5862
|
mkdirSync3(out, { recursive: true });
|
|
5804
5863
|
cpSync(web, out, { recursive: true });
|
|
5805
5864
|
const hasPublic = existsSync4(publicAbs) && statSync3(publicAbs).isDirectory();
|
|
5865
|
+
const themed = hasPublic && existsSync4(resolve6(publicAbs, THEME_FILE));
|
|
5866
|
+
const page = (html) => themed ? linkTheme(html) : html;
|
|
5867
|
+
const hostHtml = resolve6(out, "host/index.html");
|
|
5868
|
+
const hostPages = writeFiles(out, renderHostPages(page(readFileSync3(hostHtml, "utf-8")), decks, seo));
|
|
5806
5869
|
const catalog = catalogEnabled(env) ? writeCatalog(out, decks, seo) : [];
|
|
5807
|
-
const
|
|
5870
|
+
const indexed = [...seo.indexable ? ["index.html", ...hostPages] : [], ...catalog.filter((f) => f.endsWith("index.html"))];
|
|
5871
|
+
if (seo.siteUrl && indexed.length)
|
|
5872
|
+
writeFileSync2(resolve6(out, "sitemap.xml"), renderSitemap(seo.siteUrl, indexed.map(pagePath)));
|
|
5873
|
+
const hasSitemap = existsSync4(resolve6(out, "sitemap.xml")) || hasPublic && existsSync4(resolve6(publicAbs, "sitemap.xml"));
|
|
5808
5874
|
writeFileSync2(resolve6(out, "robots.txt"), renderRobots(seo, hasSitemap));
|
|
5809
5875
|
if (hasPublic)
|
|
5810
5876
|
cpSync(publicAbs, out, { recursive: true });
|
|
5811
5877
|
const playerHtml = resolve6(out, "index.html");
|
|
5812
|
-
const themed = hasPublic && existsSync4(resolve6(publicAbs, THEME_FILE));
|
|
5813
|
-
const page = (html) => themed ? linkTheme(html) : html;
|
|
5814
5878
|
const playerPage = page(applySeo(readFileSync3(playerHtml, "utf-8"), seo));
|
|
5815
5879
|
writeFileSync2(playerHtml, playerPage);
|
|
5816
5880
|
writeSoloPages(out, playerPage, soloIds, deckSlugs(decks.map((d) => d.id)));
|
|
5817
|
-
const hostHtml = resolve6(out, "host/index.html");
|
|
5818
|
-
if (themed)
|
|
5819
|
-
writeFileSync2(hostHtml, page(readFileSync3(hostHtml, "utf-8")));
|
|
5820
5881
|
const manifest = JSON.stringify(decks);
|
|
5821
5882
|
writeFileSync2(resolve6(out, "host/decks.json"), manifest);
|
|
5822
5883
|
writeFileSync2(resolve6(out, "decks.json"), manifest);
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.expo
|
|
|
5
5
|
The chosen QR Code version cannot contain this amount of data.
|
|
6
6
|
Minimum version required to store current data is: `+l+`.
|
|
7
7
|
`);let u=be(n,r,s),h=new a(t.getSymbolSize(n));return E(h,n),D(h),O(h,n),ne(h,r,0),n>=7&&N(h,n),re(h,u),isNaN(o)&&(o=c.getBestMask(h,ne.bind(null,h,r))),c.applyMask(o,h),ne(h,r,o),{modules:h,version:n,errorCorrectionLevel:r,maskPattern:o,segments:s}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let a=n.M,o,s;return r!==void 0&&(a=n.from(r.errorCorrectionLevel,n.M),o=d.from(r.version),s=c.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),Fe(e,o,a,s)}})),require_utils$1=__commonJSMin((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||(e.color={});let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,a=e.scale||4;return{width:r,scale:r?4:a,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let a=n.modules.size,o=n.modules.data,s=e.getScale(a,r),c=Math.floor((a+r.margin*2)*s),l=r.margin*s,u=[r.color.light,r.color.dark];for(let e=0;e<c;e++)for(let n=0;n<c;n++){let d=(e*c+n)*4,h=r.color.light;if(e>=l&&n>=l&&e<c-l&&n<c-l){let t=Math.floor((e-l)/s),r=Math.floor((n-l)/s);h=u[+!!o[t*a+r]]}t[d++]=h.r,t[d++]=h.g,t[d++]=h.b,t[d]=h.a}}})),require_canvas=__commonJSMin((e=>{var t=require_utils$1();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,a,o){let s=o,c=a;s!==void 0||a&&a.getContext||(s=a,a=void 0),a||(c=r()),s=t.getOptions(s);let l=t.getImageWidth(e.modules.size,s),u=c.getContext(`2d`),d=u.createImageData(l,l);return t.qrToImageData(d.data,e,s),n(u,c,l),u.putImageData(d,0,0),c},e.renderToDataURL=function(t,n,r){let a=r;a!==void 0||n&&n.getContext||(a=n,n=void 0),a||={};let o=e.render(t,n,a),s=a.type||`image/png`,c=a.rendererOpts||{};return o.toDataURL(s,c.quality)}})),require_svg_tag=__commonJSMin((e=>{var t=require_utils$1();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function a(e,t,n){let a=``,o=0,s=!1,c=0;for(let l=0;l<e.length;l++){let u=Math.floor(l%t),d=Math.floor(l/t);!u&&!s&&(s=!0),e[l]?(c++,l>0&&u>0&&e[l-1]||(a+=s?r(`M`,u+n,.5+d+n):r(`m`,o,0),o=0,s=!1),u+1<t&&e[l+1]||(a+=r(`h`,c),c=0)):o++}return a}e.render=function(e,r,o){let s=t.getOptions(r),c=e.modules.size,l=e.modules.data,u=c+s.margin*2,d=s.color.light.a?`<path `+n(s.color.light,`fill`)+` d="M0 0h`+u+`v`+u+`H0z"/>`:``,h=`<path `+n(s.color.dark,`stroke`)+` d="`+a(l,c,s.margin)+`"/>`,g=`viewBox="0 0 `+u+` `+u+`"`,w=`<svg xmlns="http://www.w3.org/2000/svg" `+(s.width?`width="`+s.width+`" height="`+s.width+`" `:``)+g+` shape-rendering="crispEdges">`+d+h+`</svg>
|
|
8
|
-
`;return typeof o==`function`&&o(null,w),w}})),require_browser=__commonJSMin((e=>{var t=require_can_promise(),n=require_qrcode(),r=require_canvas(),a=require_svg_tag();function o(e,r,a,o,s){let c=[].slice.call(arguments,1),l=c.length,u=typeof c[l-1]==`function`;if(!u&&!t())throw Error(`Callback required as last argument`);if(u){if(l<2)throw Error(`Too few arguments provided`);l===2?(s=a,a=r,r=o=void 0):l===3&&(r.getContext&&s===void 0?(s=o,o=void 0):(s=o,o=a,a=r,r=void 0))}else{if(l<1)throw Error(`Too few arguments provided`);return l===1?(a=r,r=o=void 0):l===2&&!r.getContext&&(o=a,a=r,r=void 0),new Promise(function(t,s){try{t(e(n.create(a,o),r,o))}catch(e){s(e)}})}try{let t=n.create(a,o);s(null,e(t,r,o))}catch(e){s(e)}}e.create=n.create,e.toCanvas=o.bind(null,r.render),e.toDataURL=o.bind(null,r.renderToDataURL),e.toString=o.bind(null,function(e,t,n){return a.render(e,n)})})),import_browser=__toESM(require_browser(),1),QrCode_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`QrCode`,props:{value:{},size:{}},setup(e){let t=e,n=ref();return watchEffect(async()=>{if(!n.value||!t.value)return;let e=getComputedStyle(document.documentElement),r=e.getPropertyValue(`--hq-qr-dark`).trim(),a=e.getPropertyValue(`--hq-qr-light`).trim();await import_browser.toCanvas(n.value,t.value,{width:t.size??200,margin:1,color:{dark:r,light:a}})}),(e,t)=>(openBlock(),createElementBlock(`canvas`,{ref_key:`canvasEl`,ref:n,class:`hq-qr`},null,512))}}),QrCode_default=_plugin_vue_export_helper_default(QrCode_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-7ecbb7cc`]]),_hoisted_1$8={class:`diff-bar`},_hoisted_2$8={class:`diff-bar__track hq-steps`},_hoisted_3$6={class:`diff-bar__legend`},DifficultyBar_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`DifficultyBar`,props:{distribution:{}},setup(e){return(t,n)=>(openBlock(),createElementBlock(`div`,_hoisted_1$8,[createBaseVNode(`div`,_hoisted_2$8,[createBaseVNode(`div`,{class:`diff-bar__seg diff-bar__seg--easy`,style:normalizeStyle({width:e.distribution.easy+`%`})},null,4),createBaseVNode(`div`,{class:`diff-bar__seg diff-bar__seg--medium`,style:normalizeStyle({width:e.distribution.medium+`%`})},null,4),createBaseVNode(`div`,{class:`diff-bar__seg diff-bar__seg--hard`,style:normalizeStyle({width:e.distribution.hard+`%`})},null,4)]),createBaseVNode(`p`,_hoisted_3$6,[n[0]||=createBaseVNode(`span`,{class:`diff-bar__dot diff-bar__dot--easy`},null,-1),createTextVNode(`facile `+toDisplayString(e.distribution.easy)+`% `,1),n[1]||=createBaseVNode(`span`,{class:`diff-bar__dot diff-bar__dot--medium`},null,-1),createTextVNode(`moyen `+toDisplayString(e.distribution.medium)+`% `,1),n[2]||=createBaseVNode(`span`,{class:`diff-bar__dot diff-bar__dot--hard`},null,-1),createTextVNode(`difficile `+toDisplayString(e.distribution.hard)+`% `,1)])]))}}),DifficultyBar_default=_plugin_vue_export_helper_default(DifficultyBar_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-a3903778`]]),_hoisted_1$7={key:0,class:`qip__labels`},_hoisted_2$7={key:0,class:`qip__badge`},_hoisted_3$5={key:1,class:`qip__label`},_hoisted_4$5={class:`qip__header`},_hoisted_5$4={class:`qip__title`},_hoisted_6$4={class:`qip__content`},_hoisted_7$4={key:0,class:`qip__tags`},_hoisted_8$4={key:1,class:`qip__description`},_hoisted_9$4={class:`qip__metrics`},_hoisted_10$4={class:`qip__metric`},_hoisted_11$4={key:0},_hoisted_12$4={key:0,class:`qip__metric`},_hoisted_13$4={key:1,class:`qip__metric`},_hoisted_14$3={key:2,class:`qip__metric`},QuizInfoPanel_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`QuizInfoPanel`,props:{quizInfo:{},playerCount:{},playCount:{},compact:{type:Boolean}},setup(e){let t=e,n={easy:`FACILE`,medium:`MOYEN`,hard:`DIFFICILE`},r=computed(()=>{let e=t.quizInfo.poolSize;return e!==void 0&&e>t.quizInfo.totalQuestions?e:null});return(t,a)=>(openBlock(),createElementBlock(`div`,{class:normalizeClass([`qip`,{"qip--compact":e.compact}])},[e.quizInfo.oneShoot!==void 0||e.quizInfo.randomDraw!==void 0?(openBlock(),createElementBlock(`div`,_hoisted_1$7,[e.quizInfo.oneShoot===void 0?createCommentVNode(``,!0):(openBlock(),createElementBlock(`span`,_hoisted_2$7,toDisplayString(e.quizInfo.oneShoot?`⚡ Réponse unique`:`✏️ Réponses modifiables`),1)),e.quizInfo.randomDraw===void 0?createCommentVNode(``,!0):(openBlock(),createElementBlock(`span`,_hoisted_3$5,toDisplayString(e.quizInfo.randomDraw?`🎲 Tirage aléatoire`:`📋 Liste fixe`),1))])):createCommentVNode(``,!0),createBaseVNode(`div`,_hoisted_4$5,[createBaseVNode(`h2`,_hoisted_5$4,toDisplayString(e.quizInfo.title),1),e.quizInfo.targetDifficulty?(openBlock(),createElementBlock(`span`,{key:0,class:normalizeClass([`qip__target-badge`,`qip__target-badge--${e.quizInfo.targetDifficulty}`])},`🎯 `+toDisplayString(n[e.quizInfo.targetDifficulty]),3)):createCommentVNode(``,!0)]),createBaseVNode(`div`,_hoisted_6$4,[e.quizInfo.tags.length?(openBlock(),createElementBlock(`div`,_hoisted_7$4,[(openBlock(!0),createElementBlock(Fragment,null,renderList(e.quizInfo.tags,e=>(openBlock(),createElementBlock(`span`,{key:e,class:`qip__tag`},toDisplayString(e),1))),128))])):createCommentVNode(``,!0),e.quizInfo.description?(openBlock(),createElementBlock(`p`,_hoisted_8$4,toDisplayString(e.quizInfo.description),1)):createCommentVNode(``,!0)]),createBaseVNode(`div`,_hoisted_9$4,[createBaseVNode(`div`,_hoisted_10$4,[createBaseVNode(`strong`,null,[createTextVNode(toDisplayString(e.quizInfo.totalQuestions),1),r.value?(openBlock(),createElementBlock(`small`,_hoisted_11$4,`/`+toDisplayString(r.value),1)):createCommentVNode(``,!0)]),a[0]||=createBaseVNode(`span`,null,`questions`,-1)]),e.quizInfo.tags.length?(openBlock(),createElementBlock(`div`,_hoisted_12$4,[createBaseVNode(`strong`,null,toDisplayString(e.quizInfo.tags.length),1),a[1]||=createBaseVNode(`span`,null,`tags`,-1)])):createCommentVNode(``,!0),e.playCount===void 0?createCommentVNode(``,!0):(openBlock(),createElementBlock(`div`,_hoisted_13$4,[createBaseVNode(`strong`,null,toDisplayString(e.playCount),1),a[2]||=createBaseVNode(`span`,null,`parties`,-1)])),e.playerCount===void 0?createCommentVNode(``,!0):(openBlock(),createElementBlock(`div`,_hoisted_14$3,[createBaseVNode(`strong`,null,toDisplayString(e.playerCount),1),a[3]||=createBaseVNode(`span`,null,`joueurs`,-1)]))]),createVNode(DifficultyBar_default,{distribution:e.quizInfo.difficultyDistribution},null,8,[`distribution`])],2))}}),QuizInfoPanel_default=_plugin_vue_export_helper_default(QuizInfoPanel_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-549d1637`]]);init_dist();function quizFormat(e,t){return{poolSize:t,randomDraw:e.maxQuestions!==void 0||e.maxTimeSec!==void 0||e.targetDifficulty!==void 0,oneShoot:e.oneShoot??!0}}var GameEvents={playerJoined:e=>({type:`player_joined`,player:e}),playerRejoined:e=>({type:`player_rejoined`,playerId:e}),playerLeft:e=>({type:`player_left`,playerId:e}),gameStarted:()=>({type:`game_started`}),questionStarted:(e,t,n)=>({type:`question_started`,question:e,idx:t,deadlineMs:n}),timerTick:e=>({type:`timer_tick`,remaining:e}),answerSubmit:(e,t,n)=>({type:`answer_submit`,playerId:e,choiceIds:t,timeRemaining:n}),answerSubmitted:e=>({type:`answer_submitted`,playerId:e}),answerRevealed:(e,t,n,r)=>({type:`answer_revealed`,correct:e,explanation:t,scores:n,choiceCounts:r}),nextQuestion:e=>({type:`next_question`,idx:e}),gameEnded:e=>({type:`game_ended`,podium:e}),gameReset:()=>({type:`game_reset`}),stateRequest:e=>({type:`state_request`,playerId:e}),stateSnapshot:(e,t)=>({type:`state_snapshot`,playerId:e,snapshot:t})};function calcPoints(e,t){return t?e<0?10:Math.max(10,Math.round(50+e*5)):0}var POSITIONAL_IDS=[`a`,`b`,`c`,`d`];function shuffle(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}function selectQuestions(e){let{maxQuestions:t,maxTimeSec:n,targetDifficulty:r}=e.meta,a=e.questions;if(!t&&!n&&!r)return a;let o={easy:0,medium:1,hard:2};if(r){let e=o[r],s=new Set,c=[...new Set(a.flatMap(e=>e.tags))];for(let e of c){let t=shuffle(a.filter(t=>t.difficulty===`hard`&&t.tags.includes(e)));for(let e of t)if(!s.has(e)){s.add(e);break}}let l=[...s],u=a.filter(e=>!s.has(e)),d=shuffle(u.filter(e=>e.difficulty===r)),h=shuffle(u.filter(t=>o[t.difficulty]<e));shuffle(u.filter(t=>o[t.difficulty]>e));let g=t===void 0?a.length:Math.min(t,a.length),w=Math.max(0,g-l.length),E=Math.round(w*.6),D=w-E,O=d.slice(0,E),N=h.slice(0,D),ne=new Set([...l,...O,...N]),re=w-O.length-N.length,be=shuffle([...d,...h].filter(e=>!ne.has(e))).slice(0,Math.max(0,re)),Ae=[...l,...O,...N,...be];if(n!==void 0){Ae.sort((e,t)=>o[e.difficulty]-o[t.difficulty]);let e=0;Ae=Ae.filter(t=>e+t.timer<=n&&(e+=t.timer,!0))}return Ae.sort((e,t)=>o[e.difficulty]-o[t.difficulty]),Ae}let s=a.map((e,t)=>t);for(let e=s.length-1;e>0;e--){let t=Math.floor(Math.random()*(e+1));[s[e],s[t]]=[s[t],s[e]]}let c;if(t!==void 0)c=s.slice(0,t);else{c=[];let e=0;for(let t of s){let r=a[t].timer;e+r<=n&&(c.push(t),e+=r)}}return c.sort((e,t)=>e-t),c.map(e=>a[e])}function shuffleWithOrder(e){let t=e.choices.map((e,t)=>t);for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}let n=t.map((t,n)=>({...e.choices[t],id:POSITIONAL_IDS[n]??e.choices[t].id}));return{question:{...e,choices:n},order:t}}function serveQuestions(e){return selectQuestions(e).map(t=>{let{question:n,order:r}=shuffleWithOrder(t);return{...n,deckIndex:e.questions.indexOf(t),choiceOrder:r}})}function toPublic(e,t,n){return{idx:t,type:e.type,timer:e.timer,difficulty:e.difficulty,text:e.text,choices:e.choices.map(({id:e,text:t})=>({id:e,text:t})),oneShoot:n,tags:e.tags}}var GameEngine=class{state;quiz;transport;channel;pendingAnswers=new Map;activeQuestions=[];revealedForIdx=-1;lastReveal=null;podium=null;constructor(e,t,n){this.quiz=e,this.transport=t,this.channel=`game:${n}`,this.state={sessionId:crypto.randomUUID(),joinCode:n,status:`lobby`,players:new Map,currentQuestionIdx:0,totalQuestions:e.questions.length}}addPlayer(e){let t=this.state.players.get(e.id);return t?(t.pseudo=e.pseudo,t.email=e.email,delete t.disconnectedAt,this.transport.broadcast(this.channel,GameEvents.playerRejoined(e.id)),!0):(this.state.players.set(e.id,e),this.transport.broadcast(this.channel,GameEvents.playerJoined(e)),!1)}markPlayerDisconnected(e,t=Date.now()){let n=this.state.players.get(e);n&&(n.disconnectedAt=t)}removePlayer(e){this.state.players.has(e)&&(this.state.players.delete(e),this.transport.broadcast(this.channel,GameEvents.playerLeft(e)))}async start(){this.state.status===`lobby`&&(this.state.status=`active`,this.activeQuestions=serveQuestions(this.quiz),this.state.totalQuestions=this.activeQuestions.length,await this.transport.broadcast(this.channel,GameEvents.gameStarted()),await this._broadcastCurrentQuestion())}async _broadcastCurrentQuestion(){this.pendingAnswers.clear(),this.lastReveal=null;let e=this.activeQuestions[this.state.currentQuestionIdx],t=this.quiz.meta.oneShoot??!0,n=Date.now()+e.timer*1e3;this.state.currentQuestionDeadlineMs=n,await this.transport.broadcast(this.channel,GameEvents.questionStarted(toPublic(e,this.state.currentQuestionIdx,t),this.state.currentQuestionIdx,n))}submitAnswer(e,t,n){this.revealedForIdx!==this.state.currentQuestionIdx&&(this.pendingAnswers.has(e)||(this.pendingAnswers.set(e,{playerId:e,choiceIds:t,answerTimeMs:n}),this.transport.broadcast(this.channel,GameEvents.answerSubmitted(e))))}async revealAnswer(){if(this.state.status!==`active`)return[];let e=this.activeQuestions[this.state.currentQuestionIdx],t=e.choices.filter(e=>e.isCorrect).map(e=>e.id),n=[];for(let[,r]of this.state.players){let a=this.pendingAnswers.get(r.id),o=a?.answerTimeMs??e.timer*1e3,s=Math.min(e.timer*1e3,Math.max(0,o)),c=calcPoints(Math.max(0,e.timer-s/1e3),a?t.every(e=>a.choiceIds.includes(e))&&a.choiceIds.every(e=>t.includes(e)):!1);r.score+=c,n.push({playerId:r.id,pseudo:r.pseudo,score:r.score,delta:c})}let r={};for(let[,e]of this.pendingAnswers)for(let t of e.choiceIds)r[t]=(r[t]??0)+1;return this.lastReveal={correct:t,explanation:e.explanation,scores:n,choiceCounts:r},this.revealedForIdx=this.state.currentQuestionIdx,delete this.state.currentQuestionDeadlineMs,await this.transport.broadcast(this.channel,GameEvents.answerRevealed(t,e.explanation,n,r)),n}async nextQuestion(){if(this.state.status!==`active`)return;let e=this.state.currentQuestionIdx+1;e>=this.activeQuestions.length?await this._finishGame():(this.state.currentQuestionIdx=e,await this._broadcastCurrentQuestion())}async _finishGame(){this.state.status=`finished`,delete this.state.currentQuestionDeadlineMs;let e=Array.from(this.state.players.values()).sort((e,t)=>t.score-e.score).map((e,t)=>({rank:t+1,playerId:e.id,pseudo:e.pseudo,score:e.score}));this.podium=e,await this.transport.broadcast(this.channel,GameEvents.gameEnded(e))}async reset(){if(this.state.status===`finished`){this.state.status=`lobby`,this.state.currentQuestionIdx=0,this.state.totalQuestions=this.quiz.questions.length,delete this.state.currentQuestionDeadlineMs;for(let e of this.state.players.values())e.score=0;this.pendingAnswers.clear(),this.activeQuestions=[],this.revealedForIdx=-1,this.lastReveal=null,this.podium=null,await this.transport.broadcast(this.channel,GameEvents.gameReset())}}buildSnapshot(e,t){let n=this.state.players.get(e)?.score??0,r=Array.from(this.state.players.values()).filter(e=>!e.disconnectedAt).length,a=this.state.status,o=this.state.currentQuestionIdx,s=this.quiz.meta.oneShoot??!0;if(a===`finished`)return{phase:`finished`,quizMeta:t,totalScore:n,playerCount:r,...this.podium?{podium:this.podium}:{}};if(a===`active`){let e=this.revealedForIdx===o,a=this.activeQuestions[o],c=a?toPublic(a,o,s):void 0;return e&&this.lastReveal?{phase:`revealed`,quizMeta:t,totalScore:n,playerCount:r,...c?{question:c,questionIdx:o}:{},reveal:this.lastReveal}:{phase:`question`,quizMeta:t,totalScore:n,playerCount:r,...c?{question:c,questionIdx:o}:{},...this.state.currentQuestionDeadlineMs===void 0?{}:{deadlineMs:this.state.currentQuestionDeadlineMs}}}return{phase:`lobby`,quizMeta:t,totalScore:n,playerCount:r}}};function soloAvailable(e,t=globalThis.location?.protocol){return e.transport===`local`?t!==`https:`:!!(e.supabaseUrl&&e.supabaseAnonKey)}function configFromEnv(e){let t=t=>e[`HASHQUIZ_${t}`]||e[`VITE_${t}`]||void 0,n=t(`GRACE_MS`),r=n===void 0?NaN:Number(n);return{transport:t(`TRANSPORT`)===`supabase`?`supabase`:`local`,supabaseUrl:t(`SUPABASE_URL`),supabaseAnonKey:t(`SUPABASE_ANON_KEY`),graceMs:Number.isFinite(r)&&r>=0?r:void 0,soloScoring:t(`SOLO_SCORING`)===`edge`?`edge`:`browser`,playerUrl:t(`PLAYER_URL`)}}function readRuntimeConfig(e={}){let t=globalThis.__HASHQUIZ_CONFIG__,n=configFromEnv(e);return t?{transport:t.transport===`supabase`||t.transport===`local`?t.transport:n.transport,supabaseUrl:t.supabaseUrl||n.supabaseUrl,supabaseAnonKey:t.supabaseAnonKey||n.supabaseAnonKey,graceMs:t.graceMs??n.graceMs,soloScoring:t.soloScoring===`edge`||t.soloScoring===`browser`?t.soloScoring:n.soloScoring,playerUrl:t.playerUrl||n.playerUrl}:n}var config=readRuntimeConfig({BASE_URL:`/host/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}),HOST_PRESENCE_ID=`__host__`;function resolveGraceMs(e){if(typeof e==`number`&&Number.isFinite(e)&&e>=0)return e;let t=readRuntimeConfig({BASE_URL:`/host/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}).graceMs;return t===void 0?6e4:t}var SupabaseHostSession=class{engine;transport;channel;listeners=[];offBroadcast;offPresence;quizInfo;graceMs;graceTimers=new Map;constructor(e){this.transport=e.transport,this.channel=`game:${e.joinCode}`,this.engine=new GameEngine(e.quiz,e.transport,e.joinCode),this.graceMs=resolveGraceMs(e.graceMs);let t=e.quiz.questions.filter(e=>e.difficulty===`easy`).length,n=e.quiz.questions.filter(e=>e.difficulty===`medium`).length,r=e.quiz.questions.filter(e=>e.difficulty===`hard`).length,a=e.quiz.questions.length||1,o=e=>Math.round(e/a*100);this.quizInfo={title:e.quiz.meta.title,...e.quiz.meta.description!==void 0&&{description:e.quiz.meta.description},tags:e.quiz.meta.tags??[],totalQuestions:e.quiz.meta.maxQuestions===void 0?e.quiz.questions.length:Math.min(e.quiz.meta.maxQuestions,e.quiz.questions.length),...e.quiz.meta.targetDifficulty!==void 0&&{targetDifficulty:e.quiz.meta.targetDifficulty},difficultyDistribution:{easy:o(t),medium:o(n),hard:o(r)},...quizFormat(e.quiz.meta,e.quiz.questions.length)},this.offBroadcast=this.transport.subscribe(this.channel,e=>{this.emit(e),e.type===`answer_submit`&&this.engine.submitAnswer(e.playerId,e.choiceIds,e.timeRemaining),e.type===`state_request`&&this.transport.broadcast(this.channel,GameEvents.stateSnapshot(e.playerId,this.engine.buildSnapshot(e.playerId,this.quizInfo)))}),this.offPresence=this.transport.presence.onChange(this.channel,e=>{this.syncPlayers(e.filter(e=>e.id!==HOST_PRESENCE_ID))}),this.transport.presence.track(this.channel,{id:HOST_PRESENCE_ID,pseudo:`__host__`,email:``,score:0,joinedAt:Date.now()}),queueMicrotask(()=>{this.emit({type:`host_ready`,joinCode:e.joinCode,totalQuestions:e.quiz.meta.maxQuestions===void 0?e.quiz.questions.length:Math.min(e.quiz.meta.maxQuestions,e.quiz.questions.length),playerUrl:`${e.origin}/?code=${e.joinCode}`,quizMeta:this.quizInfo})})}syncPlayers(e){let t=new Set(e.map(e=>e.id));for(let t of e)this.cancelGrace(t.id),this.engine.addPlayer(t);for(let e of this.engine.state.players.keys()){if(t.has(e)||this.graceTimers.has(e))continue;if(this.engine.markPlayerDisconnected(e),this.graceMs===0){this.engine.removePlayer(e);continue}let n=setTimeout(()=>{this.graceTimers.delete(e),this.engine.state.players.get(e)?.disconnectedAt&&this.engine.removePlayer(e)},this.graceMs);this.graceTimers.set(e,n)}}cancelGrace(e){let t=this.graceTimers.get(e);t&&(clearTimeout(t),this.graceTimers.delete(e))}on(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}emit(e){for(let t of this.listeners)t(e)}async start(){await this.engine.start()}async reveal(){await this.engine.revealAnswer()}async next(){await this.engine.nextQuestion()}async reset(){await this.engine.reset()}dispose(){this.offBroadcast?.(),this.offPresence?.();for(let e of this.graceTimers.values())clearTimeout(e);this.graceTimers.clear()}};function __rest(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function __awaiter$1(e,t,n,r){function a(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?n(e.value):a(e.value).then(s,c)}l((r=r.apply(e,t||[])).next())})}var resolveFetch$3=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),FunctionsError=class extends Error{constructor(e,t=`FunctionsError`,n){super(e),this.name=t,this.context=n}toJSON(){return{name:this.name,message:this.message,context:this.context}}},FunctionsFetchError=class extends FunctionsError{constructor(e){super(`Failed to send a request to the Edge Function`,`FunctionsFetchError`,e)}},FunctionsRelayError=class extends FunctionsError{constructor(e){super(`Relay Error invoking the Edge Function`,`FunctionsRelayError`,e)}},FunctionsHttpError=class extends FunctionsError{constructor(e){super(`Edge Function returned a non-2xx status code`,`FunctionsHttpError`,e)}},FunctionRegion;(function(e){e.Any=`any`,e.ApNortheast1=`ap-northeast-1`,e.ApNortheast2=`ap-northeast-2`,e.ApSouth1=`ap-south-1`,e.ApSoutheast1=`ap-southeast-1`,e.ApSoutheast2=`ap-southeast-2`,e.CaCentral1=`ca-central-1`,e.EuCentral1=`eu-central-1`,e.EuWest1=`eu-west-1`,e.EuWest2=`eu-west-2`,e.EuWest3=`eu-west-3`,e.SaEast1=`sa-east-1`,e.UsEast1=`us-east-1`,e.UsWest1=`us-west-1`,e.UsWest2=`us-west-2`})(FunctionRegion||={});var FunctionsClient=class{constructor(e,{headers:t={},customFetch:n,region:r=FunctionRegion.Any}={}){this.url=e,this.headers=t,this.region=r,this.fetch=resolveFetch$3(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return __awaiter$1(this,arguments,void 0,function*(e,t={}){var n;let r,a;try{let{headers:n,method:o,body:s,signal:c,timeout:l}=t,u={},{region:d}=t;d||=this.region;let h=new URL(`${this.url}/${e}`);d&&d!==`any`&&(u[`x-region`]=d,h.searchParams.set(`forceFunctionRegion`,d));let g;s&&(n&&!Object.prototype.hasOwnProperty.call(n,`Content-Type`)||!n)?typeof Blob<`u`&&s instanceof Blob||s instanceof ArrayBuffer?(u[`Content-Type`]=`application/octet-stream`,g=s):typeof s==`string`?(u[`Content-Type`]=`text/plain`,g=s):typeof FormData<`u`&&s instanceof FormData?g=s:(u[`Content-Type`]=`application/json`,g=JSON.stringify(s)):g=s&&typeof s!=`string`&&!(typeof Blob<`u`&&s instanceof Blob)&&!(s instanceof ArrayBuffer)&&!(typeof FormData<`u`&&s instanceof FormData)?JSON.stringify(s):s;let w=c;l&&(a=new AbortController,r=setTimeout(()=>a.abort(),l),c?(w=a.signal,c.addEventListener(`abort`,()=>a.abort())):w=a.signal);let E=yield this.fetch(h.toString(),{method:o||`POST`,headers:Object.assign(Object.assign(Object.assign({},u),this.headers),n),body:g,signal:w}).catch(e=>{throw new FunctionsFetchError(e)}),D=E.headers.get(`x-relay-error`);if(D&&D===`true`)throw new FunctionsRelayError(E);if(!E.ok)throw new FunctionsHttpError(E);let O=(E.headers.get(`Content-Type`)??`text/plain`).split(`;`)[0].trim(),N;return N=O===`application/json`?yield E.json():O===`application/octet-stream`||O===`application/pdf`?yield E.blob():O===`text/event-stream`?E:O===`multipart/form-data`?yield E.formData():yield E.text(),{data:N,error:null,response:E}}catch(e){return{data:null,error:e,response:e instanceof FunctionsHttpError||e instanceof FunctionsRelayError?e.context:void 0}}finally{r&&clearTimeout(r)}})}},DEFAULT_MAX_RETRIES=3,getRetryDelay=e=>Math.min(1e3*2**e,3e4),RETRYABLE_STATUS_CODES=[520,503],RETRYABLE_METHODS=[`GET`,`HEAD`,`OPTIONS`],PostgrestError=class extends Error{constructor(e){super(e.message),this.name=`PostgrestError`,this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function sleep$1(e,t){return new Promise(n=>{if(t?.aborted){n();return}let r=setTimeout(()=>{t?.removeEventListener(`abort`,a),n()},e);function a(){clearTimeout(r),n()}t?.addEventListener(`abort`,a)})}function shouldRetry(e,t,n,r){return!(!r||n>=DEFAULT_MAX_RETRIES||!RETRYABLE_METHODS.includes(e)||!RETRYABLE_STATUS_CODES.includes(t))}var PostgrestBuilder=class{constructor(e){var t,n,r,a,o;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError??!1,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle??!1,this.shouldStripNulls=e.shouldStripNulls??!1,this.urlLengthLimit=e.urlLengthLimit??8e3,this.retryEnabled=e.retry??!0,this.fetch=e.fetch?e.fetch:fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get(`Accept`)===`text/csv`)throw Error(`stripNulls() cannot be used with csv()`);return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var n=this;if(this.schema===void 0||([`GET`,`HEAD`].includes(this.method)?this.headers.set(`Accept-Profile`,this.schema):this.headers.set(`Content-Profile`,this.schema)),this.method!==`GET`&&this.method!==`HEAD`&&this.headers.set(`Content-Type`,`application/json`),this.shouldStripNulls){let e=this.headers.get(`Accept`);e===`application/vnd.pgrst.object+json`?this.headers.set(`Accept`,`application/vnd.pgrst.object+json;nulls=stripped`):e&&e!==`application/json`||this.headers.set(`Accept`,`application/vnd.pgrst.array+json;nulls=stripped`)}let r=this.fetch,a=(async()=>{let e=0;for(;;){let o=new Headers(n.headers);e>0&&o.set(`X-Retry-Count`,String(e));let s;try{s=await r(n.url.toString(),{method:n.method,headers:o,body:JSON.stringify(n.body,(e,t)=>typeof t==`bigint`?t.toString():t),signal:n.signal})}catch(t){if(t?.name===`AbortError`||t?.code===`ABORT_ERR`||!RETRYABLE_METHODS.includes(n.method))throw t;if(n.retryEnabled&&e<DEFAULT_MAX_RETRIES){let t=getRetryDelay(e);e++,await sleep$1(t,n.signal);continue}throw t}if(shouldRetry(n.method,s.status,e,n.retryEnabled)){var t,a;let r=s.headers?.get(`Retry-After`)??null,o=r===null?getRetryDelay(e):Math.max(0,parseInt(r,10)||0)*1e3;await s.text(),e++,await sleep$1(o,n.signal)}else return await n.processResponse(s)}})();return this.shouldThrowOnError||(a=a.catch(e=>{var t;let n=``,r=``,a=``,o=e?.cause;if(o){var s,c,l,u;let t=o?.message??``,r=o?.code??``;n=`${e?.name??`FetchError`}: ${e?.message}`,n+=`\n\nCaused by: ${o?.name??`Error`}: ${t}`,r&&(n+=` (${r})`),o?.stack&&(n+=`\n${o.stack}`)}else{var d;n=e?.stack??``}let h=this.url.toString().length;return e?.name===`AbortError`||e?.code===`ABORT_ERR`?(a=``,r=`Request was aborted (timeout or manual cancellation)`,h>this.urlLengthLimit&&(r+=`. Note: Your request URL is ${h} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):(o?.name===`HeadersOverflowError`||o?.code===`UND_ERR_HEADERS_OVERFLOW`)&&(a=``,r=`HTTP headers exceeded server limits (typically 16KB)`,h>this.urlLengthLimit&&(r+=`. Your request URL is ${h} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${e?.name??`FetchError`}: ${e?.message}`,details:n,hint:r,code:a},data:null,count:null,status:0,statusText:``}})),a.then(e,t)}async processResponse(e){var t=this;let n=null,r=null,a=null,o=e.status,s=e.statusText;if(e.ok){var c,l;if(t.method!==`HEAD`){var u;let n=await e.text();n===``||(r=t.headers.get(`Accept`)===`text/csv`||t.headers.get(`Accept`)&&t.headers.get(`Accept`)?.includes(`application/vnd.pgrst.plan+text`)?n:JSON.parse(n))}let d=t.headers.get(`Prefer`)?.match(/count=(exact|planned|estimated)/),h=e.headers.get(`content-range`)?.split(`/`);d&&h&&h.length>1&&(a=parseInt(h[1])),t.isMaybeSingle&&Array.isArray(r)&&(r.length>1?(n={code:`PGRST116`,details:`Results contain ${r.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:`JSON object requested, multiple (or no) rows returned`},r=null,a=null,o=406,s=`Not Acceptable`):r=r.length===1?r[0]:null)}else{let a=await e.text();try{n=JSON.parse(a),Array.isArray(n)&&e.status===404&&(r=[],n=null,o=200,s=`OK`)}catch{e.status===404&&a===``?(o=204,s=`No Content`):n={message:a}}if(n&&t.shouldThrowOnError)throw new PostgrestError(n)}return{success:n===null,error:n,data:r,count:a,status:o,statusText:s}}returns(){return this}overrideTypes(){return this}},PostgrestTransformBuilder=class extends PostgrestBuilder{select(e){let t=!1,n=(e??`*`).split(``).map(e=>/\s/.test(e)&&!t?``:(e===`"`&&(t=!t),e)).join(``);return this.url.searchParams.set(`select`,n),this.headers.append(`Prefer`,`return=representation`),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:r,referencedTable:a=r}={}){let o=a?`${a}.order`:`order`,s=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${s?`${s},`:``}${e}.${t?`asc`:`desc`}${n===void 0?``:n?`.nullsfirst`:`.nullslast`}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){let r=n===void 0?`limit`:`${n}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:r=n}={}){let a=r===void 0?`offset`:`${r}.offset`,o=r===void 0?`limit`:`${r}.limit`;return this.url.searchParams.set(a,`${e}`),this.url.searchParams.set(o,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set(`Accept`,`application/vnd.pgrst.object+json`),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set(`Accept`,`text/csv`),this}geojson(){return this.headers.set(`Accept`,`application/geo+json`),this}explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:r=!1,wal:a=!1,format:o=`text`}={}){var s;let c=[e?`analyze`:null,t?`verbose`:null,n?`settings`:null,r?`buffers`:null,a?`wal`:null].filter(Boolean).join(`|`),l=this.headers.get(`Accept`)??`application/json`;return this.headers.set(`Accept`,`application/vnd.pgrst.plan+${o}; for="${l}"; options=${c};`),this}rollback(){return this.headers.append(`Prefer`,`tx=rollback`),this}returns(){return this}maxAffected(e){return this.headers.append(`Prefer`,`handling=strict`),this.headers.append(`Prefer`,`max-affected=${e}`),this}},PostgrestReservedCharsRegexp=RegExp(`[,()]`),PostgrestFilterBuilder=class extends PostgrestTransformBuilder{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(`,`)}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(`,`)}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(`,`)}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(`,`)}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){let n=Array.from(new Set(t)).map(e=>typeof e==`string`&&PostgrestReservedCharsRegexp.test(e)?`"${e}"`:`${e}`).join(`,`);return this.url.searchParams.append(e,`in.(${n})`),this}notIn(e,t){let n=Array.from(new Set(t)).map(e=>typeof e==`string`&&PostgrestReservedCharsRegexp.test(e)?`"${e}"`:`${e}`).join(`,`);return this.url.searchParams.append(e,`not.in.(${n})`),this}contains(e,t){return typeof t==`string`?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(`,`)}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t==`string`?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(`,`)}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t==`string`?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(`,`)}}`),this}textSearch(e,t,{config:n,type:r}={}){let a=``;r===`plain`?a=`pl`:r===`phrase`?a=`ph`:r===`websearch`&&(a=`w`);let o=n===void 0?``:`(${n})`;return this.url.searchParams.append(e,`${a}fts${o}.${t}`),this}match(e){return Object.entries(e).filter(([e,t])=>t!==void 0).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){let r=n?`${n}.or`:`or`;return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}},PostgrestQueryBuilder=class{constructor(e,{headers:t={},schema:n,fetch:r,urlLengthLimit:a=8e3,retry:o}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=r,this.urlLengthLimit=a,this.retry=o}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){let{head:n=!1,count:r}=t??{},a=n?`HEAD`:`GET`,o=!1,s=(e??`*`).split(``).map(e=>/\s/.test(e)&&!o?``:(e===`"`&&(o=!o),e)).join(``),{url:c,headers:l}=this.cloneRequestState();return c.searchParams.set(`select`,s),r&&l.append(`Prefer`,`count=${r}`),new PostgrestFilterBuilder({method:a,url:c,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:n=!0}={}){var r;let a=`POST`,{url:o,headers:s}=this.cloneRequestState();if(t&&s.append(`Prefer`,`count=${t}`),n||s.append(`Prefer`,`missing=default`),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);o.searchParams.set(`columns`,e.join(`,`))}}return new PostgrestFilterBuilder({method:`POST`,url:o,headers:s,schema:this.schema,body:e,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:r,defaultToNull:a=!0}={}){var o;let s=`POST`,{url:c,headers:l}=this.cloneRequestState();if(l.append(`Prefer`,`resolution=${n?`ignore`:`merge`}-duplicates`),t!==void 0&&c.searchParams.set(`on_conflict`,t),r&&l.append(`Prefer`,`count=${r}`),a||l.append(`Prefer`,`missing=default`),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);c.searchParams.set(`columns`,e.join(`,`))}}return new PostgrestFilterBuilder({method:`POST`,url:c,headers:l,schema:this.schema,body:e,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var n;let r=`PATCH`,{url:a,headers:o}=this.cloneRequestState();return t&&o.append(`Prefer`,`count=${t}`),new PostgrestFilterBuilder({method:`PATCH`,url:a,headers:o,schema:this.schema,body:e,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;let n=`DELETE`,{url:r,headers:a}=this.cloneRequestState();return e&&a.append(`Prefer`,`count=${e}`),new PostgrestFilterBuilder({method:`DELETE`,url:r,headers:a,schema:this.schema,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function _typeof$2(e){"@babel/helpers - typeof";return _typeof$2=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},_typeof$2(e)}function toPrimitive$2(e,t){if(_typeof$2(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(_typeof$2(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function toPropertyKey$2(e){var t=toPrimitive$2(e,`string`);return _typeof$2(t)==`symbol`?t:t+``}function _defineProperty$2(e,t,n){return(t=toPropertyKey$2(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ownKeys$2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _objectSpread2$2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ownKeys$2(Object(n),!0).forEach(function(t){_defineProperty$2(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys$2(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var PostgrestClient=class e{constructor(e,{headers:t={},schema:n,fetch:r,timeout:a,urlLengthLimit:o=8e3,retry:s}={}){this.url=e,this.headers=new Headers(t),this.schemaName=n,this.urlLengthLimit=o;let c=r??globalThis.fetch;this.fetch=a!==void 0&&a>0?(e,t)=>{let n=new AbortController,r=setTimeout(()=>n.abort(),a),o=t?.signal;if(o){if(o.aborted)return clearTimeout(r),c(e,t);let a=()=>{clearTimeout(r),n.abort()};return o.addEventListener(`abort`,a,{once:!0}),c(e,_objectSpread2$2(_objectSpread2$2({},t),{},{signal:n.signal})).finally(()=>{clearTimeout(r),o.removeEventListener(`abort`,a)})}return c(e,_objectSpread2$2(_objectSpread2$2({},t),{},{signal:n.signal})).finally(()=>clearTimeout(r))}:c,this.retry=s}from(e){if(!e||typeof e!=`string`||e.trim()===``)throw Error(`Invalid relation name: relation must be a non-empty string.`);return new PostgrestQueryBuilder(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,t={},{head:n=!1,get:r=!1,count:a}={}){var o;let s,c=new URL(`${this.url}/rpc/${e}`),l,u=e=>typeof e==`object`&&!!e&&(!Array.isArray(e)||e.some(u)),d=n&&Object.values(t).some(u);d?(s=`POST`,l=t):n||r?(s=n?`HEAD`:`GET`,Object.entries(t).filter(([e,t])=>t!==void 0).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(`,`)}}`:`${t}`]).forEach(([e,t])=>{c.searchParams.append(e,t)})):(s=`POST`,l=t);let h=new Headers(this.headers);return d?h.set(`Prefer`,a?`count=${a},return=minimal`:`return=minimal`):a&&h.set(`Prefer`,`count=${a}`),new PostgrestFilterBuilder({method:s,url:c,headers:h,schema:this.schemaName,body:l,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}},WebSocketFactory=class{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<`u`)return{type:`native`,wsConstructor:WebSocket};let t=globalThis;if(typeof globalThis<`u`&&t.WebSocket!==void 0)return{type:`native`,wsConstructor:t.WebSocket};let n=global$1===void 0?void 0:global$1;if(n&&n.WebSocket!==void 0)return{type:`native`,wsConstructor:n.WebSocket};if(typeof globalThis<`u`&&t.WebSocketPair!==void 0&&globalThis.WebSocket===void 0)return{type:`cloudflare`,error:`Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.`,workaround:`Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime.`};if(typeof globalThis<`u`&&t.EdgeRuntime||typeof navigator<`u`&&navigator.userAgent?.includes(`Vercel-Edge`))return{type:`unsupported`,error:`Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.`,workaround:`Use serverless functions or a different deployment target for WebSocket functionality.`};let r=globalThis.process;if(r){let e=r.versions;if(e&&e.node){let t=e.node,n=parseInt(t.replace(/^v/,``).split(`.`)[0]);return n>=22?globalThis.WebSocket===void 0?{type:`unsupported`,error:`Node.js ${n} detected but native WebSocket not found.`,workaround:`Provide a WebSocket implementation via the transport option.`}:{type:`native`,wsConstructor:globalThis.WebSocket}:{type:`unsupported`,error:`Node.js ${n} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
8
|
+
`;return typeof o==`function`&&o(null,w),w}})),require_browser=__commonJSMin((e=>{var t=require_can_promise(),n=require_qrcode(),r=require_canvas(),a=require_svg_tag();function o(e,r,a,o,s){let c=[].slice.call(arguments,1),l=c.length,u=typeof c[l-1]==`function`;if(!u&&!t())throw Error(`Callback required as last argument`);if(u){if(l<2)throw Error(`Too few arguments provided`);l===2?(s=a,a=r,r=o=void 0):l===3&&(r.getContext&&s===void 0?(s=o,o=void 0):(s=o,o=a,a=r,r=void 0))}else{if(l<1)throw Error(`Too few arguments provided`);return l===1?(a=r,r=o=void 0):l===2&&!r.getContext&&(o=a,a=r,r=void 0),new Promise(function(t,s){try{t(e(n.create(a,o),r,o))}catch(e){s(e)}})}try{let t=n.create(a,o);s(null,e(t,r,o))}catch(e){s(e)}}e.create=n.create,e.toCanvas=o.bind(null,r.render),e.toDataURL=o.bind(null,r.renderToDataURL),e.toString=o.bind(null,function(e,t,n){return a.render(e,n)})})),import_browser=__toESM(require_browser(),1),QrCode_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`QrCode`,props:{value:{},size:{}},setup(e){let t=e,n=ref();return watchEffect(async()=>{if(!n.value||!t.value)return;let e=getComputedStyle(document.documentElement),r=e.getPropertyValue(`--hq-qr-dark`).trim(),a=e.getPropertyValue(`--hq-qr-light`).trim();await import_browser.toCanvas(n.value,t.value,{width:t.size??200,margin:1,color:{dark:r,light:a}})}),(e,t)=>(openBlock(),createElementBlock(`canvas`,{ref_key:`canvasEl`,ref:n,class:`hq-qr`},null,512))}}),QrCode_default=_plugin_vue_export_helper_default(QrCode_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-7ecbb7cc`]]),_hoisted_1$8={class:`diff-bar`},_hoisted_2$8={class:`diff-bar__track hq-steps`},_hoisted_3$6={class:`diff-bar__legend`},DifficultyBar_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`DifficultyBar`,props:{distribution:{}},setup(e){return(t,n)=>(openBlock(),createElementBlock(`div`,_hoisted_1$8,[createBaseVNode(`div`,_hoisted_2$8,[createBaseVNode(`div`,{class:`diff-bar__seg diff-bar__seg--easy`,style:normalizeStyle({width:e.distribution.easy+`%`})},null,4),createBaseVNode(`div`,{class:`diff-bar__seg diff-bar__seg--medium`,style:normalizeStyle({width:e.distribution.medium+`%`})},null,4),createBaseVNode(`div`,{class:`diff-bar__seg diff-bar__seg--hard`,style:normalizeStyle({width:e.distribution.hard+`%`})},null,4)]),createBaseVNode(`p`,_hoisted_3$6,[n[0]||=createBaseVNode(`span`,{class:`diff-bar__dot diff-bar__dot--easy`},null,-1),createTextVNode(`facile `+toDisplayString(e.distribution.easy)+`% `,1),n[1]||=createBaseVNode(`span`,{class:`diff-bar__dot diff-bar__dot--medium`},null,-1),createTextVNode(`moyen `+toDisplayString(e.distribution.medium)+`% `,1),n[2]||=createBaseVNode(`span`,{class:`diff-bar__dot diff-bar__dot--hard`},null,-1),createTextVNode(`difficile `+toDisplayString(e.distribution.hard)+`% `,1)])]))}}),DifficultyBar_default=_plugin_vue_export_helper_default(DifficultyBar_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-a3903778`]]),_hoisted_1$7={key:0,class:`qip__labels`},_hoisted_2$7={key:0,class:`qip__badge`},_hoisted_3$5={key:1,class:`qip__label`},_hoisted_4$5={class:`qip__header`},_hoisted_5$4={class:`qip__title`},_hoisted_6$4={class:`qip__content`},_hoisted_7$4={key:0,class:`qip__tags`},_hoisted_8$4={key:1,class:`qip__description`},_hoisted_9$4={class:`qip__metrics`},_hoisted_10$4={class:`qip__metric`},_hoisted_11$4={key:0},_hoisted_12$4={key:0,class:`qip__metric`},_hoisted_13$4={key:1,class:`qip__metric`},_hoisted_14$4={key:2,class:`qip__metric`},QuizInfoPanel_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`QuizInfoPanel`,props:{quizInfo:{},playerCount:{},playCount:{},compact:{type:Boolean}},setup(e){let t=e,n={easy:`FACILE`,medium:`MOYEN`,hard:`DIFFICILE`},r=computed(()=>{let e=t.quizInfo.poolSize;return e!==void 0&&e>t.quizInfo.totalQuestions?e:null});return(t,a)=>(openBlock(),createElementBlock(`div`,{class:normalizeClass([`qip`,{"qip--compact":e.compact}])},[e.quizInfo.oneShoot!==void 0||e.quizInfo.randomDraw!==void 0?(openBlock(),createElementBlock(`div`,_hoisted_1$7,[e.quizInfo.oneShoot===void 0?createCommentVNode(``,!0):(openBlock(),createElementBlock(`span`,_hoisted_2$7,toDisplayString(e.quizInfo.oneShoot?`⚡ Réponse unique`:`✏️ Réponses modifiables`),1)),e.quizInfo.randomDraw===void 0?createCommentVNode(``,!0):(openBlock(),createElementBlock(`span`,_hoisted_3$5,toDisplayString(e.quizInfo.randomDraw?`🎲 Tirage aléatoire`:`📋 Liste fixe`),1))])):createCommentVNode(``,!0),createBaseVNode(`div`,_hoisted_4$5,[createBaseVNode(`h2`,_hoisted_5$4,toDisplayString(e.quizInfo.title),1),e.quizInfo.targetDifficulty?(openBlock(),createElementBlock(`span`,{key:0,class:normalizeClass([`qip__target-badge`,`qip__target-badge--${e.quizInfo.targetDifficulty}`])},`🎯 `+toDisplayString(n[e.quizInfo.targetDifficulty]),3)):createCommentVNode(``,!0)]),createBaseVNode(`div`,_hoisted_6$4,[e.quizInfo.tags.length?(openBlock(),createElementBlock(`div`,_hoisted_7$4,[(openBlock(!0),createElementBlock(Fragment,null,renderList(e.quizInfo.tags,e=>(openBlock(),createElementBlock(`span`,{key:e,class:`qip__tag`},toDisplayString(e),1))),128))])):createCommentVNode(``,!0),e.quizInfo.description?(openBlock(),createElementBlock(`p`,_hoisted_8$4,toDisplayString(e.quizInfo.description),1)):createCommentVNode(``,!0)]),createBaseVNode(`div`,_hoisted_9$4,[createBaseVNode(`div`,_hoisted_10$4,[createBaseVNode(`strong`,null,[createTextVNode(toDisplayString(e.quizInfo.totalQuestions),1),r.value?(openBlock(),createElementBlock(`small`,_hoisted_11$4,`/`+toDisplayString(r.value),1)):createCommentVNode(``,!0)]),a[0]||=createBaseVNode(`span`,null,`questions`,-1)]),e.quizInfo.tags.length?(openBlock(),createElementBlock(`div`,_hoisted_12$4,[createBaseVNode(`strong`,null,toDisplayString(e.quizInfo.tags.length),1),a[1]||=createBaseVNode(`span`,null,`tags`,-1)])):createCommentVNode(``,!0),e.playCount===void 0?createCommentVNode(``,!0):(openBlock(),createElementBlock(`div`,_hoisted_13$4,[createBaseVNode(`strong`,null,toDisplayString(e.playCount),1),a[2]||=createBaseVNode(`span`,null,`parties`,-1)])),e.playerCount===void 0?createCommentVNode(``,!0):(openBlock(),createElementBlock(`div`,_hoisted_14$4,[createBaseVNode(`strong`,null,toDisplayString(e.playerCount),1),a[3]||=createBaseVNode(`span`,null,`joueurs`,-1)]))]),createVNode(DifficultyBar_default,{distribution:e.quizInfo.difficultyDistribution},null,8,[`distribution`])],2))}}),QuizInfoPanel_default=_plugin_vue_export_helper_default(QuizInfoPanel_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-549d1637`]]);init_dist();function quizFormat(e,t){return{poolSize:t,randomDraw:e.maxQuestions!==void 0||e.maxTimeSec!==void 0||e.targetDifficulty!==void 0,oneShoot:e.oneShoot??!0}}var GameEvents={playerJoined:e=>({type:`player_joined`,player:e}),playerRejoined:e=>({type:`player_rejoined`,playerId:e}),playerLeft:e=>({type:`player_left`,playerId:e}),gameStarted:()=>({type:`game_started`}),questionStarted:(e,t,n)=>({type:`question_started`,question:e,idx:t,deadlineMs:n}),timerTick:e=>({type:`timer_tick`,remaining:e}),answerSubmit:(e,t,n)=>({type:`answer_submit`,playerId:e,choiceIds:t,timeRemaining:n}),answerSubmitted:e=>({type:`answer_submitted`,playerId:e}),answerRevealed:(e,t,n,r)=>({type:`answer_revealed`,correct:e,explanation:t,scores:n,choiceCounts:r}),nextQuestion:e=>({type:`next_question`,idx:e}),gameEnded:e=>({type:`game_ended`,podium:e}),gameReset:()=>({type:`game_reset`}),stateRequest:e=>({type:`state_request`,playerId:e}),stateSnapshot:(e,t)=>({type:`state_snapshot`,playerId:e,snapshot:t})};function calcPoints(e,t){return t?e<0?10:Math.max(10,Math.round(50+e*5)):0}var POSITIONAL_IDS=[`a`,`b`,`c`,`d`];function shuffle(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}function selectQuestions(e){let{maxQuestions:t,maxTimeSec:n,targetDifficulty:r}=e.meta,a=e.questions;if(!t&&!n&&!r)return a;let o={easy:0,medium:1,hard:2};if(r){let e=o[r],s=new Set,c=[...new Set(a.flatMap(e=>e.tags))];for(let e of c){let t=shuffle(a.filter(t=>t.difficulty===`hard`&&t.tags.includes(e)));for(let e of t)if(!s.has(e)){s.add(e);break}}let l=[...s],u=a.filter(e=>!s.has(e)),d=shuffle(u.filter(e=>e.difficulty===r)),h=shuffle(u.filter(t=>o[t.difficulty]<e));shuffle(u.filter(t=>o[t.difficulty]>e));let g=t===void 0?a.length:Math.min(t,a.length),w=Math.max(0,g-l.length),E=Math.round(w*.6),D=w-E,O=d.slice(0,E),N=h.slice(0,D),ne=new Set([...l,...O,...N]),re=w-O.length-N.length,be=shuffle([...d,...h].filter(e=>!ne.has(e))).slice(0,Math.max(0,re)),Ae=[...l,...O,...N,...be];if(n!==void 0){Ae.sort((e,t)=>o[e.difficulty]-o[t.difficulty]);let e=0;Ae=Ae.filter(t=>e+t.timer<=n&&(e+=t.timer,!0))}return Ae.sort((e,t)=>o[e.difficulty]-o[t.difficulty]),Ae}let s=a.map((e,t)=>t);for(let e=s.length-1;e>0;e--){let t=Math.floor(Math.random()*(e+1));[s[e],s[t]]=[s[t],s[e]]}let c;if(t!==void 0)c=s.slice(0,t);else{c=[];let e=0;for(let t of s){let r=a[t].timer;e+r<=n&&(c.push(t),e+=r)}}return c.sort((e,t)=>e-t),c.map(e=>a[e])}function shuffleWithOrder(e){let t=e.choices.map((e,t)=>t);for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}let n=t.map((t,n)=>({...e.choices[t],id:POSITIONAL_IDS[n]??e.choices[t].id}));return{question:{...e,choices:n},order:t}}function serveQuestions(e){return selectQuestions(e).map(t=>{let{question:n,order:r}=shuffleWithOrder(t);return{...n,deckIndex:e.questions.indexOf(t),choiceOrder:r}})}function toPublic(e,t,n){return{idx:t,type:e.type,timer:e.timer,difficulty:e.difficulty,text:e.text,choices:e.choices.map(({id:e,text:t})=>({id:e,text:t})),oneShoot:n,tags:e.tags}}var GameEngine=class{state;quiz;transport;channel;pendingAnswers=new Map;activeQuestions=[];revealedForIdx=-1;lastReveal=null;podium=null;constructor(e,t,n){this.quiz=e,this.transport=t,this.channel=`game:${n}`,this.state={sessionId:crypto.randomUUID(),joinCode:n,status:`lobby`,players:new Map,currentQuestionIdx:0,totalQuestions:e.questions.length}}addPlayer(e){let t=this.state.players.get(e.id);return t?(t.pseudo=e.pseudo,t.email=e.email,delete t.disconnectedAt,this.transport.broadcast(this.channel,GameEvents.playerRejoined(e.id)),!0):(this.state.players.set(e.id,e),this.transport.broadcast(this.channel,GameEvents.playerJoined(e)),!1)}markPlayerDisconnected(e,t=Date.now()){let n=this.state.players.get(e);n&&(n.disconnectedAt=t)}removePlayer(e){this.state.players.has(e)&&(this.state.players.delete(e),this.transport.broadcast(this.channel,GameEvents.playerLeft(e)))}async start(){this.state.status===`lobby`&&(this.state.status=`active`,this.activeQuestions=serveQuestions(this.quiz),this.state.totalQuestions=this.activeQuestions.length,await this.transport.broadcast(this.channel,GameEvents.gameStarted()),await this._broadcastCurrentQuestion())}async _broadcastCurrentQuestion(){this.pendingAnswers.clear(),this.lastReveal=null;let e=this.activeQuestions[this.state.currentQuestionIdx],t=this.quiz.meta.oneShoot??!0,n=Date.now()+e.timer*1e3;this.state.currentQuestionDeadlineMs=n,await this.transport.broadcast(this.channel,GameEvents.questionStarted(toPublic(e,this.state.currentQuestionIdx,t),this.state.currentQuestionIdx,n))}submitAnswer(e,t,n){this.revealedForIdx!==this.state.currentQuestionIdx&&(this.pendingAnswers.has(e)||(this.pendingAnswers.set(e,{playerId:e,choiceIds:t,answerTimeMs:n}),this.transport.broadcast(this.channel,GameEvents.answerSubmitted(e))))}async revealAnswer(){if(this.state.status!==`active`)return[];let e=this.activeQuestions[this.state.currentQuestionIdx],t=e.choices.filter(e=>e.isCorrect).map(e=>e.id),n=[];for(let[,r]of this.state.players){let a=this.pendingAnswers.get(r.id),o=a?.answerTimeMs??e.timer*1e3,s=Math.min(e.timer*1e3,Math.max(0,o)),c=calcPoints(Math.max(0,e.timer-s/1e3),a?t.every(e=>a.choiceIds.includes(e))&&a.choiceIds.every(e=>t.includes(e)):!1);r.score+=c,n.push({playerId:r.id,pseudo:r.pseudo,score:r.score,delta:c})}let r={};for(let[,e]of this.pendingAnswers)for(let t of e.choiceIds)r[t]=(r[t]??0)+1;return this.lastReveal={correct:t,explanation:e.explanation,scores:n,choiceCounts:r},this.revealedForIdx=this.state.currentQuestionIdx,delete this.state.currentQuestionDeadlineMs,await this.transport.broadcast(this.channel,GameEvents.answerRevealed(t,e.explanation,n,r)),n}async nextQuestion(){if(this.state.status!==`active`)return;let e=this.state.currentQuestionIdx+1;e>=this.activeQuestions.length?await this._finishGame():(this.state.currentQuestionIdx=e,await this._broadcastCurrentQuestion())}async _finishGame(){this.state.status=`finished`,delete this.state.currentQuestionDeadlineMs;let e=Array.from(this.state.players.values()).sort((e,t)=>t.score-e.score).map((e,t)=>({rank:t+1,playerId:e.id,pseudo:e.pseudo,score:e.score}));this.podium=e,await this.transport.broadcast(this.channel,GameEvents.gameEnded(e))}async reset(){if(this.state.status===`finished`){this.state.status=`lobby`,this.state.currentQuestionIdx=0,this.state.totalQuestions=this.quiz.questions.length,delete this.state.currentQuestionDeadlineMs;for(let e of this.state.players.values())e.score=0;this.pendingAnswers.clear(),this.activeQuestions=[],this.revealedForIdx=-1,this.lastReveal=null,this.podium=null,await this.transport.broadcast(this.channel,GameEvents.gameReset())}}buildSnapshot(e,t){let n=this.state.players.get(e)?.score??0,r=Array.from(this.state.players.values()).filter(e=>!e.disconnectedAt).length,a=this.state.status,o=this.state.currentQuestionIdx,s=this.quiz.meta.oneShoot??!0;if(a===`finished`)return{phase:`finished`,quizMeta:t,totalScore:n,playerCount:r,...this.podium?{podium:this.podium}:{}};if(a===`active`){let e=this.revealedForIdx===o,a=this.activeQuestions[o],c=a?toPublic(a,o,s):void 0;return e&&this.lastReveal?{phase:`revealed`,quizMeta:t,totalScore:n,playerCount:r,...c?{question:c,questionIdx:o}:{},reveal:this.lastReveal}:{phase:`question`,quizMeta:t,totalScore:n,playerCount:r,...c?{question:c,questionIdx:o}:{},...this.state.currentQuestionDeadlineMs===void 0?{}:{deadlineMs:this.state.currentQuestionDeadlineMs}}}return{phase:`lobby`,quizMeta:t,totalScore:n,playerCount:r}}};function soloAvailable(e,t=globalThis.location?.protocol){return e.transport===`local`?t!==`https:`:!!(e.supabaseUrl&&e.supabaseAnonKey)}function configFromEnv(e){let t=t=>e[`HASHQUIZ_${t}`]||e[`VITE_${t}`]||void 0,n=t(`GRACE_MS`),r=n===void 0?NaN:Number(n);return{transport:t(`TRANSPORT`)===`supabase`?`supabase`:`local`,supabaseUrl:t(`SUPABASE_URL`),supabaseAnonKey:t(`SUPABASE_ANON_KEY`),graceMs:Number.isFinite(r)&&r>=0?r:void 0,soloScoring:t(`SOLO_SCORING`)===`edge`?`edge`:`browser`,playerUrl:t(`PLAYER_URL`)}}function readRuntimeConfig(e={}){let t=globalThis.__HASHQUIZ_CONFIG__,n=configFromEnv(e);return t?{transport:t.transport===`supabase`||t.transport===`local`?t.transport:n.transport,supabaseUrl:t.supabaseUrl||n.supabaseUrl,supabaseAnonKey:t.supabaseAnonKey||n.supabaseAnonKey,graceMs:t.graceMs??n.graceMs,soloScoring:t.soloScoring===`edge`||t.soloScoring===`browser`?t.soloScoring:n.soloScoring,playerUrl:t.playerUrl||n.playerUrl}:n}var config=readRuntimeConfig({BASE_URL:`/host/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}),HOST_PRESENCE_ID=`__host__`;function resolveGraceMs(e){if(typeof e==`number`&&Number.isFinite(e)&&e>=0)return e;let t=readRuntimeConfig({BASE_URL:`/host/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}).graceMs;return t===void 0?6e4:t}var SupabaseHostSession=class{engine;transport;channel;listeners=[];offBroadcast;offPresence;quizInfo;graceMs;graceTimers=new Map;constructor(e){this.transport=e.transport,this.channel=`game:${e.joinCode}`,this.engine=new GameEngine(e.quiz,e.transport,e.joinCode),this.graceMs=resolveGraceMs(e.graceMs);let t=e.quiz.questions.filter(e=>e.difficulty===`easy`).length,n=e.quiz.questions.filter(e=>e.difficulty===`medium`).length,r=e.quiz.questions.filter(e=>e.difficulty===`hard`).length,a=e.quiz.questions.length||1,o=e=>Math.round(e/a*100);this.quizInfo={title:e.quiz.meta.title,...e.quiz.meta.description!==void 0&&{description:e.quiz.meta.description},tags:e.quiz.meta.tags??[],totalQuestions:e.quiz.meta.maxQuestions===void 0?e.quiz.questions.length:Math.min(e.quiz.meta.maxQuestions,e.quiz.questions.length),...e.quiz.meta.targetDifficulty!==void 0&&{targetDifficulty:e.quiz.meta.targetDifficulty},difficultyDistribution:{easy:o(t),medium:o(n),hard:o(r)},...quizFormat(e.quiz.meta,e.quiz.questions.length)},this.offBroadcast=this.transport.subscribe(this.channel,e=>{this.emit(e),e.type===`answer_submit`&&this.engine.submitAnswer(e.playerId,e.choiceIds,e.timeRemaining),e.type===`state_request`&&this.transport.broadcast(this.channel,GameEvents.stateSnapshot(e.playerId,this.engine.buildSnapshot(e.playerId,this.quizInfo)))}),this.offPresence=this.transport.presence.onChange(this.channel,e=>{this.syncPlayers(e.filter(e=>e.id!==HOST_PRESENCE_ID))}),this.transport.presence.track(this.channel,{id:HOST_PRESENCE_ID,pseudo:`__host__`,email:``,score:0,joinedAt:Date.now()}),queueMicrotask(()=>{this.emit({type:`host_ready`,joinCode:e.joinCode,totalQuestions:e.quiz.meta.maxQuestions===void 0?e.quiz.questions.length:Math.min(e.quiz.meta.maxQuestions,e.quiz.questions.length),playerUrl:`${e.origin}/?code=${e.joinCode}`,quizMeta:this.quizInfo})})}syncPlayers(e){let t=new Set(e.map(e=>e.id));for(let t of e)this.cancelGrace(t.id),this.engine.addPlayer(t);for(let e of this.engine.state.players.keys()){if(t.has(e)||this.graceTimers.has(e))continue;if(this.engine.markPlayerDisconnected(e),this.graceMs===0){this.engine.removePlayer(e);continue}let n=setTimeout(()=>{this.graceTimers.delete(e),this.engine.state.players.get(e)?.disconnectedAt&&this.engine.removePlayer(e)},this.graceMs);this.graceTimers.set(e,n)}}cancelGrace(e){let t=this.graceTimers.get(e);t&&(clearTimeout(t),this.graceTimers.delete(e))}on(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}emit(e){for(let t of this.listeners)t(e)}async start(){await this.engine.start()}async reveal(){await this.engine.revealAnswer()}async next(){await this.engine.nextQuestion()}async reset(){await this.engine.reset()}dispose(){this.offBroadcast?.(),this.offPresence?.();for(let e of this.graceTimers.values())clearTimeout(e);this.graceTimers.clear()}};function __rest(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function __awaiter$1(e,t,n,r){function a(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?n(e.value):a(e.value).then(s,c)}l((r=r.apply(e,t||[])).next())})}var resolveFetch$3=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),FunctionsError=class extends Error{constructor(e,t=`FunctionsError`,n){super(e),this.name=t,this.context=n}toJSON(){return{name:this.name,message:this.message,context:this.context}}},FunctionsFetchError=class extends FunctionsError{constructor(e){super(`Failed to send a request to the Edge Function`,`FunctionsFetchError`,e)}},FunctionsRelayError=class extends FunctionsError{constructor(e){super(`Relay Error invoking the Edge Function`,`FunctionsRelayError`,e)}},FunctionsHttpError=class extends FunctionsError{constructor(e){super(`Edge Function returned a non-2xx status code`,`FunctionsHttpError`,e)}},FunctionRegion;(function(e){e.Any=`any`,e.ApNortheast1=`ap-northeast-1`,e.ApNortheast2=`ap-northeast-2`,e.ApSouth1=`ap-south-1`,e.ApSoutheast1=`ap-southeast-1`,e.ApSoutheast2=`ap-southeast-2`,e.CaCentral1=`ca-central-1`,e.EuCentral1=`eu-central-1`,e.EuWest1=`eu-west-1`,e.EuWest2=`eu-west-2`,e.EuWest3=`eu-west-3`,e.SaEast1=`sa-east-1`,e.UsEast1=`us-east-1`,e.UsWest1=`us-west-1`,e.UsWest2=`us-west-2`})(FunctionRegion||={});var FunctionsClient=class{constructor(e,{headers:t={},customFetch:n,region:r=FunctionRegion.Any}={}){this.url=e,this.headers=t,this.region=r,this.fetch=resolveFetch$3(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return __awaiter$1(this,arguments,void 0,function*(e,t={}){var n;let r,a;try{let{headers:n,method:o,body:s,signal:c,timeout:l}=t,u={},{region:d}=t;d||=this.region;let h=new URL(`${this.url}/${e}`);d&&d!==`any`&&(u[`x-region`]=d,h.searchParams.set(`forceFunctionRegion`,d));let g;s&&(n&&!Object.prototype.hasOwnProperty.call(n,`Content-Type`)||!n)?typeof Blob<`u`&&s instanceof Blob||s instanceof ArrayBuffer?(u[`Content-Type`]=`application/octet-stream`,g=s):typeof s==`string`?(u[`Content-Type`]=`text/plain`,g=s):typeof FormData<`u`&&s instanceof FormData?g=s:(u[`Content-Type`]=`application/json`,g=JSON.stringify(s)):g=s&&typeof s!=`string`&&!(typeof Blob<`u`&&s instanceof Blob)&&!(s instanceof ArrayBuffer)&&!(typeof FormData<`u`&&s instanceof FormData)?JSON.stringify(s):s;let w=c;l&&(a=new AbortController,r=setTimeout(()=>a.abort(),l),c?(w=a.signal,c.addEventListener(`abort`,()=>a.abort())):w=a.signal);let E=yield this.fetch(h.toString(),{method:o||`POST`,headers:Object.assign(Object.assign(Object.assign({},u),this.headers),n),body:g,signal:w}).catch(e=>{throw new FunctionsFetchError(e)}),D=E.headers.get(`x-relay-error`);if(D&&D===`true`)throw new FunctionsRelayError(E);if(!E.ok)throw new FunctionsHttpError(E);let O=(E.headers.get(`Content-Type`)??`text/plain`).split(`;`)[0].trim(),N;return N=O===`application/json`?yield E.json():O===`application/octet-stream`||O===`application/pdf`?yield E.blob():O===`text/event-stream`?E:O===`multipart/form-data`?yield E.formData():yield E.text(),{data:N,error:null,response:E}}catch(e){return{data:null,error:e,response:e instanceof FunctionsHttpError||e instanceof FunctionsRelayError?e.context:void 0}}finally{r&&clearTimeout(r)}})}},DEFAULT_MAX_RETRIES=3,getRetryDelay=e=>Math.min(1e3*2**e,3e4),RETRYABLE_STATUS_CODES=[520,503],RETRYABLE_METHODS=[`GET`,`HEAD`,`OPTIONS`],PostgrestError=class extends Error{constructor(e){super(e.message),this.name=`PostgrestError`,this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function sleep$1(e,t){return new Promise(n=>{if(t?.aborted){n();return}let r=setTimeout(()=>{t?.removeEventListener(`abort`,a),n()},e);function a(){clearTimeout(r),n()}t?.addEventListener(`abort`,a)})}function shouldRetry(e,t,n,r){return!(!r||n>=DEFAULT_MAX_RETRIES||!RETRYABLE_METHODS.includes(e)||!RETRYABLE_STATUS_CODES.includes(t))}var PostgrestBuilder=class{constructor(e){var t,n,r,a,o;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError??!1,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle??!1,this.shouldStripNulls=e.shouldStripNulls??!1,this.urlLengthLimit=e.urlLengthLimit??8e3,this.retryEnabled=e.retry??!0,this.fetch=e.fetch?e.fetch:fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get(`Accept`)===`text/csv`)throw Error(`stripNulls() cannot be used with csv()`);return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var n=this;if(this.schema===void 0||([`GET`,`HEAD`].includes(this.method)?this.headers.set(`Accept-Profile`,this.schema):this.headers.set(`Content-Profile`,this.schema)),this.method!==`GET`&&this.method!==`HEAD`&&this.headers.set(`Content-Type`,`application/json`),this.shouldStripNulls){let e=this.headers.get(`Accept`);e===`application/vnd.pgrst.object+json`?this.headers.set(`Accept`,`application/vnd.pgrst.object+json;nulls=stripped`):e&&e!==`application/json`||this.headers.set(`Accept`,`application/vnd.pgrst.array+json;nulls=stripped`)}let r=this.fetch,a=(async()=>{let e=0;for(;;){let o=new Headers(n.headers);e>0&&o.set(`X-Retry-Count`,String(e));let s;try{s=await r(n.url.toString(),{method:n.method,headers:o,body:JSON.stringify(n.body,(e,t)=>typeof t==`bigint`?t.toString():t),signal:n.signal})}catch(t){if(t?.name===`AbortError`||t?.code===`ABORT_ERR`||!RETRYABLE_METHODS.includes(n.method))throw t;if(n.retryEnabled&&e<DEFAULT_MAX_RETRIES){let t=getRetryDelay(e);e++,await sleep$1(t,n.signal);continue}throw t}if(shouldRetry(n.method,s.status,e,n.retryEnabled)){var t,a;let r=s.headers?.get(`Retry-After`)??null,o=r===null?getRetryDelay(e):Math.max(0,parseInt(r,10)||0)*1e3;await s.text(),e++,await sleep$1(o,n.signal)}else return await n.processResponse(s)}})();return this.shouldThrowOnError||(a=a.catch(e=>{var t;let n=``,r=``,a=``,o=e?.cause;if(o){var s,c,l,u;let t=o?.message??``,r=o?.code??``;n=`${e?.name??`FetchError`}: ${e?.message}`,n+=`\n\nCaused by: ${o?.name??`Error`}: ${t}`,r&&(n+=` (${r})`),o?.stack&&(n+=`\n${o.stack}`)}else{var d;n=e?.stack??``}let h=this.url.toString().length;return e?.name===`AbortError`||e?.code===`ABORT_ERR`?(a=``,r=`Request was aborted (timeout or manual cancellation)`,h>this.urlLengthLimit&&(r+=`. Note: Your request URL is ${h} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):(o?.name===`HeadersOverflowError`||o?.code===`UND_ERR_HEADERS_OVERFLOW`)&&(a=``,r=`HTTP headers exceeded server limits (typically 16KB)`,h>this.urlLengthLimit&&(r+=`. Your request URL is ${h} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${e?.name??`FetchError`}: ${e?.message}`,details:n,hint:r,code:a},data:null,count:null,status:0,statusText:``}})),a.then(e,t)}async processResponse(e){var t=this;let n=null,r=null,a=null,o=e.status,s=e.statusText;if(e.ok){var c,l;if(t.method!==`HEAD`){var u;let n=await e.text();n===``||(r=t.headers.get(`Accept`)===`text/csv`||t.headers.get(`Accept`)&&t.headers.get(`Accept`)?.includes(`application/vnd.pgrst.plan+text`)?n:JSON.parse(n))}let d=t.headers.get(`Prefer`)?.match(/count=(exact|planned|estimated)/),h=e.headers.get(`content-range`)?.split(`/`);d&&h&&h.length>1&&(a=parseInt(h[1])),t.isMaybeSingle&&Array.isArray(r)&&(r.length>1?(n={code:`PGRST116`,details:`Results contain ${r.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:`JSON object requested, multiple (or no) rows returned`},r=null,a=null,o=406,s=`Not Acceptable`):r=r.length===1?r[0]:null)}else{let a=await e.text();try{n=JSON.parse(a),Array.isArray(n)&&e.status===404&&(r=[],n=null,o=200,s=`OK`)}catch{e.status===404&&a===``?(o=204,s=`No Content`):n={message:a}}if(n&&t.shouldThrowOnError)throw new PostgrestError(n)}return{success:n===null,error:n,data:r,count:a,status:o,statusText:s}}returns(){return this}overrideTypes(){return this}},PostgrestTransformBuilder=class extends PostgrestBuilder{select(e){let t=!1,n=(e??`*`).split(``).map(e=>/\s/.test(e)&&!t?``:(e===`"`&&(t=!t),e)).join(``);return this.url.searchParams.set(`select`,n),this.headers.append(`Prefer`,`return=representation`),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:r,referencedTable:a=r}={}){let o=a?`${a}.order`:`order`,s=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${s?`${s},`:``}${e}.${t?`asc`:`desc`}${n===void 0?``:n?`.nullsfirst`:`.nullslast`}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){let r=n===void 0?`limit`:`${n}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:r=n}={}){let a=r===void 0?`offset`:`${r}.offset`,o=r===void 0?`limit`:`${r}.limit`;return this.url.searchParams.set(a,`${e}`),this.url.searchParams.set(o,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set(`Accept`,`application/vnd.pgrst.object+json`),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set(`Accept`,`text/csv`),this}geojson(){return this.headers.set(`Accept`,`application/geo+json`),this}explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:r=!1,wal:a=!1,format:o=`text`}={}){var s;let c=[e?`analyze`:null,t?`verbose`:null,n?`settings`:null,r?`buffers`:null,a?`wal`:null].filter(Boolean).join(`|`),l=this.headers.get(`Accept`)??`application/json`;return this.headers.set(`Accept`,`application/vnd.pgrst.plan+${o}; for="${l}"; options=${c};`),this}rollback(){return this.headers.append(`Prefer`,`tx=rollback`),this}returns(){return this}maxAffected(e){return this.headers.append(`Prefer`,`handling=strict`),this.headers.append(`Prefer`,`max-affected=${e}`),this}},PostgrestReservedCharsRegexp=RegExp(`[,()]`),PostgrestFilterBuilder=class extends PostgrestTransformBuilder{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(`,`)}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(`,`)}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(`,`)}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(`,`)}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){let n=Array.from(new Set(t)).map(e=>typeof e==`string`&&PostgrestReservedCharsRegexp.test(e)?`"${e}"`:`${e}`).join(`,`);return this.url.searchParams.append(e,`in.(${n})`),this}notIn(e,t){let n=Array.from(new Set(t)).map(e=>typeof e==`string`&&PostgrestReservedCharsRegexp.test(e)?`"${e}"`:`${e}`).join(`,`);return this.url.searchParams.append(e,`not.in.(${n})`),this}contains(e,t){return typeof t==`string`?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(`,`)}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t==`string`?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(`,`)}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t==`string`?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(`,`)}}`),this}textSearch(e,t,{config:n,type:r}={}){let a=``;r===`plain`?a=`pl`:r===`phrase`?a=`ph`:r===`websearch`&&(a=`w`);let o=n===void 0?``:`(${n})`;return this.url.searchParams.append(e,`${a}fts${o}.${t}`),this}match(e){return Object.entries(e).filter(([e,t])=>t!==void 0).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){let r=n?`${n}.or`:`or`;return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}},PostgrestQueryBuilder=class{constructor(e,{headers:t={},schema:n,fetch:r,urlLengthLimit:a=8e3,retry:o}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=r,this.urlLengthLimit=a,this.retry=o}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){let{head:n=!1,count:r}=t??{},a=n?`HEAD`:`GET`,o=!1,s=(e??`*`).split(``).map(e=>/\s/.test(e)&&!o?``:(e===`"`&&(o=!o),e)).join(``),{url:c,headers:l}=this.cloneRequestState();return c.searchParams.set(`select`,s),r&&l.append(`Prefer`,`count=${r}`),new PostgrestFilterBuilder({method:a,url:c,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:n=!0}={}){var r;let a=`POST`,{url:o,headers:s}=this.cloneRequestState();if(t&&s.append(`Prefer`,`count=${t}`),n||s.append(`Prefer`,`missing=default`),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);o.searchParams.set(`columns`,e.join(`,`))}}return new PostgrestFilterBuilder({method:`POST`,url:o,headers:s,schema:this.schema,body:e,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:r,defaultToNull:a=!0}={}){var o;let s=`POST`,{url:c,headers:l}=this.cloneRequestState();if(l.append(`Prefer`,`resolution=${n?`ignore`:`merge`}-duplicates`),t!==void 0&&c.searchParams.set(`on_conflict`,t),r&&l.append(`Prefer`,`count=${r}`),a||l.append(`Prefer`,`missing=default`),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);c.searchParams.set(`columns`,e.join(`,`))}}return new PostgrestFilterBuilder({method:`POST`,url:c,headers:l,schema:this.schema,body:e,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var n;let r=`PATCH`,{url:a,headers:o}=this.cloneRequestState();return t&&o.append(`Prefer`,`count=${t}`),new PostgrestFilterBuilder({method:`PATCH`,url:a,headers:o,schema:this.schema,body:e,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;let n=`DELETE`,{url:r,headers:a}=this.cloneRequestState();return e&&a.append(`Prefer`,`count=${e}`),new PostgrestFilterBuilder({method:`DELETE`,url:r,headers:a,schema:this.schema,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function _typeof$2(e){"@babel/helpers - typeof";return _typeof$2=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},_typeof$2(e)}function toPrimitive$2(e,t){if(_typeof$2(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(_typeof$2(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function toPropertyKey$2(e){var t=toPrimitive$2(e,`string`);return _typeof$2(t)==`symbol`?t:t+``}function _defineProperty$2(e,t,n){return(t=toPropertyKey$2(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ownKeys$2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _objectSpread2$2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ownKeys$2(Object(n),!0).forEach(function(t){_defineProperty$2(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys$2(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var PostgrestClient=class e{constructor(e,{headers:t={},schema:n,fetch:r,timeout:a,urlLengthLimit:o=8e3,retry:s}={}){this.url=e,this.headers=new Headers(t),this.schemaName=n,this.urlLengthLimit=o;let c=r??globalThis.fetch;this.fetch=a!==void 0&&a>0?(e,t)=>{let n=new AbortController,r=setTimeout(()=>n.abort(),a),o=t?.signal;if(o){if(o.aborted)return clearTimeout(r),c(e,t);let a=()=>{clearTimeout(r),n.abort()};return o.addEventListener(`abort`,a,{once:!0}),c(e,_objectSpread2$2(_objectSpread2$2({},t),{},{signal:n.signal})).finally(()=>{clearTimeout(r),o.removeEventListener(`abort`,a)})}return c(e,_objectSpread2$2(_objectSpread2$2({},t),{},{signal:n.signal})).finally(()=>clearTimeout(r))}:c,this.retry=s}from(e){if(!e||typeof e!=`string`||e.trim()===``)throw Error(`Invalid relation name: relation must be a non-empty string.`);return new PostgrestQueryBuilder(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,t={},{head:n=!1,get:r=!1,count:a}={}){var o;let s,c=new URL(`${this.url}/rpc/${e}`),l,u=e=>typeof e==`object`&&!!e&&(!Array.isArray(e)||e.some(u)),d=n&&Object.values(t).some(u);d?(s=`POST`,l=t):n||r?(s=n?`HEAD`:`GET`,Object.entries(t).filter(([e,t])=>t!==void 0).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(`,`)}}`:`${t}`]).forEach(([e,t])=>{c.searchParams.append(e,t)})):(s=`POST`,l=t);let h=new Headers(this.headers);return d?h.set(`Prefer`,a?`count=${a},return=minimal`:`return=minimal`):a&&h.set(`Prefer`,`count=${a}`),new PostgrestFilterBuilder({method:s,url:c,headers:h,schema:this.schemaName,body:l,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}},WebSocketFactory=class{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<`u`)return{type:`native`,wsConstructor:WebSocket};let t=globalThis;if(typeof globalThis<`u`&&t.WebSocket!==void 0)return{type:`native`,wsConstructor:t.WebSocket};let n=global$1===void 0?void 0:global$1;if(n&&n.WebSocket!==void 0)return{type:`native`,wsConstructor:n.WebSocket};if(typeof globalThis<`u`&&t.WebSocketPair!==void 0&&globalThis.WebSocket===void 0)return{type:`cloudflare`,error:`Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.`,workaround:`Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime.`};if(typeof globalThis<`u`&&t.EdgeRuntime||typeof navigator<`u`&&navigator.userAgent?.includes(`Vercel-Edge`))return{type:`unsupported`,error:`Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.`,workaround:`Use serverless functions or a different deployment target for WebSocket functionality.`};let r=globalThis.process;if(r){let e=r.versions;if(e&&e.node){let t=e.node,n=parseInt(t.replace(/^v/,``).split(`.`)[0]);return n>=22?globalThis.WebSocket===void 0?{type:`unsupported`,error:`Node.js ${n} detected but native WebSocket not found.`,workaround:`Provide a WebSocket implementation via the transport option.`}:{type:`native`,wsConstructor:globalThis.WebSocket}:{type:`unsupported`,error:`Node.js ${n} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
9
9
|
import ws from "ws"
|
|
10
10
|
new RealtimeClient(url, { transport: ws })`}}}return{type:`unsupported`,error:`Unknown JavaScript runtime without WebSocket support.`,workaround:`Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation.`}}static getWebSocketConstructor(){let e=this.detectEnvironment();if(e.wsConstructor)return e.wsConstructor;let t=e.error||`WebSocket not supported in this environment.`;throw e.workaround&&(t+=`\n\nSuggested solution: ${e.workaround}`),Error(t)}static isWebSocketSupported(){try{let e=this.detectEnvironment();return e.type===`native`||e.type===`ws`}catch{return!1}}},version$2=`2.106.1`,DEFAULT_VERSION=`realtime-js/${version$2}`,VSN_1_0_0=`1.0.0`,VSN_2_0_0=`2.0.0`,DEFAULT_VSN$1=VSN_2_0_0,DEFAULT_TIMEOUT$1=1e4,CHANNEL_STATES$1={closed:`closed`,errored:`errored`,joined:`joined`,joining:`joining`,leaving:`leaving`},CHANNEL_EVENTS$1={close:`phx_close`,error:`phx_error`,join:`phx_join`,reply:`phx_reply`,leave:`phx_leave`,access_token:`access_token`},CONNECTION_STATE={connecting:`connecting`,open:`open`,closing:`closing`,closed:`closed`},Serializer=class{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT=`broadcast`,this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,t){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event==`string`)return t(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var t;return this._isArrayBuffer(e.payload?.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var t,n;let r=e.payload?.payload??new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,r)}_encodeJsonUserBroadcastPush(e){var t,n;let r=e.payload?.payload??{},a=new TextEncoder().encode(JSON.stringify(r)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,a)}_encodeUserBroadcastPush(e,t,n){var r,a;let o=e.topic,s=e.ref??``,c=e.join_ref??``,l=e.payload.event,u=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},d=Object.keys(u).length===0?``:JSON.stringify(u);if(c.length>255)throw Error(`joinRef length ${c.length} exceeds maximum of 255`);if(s.length>255)throw Error(`ref length ${s.length} exceeds maximum of 255`);if(o.length>255)throw Error(`topic length ${o.length} exceeds maximum of 255`);if(l.length>255)throw Error(`userEvent length ${l.length} exceeds maximum of 255`);if(d.length>255)throw Error(`metadata length ${d.length} exceeds maximum of 255`);let h=this.USER_BROADCAST_PUSH_META_LENGTH+c.length+s.length+o.length+l.length+d.length,g=new ArrayBuffer(this.HEADER_LENGTH+h),w=new DataView(g),E=0;w.setUint8(E++,this.KINDS.userBroadcastPush),w.setUint8(E++,c.length),w.setUint8(E++,s.length),w.setUint8(E++,o.length),w.setUint8(E++,l.length),w.setUint8(E++,d.length),w.setUint8(E++,t),Array.from(c,e=>w.setUint8(E++,e.charCodeAt(0))),Array.from(s,e=>w.setUint8(E++,e.charCodeAt(0))),Array.from(o,e=>w.setUint8(E++,e.charCodeAt(0))),Array.from(l,e=>w.setUint8(E++,e.charCodeAt(0))),Array.from(d,e=>w.setUint8(E++,e.charCodeAt(0)));var D=new Uint8Array(g.byteLength+n.byteLength);return D.set(new Uint8Array(g),0),D.set(new Uint8Array(n),g.byteLength),D.buffer}decode(e,t){if(this._isArrayBuffer(e))return t(this._binaryDecode(e));if(typeof e==`string`){let[n,r,a,o,s]=JSON.parse(e);return t({join_ref:n,ref:r,topic:a,event:o,payload:s})}return t({})}_binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,t,r)}}_decodeUserBroadcast(e,t,n){let r=t.getUint8(1),a=t.getUint8(2),o=t.getUint8(3),s=t.getUint8(4),c=this.HEADER_LENGTH+4,l=n.decode(e.slice(c,c+r));c+=r;let u=n.decode(e.slice(c,c+a));c+=a;let d=n.decode(e.slice(c,c+o));c+=o;let h=e.slice(c,e.byteLength),g=s===this.JSON_ENCODING?JSON.parse(n.decode(h)):h,w={type:this.BROADCAST_EVENT,event:u,payload:g};return o>0&&(w.meta=JSON.parse(d)),{join_ref:null,ref:null,topic:l,event:this.BROADCAST_EVENT,payload:w}}_isArrayBuffer(e){var t;return e instanceof ArrayBuffer||e?.constructor?.name===`ArrayBuffer`}_pick(e,t){return!e||typeof e!=`object`?{}:Object.fromEntries(Object.entries(e).filter(([e])=>t.includes(e)))}},PostgresTypes;(function(e){e.abstime=`abstime`,e.bool=`bool`,e.date=`date`,e.daterange=`daterange`,e.float4=`float4`,e.float8=`float8`,e.int2=`int2`,e.int4=`int4`,e.int4range=`int4range`,e.int8=`int8`,e.int8range=`int8range`,e.json=`json`,e.jsonb=`jsonb`,e.money=`money`,e.numeric=`numeric`,e.oid=`oid`,e.reltime=`reltime`,e.text=`text`,e.time=`time`,e.timestamp=`timestamp`,e.timestamptz=`timestamptz`,e.timetz=`timetz`,e.tsrange=`tsrange`,e.tstzrange=`tstzrange`})(PostgresTypes||={});var convertChangeData=(e,t,n={})=>{var r;let a=n.skipTypes??[];return t?Object.keys(t).reduce((n,r)=>(n[r]=convertColumn(r,e,t,a),n),{}):{}},convertColumn=(e,t,n,r)=>{let a=t.find(t=>t.name===e)?.type,o=n[e];return a&&!r.includes(a)?convertCell(a,o):noop(o)},convertCell=(e,t)=>{if(e.charAt(0)===`_`)return toArray(t,e.slice(1,e.length));switch(e){case PostgresTypes.bool:return toBoolean(t);case PostgresTypes.float4:case PostgresTypes.float8:case PostgresTypes.int2:case PostgresTypes.int4:case PostgresTypes.int8:case PostgresTypes.numeric:case PostgresTypes.oid:return toNumber(t);case PostgresTypes.json:case PostgresTypes.jsonb:return toJson(t);case PostgresTypes.timestamp:return toTimestampString(t);case PostgresTypes.abstime:case PostgresTypes.date:case PostgresTypes.daterange:case PostgresTypes.int4range:case PostgresTypes.int8range:case PostgresTypes.money:case PostgresTypes.reltime:case PostgresTypes.text:case PostgresTypes.time:case PostgresTypes.timestamptz:case PostgresTypes.timetz:case PostgresTypes.tsrange:case PostgresTypes.tstzrange:default:return noop(t)}},noop=e=>e,toBoolean=e=>{switch(e){case`t`:return!0;case`f`:return!1;default:return e}},toNumber=e=>{if(typeof e==`string`){let t=parseFloat(e);if(!Number.isNaN(t))return t}return e},toJson=e=>{if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e},toArray=(e,t)=>{if(typeof e!=`string`)return e;let n=e.length-1,r=e[n];if(e[0]===`{`&&r===`}`){let r,a=e.slice(1,n);try{r=JSON.parse(`[`+a+`]`)}catch{r=a?a.split(`,`):[]}return r.map(e=>convertCell(t,e))}return e},toTimestampString=e=>typeof e==`string`?e.replace(` `,`T`):e,httpEndpointURL=e=>{let t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,`http`),t.pathname=t.pathname.replace(/\/+$/,``).replace(/\/socket\/websocket$/i,``).replace(/\/socket$/i,``).replace(/\/websocket$/i,``),t.pathname===``||t.pathname===`/`?t.pathname=`/api/broadcast`:t.pathname+=`/api/broadcast`,t.href},closure=e=>typeof e==`function`?e:function(){return e},globalSelf=typeof self<`u`?self:null,phxWindow=typeof window<`u`?window:null,global=globalSelf||phxWindow||globalThis,DEFAULT_VSN=`2.0.0`,DEFAULT_TIMEOUT=1e4,WS_CLOSE_NORMAL=1e3,SOCKET_STATES={connecting:0,open:1,closing:2,closed:3},CHANNEL_STATES={closed:`closed`,errored:`errored`,joined:`joined`,joining:`joining`,leaving:`leaving`},CHANNEL_EVENTS={close:`phx_close`,error:`phx_error`,join:`phx_join`,reply:`phx_reply`,leave:`phx_leave`},TRANSPORTS={longpoll:`longpoll`,websocket:`websocket`},XHR_STATES={complete:4},AUTH_TOKEN_PREFIX=`base64url.bearer.phx.`,Push=class{constructor(e,t,n,r){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived(`timeout`)||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger(`timeout`,{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},Timer=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries+=1,this.callback()},this.timerCalc(this.tries+1))}},Channel=class{constructor(e,t,n){this.state=CHANNEL_STATES.closed,this.topic=e,this.params=closure(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Push(this,CHANNEL_EVENTS.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Timer(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive(`ok`,()=>{this.state=CHANNEL_STATES.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this.joinPush.receive(`error`,e=>{this.state=CHANNEL_STATES.errored,this.socket.hasLogger()&&this.socket.log(`channel`,`error ${this.topic}`,e),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log(`channel`,`close ${this.topic}`),this.state=CHANNEL_STATES.closed,this.socket.remove(this)}),this.onError(e=>{this.socket.hasLogger()&&this.socket.log(`channel`,`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=CHANNEL_STATES.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive(`timeout`,()=>{this.socket.hasLogger()&&this.socket.log(`channel`,`timeout ${this.topic}`,this.joinPush.timeout),new Push(this,CHANNEL_EVENTS.leave,closure({}),this.timeout).send(),this.state=CHANNEL_STATES.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(CHANNEL_EVENTS.reply,(e,t)=>{this.trigger(this.replyEventName(t),e)})}join(e=this.timeout){if(this.joinedOnce)throw Error(`tried to join multiple times. 'join' can only be called a single time per channel instance`);return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=CHANNEL_STATES.closed,this.bindings=[]}onClose(e){this.on(CHANNEL_EVENTS.close,e)}onError(e){return this.on(CHANNEL_EVENTS.error,t=>e(t))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter(n=>n.event!==e||t!==void 0&&t!==n.ref)}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t||={},!this.joinedOnce)throw Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new Push(this,e,function(){return t},n);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=CHANNEL_STATES.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log(`channel`,`leave ${this.topic}`),this.trigger(CHANNEL_EVENTS.close,`leave`)},n=new Push(this,CHANNEL_EVENTS.leave,closure({}),e);return n.receive(`ok`,()=>t()).receive(`timeout`,()=>t()),n.send(),this.canPush()||n.trigger(`ok`,{}),n}onMessage(e,t,n){return t}filterBindings(e,t,n){return!0}isMember(e,t,n,r){return this.topic===e?r&&r!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log(`channel`,`dropping outdated message`,{topic:e,event:t,payload:n,joinRef:r}),!1):!0:!1}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=CHANNEL_STATES.joining,this.joinPush.resend(e))}trigger(e,t,n,r){let a=this.onMessage(e,t,n,r);if(t&&!a)throw Error(`channel onMessage callbacks must return the payload, modified or unmodified`);let o=this.bindings.filter(r=>r.event===e&&this.filterBindings(r,t,n));for(let e=0;e<o.length;e++)o[e].callback(a,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===CHANNEL_STATES.closed}isErrored(){return this.state===CHANNEL_STATES.errored}isJoined(){return this.state===CHANNEL_STATES.joined}isJoining(){return this.state===CHANNEL_STATES.joining}isLeaving(){return this.state===CHANNEL_STATES.leaving}},Ajax=class{static request(e,t,n,r,a,o,s){if(global.XDomainRequest){let n=new global.XDomainRequest;return this.xdomainRequest(n,e,t,r,a,o,s)}if(global.XMLHttpRequest){let c=new global.XMLHttpRequest;return this.xhrRequest(c,e,t,n,r,a,o,s)}if(global.fetch&&global.AbortController)return this.fetchRequest(e,t,n,r,a,o,s);throw Error(`No suitable XMLHttpRequest implementation found`)}static fetchRequest(e,t,n,r,a,o,s){let c={method:e,headers:n,body:r},l=null;return a&&(l=new AbortController,setTimeout(()=>l.abort(),a),c.signal=l.signal),global.fetch(t,c).then(e=>e.text()).then(e=>this.parseJSON(e)).then(e=>s&&s(e)).catch(e=>{e.name===`AbortError`&&o?o():s&&s(null)}),l}static xdomainRequest(e,t,n,r,a,o,s){return e.timeout=a,e.open(t,n),e.onload=()=>{let t=this.parseJSON(e.responseText);s&&s(t)},o&&(e.ontimeout=o),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,a,o,s,c){e.open(t,n,!0),e.timeout=o;for(let[t,n]of Object.entries(r))e.setRequestHeader(t,n);return e.onerror=()=>c&&c(null),e.onreadystatechange=()=>{e.readyState===XHR_STATES.complete&&c&&c(this.parseJSON(e.responseText))},s&&(e.ontimeout=s),e.send(a),e}static parseJSON(e){if(!e||e===``)return null;try{return JSON.parse(e)}catch{return console&&console.log(`failed to parse JSON response`,e),null}}static serialize(e,t){let n=[];for(var r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let a=t?`${t}[${r}]`:r,o=e[r];typeof o==`object`?n.push(this.serialize(o,a)):n.push(encodeURIComponent(a)+`=`+encodeURIComponent(o))}return n.join(`&`)}static appendParams(e,t){return Object.keys(t).length===0?e:`${e}${e.match(/\?/)?`&`:`?`}${this.serialize(t)}`}},arrayBufferToBase64=e=>{let t=``,n=new Uint8Array(e),r=n.byteLength;for(let e=0;e<r;e++)t+=String.fromCharCode(n[e]);return btoa(t)},LongPoll=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(AUTH_TOKEN_PREFIX)&&(this.authToken=atob(t[1].slice(AUTH_TOKEN_PREFIX.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=SOCKET_STATES.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace(`ws://`,`http://`).replace(`wss://`,`https://`).replace(RegExp(`(.*)/`+TRANSPORTS.websocket),`$1/`+TRANSPORTS.longpoll)}endpointURL(){return Ajax.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=SOCKET_STATES.connecting}ontimeout(){this.onerror(`timeout`),this.closeAndRetry(1005,`timeout`,!1)}isActive(){return this.readyState===SOCKET_STATES.open||this.readyState===SOCKET_STATES.connecting}poll(){let e={Accept:`application/json`};this.authToken&&(e[`X-Phoenix-AuthToken`]=this.authToken),this.ajax(`GET`,e,null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:n,messages:r}=e;if(t===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,`session_gone`,!1);return}this.token=n}else t=0;switch(t){case 200:r.forEach(e=>{setTimeout(()=>this.onmessage({data:e}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=SOCKET_STATES.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,`forbidden`,!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,`internal server error`,500);break;default:throw Error(`unhandled poll status ${t}`)}})}send(e){typeof e!=`string`&&(e=arrayBufferToBase64(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax(`POST`,{"Content-Type":`application/x-ndjson`},e.join(`
|
|
11
11
|
`),()=>this.onerror(`timeout`),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,`internal server error`,!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,n){for(let e of this.reqs)e.abort();this.readyState=SOCKET_STATES.closed;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<`u`?this.onclose(new CloseEvent(`close`,r)):this.onclose(r)}ajax(e,t,n,r,a){let o;o=Ajax.request(e,this.endpointURL(),t,n,this.timeout,()=>{this.reqs.delete(o),r()},e=>{this.reqs.delete(o),this.isActive()&&a(e)}),this.reqs.add(o)}},Presence=class e{constructor(t,n={}){let r=n.events||{state:`presence_state`,diff:`presence_diff`};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(r.state,t=>{let{onJoin:n,onLeave:r,onSync:a}=this.caller;this.joinRef=this.channel.joinRef(),this.state=e.syncState(this.state,t,n,r),this.pendingDiffs.forEach(t=>{this.state=e.syncDiff(this.state,t,n,r)}),this.pendingDiffs=[],a()}),this.channel.on(r.diff,t=>{let{onJoin:n,onLeave:r,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(t):(this.state=e.syncDiff(this.state,t,n,r),a())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(t){return e.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,t,n,r){let a=this.clone(e),o={},s={};return this.map(a,(e,n)=>{t[e]||(s[e]=n)}),this.map(t,(e,t)=>{let n=a[e];if(n){let r=t.metas.map(e=>e.phx_ref),a=n.metas.map(e=>e.phx_ref),c=t.metas.filter(e=>a.indexOf(e.phx_ref)<0),l=n.metas.filter(e=>r.indexOf(e.phx_ref)<0);c.length>0&&(o[e]=t,o[e].metas=c),l.length>0&&(s[e]=this.clone(n),s[e].metas=l)}else o[e]=t}),this.syncDiff(a,{joins:o,leaves:s},n,r)}static syncDiff(e,t,n,r){let{joins:a,leaves:o}=this.clone(t);return n||=function(){},r||=function(){},this.map(a,(t,r)=>{let a=e[t];if(e[t]=this.clone(r),a){let n=e[t].metas.map(e=>e.phx_ref),r=a.metas.filter(e=>n.indexOf(e.phx_ref)<0);e[t].metas.unshift(...r)}n(t,a,r)}),this.map(o,(t,n)=>{let a=e[t];if(!a)return;let o=n.metas.map(e=>e.phx_ref);a.metas=a.metas.filter(e=>o.indexOf(e.phx_ref)<0),r(t,a,n),a.metas.length===0&&delete e[t]}),e}static list(e,t){return t||=function(e,t){return t},this.map(e,(e,n)=>t(e,n))}static map(e,t){return Object.getOwnPropertyNames(e).map(n=>t(n,e[n]))}static clone(e){return JSON.parse(JSON.stringify(e))}},serializer_default={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,r,a,o,s]=JSON.parse(e);return t({join_ref:n,ref:r,topic:a,event:o,payload:s})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:a,payload:o}=e,s=this.META_LENGTH+t.length+n.length+a.length+r.length,c=new ArrayBuffer(this.HEADER_LENGTH+s),l=new DataView(c),u=0;l.setUint8(u++,this.KINDS.push),l.setUint8(u++,t.length),l.setUint8(u++,n.length),l.setUint8(u++,a.length),l.setUint8(u++,r.length),Array.from(t,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(n,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(a,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(r,e=>l.setUint8(u++,e.charCodeAt(0)));var d=new Uint8Array(c.byteLength+o.byteLength);return d.set(new Uint8Array(c),0),d.set(new Uint8Array(o),c.byteLength),d.buffer},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,r);case this.KINDS.reply:return this.decodeReply(e,t,r);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,r)}},decodePush(e,t,n){let r=t.getUint8(1),a=t.getUint8(2),o=t.getUint8(3),s=this.HEADER_LENGTH+this.META_LENGTH-1,c=n.decode(e.slice(s,s+r));s+=r;let l=n.decode(e.slice(s,s+a));s+=a;let u=n.decode(e.slice(s,s+o));return s+=o,{join_ref:c,ref:null,topic:l,event:u,payload:e.slice(s,e.byteLength)}},decodeReply(e,t,n){let r=t.getUint8(1),a=t.getUint8(2),o=t.getUint8(3),s=t.getUint8(4),c=this.HEADER_LENGTH+this.META_LENGTH,l=n.decode(e.slice(c,c+r));c+=r;let u=n.decode(e.slice(c,c+a));c+=a;let d=n.decode(e.slice(c,c+o));c+=o;let h=n.decode(e.slice(c,c+s));c+=s;let g={status:h,response:e.slice(c,e.byteLength)};return{join_ref:l,ref:u,topic:d,event:CHANNEL_EVENTS.reply,payload:g}},decodeBroadcast(e,t,n){let r=t.getUint8(1),a=t.getUint8(2),o=this.HEADER_LENGTH+2,s=n.decode(e.slice(o,o+r));o+=r;let c=n.decode(e.slice(o,o+a));return o+=a,{join_ref:null,ref:null,topic:s,event:c,payload:e.slice(o,e.byteLength)}}},Socket=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||DEFAULT_TIMEOUT,this.transport=t.transport||global.WebSocket||LongPoll,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let n=null;try{n=global&&global.sessionStorage}catch{}this.sessionStore=t.sessionStorage||n,this.establishedConnections=0,this.defaultEncoder=serializer_default.encode.bind(serializer_default),this.defaultDecoder=serializer_default.decode.bind(serializer_default),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=t.binaryType||`arraybuffer`,this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport===LongPoll?(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder):(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder);let r=null;phxWindow&&phxWindow.addEventListener&&(phxWindow.addEventListener(`pagehide`,e=>{this.conn&&(this.disconnect(),r=this.connectClock)}),phxWindow.addEventListener(`pageshow`,e=>{r===this.connectClock&&(r=null,this.connect())}),phxWindow.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=e=>t.rejoinAfterMs?t.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>t.reconnectAfterMs?t.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(e,t,n)=>{console.log(`${e}: ${t}`,n)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=closure(t.params||{}),this.endPoint=`${e}/${TRANSPORTS.websocket}`,this.vsn=t.vsn||DEFAULT_VSN,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Timer(()=>{this.pageHidden?(this.log(`Not reconnecting as page is hidden!`),this.teardown()):this.teardown(async()=>{t.beforeReconnect&&await t.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=t.authToken}getLongPollTransport(){return LongPoll}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&=(this.conn.close(),null),this.transport=e}protocol(){return location.protocol.match(/^https/)?`wss`:`ws`}endPointURL(){let e=Ajax.appendParams(Ajax.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)===`/`?e.charAt(1)===`/`?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`:e}disconnect(e,t,n){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,n)}connect(e){e&&(console&&console.log(`passing params to connect is deprecated. Instead pass :params to the Socket constructor`),this.params=closure(e)),(!this.conn||this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==LongPoll?this.connectWithFallback(LongPoll,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:`phoenix`,event:`heartbeat`,payload:{},ref:t});let r=this.onMessage(a=>{a.ref===t&&(this.off([r]),e(Date.now()-n))});return!0}transportName(e){return e===LongPoll?`LongPoll`:e.name}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=[`phoenix`,`${AUTH_TOKEN_PREFIX}${btoa(this.authToken).replace(/=/g,``)}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n=!1,r=!0,a,o,s=this.transportName(e),c=t=>{this.log(`transport`,`falling back to ${s}...`,t),this.off([a,o]),r=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${s}`))return c(`memorized`);this.fallbackTimer=setTimeout(c,t),o=this.onError(e=>{this.log(`transport`,`error`,e),r&&!n&&(clearTimeout(this.fallbackTimer),c(e))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(n=!0,!r){let t=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${t}`,`true`),this.log(`transport`,`established ${t} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(c,t),this.ping(e=>{this.log(`transport`,`connected to primary after`,e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log(`transport`,`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks(`open`)}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log(`transport`,`heartbeat timeout. Attempting to re-establish connection`);try{this.heartbeatCallback(`timeout`)}catch(e){this.log(`error`,`error in heartbeat callback`,e)}this.triggerChanError(Error(`heartbeat timeout`)),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),WS_CLOSE_NORMAL,`heartbeat timeout`)}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();let r=this.conn;this.waitForBufferDone(r,()=>{t?r.close(t,n||``):r.close(),this.waitForSocketClosed(r,()=>{this.conn===r&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,n=1){n===5||!e.bufferedAmount?t():setTimeout(()=>{this.waitForBufferDone(e,t,n+1)},150*n)}waitForSocketClosed(e,t,n=1){n===5||e.readyState===SOCKET_STATES.closed?t():setTimeout(()=>{this.waitForSocketClosed(e,t,n+1)},150*n)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log(`transport`,`close`,e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks(`close`,e)}onConnError(e){this.hasLogger()&&this.log(`transport`,`error`,e);let t=this.transport,n=this.establishedConnections;this.triggerStateCallbacks(`error`,e,t,n),(t===this.transport||n>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(CHANNEL_EVENTS.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case SOCKET_STATES.connecting:return`connecting`;case SOCKET_STATES.open:return`open`;case SOCKET_STATES.closing:return`closing`;default:return`closed`}}isConnected(){return this.connectionState()===`open`}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([t])=>e.indexOf(t)===-1)}channel(e,t={}){let n=new Channel(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:a,join_ref:o}=e;this.log(`push`,`${t} ${n} (${o}, ${a})`,r)}this.isConnected()?this.encode(e,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(e,e=>this.conn.send(e)))}makeRef(){let e=this.ref+1;return this.ref=e===this.ref?0:e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected())try{this.heartbeatCallback(`disconnected`)}catch(e){this.log(`error`,`error in heartbeat callback`,e)}else if(this.pendingHeartbeatRef)this.heartbeatTimeout();else{this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:`phoenix`,event:`heartbeat`,payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback(`sent`)}catch(e){this.log(`error`,`error in heartbeat callback`,e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,e=>{let{topic:t,event:n,payload:r,ref:a,join_ref:o}=e;if(a&&a===this.pendingHeartbeatRef){let e=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(r.status===`ok`?`ok`:`error`,e)}catch(e){this.log(`error`,`error in heartbeat callback`,e)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log(`receive`,`${r.status||``} ${t} ${n} ${a&&`(`+a+`)`||``}`.trim(),r);for(let e=0;e<this.channels.length;e++){let s=this.channels[e];s.isMember(t,n,r,o)&&s.trigger(n,r,a,o)}this.triggerStateCallbacks(`message`,e)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([n,r])=>{try{r(...t)}catch(t){this.log(`error`,`error in ${e} callback`,t)}})}catch(t){this.log(`error`,`error triggering ${e} callbacks`,t)}}leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t.isJoined()||t.isJoining()));t&&(this.hasLogger()&&this.log(`transport`,`leaving duplicate topic "${e}"`),t.leave())}},PresenceAdapter=class e{constructor(t,n){let r=phoenixPresenceOptions(n);this.presence=new Presence(t.getChannel(),r),this.presence.onJoin((n,r,a)=>{let o=e.onJoinPayload(n,r,a);t.getChannel().trigger(`presence`,o)}),this.presence.onLeave((n,r,a)=>{let o=e.onLeavePayload(n,r,a);t.getChannel().trigger(`presence`,o)}),this.presence.onSync(()=>{t.getChannel().trigger(`presence`,{event:`sync`})})}get state(){return e.transformState(this.presence.state)}static transformState(e){return e=cloneState(e),Object.getOwnPropertyNames(e).reduce((t,n)=>(t[n]=transformState(e[n]),t),{})}static onJoinPayload(e,t,n){return{event:`join`,key:e,currentPresences:parseCurrentPresences(t),newPresences:transformState(n)}}static onLeavePayload(e,t,n){return{event:`leave`,key:e,currentPresences:parseCurrentPresences(t),leftPresences:transformState(n)}}};function transformState(e){return e.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function cloneState(e){return JSON.parse(JSON.stringify(e))}function phoenixPresenceOptions(e){return e?.events&&{events:e.events}}function parseCurrentPresences(e){return e?.metas?transformState(e):[]}var REALTIME_PRESENCE_LISTEN_EVENTS;(function(e){e.SYNC=`sync`,e.JOIN=`join`,e.LEAVE=`leave`})(REALTIME_PRESENCE_LISTEN_EVENTS||={});var RealtimePresence=class{get state(){return this.presenceAdapter.state}constructor(e,t){this.channel=e,this.presenceAdapter=new PresenceAdapter(this.channel.channelAdapter,t)}};function normalizeChannelError(e){if(e instanceof Error)return e;if(typeof e==`string`)return Error(e);if(e&&typeof e==`object`){let t=e;if(typeof t.code==`number`){let n=typeof t.reason==`string`&&t.reason?` (${t.reason})`:``;return Error(`socket closed: ${t.code}${n}`,{cause:e})}return Error(`channel error: transport failure`,{cause:e})}return Error(`channel error: connection lost`)}var ChannelAdapter=class{constructor(e,t,n){let r=phoenixChannelParams(n);this.channel=e.getSocket().channel(t,r),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,t){return this.channel.on(e,t)}off(e,t){this.channel.off(e,t)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,t,n){let r;try{r=this.channel.push(e,t,n)}catch{throw Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>100){let e=this.channel.pushBuffer.shift();e.cancelTimeout(),this.socket.log(`channel`,`discarded push due to buffer overflow: ${e.event}`,e.payload())}return r}updateJoinPayload(e){let t=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},t),e)}canPush(){return this.socket.isConnected()&&this.state===CHANNEL_STATES$1.joined}isJoined(){return this.state===CHANNEL_STATES$1.joined}isJoining(){return this.state===CHANNEL_STATES$1.joining}isClosed(){return this.state===CHANNEL_STATES$1.closed}isLeaving(){return this.state===CHANNEL_STATES$1.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}};function phoenixChannelParams(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:``,enabled:!1},private:!1},e.config)}}var REALTIME_POSTGRES_CHANGES_LISTEN_EVENT;(function(e){e.ALL=`*`,e.INSERT=`INSERT`,e.UPDATE=`UPDATE`,e.DELETE=`DELETE`})(REALTIME_POSTGRES_CHANGES_LISTEN_EVENT||={});var REALTIME_LISTEN_TYPES;(function(e){e.BROADCAST=`broadcast`,e.PRESENCE=`presence`,e.POSTGRES_CHANGES=`postgres_changes`,e.SYSTEM=`system`})(REALTIME_LISTEN_TYPES||={});var REALTIME_SUBSCRIBE_STATES;(function(e){e.SUBSCRIBED=`SUBSCRIBED`,e.TIMED_OUT=`TIMED_OUT`,e.CLOSED=`CLOSED`,e.CHANNEL_ERROR=`CHANNEL_ERROR`})(REALTIME_SUBSCRIBE_STATES||={});var RealtimeChannel=class e{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,t={config:{}},n){var r,a;if(this.topic=e,this.params=t,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,``),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:``,enabled:!1},private:!1},t.config),this.channelAdapter=new ChannelAdapter(this.socket.socketAdapter,e,this.params),this.presence=new RealtimePresence(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=httpEndpointURL(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&this.params.config?.broadcast?.replay)throw Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,t=this.timeout){var n,r,a;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){let{config:{broadcast:n,presence:r,private:a}}=this.params,o=this.bindings.postgres_changes?.map(e=>e.filter)??[],s=!!this.bindings[REALTIME_LISTEN_TYPES.PRESENCE]&&this.bindings[REALTIME_LISTEN_TYPES.PRESENCE].length>0||this.params.config.presence?.enabled===!0,c={},l={broadcast:n,presence:Object.assign(Object.assign({},r),{enabled:s}),postgres_changes:o,private:a};this.socket.accessTokenValue&&(c.access_token=this.socket.accessTokenValue),this._onError(t=>{e?.(REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR,normalizeChannelError(t))}),this._onClose(()=>e?.(REALTIME_SUBSCRIBE_STATES.CLOSED)),this.updateJoinPayload(Object.assign({config:l},c)),this._updateFilterMessage(),this.channelAdapter.subscribe(t).receive(`ok`,async({postgres_changes:t})=>{this.socket._isManualToken()||this.socket.setAuth(),t===void 0?e?.(REALTIME_SUBSCRIBE_STATES.SUBSCRIBED):this._updatePostgresBindings(t,e)}).receive(`error`,t=>{this.state=CHANNEL_STATES$1.errored;let n=Object.values(t).join(`, `)||`error`;e?.(REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR,Error(n,{cause:t}))}).receive(`timeout`,()=>{e?.(REALTIME_SUBSCRIBE_STATES.TIMED_OUT)})}return this}_updatePostgresBindings(t,n){var r;let a=this.bindings.postgres_changes,o=a?.length??0,s=[];for(let r=0;r<o;r++){let o=a[r],{filter:{event:c,schema:l,table:u,filter:d}}=o,h=t&&t[r];if(h&&h.event===c&&e.isFilterValueEqual(h.schema,l)&&e.isFilterValueEqual(h.table,u)&&e.isFilterValueEqual(h.filter,d))s.push(Object.assign(Object.assign({},o),{id:h.id}));else{this.unsubscribe(),this.state=CHANNEL_STATES$1.errored,n?.(REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR,Error(`mismatch between server and client bindings for postgres changes`));return}}this.bindings.postgres_changes=s,this.state!=CHANNEL_STATES$1.errored&&n&&n(REALTIME_SUBSCRIBE_STATES.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:`presence`,event:`track`,payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:`presence`,event:`untrack`},e)}on(e,t,n){let r=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),a=e===REALTIME_LISTEN_TYPES.PRESENCE||e===REALTIME_LISTEN_TYPES.POSTGRES_CHANGES;if(r&&a)throw this.socket.log(`channel`,`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,t,n)}async httpSend(e,t,n={}){var r;if(t==null)return Promise.reject(Error(`Payload is required for httpSend()`));let a={apikey:this.socket.apiKey?this.socket.apiKey:``,"Content-Type":`application/json`};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);let o={method:`POST`,headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:t,private:this.private}]})},s=await this._fetchWithTimeout(this.broadcastEndpointURL,o,n.timeout??this.timeout);if(s.status===202)return{success:!0};let c=s.statusText;try{let e=await s.json();c=e.error||e.message||c}catch{}return Promise.reject(Error(c))}async send(e,t={}){var n,r;if(!this.channelAdapter.canPush()&&e.type===`broadcast`){console.warn(`Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.`);let{event:n,payload:r}=e,a={apikey:this.socket.apiKey?this.socket.apiKey:``,"Content-Type":`application/json`};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);let o={method:`POST`,headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:n,payload:r,private:this.private}]})};try{let e=await this._fetchWithTimeout(this.broadcastEndpointURL,o,t.timeout??this.timeout);return await e.body?.cancel(),e.ok?`ok`:`error`}catch(e){return e instanceof Error&&e.name===`AbortError`?`timed out`:`error`}}return new Promise(n=>{var r,a,o;let s=this.channelAdapter.push(e.type,e,t.timeout||this.timeout);e.type===`broadcast`&&!this.params?.config?.broadcast?.ack&&n(`ok`),s.receive(`ok`,()=>n(`ok`)),s.receive(`error`,()=>n(`error`)),s.receive(`timeout`,()=>n(`timed out`))})}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(t=>{this.channelAdapter.unsubscribe(e).receive(`ok`,()=>t(`ok`)).receive(`timeout`,()=>t(`timed out`)).receive(`error`,()=>t(`error`))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,t,n){let r=new AbortController,a=setTimeout(()=>r.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:r.signal}));return clearTimeout(a),o}_on(e,t,n){let r=e.toLocaleLowerCase(),a={type:r,filter:t,callback:n,ref:this.channelAdapter.on(e,n)};return this.bindings[r]?this.bindings[r].push(a):this.bindings[r]=[a],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,t,n)=>{var r,a,o,s,c,l,u;let d=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,n))return!1;let h=this.bindings[d]?.find(t=>t.ref===e.ref);if(!h)return!0;if([`broadcast`,`presence`,`postgres_changes`].includes(d)){if(`id`in h){let e=h.id,n=h.filter?.event;return e&&t.ids?.includes(e)&&(n===`*`||n?.toLocaleLowerCase()===t.data?.type.toLocaleLowerCase())}{let e=(h?.filter?.event)?.toLocaleLowerCase();return e===`*`||e===(t?.event)?.toLocaleLowerCase()}}return h.type.toLocaleLowerCase()===d})}_notThisChannelEvent(e,t){let{close:n,error:r,leave:a,join:o}=CHANNEL_EVENTS$1;return t&&[n,r,a,o].includes(e)&&t!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,t,n)=>{if(typeof t==`object`&&`ids`in t){let e=t.data,{schema:n,table:r,commit_timestamp:a,type:o,errors:s}=e;return Object.assign(Object.assign({},{schema:n,table:r,commit_timestamp:a,eventType:o,new:{},old:{},errors:s}),this._getPayloadRecords(e))}return t})}copyBindings(e){if(this.joinedOnce)throw Error(`cannot copy bindings into joined channel`);for(let t in e.bindings)for(let n of e.bindings[t])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,t){return(e??void 0)===(t??void 0)}_getPayloadRecords(e){let t={new:{},old:{}};return(e.type===`INSERT`||e.type===`UPDATE`)&&(t.new=convertChangeData(e.columns,e.record)),(e.type===`UPDATE`||e.type===`DELETE`)&&(t.old=convertChangeData(e.columns,e.old_record)),t}},SocketAdapter=class{constructor(e,t){this.socket=new Socket(e,t)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,t,n,r=1e4){return new Promise(a=>{setTimeout(()=>a(`timeout`),r),this.socket.disconnect(()=>{e(),a(`ok`)},t,n)})}push(e){this.socket.push(e)}log(e,t,n){this.socket.log(e,t,n)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==CONNECTION_STATE.connecting}isDisconnecting(){return this.socket.connectionState()==CONNECTION_STATE.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}},CONNECTION_TIMEOUTS={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},RECONNECT_INTERVALS=[1e3,2e3,5e3,1e4],DEFAULT_RECONNECT_FALLBACK=1e4;function createMemorySessionStorage(){let e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem(t){return e.has(t)?e.get(t):null},key(t){var n;return Array.from(e.keys())[t]??null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,String(n))}}}function resolveSessionStorage(){try{if(typeof globalThis<`u`&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return createMemorySessionStorage()}var WORKER_SCRIPT=`
|
|
@@ -76,7 +76,7 @@ return `+str.trim()+`;
|
|
|
76
76
|
`}})),require_excerpt=__commonJSMin(((e,t)=>{var n=require_defaults();t.exports=function(e,t){let r=n(t);if(e.data??={},typeof r.excerpt==`function`)return r.excerpt(e,r);let a=e.data.excerpt_separator||r.excerpt_separator;if(a==null&&(r.excerpt===!1||r.excerpt==null))return e;let o=typeof r.excerpt==`string`?r.excerpt:a||r.delimiters[0],s=e.content.indexOf(o);return s!==-1&&(e.excerpt=e.content.slice(0,s)),e}})),require_to_file=__commonJSMin(((e,t)=>{var n=require_kind_of(),r=require_stringify(),a=require_utils();t.exports=function(e){return n(e)!==`object`&&(e={content:e}),n(e.data)!==`object`&&(e.data={}),e.contents&&e.content==null&&(e.content=e.contents),a.define(e,`orig`,a.toBuffer(e.content)),a.define(e,`language`,e.language||``),a.define(e,`matter`,e.matter||``),a.define(e,`stringify`,function(t,n){return n&&n.language&&(e.language=n.language),r(e,t,n)}),e.content=a.toString(e.content),e.isEmpty=!1,e.excerpt=``,e}})),require_parse=__commonJSMin(((e,t)=>{var n=require_engine(),r=require_defaults();t.exports=function(e,t,a){let o=r(a),s=n(e,o);if(typeof s.parse!=`function`)throw TypeError(`expected "`+e+`.parse" to be a function`);return s.parse(t,o)}})),require_gray_matter=__commonJSMin(((e,t)=>{var n=require___vite_browser_external(),r=require_section_matter(),a=require_defaults(),o=require_stringify(),s=require_excerpt(),c=require_engines(),l=require_to_file(),u=require_parse(),d=require_utils();function h(e,t){if(e===``)return{data:{},content:e,excerpt:``,orig:e};let n=l(e),r=h.cache[n.content];if(!t){if(r)return n=Object.assign({},r),n.orig=r.orig,n;h.cache[n.content]=n}return g(n,t)}function g(e,t){let n=a(t),o=n.delimiters[0],c=`
|
|
77
77
|
`+n.delimiters[1],l=e.content;n.language&&(e.language=n.language);let g=o.length;if(!d.startsWith(l,o,g))return s(e,n),e;if(l.charAt(g)===o.slice(-1))return e;l=l.slice(g);let w=l.length,E=h.language(l,n);E.name&&(e.language=E.name,l=l.slice(E.raw.length));let D=l.indexOf(c);return D===-1&&(D=w),e.matter=l.slice(0,D),e.matter.replace(/^\s*#[^\n]+/gm,``).trim()===``?(e.isEmpty=!0,e.empty=e.content,e.data={}):e.data=u(e.language,e.matter,n),D===w?e.content=``:(e.content=l.slice(D+c.length),e.content[0]===`\r`&&(e.content=e.content.slice(1)),e.content[0]===`
|
|
78
78
|
`&&(e.content=e.content.slice(1))),s(e,n),(n.sections===!0||typeof n.section==`function`)&&r(e,n.section),e}h.engines=c,h.stringify=function(e,t,n){return typeof e==`string`&&(e=h(e,n)),o(e,t,n)},h.read=function(e,t){let r=h(n.readFileSync(e,`utf8`),t);return r.path=e,r},h.test=function(e,t){return d.startsWith(e,a(t).delimiters[0])},h.language=function(e,t){let n=a(t).delimiters[0];h.test(e)&&(e=e.slice(n.length));let r=e.slice(0,e.search(/\r?\n/));return{raw:r,name:r?r.trim():``}},h.cache={},h.clearCache=function(){h.cache={}},t.exports=h})),import_gray_matter=__toESM(require_gray_matter(),1);function parseMaxTime(e){if(e!=null){if(typeof e==`number`)return e*60;if(typeof e==`string`){let t=e.trim();if(t.endsWith(`s`)){let e=parseInt(t,10);return isNaN(e)?void 0:e}if(t.endsWith(`m`)){let e=parseInt(t,10);return isNaN(e)?void 0:e*60}let n=parseInt(t,10);return isNaN(n)?void 0:n*60}}}function parseMeta(e){let t;t=e.startsWith(`---`)?e.split(`
|
|
79
|
-
`).slice(1).findIndex(e=>e===`---`)===-1?`${e}\n---`:e:`---\n${e}\n---`;let{data:n}=(0,import_gray_matter.default)(t);return{title:typeof n.title==`string`?n.title:``,description:typeof n.description==`string`?n.description:void 0,theme:typeof n.theme==`string`?n.theme:`default`,author:typeof n.author==`string`?n.author:void 0,tags:Array.isArray(n.tags)?n.tags:[],oneShoot:n[`one-shoot`]!==!1,solo:n.solo===!0,maxQuestions:typeof n[`max-questions`]==`number`&&n[`max-questions`]>0?n[`max-questions`]:void 0,maxTimeSec:parseMaxTime(n[`max-time`]),targetDifficulty:[`easy`,`medium`,`hard`].includes(n[`target-difficulty`])?n[`target-difficulty`]:void 0}}var CHOICE_IDS=[`a`,`b`,`c`,`d`];function parseQuestion(e){let t={},n=e;if(e.startsWith(`---`)){let r=(0,import_gray_matter.default)(e);t=r.data,n=r.content.trim()}let r=n.match(/^## (.+)$/m),a=r?r[1].trim():``,o=/^-\s+\[(x| )\]\s+(.+)$/gm,s=[],c,l=0;for(;(c=o.exec(n))!==null;)s.push({id:CHOICE_IDS[l]??String(l),text:c[2].trim(),isCorrect:c[1]===`x`}),l++;let u=/^>\s+(.+)$/gm,d=[];for(;(c=u.exec(n))!==null;)d.push(c[1].trim());let h=d.length>0?d.join(` `):void 0,g=s.filter(e=>e.isCorrect).length>1?`multiple`:`single`;return{type:t.type===`multiple`||t.type===`single`?t.type:g,timer:typeof t.timer==`number`?t.timer:20,difficulty:t.difficulty===`easy`||t.difficulty===`medium`||t.difficulty===`hard`?t.difficulty:`medium`,tags:Array.isArray(t.tags)?t.tags:[],text:a,choices:s,explanation:h}}function parseQuizFile(e){let t=splitBlocks(e);if(t.length===0)return{meta:{title:``,theme:`default`,tags:[],solo:!1},questions:[]};let[n,...r]=t;return{meta:parseMeta(n),questions:r.map(parseQuestion)}}function deckVersion(e){let t=0x811c9dc5;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return(t>>>0).toString(16).padStart(8,`0`)}var slugify=e=>e.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``);function deckSlug(e){return e.replace(/(^|\/)index\.hashquiz\.md$/,``).replace(/\.hashquiz\.md$/,``).split(`/`).map(slugify).filter(Boolean).join(`/`)||`quiz`}function deckSlugs(e){let t=new Set,n=new Map;for(let r of[...new Set(e)].sort()){let e=deckSlug(r),a=e;for(let n=2;t.has(a)||a===`tag`;n++)a=`${e}-${n}`;t.add(a),n.set(r,a)}return n}function toDecks(e){let t=deckSlugs(e.map(e=>e.id));return e.flatMap(({id:e,content:n})=>{try{let r=parseQuizFile(n);return[{id:e,slug:t.get(e),name:r.meta.title||e,version:deckVersion(n),quiz:r}]}catch(t){return console.error(`Skipping deck ${e}:`,t),[]}}).sort((e,t)=>e.name.localeCompare(t.name))}async function fetchDecks(e,t=fetch){let n=await t(e);if(!n.ok)throw Error(`Failed to load ${e}: ${n.status}`);return toDecks(await n.json())}function deckInfo(e){let{meta:t,questions:n}=e.quiz,r=n.length,a=e=>Math.round(n.filter(t=>t.difficulty===e).length/(r||1)*100);return{title:t.title||e.name,...t.description!==void 0&&{description:t.description},tags:t.tags,totalQuestions:t.maxQuestions===void 0?r:Math.min(t.maxQuestions,r),...t.targetDifficulty!==void 0&&{targetDifficulty:t.targetDifficulty},difficultyDistribution:{easy:a(`easy`),medium:a(`medium`),hard:a(`hard`)},...quizFormat(t,r)}}function loadDecks(e=`/host/decks.json`){return fetchDecks(e)}function tagCounts(e){let t=new Map;for(let n of e)for(let e of new Set(n.quiz.meta.tags))t.set(e,(t.get(e)??0)+1);return[...t.entries()].map(([e,t])=>({tag:e,count:t})).sort((e,t)=>t.count-e.count||e.tag.localeCompare(t.tag))}function decksForTag(e,t){return e.filter(e=>e.quiz.meta.tags.includes(t))}function parseDeckHash(e){let t=/^#\/tag\/(.+)$/.exec(e);if(!t)return{kind:`list`};try{return{kind:`tag`,tag:decodeURIComponent(t[1])}}catch{return{kind:`list`}}}var tagHash=e=>`#/tag/${encodeURIComponent(e)}`,soloUrl=(e,t)=>`${t.replace(/\/+$/,``)}/solo/${e}`,PLAYER_DEV_PORT=3032;function playerBaseUrl(e,t){return e.playerUrl?e.playerUrl:e.dev?`${t.protocol}//${t.hostname}:${PLAYER_DEV_PORT}/`:`${t.origin}/`}var _hoisted_1$6={class:`deck-card`},_hoisted_2$6=[`href`,`aria-label`],DeckCard_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`DeckCard`,props:{deck:{},soloHref:{}},emits:[`pick`],setup(e,{emit:t}){let n=e,r=t,a=computed(()=>deckInfo(n.deck));return(t,n)=>(openBlock(),createElementBlock(`li`,_hoisted_1$6,[createBaseVNode(`button`,{class:`deck-card__btn`,type:`button`,onClick:n[0]||=t=>r(`pick`,e.deck)},[createVNode(unref(QuizInfoPanel_default),{quizInfo:a.value,compact:``},null,8,[`quizInfo`])]),e.soloHref?(openBlock(),createElementBlock(`a`,{key:0,class:`deck-card__solo`,href:e.soloHref,"aria-label":`Jouer en solo : ${a.value.title}`},`Jouer en solo`,8,_hoisted_2$6)):createCommentVNode(``,!0)]))}}),DeckCard_default=_plugin_vue_export_helper_default(DeckCard_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-d8b5fdc0`]]),_hoisted_1$5={class:`decks`},_hoisted_2$5={class:`decks__inner`},_hoisted_3$4={class:`decks__title hq-pixel`},_hoisted_4$4={key:0,class:`decks__grid`},_hoisted_5$3={key:1,class:`decks__empty`},_hoisted_6$3={key:0,class:`decks__empty`},_hoisted_7$3={key:1,class:`decks__empty`},_hoisted_8$3={key:2,class:`decks__grid`},_hoisted_9$3={key:3,class:`decks__empty`},_hoisted_10$3={key:4,class:`decks__tags`,"aria-labelledby":`decks-tags`},_hoisted_11$3={class:`decks__taglist`},_hoisted_12$3=[`href`],_hoisted_13$3={class:`decks__tag-count`},DeckSelectView_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`DeckSelectView`,setup(e){let t=useGameStore(),n=ref([]),r=ref(!0),a=ref(``),o=computed(()=>tagCounts(n.value));onMounted(async()=>{try{n.value=await loadDecks()}catch(e){a.value=e instanceof Error?e.message:String(e)}finally{r.value=!1}});let s=ref(parseDeckHash(location.hash)),c=()=>{s.value=parseDeckHash(location.hash)};onMounted(()=>window.addEventListener(`hashchange`,c)),onBeforeUnmount(()=>window.removeEventListener(`hashchange`,c));let l=computed(()=>s.value.kind===`tag`?decksForTag(n.value,s.value.tag):[]),u=soloAvailable(config),d=playerBaseUrl({dev:!1,playerUrl:config.playerUrl},location),h=e=>u&&e.quiz.meta.solo?soloUrl(e.slug,d):void 0;function g(e){t.startWithDeck(e)}return(e,t)=>(openBlock(),createElementBlock(`div`,_hoisted_1$5,[createBaseVNode(`div`,_hoisted_2$5,[createVNode(unref(BrandLogo_default),{centered:``,class:`decks__logo`}),s.value.kind===`tag`?(openBlock(),createElementBlock(Fragment,{key:0},[t[1]||=createBaseVNode(`a`,{class:`decks__back`,href:`#/`},`← All quizzes`,-1),createBaseVNode(`h1`,_hoisted_3$4,[t[0]||=createBaseVNode(`span`,{class:`decks__hash`},`#`,-1),createTextVNode(toDisplayString(s.value.tag),1)]),l.value.length?(openBlock(),createElementBlock(`ul`,_hoisted_4$4,[(openBlock(!0),createElementBlock(Fragment,null,renderList(l.value,e=>(openBlock(),createBlock(DeckCard_default,{key:e.id,deck:e,"solo-href":h(e),onPick:g},null,8,[`deck`,`solo-href`]))),128))])):(openBlock(),createElementBlock(`p`,_hoisted_5$3,`No quiz with the tag “`+toDisplayString(s.value.tag)+`”.`,1))],64)):(openBlock(),createElementBlock(Fragment,{key:1},[t[4]||=createBaseVNode(`h1`,{class:`decks__title hq-pixel`},`Pick a quiz`,-1),r.value?(openBlock(),createElementBlock(`p`,_hoisted_6$3,`Loading quizzes…`)):a.value?(openBlock(),createElementBlock(`p`,_hoisted_7$3,`Could not load the quiz list: `+toDisplayString(a.value),1)):n.value.length?(openBlock(),createElementBlock(`ul`,_hoisted_8$3,[(openBlock(!0),createElementBlock(Fragment,null,renderList(n.value,e=>(openBlock(),createBlock(DeckCard_default,{key:e.id,deck:e,"solo-href":h(e),onPick:g},null,8,[`deck`,`solo-href`]))),128))])):(openBlock(),createElementBlock(`p`,_hoisted_9$3,[...t[2]||=[createTextVNode(`No decks found. Add `,-1),createBaseVNode(`code`,null,`.hashquiz.md`,-1),createTextVNode(` files to your decks folder.`,-1)]])),o.value.length?(openBlock(),createElementBlock(`section`,_hoisted_10$3,[t[3]||=createBaseVNode(`h2`,{id:`decks-tags`,class:`decks__heading hq-label`},`Tags`,-1),createBaseVNode(`ul`,_hoisted_11$3,[(openBlock(!0),createElementBlock(Fragment,null,renderList(o.value,e=>(openBlock(),createElementBlock(`li`,{key:e.tag},[createBaseVNode(`a`,{class:`decks__tag`,href:unref(tagHash)(e.tag)},[createTextVNode(toDisplayString(e.tag)+` `,1),createBaseVNode(`span`,_hoisted_13$3,toDisplayString(e.count),1)],8,_hoisted_12$3)]))),128))])])):createCommentVNode(``,!0)],64))])]))}}),DeckSelectView_default=_plugin_vue_export_helper_default(DeckSelectView_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-090bd1f2`]]),_hoisted_1$4={class:`lobby`},_hoisted_2$4={class:`lobby__side lobby__side--left`},_hoisted_3$3={class:`lobby__bare lobby__players`},_hoisted_4$3={class:`lobby__col`},_hoisted_5$2={class:`lobby__section lobby__section--card`},_hoisted_6$2={class:`lobby__section lobby__section--join`},_hoisted_7$2={class:`lobby__join`},_hoisted_8$2=[`href`],_hoisted_9$2={class:`lobby__code-box lobby__bare`},_hoisted_10$2={class:`lobby__code hq-pixel`},_hoisted_11$2={class:`lobby__qr lobby__bare`},_hoisted_12$2={class:`lobby__start`},_hoisted_13$2={class:`lobby__count-num`},_hoisted_14$2=[`disabled`],_hoisted_15$2={class:`lobby__side lobby__side--right`},_hoisted_16$1={class:`lobby__bare lobby__players`},LobbyView_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`LobbyView`,setup(e){let t=useGameStore(),n=computed(()=>t.playerUrl||`${location.origin}/?code=${t.joinCode}`),r=new Map,a=computed(()=>{let e=new Map(t.players.map(e=>[e.id,e])),n=groupPlayers(t.players.map(e=>e.id),r),a=[],o=[];for(let t of n){let n=r.get(t[0]),s={key:n,players:t.map(t=>e.get(t))};(n%2==0?a:o).push(s)}return{left:a,right:o}}),o=computed(()=>a.value.left),s=computed(()=>a.value.right),c=computed(()=>o.value.flatMap(e=>e.players)),l=computed(()=>s.value.flatMap(e=>e.players)),u=e=>{let t=e<=2?1:2;return{gridTemplateColumns:`repeat(${t}, minmax(0, 1fr))`,gridTemplateRows:`repeat(${Math.max(Math.ceil(e/t),1)}, minmax(0, 1fr))`}},d=ref(!1),h=null;return watch(()=>t.players.length,()=>{d.value=!0,h&&clearTimeout(h),h=setTimeout(()=>{d.value=!1},160)}),onBeforeUnmount(()=>{h&&clearTimeout(h)}),(e,r)=>(openBlock(),createElementBlock(`div`,_hoisted_1$4,[createVNode(unref(BrandLogo_default)),createBaseVNode(`aside`,_hoisted_2$4,[createBaseVNode(`div`,{class:`lobby__groups`,style:normalizeStyle(u(o.value.length))},[(openBlock(!0),createElementBlock(Fragment,null,renderList(o.value,e=>(openBlock(),createBlock(unref(FxLobby_default),{key:e.key,class:`lobby__fx`,players:e.players,labels:2,spread:.1},null,8,[`players`]))),128))],4),createBaseVNode(`div`,_hoisted_3$3,[createVNode(unref(PlayerList_default),{players:c.value,"aria-live":`polite`},null,8,[`players`])])]),createBaseVNode(`div`,_hoisted_4$3,[createBaseVNode(`section`,_hoisted_5$2,[unref(t).quizMeta?(openBlock(),createBlock(unref(QuizInfoPanel_default),{key:0,quizInfo:unref(t).quizMeta,playerCount:unref(t).players.length,class:`quiz-info`},null,8,[`quizInfo`,`playerCount`])):createCommentVNode(``,!0)]),createBaseVNode(`section`,_hoisted_6$2,[createBaseVNode(`div`,_hoisted_7$2,[createBaseVNode(`a`,{class:`lobby__link lobby__bare`,href:n.value,target:`_blank`,rel:`noopener`},toDisplayString(n.value),9,_hoisted_8$2),createBaseVNode(`div`,_hoisted_9$2,[r[1]||=createBaseVNode(`p`,{class:`lobby__code-label hq-label`},`Join code`,-1),createBaseVNode(`p`,_hoisted_10$2,toDisplayString(unref(t).joinCode),1)])]),createBaseVNode(`div`,_hoisted_11$2,[createVNode(unref(QrCode_default),{value:n.value,size:800},null,8,[`value`])]),createBaseVNode(`div`,_hoisted_12$2,[createBaseVNode(`div`,{class:normalizeClass([`lobby__count`,{"lobby__count--pop":d.value}])},[createBaseVNode(`span`,_hoisted_13$2,toDisplayString(String(unref(t).players.length).padStart(2,`0`)),1),r[2]||=createBaseVNode(`span`,{class:`lobby__count-label hq-label`},`Joueurs`,-1)],2),createBaseVNode(`button`,{class:`hq-btn-primary hq-press`,disabled:unref(t).players.length===0,onClick:r[0]||=e=>unref(t).send(`host_start`)},` ▶ Start Game `,8,_hoisted_14$2)])])]),createBaseVNode(`aside`,_hoisted_15$2,[createBaseVNode(`div`,{class:`lobby__groups`,style:normalizeStyle(u(s.value.length))},[(openBlock(!0),createElementBlock(Fragment,null,renderList(s.value,e=>(openBlock(),createBlock(unref(FxLobby_default),{key:e.key,class:`lobby__fx`,players:e.players,labels:2,spread:.1},null,8,[`players`]))),128))],4),createBaseVNode(`div`,_hoisted_16$1,[createVNode(unref(PlayerList_default),{players:l.value,align:`end`,"aria-live":`polite`},null,8,[`players`])])])]))}}),LobbyView_default=_plugin_vue_export_helper_default(LobbyView_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-7fe37d38`]]),_hoisted_1$3={key:0,class:`question-view`},_hoisted_2$3={class:`hq-progress`},_hoisted_3$2={class:`hq-progress__label hq-label`},_hoisted_4$2={class:`hq-progress__track hq-steps`},_hoisted_5$1={class:`hq-progress__label`},_hoisted_6$1={class:`hq-main`},_hoisted_7$1={class:`hq-header`},_hoisted_8$1={class:`hq-body`},_hoisted_9$1={class:`hq-q-meta`},_hoisted_10$1={class:`hq-q-meta__tags`},_hoisted_11$1={class:`hq-question-text`},_hoisted_12$1={class:`hq-choices-grid`},_hoisted_13$1={class:`hq-choice-card__id`},_hoisted_14$1={class:`hq-controls`},_hoisted_15$1={class:`hq-controls__answered`},QuestionView_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`QuestionView`,setup(e){let t=useGameStore(),n=ref(t.question?.timer??0),r=null,a=0,o=0;function s(){r&&clearInterval(r),o=t.question?.timer??0,n.value=o,a=Date.now(),r=setInterval(()=>{let e=Math.max(0,Math.round((o-(Date.now()-a)/1e3)*10)/10);n.value=e,e<=0&&(clearInterval(r),r=null)},100)}return watch(()=>t.question,()=>s(),{immediate:!0}),onUnmounted(()=>{r&&clearInterval(r)}),(e,r)=>unref(t).question?(openBlock(),createElementBlock(`div`,_hoisted_1$3,[createBaseVNode(`div`,_hoisted_2$3,[createBaseVNode(`span`,_hoisted_3$2,`Q`+toDisplayString(unref(t).questionIdx+1),1),createBaseVNode(`div`,_hoisted_4$2,[createBaseVNode(`div`,{class:`hq-progress__fill`,style:normalizeStyle({width:(unref(t).questionIdx+1)/unref(t).totalQs*100+`%`})},null,4)]),createBaseVNode(`span`,_hoisted_5$1,toDisplayString(unref(t).totalQs),1)]),createBaseVNode(`div`,_hoisted_6$1,[createBaseVNode(`header`,_hoisted_7$1,[createVNode(unref(FxCountdown_default),{total:unref(t).question.timer,remaining:n.value,size:`large`},null,8,[`total`,`remaining`])]),createBaseVNode(`div`,_hoisted_8$1,[createBaseVNode(`div`,_hoisted_9$1,[createBaseVNode(`div`,_hoisted_10$1,[(openBlock(!0),createElementBlock(Fragment,null,renderList(unref(t).question.tags,e=>(openBlock(),createElementBlock(`span`,{key:e,class:`hq-q-meta__tag`},toDisplayString(e),1))),128))]),createBaseVNode(`span`,{class:normalizeClass([`hq-difficulty`,`hq-difficulty--${unref(t).question.difficulty}`])},[...r[1]||=[createBaseVNode(`span`,{class:`hq-difficulty__dot hq-difficulty__dot--1`},null,-1),createBaseVNode(`span`,{class:`hq-difficulty__dot hq-difficulty__dot--2`},null,-1),createBaseVNode(`span`,{class:`hq-difficulty__dot hq-difficulty__dot--3`},null,-1)]],2)]),createBaseVNode(`h2`,_hoisted_11$1,toDisplayString(unref(t).question.text.replace(/^#+\s/,``)),1),createBaseVNode(`div`,_hoisted_12$1,[(openBlock(!0),createElementBlock(Fragment,null,renderList(unref(t).question.choices,(e,t)=>(openBlock(),createElementBlock(`div`,{key:e.id,class:normalizeClass([`hq-choice-card`,`hq-choice-card--${[`a`,`b`,`c`,`d`][t]}`])},[createBaseVNode(`span`,_hoisted_13$1,toDisplayString(e.id.toUpperCase()),1),createBaseVNode(`span`,null,toDisplayString(e.text),1)],2))),128))])])]),createBaseVNode(`div`,_hoisted_14$1,[createBaseVNode(`p`,_hoisted_15$1,toDisplayString(unref(t).answerCount)+` / `+toDisplayString(unref(t).players.length)+` answered`,1),createBaseVNode(`button`,{class:`hq-btn-action hq-press`,onClick:r[0]||=e=>unref(t).send(`host_reveal`)},` 🔍 Reveal Answer `)])])):createCommentVNode(``,!0)}}),QuestionView_default=_plugin_vue_export_helper_default(QuestionView_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-a18eb71b`]]);function A(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var R=A();function j(e){R=e}var z={exec:()=>null};function I(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),a=t[r];return a||(a=e(r),t[r]=a),a}}function k(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let a=typeof t==`string`?t:t.source;return a=a.replace(m.caret,`$1`),n=n.replace(e,a),r},getRegex:()=>new RegExp(n,t)};return r}var Oe=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),m={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:I(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:I(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:I(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:I(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:I(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:I(e=>RegExp(`^ {0,${e}}>`))},Te=/^(?:[ \t]*(?:\n|$))+/,we=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ye=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,q=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Pe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,U=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,oe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ae=k(oe).replace(/bull/g,U).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Se=k(oe).replace(/bull/g,U).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),K=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,_e=/^[^\n]+/,W=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,$e=k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,W).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Le=k(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,U).getRegex(),Q=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,X=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ee=k(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,X).replace(`tag`,Q).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),le=e=>k(K).replace(`hr`,q).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Q).getRegex(),ze=le(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Me=le(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),J={blockquote:k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Me).getRegex(),code:we,def:$e,fences:ye,heading:Pe,hr:q,html:Ee,lheading:ae,list:Le,newline:Te,paragraph:ze,table:z,text:_e},se=k(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,q).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Q).getRegex(),Ie={...J,lheading:Se,table:se,paragraph:k(K).replace(`hr`,q).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,se).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Q).getRegex()},Ce={...J,html:k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,X).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:z,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:k(K).replace(`hr`,q).replace(`heading`,` *#{1,6} *[^
|
|
79
|
+
`).slice(1).findIndex(e=>e===`---`)===-1?`${e}\n---`:e:`---\n${e}\n---`;let{data:n}=(0,import_gray_matter.default)(t);return{title:typeof n.title==`string`?n.title:``,description:typeof n.description==`string`?n.description:void 0,theme:typeof n.theme==`string`?n.theme:`default`,author:typeof n.author==`string`?n.author:void 0,tags:Array.isArray(n.tags)?n.tags:[],oneShoot:n[`one-shoot`]!==!1,solo:n.solo===!0,maxQuestions:typeof n[`max-questions`]==`number`&&n[`max-questions`]>0?n[`max-questions`]:void 0,maxTimeSec:parseMaxTime(n[`max-time`]),targetDifficulty:[`easy`,`medium`,`hard`].includes(n[`target-difficulty`])?n[`target-difficulty`]:void 0}}var CHOICE_IDS=[`a`,`b`,`c`,`d`];function parseQuestion(e){let t={},n=e;if(e.startsWith(`---`)){let r=(0,import_gray_matter.default)(e);t=r.data,n=r.content.trim()}let r=n.match(/^## (.+)$/m),a=r?r[1].trim():``,o=/^-\s+\[(x| )\]\s+(.+)$/gm,s=[],c,l=0;for(;(c=o.exec(n))!==null;)s.push({id:CHOICE_IDS[l]??String(l),text:c[2].trim(),isCorrect:c[1]===`x`}),l++;let u=/^>\s+(.+)$/gm,d=[];for(;(c=u.exec(n))!==null;)d.push(c[1].trim());let h=d.length>0?d.join(` `):void 0,g=s.filter(e=>e.isCorrect).length>1?`multiple`:`single`;return{type:t.type===`multiple`||t.type===`single`?t.type:g,timer:typeof t.timer==`number`?t.timer:20,difficulty:t.difficulty===`easy`||t.difficulty===`medium`||t.difficulty===`hard`?t.difficulty:`medium`,tags:Array.isArray(t.tags)?t.tags:[],text:a,choices:s,explanation:h}}function parseQuizFile(e){let t=splitBlocks(e);if(t.length===0)return{meta:{title:``,theme:`default`,tags:[],solo:!1},questions:[]};let[n,...r]=t;return{meta:parseMeta(n),questions:r.map(parseQuestion)}}function deckVersion(e){let t=0x811c9dc5;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return(t>>>0).toString(16).padStart(8,`0`)}var slugify=e=>e.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``);function deckSlug(e){return e.replace(/(^|\/)index\.hashquiz\.md$/,``).replace(/\.hashquiz\.md$/,``).split(`/`).map(slugify).filter(Boolean).join(`/`)||`quiz`}var tagSlug=e=>slugify(e)||encodeURIComponent(e.toLowerCase());function deckSlugs(e){let t=new Set,n=new Map;for(let r of[...new Set(e)].sort()){let e=deckSlug(r),a=e;for(let n=2;t.has(a)||a===`tag`;n++)a=`${e}-${n}`;t.add(a),n.set(r,a)}return n}function toDecks(e){let t=deckSlugs(e.map(e=>e.id));return e.flatMap(({id:e,content:n})=>{try{let r=parseQuizFile(n);return[{id:e,slug:t.get(e),name:r.meta.title||e,version:deckVersion(n),quiz:r}]}catch(t){return console.error(`Skipping deck ${e}:`,t),[]}}).sort((e,t)=>e.name.localeCompare(t.name))}async function fetchDecks(e,t=fetch){let n=await t(e);if(!n.ok)throw Error(`Failed to load ${e}: ${n.status}`);return toDecks(await n.json())}function deckInfo(e){let{meta:t,questions:n}=e.quiz,r=n.length,a=e=>Math.round(n.filter(t=>t.difficulty===e).length/(r||1)*100);return{title:t.title||e.name,...t.description!==void 0&&{description:t.description},tags:t.tags,totalQuestions:t.maxQuestions===void 0?r:Math.min(t.maxQuestions,r),...t.targetDifficulty!==void 0&&{targetDifficulty:t.targetDifficulty},difficultyDistribution:{easy:a(`easy`),medium:a(`medium`),hard:a(`hard`)},...quizFormat(t,r)}}function loadDecks(e=`/host/decks.json`){return fetchDecks(e)}function tagCounts(e){let t=new Map;for(let n of e)for(let e of new Set(n.quiz.meta.tags))t.set(e,(t.get(e)??0)+1);return[...t.entries()].map(([e,t])=>({tag:e,count:t})).sort((e,t)=>t.count-e.count||e.tag.localeCompare(t.tag))}function decksForTag(e,t){return e.filter(e=>e.quiz.meta.tags.includes(t))}var decodeSegment=e=>{try{return decodeURIComponent(e)}catch{return null}},tagPath=(e,t=`/host/`)=>`${t.replace(/\/*$/,`/`)}tag/${tagSlug(e)}`;function parseDeckPath(e,t=`/host/`){let n=`${t.replace(/\/*$/,`/`)}tag/`;if(!e.startsWith(n))return{kind:`list`};let r=decodeSegment(e.slice(n.length).replace(/\/$/,``));return r&&!r.includes(`/`)?{kind:`tag`,slug:r}:{kind:`list`}}function tagForSlug(e,t){for(let n of e)for(let e of n.quiz.meta.tags)if(decodeSegment(tagSlug(e))===t)return e}function legacyTagPath(e,t=`/host/`){let n=/^#\/tag\/(.+)$/.exec(e),r=n?decodeSegment(n[1]):null;return r?tagPath(r,t):null}var soloUrl=(e,t)=>`${t.replace(/\/+$/,``)}/solo/${e}`,PLAYER_DEV_PORT=3032;function playerBaseUrl(e,t){return e.playerUrl?e.playerUrl:e.dev?`${t.protocol}//${t.hostname}:${PLAYER_DEV_PORT}/`:`${t.origin}/`}var _hoisted_1$6={class:`deck-card`},_hoisted_2$6=[`href`,`aria-label`],DeckCard_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`DeckCard`,props:{deck:{},soloHref:{}},emits:[`pick`],setup(e,{emit:t}){let n=e,r=t,a=computed(()=>deckInfo(n.deck));return(t,n)=>(openBlock(),createElementBlock(`li`,_hoisted_1$6,[createBaseVNode(`button`,{class:`deck-card__btn`,type:`button`,onClick:n[0]||=t=>r(`pick`,e.deck)},[createVNode(unref(QuizInfoPanel_default),{quizInfo:a.value,compact:``},null,8,[`quizInfo`])]),e.soloHref?(openBlock(),createElementBlock(`a`,{key:0,class:`deck-card__solo`,href:e.soloHref,"aria-label":`Jouer en solo : ${a.value.title}`},`Jouer en solo`,8,_hoisted_2$6)):createCommentVNode(``,!0)]))}}),DeckCard_default=_plugin_vue_export_helper_default(DeckCard_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-d8b5fdc0`]]),_hoisted_1$5={class:`decks`},_hoisted_2$5={class:`decks__inner`},_hoisted_3$4=[`href`],_hoisted_4$4={class:`decks__title hq-pixel`},_hoisted_5$3={key:0,class:`decks__empty`},_hoisted_6$3={key:1,class:`decks__grid`},_hoisted_7$3={key:2,class:`decks__empty`},_hoisted_8$3={key:0,class:`decks__empty`},_hoisted_9$3={key:1,class:`decks__empty`},_hoisted_10$3={key:2,class:`decks__grid`},_hoisted_11$3={key:3,class:`decks__empty`},_hoisted_12$3={key:4,class:`decks__tags`,"aria-labelledby":`decks-tags`},_hoisted_13$3={class:`decks__taglist`},_hoisted_14$3=[`href`,`onClick`],_hoisted_15$3={class:`decks__tag-count`},DeckSelectView_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`DeckSelectView`,setup(e){let t=useGameStore(),n=ref([]),r=ref(!0),a=ref(``),o=computed(()=>tagCounts(n.value));onMounted(async()=>{try{n.value=await loadDecks()}catch(e){a.value=e instanceof Error?e.message:String(e)}finally{r.value=!1}});let s=`/host/`;function c(){let e=legacyTagPath(location.hash,s);return e&&history.replaceState(history.state,``,e),parseDeckPath(location.pathname,s)}let l=ref(c()),u=()=>{l.value=c()};onMounted(()=>{window.addEventListener(`popstate`,u),window.addEventListener(`hashchange`,u)}),onBeforeUnmount(()=>{window.removeEventListener(`popstate`,u),window.removeEventListener(`hashchange`,u)});function d(e,t){e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),history.pushState(null,``,t),u(),document.querySelector(`.decks`)?.scrollTo(0,0))}let h=computed(()=>l.value.kind===`tag`?tagForSlug(n.value,l.value.slug):void 0),g=computed(()=>h.value??(l.value.kind===`tag`?l.value.slug:``)),w=computed(()=>h.value?decksForTag(n.value,h.value):[]),E=document.title,D=location.pathname;watchEffect(()=>{let e=l.value.kind===`tag`?`#${g.value} · HashQuiz`:`HashQuiz Host`;document.title=location.pathname===D?E:e});let O=soloAvailable(config),N=playerBaseUrl({dev:!1,playerUrl:config.playerUrl},location),ne=e=>O&&e.quiz.meta.solo?soloUrl(e.slug,N):void 0;function re(e){t.startWithDeck(e)}return(e,t)=>(openBlock(),createElementBlock(`div`,_hoisted_1$5,[createBaseVNode(`div`,_hoisted_2$5,[createVNode(unref(BrandLogo_default),{centered:``,class:`decks__logo`}),l.value.kind===`tag`?(openBlock(),createElementBlock(Fragment,{key:0},[createBaseVNode(`a`,{class:`decks__back`,href:unref(s),onClick:t[0]||=e=>d(e,unref(s))},`← All quizzes`,8,_hoisted_3$4),createBaseVNode(`h1`,_hoisted_4$4,[t[1]||=createBaseVNode(`span`,{class:`decks__hash`},`#`,-1),createTextVNode(toDisplayString(g.value),1)]),r.value?(openBlock(),createElementBlock(`p`,_hoisted_5$3,`Loading quizzes…`)):w.value.length?(openBlock(),createElementBlock(`ul`,_hoisted_6$3,[(openBlock(!0),createElementBlock(Fragment,null,renderList(w.value,e=>(openBlock(),createBlock(DeckCard_default,{key:e.id,deck:e,"solo-href":ne(e),onPick:re},null,8,[`deck`,`solo-href`]))),128))])):(openBlock(),createElementBlock(`p`,_hoisted_7$3,`No quiz with the tag “`+toDisplayString(g.value)+`”.`,1))],64)):(openBlock(),createElementBlock(Fragment,{key:1},[t[4]||=createBaseVNode(`h1`,{class:`decks__title hq-pixel`},`Pick a quiz`,-1),r.value?(openBlock(),createElementBlock(`p`,_hoisted_8$3,`Loading quizzes…`)):a.value?(openBlock(),createElementBlock(`p`,_hoisted_9$3,`Could not load the quiz list: `+toDisplayString(a.value),1)):n.value.length?(openBlock(),createElementBlock(`ul`,_hoisted_10$3,[(openBlock(!0),createElementBlock(Fragment,null,renderList(n.value,e=>(openBlock(),createBlock(DeckCard_default,{key:e.id,deck:e,"solo-href":ne(e),onPick:re},null,8,[`deck`,`solo-href`]))),128))])):(openBlock(),createElementBlock(`p`,_hoisted_11$3,[...t[2]||=[createTextVNode(`No decks found. Add `,-1),createBaseVNode(`code`,null,`.hashquiz.md`,-1),createTextVNode(` files to your decks folder.`,-1)]])),o.value.length?(openBlock(),createElementBlock(`section`,_hoisted_12$3,[t[3]||=createBaseVNode(`h2`,{id:`decks-tags`,class:`decks__heading hq-label`},`Tags`,-1),createBaseVNode(`ul`,_hoisted_13$3,[(openBlock(!0),createElementBlock(Fragment,null,renderList(o.value,e=>(openBlock(),createElementBlock(`li`,{key:e.tag},[createBaseVNode(`a`,{class:`decks__tag`,href:unref(tagPath)(e.tag,unref(s)),onClick:t=>d(t,unref(tagPath)(e.tag,unref(s)))},[createTextVNode(toDisplayString(e.tag)+` `,1),createBaseVNode(`span`,_hoisted_15$3,toDisplayString(e.count),1)],8,_hoisted_14$3)]))),128))])])):createCommentVNode(``,!0)],64))])]))}}),DeckSelectView_default=_plugin_vue_export_helper_default(DeckSelectView_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-f56e7f07`]]),_hoisted_1$4={class:`lobby`},_hoisted_2$4={class:`lobby__side lobby__side--left`},_hoisted_3$3={class:`lobby__bare lobby__players`},_hoisted_4$3={class:`lobby__col`},_hoisted_5$2={class:`lobby__section lobby__section--card`},_hoisted_6$2={class:`lobby__section lobby__section--join`},_hoisted_7$2={class:`lobby__join`},_hoisted_8$2=[`href`],_hoisted_9$2={class:`lobby__code-box lobby__bare`},_hoisted_10$2={class:`lobby__code hq-pixel`},_hoisted_11$2={class:`lobby__qr lobby__bare`},_hoisted_12$2={class:`lobby__start`},_hoisted_13$2={class:`lobby__count-num`},_hoisted_14$2=[`disabled`],_hoisted_15$2={class:`lobby__side lobby__side--right`},_hoisted_16$1={class:`lobby__bare lobby__players`},LobbyView_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`LobbyView`,setup(e){let t=useGameStore(),n=computed(()=>t.playerUrl||`${location.origin}/?code=${t.joinCode}`),r=new Map,a=computed(()=>{let e=new Map(t.players.map(e=>[e.id,e])),n=groupPlayers(t.players.map(e=>e.id),r),a=[],o=[];for(let t of n){let n=r.get(t[0]),s={key:n,players:t.map(t=>e.get(t))};(n%2==0?a:o).push(s)}return{left:a,right:o}}),o=computed(()=>a.value.left),s=computed(()=>a.value.right),c=computed(()=>o.value.flatMap(e=>e.players)),l=computed(()=>s.value.flatMap(e=>e.players)),u=e=>{let t=e<=2?1:2;return{gridTemplateColumns:`repeat(${t}, minmax(0, 1fr))`,gridTemplateRows:`repeat(${Math.max(Math.ceil(e/t),1)}, minmax(0, 1fr))`}},d=ref(!1),h=null;return watch(()=>t.players.length,()=>{d.value=!0,h&&clearTimeout(h),h=setTimeout(()=>{d.value=!1},160)}),onBeforeUnmount(()=>{h&&clearTimeout(h)}),(e,r)=>(openBlock(),createElementBlock(`div`,_hoisted_1$4,[createVNode(unref(BrandLogo_default)),createBaseVNode(`aside`,_hoisted_2$4,[createBaseVNode(`div`,{class:`lobby__groups`,style:normalizeStyle(u(o.value.length))},[(openBlock(!0),createElementBlock(Fragment,null,renderList(o.value,e=>(openBlock(),createBlock(unref(FxLobby_default),{key:e.key,class:`lobby__fx`,players:e.players,labels:2,spread:.1},null,8,[`players`]))),128))],4),createBaseVNode(`div`,_hoisted_3$3,[createVNode(unref(PlayerList_default),{players:c.value,"aria-live":`polite`},null,8,[`players`])])]),createBaseVNode(`div`,_hoisted_4$3,[createBaseVNode(`section`,_hoisted_5$2,[unref(t).quizMeta?(openBlock(),createBlock(unref(QuizInfoPanel_default),{key:0,quizInfo:unref(t).quizMeta,playerCount:unref(t).players.length,class:`quiz-info`},null,8,[`quizInfo`,`playerCount`])):createCommentVNode(``,!0)]),createBaseVNode(`section`,_hoisted_6$2,[createBaseVNode(`div`,_hoisted_7$2,[createBaseVNode(`a`,{class:`lobby__link lobby__bare`,href:n.value,target:`_blank`,rel:`noopener`},toDisplayString(n.value),9,_hoisted_8$2),createBaseVNode(`div`,_hoisted_9$2,[r[1]||=createBaseVNode(`p`,{class:`lobby__code-label hq-label`},`Join code`,-1),createBaseVNode(`p`,_hoisted_10$2,toDisplayString(unref(t).joinCode),1)])]),createBaseVNode(`div`,_hoisted_11$2,[createVNode(unref(QrCode_default),{value:n.value,size:800},null,8,[`value`])]),createBaseVNode(`div`,_hoisted_12$2,[createBaseVNode(`div`,{class:normalizeClass([`lobby__count`,{"lobby__count--pop":d.value}])},[createBaseVNode(`span`,_hoisted_13$2,toDisplayString(String(unref(t).players.length).padStart(2,`0`)),1),r[2]||=createBaseVNode(`span`,{class:`lobby__count-label hq-label`},`Joueurs`,-1)],2),createBaseVNode(`button`,{class:`hq-btn-primary hq-press`,disabled:unref(t).players.length===0,onClick:r[0]||=e=>unref(t).send(`host_start`)},` ▶ Start Game `,8,_hoisted_14$2)])])]),createBaseVNode(`aside`,_hoisted_15$2,[createBaseVNode(`div`,{class:`lobby__groups`,style:normalizeStyle(u(s.value.length))},[(openBlock(!0),createElementBlock(Fragment,null,renderList(s.value,e=>(openBlock(),createBlock(unref(FxLobby_default),{key:e.key,class:`lobby__fx`,players:e.players,labels:2,spread:.1},null,8,[`players`]))),128))],4),createBaseVNode(`div`,_hoisted_16$1,[createVNode(unref(PlayerList_default),{players:l.value,align:`end`,"aria-live":`polite`},null,8,[`players`])])])]))}}),LobbyView_default=_plugin_vue_export_helper_default(LobbyView_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-7fe37d38`]]),_hoisted_1$3={key:0,class:`question-view`},_hoisted_2$3={class:`hq-progress`},_hoisted_3$2={class:`hq-progress__label hq-label`},_hoisted_4$2={class:`hq-progress__track hq-steps`},_hoisted_5$1={class:`hq-progress__label`},_hoisted_6$1={class:`hq-main`},_hoisted_7$1={class:`hq-header`},_hoisted_8$1={class:`hq-body`},_hoisted_9$1={class:`hq-q-meta`},_hoisted_10$1={class:`hq-q-meta__tags`},_hoisted_11$1={class:`hq-question-text`},_hoisted_12$1={class:`hq-choices-grid`},_hoisted_13$1={class:`hq-choice-card__id`},_hoisted_14$1={class:`hq-controls`},_hoisted_15$1={class:`hq-controls__answered`},QuestionView_vue_vue_type_script_setup_true_lang_default=defineComponent({__name:`QuestionView`,setup(e){let t=useGameStore(),n=ref(t.question?.timer??0),r=null,a=0,o=0;function s(){r&&clearInterval(r),o=t.question?.timer??0,n.value=o,a=Date.now(),r=setInterval(()=>{let e=Math.max(0,Math.round((o-(Date.now()-a)/1e3)*10)/10);n.value=e,e<=0&&(clearInterval(r),r=null)},100)}return watch(()=>t.question,()=>s(),{immediate:!0}),onUnmounted(()=>{r&&clearInterval(r)}),(e,r)=>unref(t).question?(openBlock(),createElementBlock(`div`,_hoisted_1$3,[createBaseVNode(`div`,_hoisted_2$3,[createBaseVNode(`span`,_hoisted_3$2,`Q`+toDisplayString(unref(t).questionIdx+1),1),createBaseVNode(`div`,_hoisted_4$2,[createBaseVNode(`div`,{class:`hq-progress__fill`,style:normalizeStyle({width:(unref(t).questionIdx+1)/unref(t).totalQs*100+`%`})},null,4)]),createBaseVNode(`span`,_hoisted_5$1,toDisplayString(unref(t).totalQs),1)]),createBaseVNode(`div`,_hoisted_6$1,[createBaseVNode(`header`,_hoisted_7$1,[createVNode(unref(FxCountdown_default),{total:unref(t).question.timer,remaining:n.value,size:`large`},null,8,[`total`,`remaining`])]),createBaseVNode(`div`,_hoisted_8$1,[createBaseVNode(`div`,_hoisted_9$1,[createBaseVNode(`div`,_hoisted_10$1,[(openBlock(!0),createElementBlock(Fragment,null,renderList(unref(t).question.tags,e=>(openBlock(),createElementBlock(`span`,{key:e,class:`hq-q-meta__tag`},toDisplayString(e),1))),128))]),createBaseVNode(`span`,{class:normalizeClass([`hq-difficulty`,`hq-difficulty--${unref(t).question.difficulty}`])},[...r[1]||=[createBaseVNode(`span`,{class:`hq-difficulty__dot hq-difficulty__dot--1`},null,-1),createBaseVNode(`span`,{class:`hq-difficulty__dot hq-difficulty__dot--2`},null,-1),createBaseVNode(`span`,{class:`hq-difficulty__dot hq-difficulty__dot--3`},null,-1)]],2)]),createBaseVNode(`h2`,_hoisted_11$1,toDisplayString(unref(t).question.text.replace(/^#+\s/,``)),1),createBaseVNode(`div`,_hoisted_12$1,[(openBlock(!0),createElementBlock(Fragment,null,renderList(unref(t).question.choices,(e,t)=>(openBlock(),createElementBlock(`div`,{key:e.id,class:normalizeClass([`hq-choice-card`,`hq-choice-card--${[`a`,`b`,`c`,`d`][t]}`])},[createBaseVNode(`span`,_hoisted_13$1,toDisplayString(e.id.toUpperCase()),1),createBaseVNode(`span`,null,toDisplayString(e.text),1)],2))),128))])])]),createBaseVNode(`div`,_hoisted_14$1,[createBaseVNode(`p`,_hoisted_15$1,toDisplayString(unref(t).answerCount)+` / `+toDisplayString(unref(t).players.length)+` answered`,1),createBaseVNode(`button`,{class:`hq-btn-action hq-press`,onClick:r[0]||=e=>unref(t).send(`host_reveal`)},` 🔍 Reveal Answer `)])])):createCommentVNode(``,!0)}}),QuestionView_default=_plugin_vue_export_helper_default(QuestionView_vue_vue_type_script_setup_true_lang_default,[[`__scopeId`,`data-v-a18eb71b`]]);function A(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var R=A();function j(e){R=e}var z={exec:()=>null};function I(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),a=t[r];return a||(a=e(r),t[r]=a),a}}function k(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let a=typeof t==`string`?t:t.source;return a=a.replace(m.caret,`$1`),n=n.replace(e,a),r},getRegex:()=>new RegExp(n,t)};return r}var Oe=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),m={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:I(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:I(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:I(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:I(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:I(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:I(e=>RegExp(`^ {0,${e}}>`))},Te=/^(?:[ \t]*(?:\n|$))+/,we=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ye=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,q=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Pe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,U=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,oe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ae=k(oe).replace(/bull/g,U).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Se=k(oe).replace(/bull/g,U).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),K=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,_e=/^[^\n]+/,W=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,$e=k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,W).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Le=k(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,U).getRegex(),Q=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,X=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ee=k(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,X).replace(`tag`,Q).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),le=e=>k(K).replace(`hr`,q).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Q).getRegex(),ze=le(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Me=le(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),J={blockquote:k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Me).getRegex(),code:we,def:$e,fences:ye,heading:Pe,hr:q,html:Ee,lheading:ae,list:Le,newline:Te,paragraph:ze,table:z,text:_e},se=k(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,q).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Q).getRegex(),Ie={...J,lheading:Se,table:se,paragraph:k(K).replace(`hr`,q).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,se).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Q).getRegex()},Ce={...J,html:k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,X).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:z,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:k(K).replace(`hr`,q).replace(`heading`,` *#{1,6} *[^
|
|
80
80
|
]`).replace(`lheading`,ae).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Be=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,De=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ue=/^( {2,}|\\)\n(?!\s*$)/,qe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_=/[\p{P}\p{S}]/u,C=/[\s\p{P}\p{S}]/u,v=/[^\s\p{P}\p{S}]/u,ve=k(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,C).getRegex(),He=/[\p{Pi}\p{Ps}"']/u,pe=/(?!~)[\p{P}\p{S}]/u,Ze=/(?!~)[\s\p{P}\p{S}]/u,Ge=/(?:[^\s\p{P}\p{S}]|~)/u,Qe=k(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Oe?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),ce=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ne=k(ce,`u`).replace(/punct/g,_).getRegex(),je=k(ce,`u`).replace(/punct/g,pe).getRegex(),Ue=k(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,He).replace(/punct/g,_).getRegex(),he=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Ke=k(he,`gu`).replace(/notPunctSpace/g,v).replace(/punctSpace/g,C).replace(/punct/g,_).getRegex(),We=k(he,`gu`).replace(/notPunctSpace/g,Ge).replace(/punctSpace/g,Ze).replace(/punct/g,pe).getRegex(),Je=k(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,v).replace(/punctSpace/g,C).replace(/punct/g,_).getRegex(),Ve=k(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,v).replace(/punctSpace/g,C).replace(/punct/g,_).getRegex(),et=k(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,v).replace(/punctSpace/g,C).replace(/punct/g,_).getRegex(),tt=k(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,_).getRegex(),rt=k(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,v).replace(/punctSpace/g,C).replace(/punct/g,_).getRegex(),st=k(/\\(punct)/,`gu`).replace(/punct/g,_).getRegex(),it=k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ot=k(X).replace(`(?:-->|$)`,`-->`).getRegex(),at=k(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,ot).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),G=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,lt=k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,G).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ke=k(/^!?\[(label)\]\[(ref)\]/).replace(`label`,G).replace(`ref`,W).getRegex(),de=k(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,W).getRegex(),ut=k(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,ke).replace(`nolink`,de).getRegex(),ie=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,V={_backpedal:z,anyPunctuation:st,autolink:it,blockSkip:Qe,br:ue,code:De,del:z,delLDelim:z,delRDelim:z,emStrongLDelim:Ne,emStrongRDelimAst:Ke,emStrongRDelimUnd:Ve,escape:Be,link:lt,nolink:de,punctuation:ve,reflink:ke,reflinkSearch:ut,tag:at,text:qe,url:z},pt={...V,emStrongLDelim:Ue,emStrongRDelimAst:Je,emStrongRDelimUnd:et,link:k(/^!?\[(label)\]\((.*?)\)/).replace(`label`,G).getRegex(),reflink:k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,G).getRegex()},F={...V,emStrongRDelimAst:We,emStrongLDelim:je,delLDelim:tt,delRDelim:rt,url:k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,ie).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:k(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,ie).getRegex()},ct={...F,br:k(ue).replace(`{2,}`,`*`).getRegex(),text:k(F.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},H={normal:J,gfm:Ie,pedantic:Ce},B={normal:V,gfm:F,breaks:ct,pedantic:pt},ht={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},ge=e=>ht[e];function T(e,t){if(t){if(m.escapeTest.test(e))return e.replace(m.escapeReplace,ge)}else if(m.escapeTestNoEncode.test(e))return e.replace(m.escapeReplaceNoEncode,ge);return e}function Y(e){try{e=encodeURI(e).replace(m.percentDecode,`%`)}catch{return null}return e}function ee(e,t){let n=e.replace(m.findPipe,(e,t,n)=>{let r=!1,a=t;for(;--a>=0&&n[a]===`\\`;)r=!r;return r?`|`:` |`}).split(m.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(m.slashPipe,`|`);return n}function $(e,t,n){let r=e.length;if(r===0)return``;let a=0;for(;a<r;){let o=e.charAt(r-a-1);if(o===t&&!n)a++;else if(o!==t&&n)a++;else break}return e.slice(0,r-a)}function te(e){let t=e.split(`
|
|
81
81
|
`),n=t.length-1;for(;n>=0&&m.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
82
82
|
`)}function fe(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function me(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function xe(e,t,n,r,a){let o=t.href,s=t.title||null,c=e[1].replace(a.other.outputLinkReplace,`$1`),l=e[0].charAt(0)===`!`;r.state.inLink=!0;let u=r.state.linkEmitted,d=r.state.inRawBlock;r.state.linkEmitted=!1;let h=r.inlineTokens(c),g=r.state.linkEmitted;if(r.state.linkEmitted=u,r.state.inLink=!1,!l){if(g){r.state.inRawBlock=d;return}r.state.linkEmitted=!0}return{type:l?`image`:`link`,raw:n,href:o,title:s,text:c,tokens:h}}function kt(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let a=r[1];return t.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@import "https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Jersey+10&family=JetBrains+Mono:wght@400;500;700&display=swap";.fx-countdown[data-v-80535576]{flex:none;place-items:center;display:grid;position:relative}.fx-countdown--large[data-v-80535576]{width:min(38vmin,32vw);height:min(38vmin,32vw)}.fx-countdown--compact[data-v-80535576]{width:140px;height:140px}.fx-countdown__canvas[data-v-80535576]{width:100%;height:100%;position:absolute;inset:0}.fx-countdown__num[data-v-80535576]{font-family:var(--hq-font-pixel);font-variant-numeric:tabular-nums;color:var(--hq-text);font-weight:500;line-height:1;transition:color .3s;position:relative}.fx-countdown--large .fx-countdown__num[data-v-80535576]{font-size:min(12vmin,10vw)}.fx-countdown--compact .fx-countdown__num[data-v-80535576]{font-size:52px}.fx-countdown--danger .fx-countdown__num[data-v-80535576]{color:var(--hq-wrong)}.hq-logo[data-v-0397f988]{z-index:50;width:auto;height:clamp(1.1rem,2.6vmin,1.9rem);color:var(--hq-text-muted);opacity:.7;pointer-events:none;position:fixed;top:1.5vmin;left:1.5vmin}.hq-logo--center[data-v-0397f988]{height:clamp(2.5rem,8vmin,5.5rem);color:var(--hq-text);opacity:1;pointer-events:auto;margin:0 auto;display:block;position:static}.hq-logo--inline[data-v-0397f988]{height:100%;color:var(--hq-text);opacity:1;display:block;position:static}.hq-logo__hash-back[data-v-0397f988]{fill:var(--hq-brand-violet)}.hq-logo__hash-front[data-v-0397f988]{fill:var(--hq-brand-purple)}.hq-logo__text[data-v-0397f988]{fill:currentColor}.fx-backdrop[data-v-b3f1f5c8]{z-index:0;pointer-events:none;width:100vw;height:100dvh;display:block;position:fixed;inset:0}.fx-lobby[data-v-b52d79da]{pointer-events:none;width:100%;height:100%;position:relative}.fx-lobby__canvas[data-v-b52d79da]{width:100%;height:100%;display:block;position:absolute;inset:0}.fx-podium[data-v-d5e3b296]{pointer-events:none;width:100%;height:100%;position:relative;container-type:size}.fx-podium__canvas[data-v-d5e3b296]{width:100%;height:100%;display:block;position:absolute;inset:0}.fx-podium__label[data-v-d5e3b296]{text-align:center;opacity:0;flex-direction:column;gap:.2em;width:26cqw;transition:opacity .6s;display:flex;position:absolute;top:calc(74% + 2cqh);transform:translate(-50%)}.fx-podium__label--on[data-v-d5e3b296]{opacity:1}.fx-podium__name[data-v-d5e3b296]{font-family:var(--hq-font-display);color:var(--hq-text);text-overflow:ellipsis;white-space:nowrap;font-size:clamp(1rem,4cqh,3.2rem);font-weight:600;overflow:hidden}.fx-podium__label--first .fx-podium__name[data-v-d5e3b296]{font-size:clamp(1.15rem,5cqh,4rem)}.fx-podium__score[data-v-d5e3b296]{color:var(--hq-text-muted);font-size:clamp(.85rem,3cqh,2.4rem)}.fx-podium__label--me .fx-podium__name[data-v-d5e3b296],.fx-podium__label--me .fx-podium__score[data-v-d5e3b296]{color:var(--hq-accent)}.fx-podium__outside[data-v-d5e3b296]{font-family:var(--hq-font-pixel);color:var(--hq-accent);opacity:0;margin:0;font-size:clamp(1.2rem,5cqh,4rem);font-weight:700;transition:opacity .6s;position:absolute;top:5cqh;left:50%;transform:translate(-50%)}.fx-podium__outside--on[data-v-d5e3b296]{opacity:1}.fx-reveal[data-v-f199a57b]{flex-direction:column;width:100%;height:100%;min-height:0;display:flex;position:relative}.fx-reveal__canvas[data-v-f199a57b]{flex:1 1 0;width:100%;min-height:0;display:block}.fx-reveal__labels[data-v-f199a57b]{flex:none;gap:.5vmin;width:60%;margin:0 auto;padding:0;list-style:none;display:grid}.fx-reveal__label[data-v-f199a57b]{text-align:center;opacity:1;flex-direction:column;align-items:center;gap:.2em;min-width:0;transition:opacity .7s;display:flex}.fx-reveal__label--dim[data-v-f199a57b]{opacity:.75}.fx-reveal__letter[data-v-f199a57b]{font-family:var(--hq-font-pixel);font-size:clamp(1.4rem,4.2vmin,3rem);font-weight:600;line-height:1}.fx-reveal__text[data-v-f199a57b]{font-family:var(--hq-font-display);color:var(--hq-text);overflow-wrap:anywhere;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;font-size:clamp(1rem,2.8vmin,2rem);line-height:1.2;display:-webkit-box;overflow:hidden}.fx-reveal__votes[data-v-f199a57b]{color:var(--hq-text-muted);font-variant-numeric:tabular-nums;font-size:clamp(.85rem,2.2vmin,1.5rem)}.fx-reveal__label--ok .fx-reveal__text[data-v-f199a57b],.fx-reveal__check[data-v-f199a57b]{color:var(--hq-correct)}@media (prefers-reduced-motion:reduce){.fx-reveal__label[data-v-f199a57b]{transition:none}}.hq-players[data-v-44834f23]{flex-wrap:wrap;align-items:flex-start;gap:.5rem;min-height:2.5rem;display:flex}.hq-players--end[data-v-44834f23]{text-align:right;justify-content:flex-end}.hq-players__chip[data-v-44834f23]{background:var(--hq-surface-2);border-radius:var(--hq-radius-sm);align-items:center;gap:.45rem;padding:.3rem .65rem;font-size:.9rem;display:flex}.hq-players__avatar[data-v-44834f23]{background:var(--hq-accent);width:1.5rem;height:1.5rem;color:var(--hq-text);border-radius:var(--hq-radius-sm);font-family:var(--hq-font-pixel);flex-shrink:0;justify-content:center;align-items:center;font-size:.75rem;font-weight:700;display:flex}.hq-players__empty[data-v-44834f23]{color:var(--hq-text-muted);font-size:.9rem}.hq-podium[data-v-8d79b015]{flex-direction:column;gap:.5rem;margin:0;padding:0;list-style:none;display:flex}.hq-podium__row[data-v-8d79b015]{border-radius:var(--hq-radius-sm);background:var(--hq-surface);border:1px solid #0000;align-items:center;gap:.9rem;padding:.75rem 1rem;display:flex}.hq-podium__row--top1[data-v-8d79b015]{box-shadow:var(--hq-pixel) var(--hq-pixel) 0 var(--hq-accent-2);border-color:var(--hq-warn);background:color-mix(in srgb, var(--hq-warn) 10%, var(--hq-surface))}.hq-podium__row--top2[data-v-8d79b015]{border-color:var(--hq-text-muted);background:color-mix(in srgb, var(--hq-text-muted) 8%, var(--hq-surface))}.hq-podium__row--top3[data-v-8d79b015]{border-color:var(--hq-choice-c);background:color-mix(in srgb, var(--hq-choice-c) 8%, var(--hq-surface))}.hq-podium__rank[data-v-8d79b015]{min-width:2.2rem;font-size:1.3rem}.hq-podium__name[data-v-8d79b015]{flex:1;font-weight:600}.hq-podium__score[data-v-8d79b015]{font-family:var(--hq-font-pixel);color:var(--hq-figure);font-weight:700}.hq-qr[data-v-7ecbb7cc]{border-radius:var(--hq-radius-sm);display:block}.diff-bar__track[data-v-a3903778]{border-radius:var(--hq-radius-sm);background:var(--hq-border);height:8px;display:flex;overflow:hidden}.diff-bar__seg[data-v-a3903778]{height:100%;transition:width .4s}.diff-bar__seg--easy[data-v-a3903778]{background:var(--hq-correct)}.diff-bar__seg--medium[data-v-a3903778]{background:var(--hq-warn)}.diff-bar__seg--hard[data-v-a3903778]{background:var(--hq-wrong)}.diff-bar__legend[data-v-a3903778]{color:var(--hq-text-muted);align-items:center;gap:.5rem;margin:.4rem 0 0;font-size:.875rem;display:flex}.diff-bar__dot[data-v-a3903778]{border-radius:var(--hq-radius-sm);width:8px;height:8px;display:inline-block}.diff-bar__dot--easy[data-v-a3903778]{background:var(--hq-correct)}.diff-bar__dot--medium[data-v-a3903778]{background:var(--hq-warn)}.diff-bar__dot--hard[data-v-a3903778]{background:var(--hq-wrong)}.qip[data-v-549d1637]{background:color-mix(in srgb, var(--hq-surface) 82%, transparent);border:1px solid var(--hq-border);border-radius:var(--hq-radius);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);flex-direction:column;gap:1rem;min-width:0;padding:1.25rem;display:flex}.qip--compact[data-v-549d1637]{gap:.75rem;padding:1rem}.qip--compact .qip__title[data-v-549d1637]{overflow-wrap:anywhere;font-size:1.5rem}.qip--compact .qip__description[data-v-549d1637]{-webkit-line-clamp:4;line-clamp:4;-webkit-box-orient:vertical;font-size:1rem;display:-webkit-box;overflow:hidden}.qip--compact .qip__badge[data-v-549d1637]{font-size:.75rem}.qip--compact .qip__metrics[data-v-549d1637]{gap:.5rem}.qip--compact .qip__metric[data-v-549d1637]{flex:1 1 0;min-width:0;padding:.4rem .5rem}.qip--compact .qip__metric strong[data-v-549d1637]{font-size:1.4rem}.qip--compact .qip__metric strong small[data-v-549d1637]{color:var(--hq-text-muted);font-size:.6em}.qip__metric span[data-v-549d1637],.qip--compact .qip__tag[data-v-549d1637]{font-size:.75rem}.qip__labels[data-v-549d1637]{flex-wrap:wrap;align-items:center;gap:.6rem;display:flex}.qip__label[data-v-549d1637]{font-family:var(--hq-font-label);letter-spacing:.1em;text-transform:uppercase;border:1px solid var(--hq-border);border-radius:var(--hq-radius-sm);color:var(--hq-text-muted);padding:.25rem .7rem;font-size:.875rem;font-weight:700}.qip--compact .qip__label[data-v-549d1637]{font-size:.75rem}.qip__badge[data-v-549d1637]{background:var(--hq-accent);box-shadow:calc(var(--hq-pixel) * .75) calc(var(--hq-pixel) * .75) 0 var(--hq-accent-2);color:var(--hq-text);font-family:var(--hq-font-label);letter-spacing:.1em;text-transform:uppercase;border-radius:var(--hq-radius-sm);padding:.3rem .75rem;font-size:.875rem;font-weight:700;display:inline-block}.qip__header[data-v-549d1637]{justify-content:space-between;align-items:flex-start;gap:.75rem;display:flex}.qip__title[data-v-549d1637]{font-family:var(--hq-font-pixel);color:var(--hq-text);margin:0;font-size:3rem;font-weight:700}.qip__content[data-v-549d1637]{flex-direction:column;gap:0;display:flex}.qip__tags[data-v-549d1637]{flex-wrap:wrap;gap:.35rem;margin-bottom:.5rem;display:flex}.qip__tag[data-v-549d1637]{background:var(--hq-surface);border:1px solid var(--hq-border);border-radius:var(--hq-radius-sm);color:var(--hq-text-muted);padding:.2rem .55rem;font-size:.875rem}.qip__description[data-v-549d1637]{color:var(--hq-text-muted);margin:0;font-size:1.25rem;line-height:1.5}.qip__target-badge[data-v-549d1637]{border-radius:var(--hq-radius-sm);letter-spacing:.05em;flex-shrink:0;padding:.3rem .75rem;font-size:.75rem;font-weight:700}.qip__target-badge--easy[data-v-549d1637]{background:color-mix(in srgb, var(--hq-correct) 15%, transparent);color:var(--hq-correct)}.qip__target-badge--medium[data-v-549d1637]{background:color-mix(in srgb, var(--hq-warn) 15%, transparent);color:var(--hq-warn)}.qip__target-badge--hard[data-v-549d1637]{background:color-mix(in srgb, var(--hq-wrong) 15%, transparent);color:var(--hq-wrong)}.qip__metrics[data-v-549d1637]{justify-content:center;gap:1rem;display:flex}.qip__metric[data-v-549d1637]{background:var(--hq-surface);border:1px solid var(--hq-border);border-radius:var(--hq-radius-sm);flex-direction:column;align-items:center;min-width:70px;padding:.5rem 1rem;display:flex}.qip__metric strong[data-v-549d1637]{font-family:var(--hq-font-pixel);color:var(--hq-figure);font-size:2rem;font-weight:700;line-height:1}.qip__metric span[data-v-549d1637]{color:var(--hq-text-muted);margin-top:.15rem;font-size:.875rem}.deck-card[data-v-d8b5fdc0]{flex-direction:column;gap:.6vmin;min-width:0;display:flex}.deck-card__btn[data-v-d8b5fdc0]{text-align:left;min-width:0;font:inherit;color:inherit;border-radius:var(--hq-radius);cursor:pointer;background:0 0;border:none;flex:1;padding:0}.deck-card__btn[data-v-d8b5fdc0] .qip{height:100%;transition:border-color .15s,transform .12s steps(2,end),box-shadow .12s steps(2,end)}.deck-card__btn[data-v-d8b5fdc0]:hover .qip{border-color:var(--hq-accent);transform:translate(calc(var(--hq-pixel) * -1), calc(var(--hq-pixel) * -1));box-shadow:var(--hq-pixel) var(--hq-pixel) 0 var(--hq-accent-2)}.deck-card__btn[data-v-d8b5fdc0]:focus-visible{outline:2px solid var(--hq-accent);outline-offset:3px}.deck-card__solo[data-v-d8b5fdc0]{color:var(--hq-accent);border-radius:var(--hq-radius-sm);align-self:flex-end;padding:.25rem .7rem;font-size:clamp(.85rem,1.8vmin,1.2rem);text-decoration:none}.deck-card__solo[data-v-d8b5fdc0]:hover{text-decoration:underline}.deck-card__solo[data-v-d8b5fdc0]:focus-visible{outline:2px solid var(--hq-accent);outline-offset:2px}@media (prefers-reduced-motion:reduce){.deck-card__btn[data-v-d8b5fdc0]:hover .qip{transform:none}}.decks[data-v-090bd1f2]{height:100%;overflow-y:auto}.decks__inner[data-v-090bd1f2]{flex-direction:column;gap:3vmin;max-width:84rem;margin:0 auto;padding:4vmin 4vmin 6vmin;display:flex}.decks__title[data-v-090bd1f2]{text-align:center;margin:0;font-size:clamp(1.4rem,3.4vmin,2.4rem)}.decks__hash[data-v-090bd1f2]{color:var(--hq-accent);margin-right:.1em}.decks__back[data-v-090bd1f2]{color:var(--hq-text-muted);align-self:flex-start;font-size:clamp(.9rem,1.8vmin,1.2rem);text-decoration:none}.decks__back[data-v-090bd1f2]:hover,.decks__back[data-v-090bd1f2]:focus-visible{color:var(--hq-text);text-decoration:underline}.decks__grid[data-v-090bd1f2]{grid-template-columns:repeat(auto-fill,minmax(min(100%,22rem),1fr));gap:2vmin;margin:0;padding:0;list-style:none;display:grid}.decks__empty[data-v-090bd1f2]{text-align:center;color:var(--hq-text-muted)}.decks__heading[data-v-090bd1f2]{color:var(--hq-text-muted);margin:0 0 1.2vmin;font-size:clamp(.8rem,1.6vmin,1.1rem)}.decks__taglist[data-v-090bd1f2]{flex-wrap:wrap;gap:1vmin;margin:0;padding:0;list-style:none;display:flex}.decks__tag[data-v-090bd1f2]{background:color-mix(in srgb, var(--hq-surface) 82%, transparent);border:1px solid var(--hq-border);border-radius:var(--hq-radius-sm);color:var(--hq-text);align-items:center;gap:.5rem;padding:.35rem .8rem;font-size:clamp(.85rem,1.8vmin,1.2rem);text-decoration:none;display:inline-flex}.decks__tag[data-v-090bd1f2]:hover{border-color:var(--hq-accent)}.decks__tag[data-v-090bd1f2]:focus-visible{outline:2px solid var(--hq-accent);outline-offset:2px}.decks__tag-count[data-v-090bd1f2]{color:var(--hq-text-muted);font-size:.85em}.lobby[data-v-7fe37d38]{grid-template-columns:minmax(0,1fr) minmax(0,min(48rem,56vw)) minmax(0,1fr);height:100%;display:grid;position:relative;overflow:hidden}.lobby__side[data-v-7fe37d38]{flex-direction:column;gap:2vmin;min-height:0;padding:3vmin;display:flex;position:relative}.lobby__groups[data-v-7fe37d38]{flex:1 1 0;gap:1vmin;min-height:0;display:grid}.lobby__groups .lobby__fx[data-v-7fe37d38]{min-width:0;min-height:0}.lobby__players[data-v-7fe37d38]{flex:0 auto;max-height:34%;padding:1.2vmin;overflow:auto}.lobby__side[data-v-7fe37d38] .hq-players{gap:.4rem}.lobby__side[data-v-7fe37d38] .hq-players__chip{padding:.2rem .5rem;font-size:clamp(.7rem,1.6vmin,1rem)}.lobby__col[data-v-7fe37d38]{scroll-snap-type:y proximity;scrollbar-width:none;min-height:0;overflow-y:auto}.lobby__col[data-v-7fe37d38]::-webkit-scrollbar{display:none}.lobby__section[data-v-7fe37d38]{scroll-snap-align:start;flex-direction:column;justify-content:center;align-items:center;gap:3vmin;min-height:100%;padding:4vmin 1vmin;display:flex}.lobby__section--card[data-v-7fe37d38]{justify-content:center;align-items:center}.lobby__section--join[data-v-7fe37d38]{gap:2vmin}.lobby__join[data-v-7fe37d38],.lobby__start[data-v-7fe37d38]{flex-direction:column;align-items:center;gap:1.2vmin;display:flex}.lobby__bare[data-v-7fe37d38]{text-shadow:0 0 1vmin var(--hq-bg), 0 0 2vmin var(--hq-bg)}.lobby .quiz-info[data-v-7fe37d38]{flex:none;gap:2vmin;width:100%;padding:3vmin}.quiz-info[data-v-7fe37d38] .qip__title{font-size:clamp(1.75rem,5vmin,3.5rem)}.quiz-info[data-v-7fe37d38] .qip__description{font-size:clamp(1rem,2.4vmin,1.5rem)}.quiz-info[data-v-7fe37d38] .qip__metric strong{font-size:clamp(1.25rem,3.4vmin,2.2rem)}.lobby__link[data-v-7fe37d38]{color:var(--hq-accent);word-break:break-all;text-align:center;font-size:clamp(1rem,2.6vmin,1.8rem)}.lobby__link[data-v-7fe37d38]:hover{text-decoration:underline}.lobby__code-box[data-v-7fe37d38]{text-align:center}.lobby__code-label[data-v-7fe37d38]{color:var(--hq-text-muted);margin:0;font-size:clamp(.75rem,1.8vmin,1.1rem)}.lobby__code[data-v-7fe37d38]{letter-spacing:.16em;color:var(--hq-figure);margin:.6vmin 0 0;font-size:clamp(2.5rem,8vmin,5.5rem);line-height:1.1}.lobby__qr[data-v-7fe37d38]{justify-content:center;width:100%;display:flex}.lobby__qr[data-v-7fe37d38] .hq-qr{aspect-ratio:1;image-rendering:pixelated;width:min(100%,34vh)!important;height:auto!important}.lobby__count[data-v-7fe37d38]{transform-origin:50% 70%;flex-direction:column;align-items:center;gap:.6vmin;transition:transform .45s cubic-bezier(.2,.9,.3,1);display:flex}.lobby__count--pop[data-v-7fe37d38]{transition-duration:.12s;transform:scale(1.25)}.lobby__count-num[data-v-7fe37d38]{font-family:var(--hq-font-pixel);font-variant-numeric:tabular-nums;color:var(--hq-text);text-shadow:0 0 1.5vmin var(--hq-bg), 0 0 3vmin var(--hq-bg);font-size:clamp(3rem,10vmin,7rem);font-weight:500;line-height:1}.lobby__count-label[data-v-7fe37d38]{color:var(--hq-text-muted);font-size:clamp(.75rem,1.8vmin,1.2rem)}@media (prefers-reduced-motion:reduce){.lobby__count[data-v-7fe37d38],.lobby__count--pop[data-v-7fe37d38]{transition:none;transform:none}.lobby__col[data-v-7fe37d38]{scroll-behavior:auto}}.hq-btn-primary[data-v-7fe37d38]{background:var(--hq-accent);width:min(100%,28rem);color:var(--hq-text);border-radius:var(--hq-radius);cursor:pointer;font-size:clamp(1rem,2.4vmin,1.6rem);font-family:var(--hq-font-pixel);border:none;padding:1.6vmin 2vmin;font-weight:700}.hq-btn-primary[data-v-7fe37d38]:hover:not(:disabled){background:color-mix(in srgb, var(--hq-accent) 80%, var(--hq-bg))}.hq-btn-primary[data-v-7fe37d38]:disabled{opacity:.4;cursor:not-allowed}.hq-btn-primary[data-v-7fe37d38]:focus-visible{outline:2px solid var(--hq-text);outline-offset:3px}.question-view[data-v-a18eb71b]{grid-template-rows:auto minmax(0,1fr) auto;gap:2.5vmin;height:100%;padding:3vmin 4vmin;display:grid;overflow:hidden}.hq-progress[data-v-a18eb71b]{align-items:center;gap:.6rem;padding-right:12rem;display:flex}.hq-progress__label[data-v-a18eb71b]{color:var(--hq-text-muted);min-width:2rem;font-size:clamp(.8rem,1.6vmin,1.1rem)}.hq-progress__label[data-v-a18eb71b]:last-child{text-align:right}.hq-progress__track[data-v-a18eb71b]{background:var(--hq-border);border-radius:var(--hq-radius-sm);flex:1;height:6px;overflow:hidden}.hq-progress__fill[data-v-a18eb71b]{background:var(--hq-progress);height:100%;transition:width .3s}.hq-main[data-v-a18eb71b]{grid-template-columns:auto minmax(0,1fr);align-items:center;gap:5vmin;min-height:0;display:grid}.hq-header[data-v-a18eb71b]{justify-content:center;align-items:center;display:flex}.hq-body[data-v-a18eb71b]{flex-direction:column;min-height:0;max-height:100%;display:flex}.hq-q-meta[data-v-a18eb71b]{justify-content:space-between;align-items:center;margin-bottom:1.5vmin;display:flex}.hq-q-meta__tags[data-v-a18eb71b]{flex-wrap:wrap;gap:.4rem;display:flex}.hq-q-meta__tag[data-v-a18eb71b]{background:var(--hq-bg);border:1px solid var(--hq-border);border-radius:var(--hq-radius-sm);color:var(--hq-text-muted);padding:.15rem .5rem;font-size:clamp(.75rem,1.5vmin,1rem)}.hq-difficulty[data-v-a18eb71b]{flex-shrink:0;align-items:center;gap:3px;display:flex}.hq-difficulty__dot[data-v-a18eb71b]{border-radius:var(--hq-radius-sm);background:0 0;border:1.5px solid;width:8px;height:8px}.hq-difficulty--easy[data-v-a18eb71b]{color:var(--hq-correct)}.hq-difficulty--medium[data-v-a18eb71b]{color:var(--hq-warn)}.hq-difficulty--hard[data-v-a18eb71b]{color:var(--hq-wrong)}.hq-difficulty--easy .hq-difficulty__dot--1[data-v-a18eb71b],.hq-difficulty--medium .hq-difficulty__dot--1[data-v-a18eb71b],.hq-difficulty--medium .hq-difficulty__dot--2[data-v-a18eb71b],.hq-difficulty--hard .hq-difficulty__dot[data-v-a18eb71b]{background:currentColor}.hq-question-text[data-v-a18eb71b]{margin:0 0 3vmin;font-size:clamp(1.4rem,4.6vmin,3.4rem);line-height:1.25}.hq-choices-grid[data-v-a18eb71b]{grid-template-columns:1fr 1fr;gap:2vmin;font-size:clamp(1rem,3vmin,2.2rem);display:grid}.hq-choice-card[data-v-a18eb71b]{border-radius:var(--hq-radius);background:var(--hq-surface-2);align-items:center;gap:.75em;padding:2vmin 2.4vmin;line-height:1.25;display:flex}.hq-choice-card--a[data-v-a18eb71b]{border-left:6px solid var(--hq-choice-a)}.hq-choice-card--b[data-v-a18eb71b]{border-left:6px solid var(--hq-choice-b)}.hq-choice-card--c[data-v-a18eb71b]{border-left:6px solid var(--hq-choice-c)}.hq-choice-card--d[data-v-a18eb71b]{border-left:6px solid var(--hq-choice-d)}.hq-choice-card__id[data-v-a18eb71b]{font-family:var(--hq-font-pixel);min-width:1.5em;font-weight:700}.hq-controls[data-v-a18eb71b]{justify-content:center;align-items:center;gap:3vmin;display:flex}.hq-controls__answered[data-v-a18eb71b]{color:var(--hq-text-muted);margin:0;font-size:clamp(.9rem,2.2vmin,1.5rem)}.hq-btn-action[data-v-a18eb71b]{background:var(--hq-surface-2);color:var(--hq-text);border:1px solid var(--hq-border);border-radius:var(--hq-radius);cursor:pointer;font-size:clamp(1rem,2.2vmin,1.5rem);font-family:var(--hq-font-pixel);padding:1.4vmin 2.6vmin;font-weight:700}.hq-btn-action[data-v-a18eb71b]:hover{background:var(--hq-surface)}.reveal-view[data-v-91f02780]{grid-template-rows:auto auto minmax(0,1fr) auto;gap:2.5vmin;height:100%;padding:3vmin 4vmin;display:grid;overflow:hidden}.rv-main[data-v-91f02780]{grid-template-rows:auto minmax(0,1fr);grid-template-columns:minmax(0,1.6fr) minmax(0,1fr);gap:2.5vmin 4vmin;min-height:0;display:grid}.rv-left[data-v-91f02780]{display:contents}.rv-fx[data-v-91f02780]{grid-area:2/1/auto/-1;min-height:0}.rv-progress[data-v-91f02780]{align-items:center;gap:.6rem;padding-right:12rem;display:flex}.rv-progress__label[data-v-91f02780]{color:var(--hq-text-muted);min-width:2rem;font-size:clamp(.8rem,1.6vmin,1.1rem)}.rv-progress__label[data-v-91f02780]:last-child{text-align:right}.rv-progress__track[data-v-91f02780]{background:var(--hq-border);border-radius:var(--hq-radius-sm);flex:1;height:6px;overflow:hidden}.rv-progress__fill[data-v-91f02780]{background:var(--hq-progress);height:100%}.rv-question[data-v-91f02780]{margin:0;font-size:clamp(1.3rem,3.6vmin,2.6rem);line-height:1.25}.rv-explanation[data-v-91f02780]{background:var(--hq-surface-2);border-left:6px solid var(--hq-correct);border-radius:var(--hq-radius-sm);flex-direction:column;gap:.8vmin;padding:2vmin 2.4vmin;font-size:clamp(.95rem,2.1vmin,1.5rem);display:flex}.rv-correct__label[data-v-91f02780]{color:var(--hq-correct);font-size:.8em;font-weight:700}.rv-correct__choices[data-v-91f02780]{flex-direction:column;gap:.25rem;margin:0 0 .25rem;padding:0;list-style:none;display:flex}.rv-correct__choice[data-v-91f02780]{color:var(--hq-correct);font-weight:600}.rv-explanation__label[data-v-91f02780]{color:var(--hq-text-muted);margin:0;font-size:.75em}.rv-explanation__body[data-v-91f02780]{line-height:1.5}.rv-explanation__body[data-v-91f02780] p{margin:0 0 .5rem}.rv-explanation__body[data-v-91f02780] p:last-child{margin:0}.rv-explanation__body[data-v-91f02780] code{background:var(--hq-surface);border:1px solid var(--hq-border);border-radius:var(--hq-radius-sm);padding:.1rem .35rem;font-size:.9em}.rv-explanation__body[data-v-91f02780] strong{color:var(--hq-text)}.rv-explanation__body[data-v-91f02780] ul,.rv-explanation__body[data-v-91f02780] ol{margin:.25rem 0;padding-left:1.25rem}.rv-scores[data-v-91f02780]{grid-area:1/2;min-height:0;font-size:clamp(.95rem,2.2vmin,1.5rem);overflow:auto}.rv-scores h3[data-v-91f02780]{color:var(--hq-text-muted);margin:0 0 1.2vmin;font-size:1em}.rv-score-row[data-v-91f02780]{border-bottom:1px solid var(--hq-border);align-items:center;gap:.75rem;padding:1vmin 0;display:flex}.rv-score-row span[data-v-91f02780]:first-child{flex:1}.rv-score-delta[data-v-91f02780]{color:var(--hq-correct);font-weight:600}.rv-score-delta--zero[data-v-91f02780]{color:var(--hq-text-muted)}.rv-score-total[data-v-91f02780]{color:var(--hq-text-muted);text-align:right;min-width:4rem;font-size:.85em}.rv-answer-block[data-v-91f02780]{flex:0 auto;grid-area:1/1;min-height:0;max-height:40vh;overflow:auto}.rv-controls[data-v-91f02780]{justify-content:center;display:flex}.hq-btn-action[data-v-91f02780]{background:var(--hq-accent);color:var(--hq-text);border-radius:var(--hq-radius);cursor:pointer;font-size:clamp(1rem,2.2vmin,1.5rem);font-family:var(--hq-font-pixel);border:none;padding:1.4vmin 2.6vmin;font-weight:700}.hq-btn-action[data-v-91f02780]:hover{background:color-mix(in srgb, var(--hq-accent) 80%, var(--hq-bg))}.podium-view[data-v-7252999f]{grid-template-columns:minmax(0,1fr) minmax(18rem,30vw);height:100%;display:grid;overflow:hidden}.podium-view__scene[data-v-7252999f]{min-height:0;position:relative}h1[data-v-7252999f]{z-index:1;text-align:center;margin:0;font-size:clamp(2rem,7vmin,5rem);position:absolute;top:3vmin;left:0;right:0}.podium-view__ranking[data-v-7252999f]{flex-direction:column;justify-content:center;align-items:center;gap:2.4vmin;min-height:0;padding:4vmin 3vmin;display:flex}.podium-view[data-v-7252999f] .hq-podium{flex:0 auto;gap:1.2vmin;width:100%;min-height:0;max-height:100%;font-size:clamp(1rem,2.6vmin,1.8rem);overflow:auto}.podium-view[data-v-7252999f] .hq-podium__row{padding:1.6vmin 2vmin}.podium-view[data-v-7252999f] .hq-podium__rank{min-width:2.2em;font-size:1.3em}.podium-view__actions[data-v-7252999f]{flex:none;gap:2vmin;width:min(100%,28rem);display:flex}.hq-btn-primary[data-v-7252999f]{background:var(--hq-accent);color:var(--hq-text);border:2px solid var(--hq-accent);border-radius:var(--hq-radius);cursor:pointer;font-size:clamp(1rem,2.4vmin,1.6rem);font-family:var(--hq-font-pixel);flex:1 1 0;padding:1.6vmin 2vmin;font-weight:700}.hq-btn-primary[data-v-7252999f]:hover{background:color-mix(in srgb, var(--hq-accent) 80%, var(--hq-bg))}.hq-btn-primary--ghost[data-v-7252999f]{color:var(--hq-accent);background:0 0}.hq-btn-primary--ghost[data-v-7252999f]:hover{background:var(--hq-accent);color:var(--hq-text)}.hq-btn-primary[data-v-7252999f]:focus-visible{outline:2px solid var(--hq-text);outline-offset:3px}.fs-btn[data-v-c2c16456]{z-index:50;color:var(--hq-text-muted);border:1px solid var(--hq-border);border-radius:var(--hq-radius-sm);cursor:pointer;opacity:.7;background:0 0;padding:.6vmin 1.2vmin;font-size:clamp(.65rem,1.1vmin,.9rem);transition:opacity .2s,color .2s;position:fixed;top:1.5vmin;right:1.5vmin}.fs-btn[data-v-c2c16456]:hover,.fs-btn[data-v-c2c16456]:focus-visible{opacity:1;color:var(--hq-text)}.fs-btn[data-v-c2c16456]:focus-visible{outline:2px solid var(--hq-accent);outline-offset:2px}.app{z-index:1;height:100dvh;padding:0;position:relative;overflow:hidden}.connecting{height:100dvh;color:var(--hq-text-muted);justify-content:center;align-items:center;display:flex}*,:before,:after,::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 #0000;--un-ring-shadow:0 0 #0000;--un-shadow-inset: ;--un-shadow:0 0 #0000;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:#93c5fd80;--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.container{width:100%}@media (width>=640px){.container{max-width:640px}}@media (width>=768px){.container{max-width:768px}}@media (width>=1024px){.container{max-width:1024px}}@media (width>=1280px){.container{max-width:1280px}}@media (width>=1536px){.container{max-width:1536px}}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.grid{display:grid}.inline{display:inline}.block{display:block}.inline-block{display:inline-block}.contents{display:contents}.hidden{display:none}.h1{height:.25rem}.h2{height:.5rem}.h3{height:.75rem}.flex{display:flex}.inline-flex{display:inline-flex}.flex-shrink{flex-shrink:1}.flex-wrap{flex-wrap:wrap}.transform{transform:translateX(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotateZ(var(--un-rotate-z)) skewX(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.break-all{word-break:break-all}.b,.border{border-width:1px}.uppercase{text-transform:uppercase}.tabular-nums{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)}.underline{text-decoration-line:underline}.text-shadow{--un-text-shadow:0 0 1px var(--un-text-shadow-color,#0003),0 0 1px var(--un-text-shadow-color,#0100051a);text-shadow:var(--un-text-shadow)}.outline{outline-style:solid}.backdrop-filter{-webkit-backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia);backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease{transition-timing-function:cubic-bezier(.4,0,.2,1)}:root{--hq-bg:#06060a;--hq-surface:#0c0c12;--hq-surface-2:#14141c;--hq-border:#22222e;--hq-accent:#a833f5;--hq-accent-2:#6523ee;--hq-brand-violet:#6523ee;--hq-brand-purple:#a833f5;--hq-correct:#4ade80;--hq-wrong:#ff4d6d;--hq-warn:#ffb020;--hq-text:#f9f8f8;--hq-text-muted:#8a8a9a;--hq-progress:#6b6b7a;--hq-font-display:"Space Grotesk", system-ui, sans-serif;--hq-font-pixel:"Jersey 10", "Space Grotesk", system-ui, sans-serif;--hq-font-mono:"JetBrains Mono", monospace;--hq-radius:0;--hq-radius-sm:0;--hq-figure:var(--hq-text);--hq-pixel:4px;--hq-step-gap:2px;--hq-font-label:"JetBrains Mono", monospace;--hq-label-spacing:.3em;--hq-choice-a:#b65cff;--hq-choice-b:#38bdf8;--hq-choice-c:#ffb020;--hq-choice-d:#2dd4bf;--hq-on-choice:#06060a;--hq-qr-dark:#f9f8f8;--hq-qr-light:#0c0c12;--hq-fx-dot:#fff;--hq-fx-line-opacity:.2;--hq-fx-glow:.35;--hq-fx-dust-density:1;--hq-fx-dust-alpha:1.8;--hq-fx-speed:1;--hq-fx-pixel:1}*,:before,:after{box-sizing:border-box}html,body{background:var(--hq-bg);color:var(--hq-text);font-family:var(--hq-font-display);font-synthesis:none;font-size-adjust:cap-height .7;min-height:100vh;margin:0}button,input,select,textarea{font-size-adjust:inherit}a{color:var(--hq-accent)}.hq-label{font-family:var(--hq-font-label);letter-spacing:var(--hq-label-spacing);text-transform:uppercase;font-weight:500}.hq-sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.hq-pixel{font-family:var(--hq-font-pixel);letter-spacing:.03em}.hq-press{box-shadow:var(--hq-pixel) var(--hq-pixel) 0 var(--hq-accent-2);transition:transform 80ms steps(2,end),box-shadow 80ms steps(2,end),background .15s,border-color .15s}.hq-press:active:not(:disabled){transform:translate(calc(var(--hq-pixel) / 2), calc(var(--hq-pixel) / 2));box-shadow:calc(var(--hq-pixel) / 2) calc(var(--hq-pixel) / 2) 0 var(--hq-accent-2)}.hq-press:disabled{box-shadow:none}.hq-steps{-webkit-mask:repeating-linear-gradient(90deg, black 0 8px, transparent 8px calc(8px + var(--hq-step-gap)));-webkit-mask:repeating-linear-gradient(90deg, black 0 8px, transparent 8px calc(8px + var(--hq-step-gap)));mask:repeating-linear-gradient(90deg, black 0 8px, transparent 8px calc(8px + var(--hq-step-gap)))}@media (prefers-reduced-motion:reduce){.hq-press,.hq-press:active:not(:disabled){transition:none;transform:none}}
|
|
1
|
+
@import "https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Jersey+10&family=JetBrains+Mono:wght@400;500;700&display=swap";.fx-countdown[data-v-80535576]{flex:none;place-items:center;display:grid;position:relative}.fx-countdown--large[data-v-80535576]{width:min(38vmin,32vw);height:min(38vmin,32vw)}.fx-countdown--compact[data-v-80535576]{width:140px;height:140px}.fx-countdown__canvas[data-v-80535576]{width:100%;height:100%;position:absolute;inset:0}.fx-countdown__num[data-v-80535576]{font-family:var(--hq-font-pixel);font-variant-numeric:tabular-nums;color:var(--hq-text);font-weight:500;line-height:1;transition:color .3s;position:relative}.fx-countdown--large .fx-countdown__num[data-v-80535576]{font-size:min(12vmin,10vw)}.fx-countdown--compact .fx-countdown__num[data-v-80535576]{font-size:52px}.fx-countdown--danger .fx-countdown__num[data-v-80535576]{color:var(--hq-wrong)}.hq-logo[data-v-0397f988]{z-index:50;width:auto;height:clamp(1.1rem,2.6vmin,1.9rem);color:var(--hq-text-muted);opacity:.7;pointer-events:none;position:fixed;top:1.5vmin;left:1.5vmin}.hq-logo--center[data-v-0397f988]{height:clamp(2.5rem,8vmin,5.5rem);color:var(--hq-text);opacity:1;pointer-events:auto;margin:0 auto;display:block;position:static}.hq-logo--inline[data-v-0397f988]{height:100%;color:var(--hq-text);opacity:1;display:block;position:static}.hq-logo__hash-back[data-v-0397f988]{fill:var(--hq-brand-violet)}.hq-logo__hash-front[data-v-0397f988]{fill:var(--hq-brand-purple)}.hq-logo__text[data-v-0397f988]{fill:currentColor}.fx-backdrop[data-v-b3f1f5c8]{z-index:0;pointer-events:none;width:100vw;height:100dvh;display:block;position:fixed;inset:0}.fx-lobby[data-v-b52d79da]{pointer-events:none;width:100%;height:100%;position:relative}.fx-lobby__canvas[data-v-b52d79da]{width:100%;height:100%;display:block;position:absolute;inset:0}.fx-podium[data-v-d5e3b296]{pointer-events:none;width:100%;height:100%;position:relative;container-type:size}.fx-podium__canvas[data-v-d5e3b296]{width:100%;height:100%;display:block;position:absolute;inset:0}.fx-podium__label[data-v-d5e3b296]{text-align:center;opacity:0;flex-direction:column;gap:.2em;width:26cqw;transition:opacity .6s;display:flex;position:absolute;top:calc(74% + 2cqh);transform:translate(-50%)}.fx-podium__label--on[data-v-d5e3b296]{opacity:1}.fx-podium__name[data-v-d5e3b296]{font-family:var(--hq-font-display);color:var(--hq-text);text-overflow:ellipsis;white-space:nowrap;font-size:clamp(1rem,4cqh,3.2rem);font-weight:600;overflow:hidden}.fx-podium__label--first .fx-podium__name[data-v-d5e3b296]{font-size:clamp(1.15rem,5cqh,4rem)}.fx-podium__score[data-v-d5e3b296]{color:var(--hq-text-muted);font-size:clamp(.85rem,3cqh,2.4rem)}.fx-podium__label--me .fx-podium__name[data-v-d5e3b296],.fx-podium__label--me .fx-podium__score[data-v-d5e3b296]{color:var(--hq-accent)}.fx-podium__outside[data-v-d5e3b296]{font-family:var(--hq-font-pixel);color:var(--hq-accent);opacity:0;margin:0;font-size:clamp(1.2rem,5cqh,4rem);font-weight:700;transition:opacity .6s;position:absolute;top:5cqh;left:50%;transform:translate(-50%)}.fx-podium__outside--on[data-v-d5e3b296]{opacity:1}.fx-reveal[data-v-f199a57b]{flex-direction:column;width:100%;height:100%;min-height:0;display:flex;position:relative}.fx-reveal__canvas[data-v-f199a57b]{flex:1 1 0;width:100%;min-height:0;display:block}.fx-reveal__labels[data-v-f199a57b]{flex:none;gap:.5vmin;width:60%;margin:0 auto;padding:0;list-style:none;display:grid}.fx-reveal__label[data-v-f199a57b]{text-align:center;opacity:1;flex-direction:column;align-items:center;gap:.2em;min-width:0;transition:opacity .7s;display:flex}.fx-reveal__label--dim[data-v-f199a57b]{opacity:.75}.fx-reveal__letter[data-v-f199a57b]{font-family:var(--hq-font-pixel);font-size:clamp(1.4rem,4.2vmin,3rem);font-weight:600;line-height:1}.fx-reveal__text[data-v-f199a57b]{font-family:var(--hq-font-display);color:var(--hq-text);overflow-wrap:anywhere;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;font-size:clamp(1rem,2.8vmin,2rem);line-height:1.2;display:-webkit-box;overflow:hidden}.fx-reveal__votes[data-v-f199a57b]{color:var(--hq-text-muted);font-variant-numeric:tabular-nums;font-size:clamp(.85rem,2.2vmin,1.5rem)}.fx-reveal__label--ok .fx-reveal__text[data-v-f199a57b],.fx-reveal__check[data-v-f199a57b]{color:var(--hq-correct)}@media (prefers-reduced-motion:reduce){.fx-reveal__label[data-v-f199a57b]{transition:none}}.hq-players[data-v-44834f23]{flex-wrap:wrap;align-items:flex-start;gap:.5rem;min-height:2.5rem;display:flex}.hq-players--end[data-v-44834f23]{text-align:right;justify-content:flex-end}.hq-players__chip[data-v-44834f23]{background:var(--hq-surface-2);border-radius:var(--hq-radius-sm);align-items:center;gap:.45rem;padding:.3rem .65rem;font-size:.9rem;display:flex}.hq-players__avatar[data-v-44834f23]{background:var(--hq-accent);width:1.5rem;height:1.5rem;color:var(--hq-text);border-radius:var(--hq-radius-sm);font-family:var(--hq-font-pixel);flex-shrink:0;justify-content:center;align-items:center;font-size:.75rem;font-weight:700;display:flex}.hq-players__empty[data-v-44834f23]{color:var(--hq-text-muted);font-size:.9rem}.hq-podium[data-v-8d79b015]{flex-direction:column;gap:.5rem;margin:0;padding:0;list-style:none;display:flex}.hq-podium__row[data-v-8d79b015]{border-radius:var(--hq-radius-sm);background:var(--hq-surface);border:1px solid #0000;align-items:center;gap:.9rem;padding:.75rem 1rem;display:flex}.hq-podium__row--top1[data-v-8d79b015]{box-shadow:var(--hq-pixel) var(--hq-pixel) 0 var(--hq-accent-2);border-color:var(--hq-warn);background:color-mix(in srgb, var(--hq-warn) 10%, var(--hq-surface))}.hq-podium__row--top2[data-v-8d79b015]{border-color:var(--hq-text-muted);background:color-mix(in srgb, var(--hq-text-muted) 8%, var(--hq-surface))}.hq-podium__row--top3[data-v-8d79b015]{border-color:var(--hq-choice-c);background:color-mix(in srgb, var(--hq-choice-c) 8%, var(--hq-surface))}.hq-podium__rank[data-v-8d79b015]{min-width:2.2rem;font-size:1.3rem}.hq-podium__name[data-v-8d79b015]{flex:1;font-weight:600}.hq-podium__score[data-v-8d79b015]{font-family:var(--hq-font-pixel);color:var(--hq-figure);font-weight:700}.hq-qr[data-v-7ecbb7cc]{border-radius:var(--hq-radius-sm);display:block}.diff-bar__track[data-v-a3903778]{border-radius:var(--hq-radius-sm);background:var(--hq-border);height:8px;display:flex;overflow:hidden}.diff-bar__seg[data-v-a3903778]{height:100%;transition:width .4s}.diff-bar__seg--easy[data-v-a3903778]{background:var(--hq-correct)}.diff-bar__seg--medium[data-v-a3903778]{background:var(--hq-warn)}.diff-bar__seg--hard[data-v-a3903778]{background:var(--hq-wrong)}.diff-bar__legend[data-v-a3903778]{color:var(--hq-text-muted);align-items:center;gap:.5rem;margin:.4rem 0 0;font-size:.875rem;display:flex}.diff-bar__dot[data-v-a3903778]{border-radius:var(--hq-radius-sm);width:8px;height:8px;display:inline-block}.diff-bar__dot--easy[data-v-a3903778]{background:var(--hq-correct)}.diff-bar__dot--medium[data-v-a3903778]{background:var(--hq-warn)}.diff-bar__dot--hard[data-v-a3903778]{background:var(--hq-wrong)}.qip[data-v-549d1637]{background:color-mix(in srgb, var(--hq-surface) 82%, transparent);border:1px solid var(--hq-border);border-radius:var(--hq-radius);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);flex-direction:column;gap:1rem;min-width:0;padding:1.25rem;display:flex}.qip--compact[data-v-549d1637]{gap:.75rem;padding:1rem}.qip--compact .qip__title[data-v-549d1637]{overflow-wrap:anywhere;font-size:1.5rem}.qip--compact .qip__description[data-v-549d1637]{-webkit-line-clamp:4;line-clamp:4;-webkit-box-orient:vertical;font-size:1rem;display:-webkit-box;overflow:hidden}.qip--compact .qip__badge[data-v-549d1637]{font-size:.75rem}.qip--compact .qip__metrics[data-v-549d1637]{gap:.5rem}.qip--compact .qip__metric[data-v-549d1637]{flex:1 1 0;min-width:0;padding:.4rem .5rem}.qip--compact .qip__metric strong[data-v-549d1637]{font-size:1.4rem}.qip--compact .qip__metric strong small[data-v-549d1637]{color:var(--hq-text-muted);font-size:.6em}.qip__metric span[data-v-549d1637],.qip--compact .qip__tag[data-v-549d1637]{font-size:.75rem}.qip__labels[data-v-549d1637]{flex-wrap:wrap;align-items:center;gap:.6rem;display:flex}.qip__label[data-v-549d1637]{font-family:var(--hq-font-label);letter-spacing:.1em;text-transform:uppercase;border:1px solid var(--hq-border);border-radius:var(--hq-radius-sm);color:var(--hq-text-muted);padding:.25rem .7rem;font-size:.875rem;font-weight:700}.qip--compact .qip__label[data-v-549d1637]{font-size:.75rem}.qip__badge[data-v-549d1637]{background:var(--hq-accent);box-shadow:calc(var(--hq-pixel) * .75) calc(var(--hq-pixel) * .75) 0 var(--hq-accent-2);color:var(--hq-text);font-family:var(--hq-font-label);letter-spacing:.1em;text-transform:uppercase;border-radius:var(--hq-radius-sm);padding:.3rem .75rem;font-size:.875rem;font-weight:700;display:inline-block}.qip__header[data-v-549d1637]{justify-content:space-between;align-items:flex-start;gap:.75rem;display:flex}.qip__title[data-v-549d1637]{font-family:var(--hq-font-pixel);color:var(--hq-text);margin:0;font-size:3rem;font-weight:700}.qip__content[data-v-549d1637]{flex-direction:column;gap:0;display:flex}.qip__tags[data-v-549d1637]{flex-wrap:wrap;gap:.35rem;margin-bottom:.5rem;display:flex}.qip__tag[data-v-549d1637]{background:var(--hq-surface);border:1px solid var(--hq-border);border-radius:var(--hq-radius-sm);color:var(--hq-text-muted);padding:.2rem .55rem;font-size:.875rem}.qip__description[data-v-549d1637]{color:var(--hq-text-muted);margin:0;font-size:1.25rem;line-height:1.5}.qip__target-badge[data-v-549d1637]{border-radius:var(--hq-radius-sm);letter-spacing:.05em;flex-shrink:0;padding:.3rem .75rem;font-size:.75rem;font-weight:700}.qip__target-badge--easy[data-v-549d1637]{background:color-mix(in srgb, var(--hq-correct) 15%, transparent);color:var(--hq-correct)}.qip__target-badge--medium[data-v-549d1637]{background:color-mix(in srgb, var(--hq-warn) 15%, transparent);color:var(--hq-warn)}.qip__target-badge--hard[data-v-549d1637]{background:color-mix(in srgb, var(--hq-wrong) 15%, transparent);color:var(--hq-wrong)}.qip__metrics[data-v-549d1637]{justify-content:center;gap:1rem;display:flex}.qip__metric[data-v-549d1637]{background:var(--hq-surface);border:1px solid var(--hq-border);border-radius:var(--hq-radius-sm);flex-direction:column;align-items:center;min-width:70px;padding:.5rem 1rem;display:flex}.qip__metric strong[data-v-549d1637]{font-family:var(--hq-font-pixel);color:var(--hq-figure);font-size:2rem;font-weight:700;line-height:1}.qip__metric span[data-v-549d1637]{color:var(--hq-text-muted);margin-top:.15rem;font-size:.875rem}.deck-card[data-v-d8b5fdc0]{flex-direction:column;gap:.6vmin;min-width:0;display:flex}.deck-card__btn[data-v-d8b5fdc0]{text-align:left;min-width:0;font:inherit;color:inherit;border-radius:var(--hq-radius);cursor:pointer;background:0 0;border:none;flex:1;padding:0}.deck-card__btn[data-v-d8b5fdc0] .qip{height:100%;transition:border-color .15s,transform .12s steps(2,end),box-shadow .12s steps(2,end)}.deck-card__btn[data-v-d8b5fdc0]:hover .qip{border-color:var(--hq-accent);transform:translate(calc(var(--hq-pixel) * -1), calc(var(--hq-pixel) * -1));box-shadow:var(--hq-pixel) var(--hq-pixel) 0 var(--hq-accent-2)}.deck-card__btn[data-v-d8b5fdc0]:focus-visible{outline:2px solid var(--hq-accent);outline-offset:3px}.deck-card__solo[data-v-d8b5fdc0]{color:var(--hq-accent);border-radius:var(--hq-radius-sm);align-self:flex-end;padding:.25rem .7rem;font-size:clamp(.85rem,1.8vmin,1.2rem);text-decoration:none}.deck-card__solo[data-v-d8b5fdc0]:hover{text-decoration:underline}.deck-card__solo[data-v-d8b5fdc0]:focus-visible{outline:2px solid var(--hq-accent);outline-offset:2px}@media (prefers-reduced-motion:reduce){.deck-card__btn[data-v-d8b5fdc0]:hover .qip{transform:none}}.decks[data-v-f56e7f07]{height:100%;overflow-y:auto}.decks__inner[data-v-f56e7f07]{flex-direction:column;gap:3vmin;max-width:84rem;margin:0 auto;padding:4vmin 4vmin 6vmin;display:flex}.decks__title[data-v-f56e7f07]{text-align:center;margin:0;font-size:clamp(1.4rem,3.4vmin,2.4rem)}.decks__hash[data-v-f56e7f07]{color:var(--hq-accent);margin-right:.1em}.decks__back[data-v-f56e7f07]{color:var(--hq-text-muted);align-self:flex-start;font-size:clamp(.9rem,1.8vmin,1.2rem);text-decoration:none}.decks__back[data-v-f56e7f07]:hover,.decks__back[data-v-f56e7f07]:focus-visible{color:var(--hq-text);text-decoration:underline}.decks__grid[data-v-f56e7f07]{grid-template-columns:repeat(auto-fill,minmax(min(100%,22rem),1fr));gap:2vmin;margin:0;padding:0;list-style:none;display:grid}.decks__empty[data-v-f56e7f07]{text-align:center;color:var(--hq-text-muted)}.decks__heading[data-v-f56e7f07]{color:var(--hq-text-muted);margin:0 0 1.2vmin;font-size:clamp(.8rem,1.6vmin,1.1rem)}.decks__taglist[data-v-f56e7f07]{flex-wrap:wrap;gap:1vmin;margin:0;padding:0;list-style:none;display:flex}.decks__tag[data-v-f56e7f07]{background:color-mix(in srgb, var(--hq-surface) 82%, transparent);border:1px solid var(--hq-border);border-radius:var(--hq-radius-sm);color:var(--hq-text);align-items:center;gap:.5rem;padding:.35rem .8rem;font-size:clamp(.85rem,1.8vmin,1.2rem);text-decoration:none;display:inline-flex}.decks__tag[data-v-f56e7f07]:hover{border-color:var(--hq-accent)}.decks__tag[data-v-f56e7f07]:focus-visible{outline:2px solid var(--hq-accent);outline-offset:2px}.decks__tag-count[data-v-f56e7f07]{color:var(--hq-text-muted);font-size:.85em}.lobby[data-v-7fe37d38]{grid-template-columns:minmax(0,1fr) minmax(0,min(48rem,56vw)) minmax(0,1fr);height:100%;display:grid;position:relative;overflow:hidden}.lobby__side[data-v-7fe37d38]{flex-direction:column;gap:2vmin;min-height:0;padding:3vmin;display:flex;position:relative}.lobby__groups[data-v-7fe37d38]{flex:1 1 0;gap:1vmin;min-height:0;display:grid}.lobby__groups .lobby__fx[data-v-7fe37d38]{min-width:0;min-height:0}.lobby__players[data-v-7fe37d38]{flex:0 auto;max-height:34%;padding:1.2vmin;overflow:auto}.lobby__side[data-v-7fe37d38] .hq-players{gap:.4rem}.lobby__side[data-v-7fe37d38] .hq-players__chip{padding:.2rem .5rem;font-size:clamp(.7rem,1.6vmin,1rem)}.lobby__col[data-v-7fe37d38]{scroll-snap-type:y proximity;scrollbar-width:none;min-height:0;overflow-y:auto}.lobby__col[data-v-7fe37d38]::-webkit-scrollbar{display:none}.lobby__section[data-v-7fe37d38]{scroll-snap-align:start;flex-direction:column;justify-content:center;align-items:center;gap:3vmin;min-height:100%;padding:4vmin 1vmin;display:flex}.lobby__section--card[data-v-7fe37d38]{justify-content:center;align-items:center}.lobby__section--join[data-v-7fe37d38]{gap:2vmin}.lobby__join[data-v-7fe37d38],.lobby__start[data-v-7fe37d38]{flex-direction:column;align-items:center;gap:1.2vmin;display:flex}.lobby__bare[data-v-7fe37d38]{text-shadow:0 0 1vmin var(--hq-bg), 0 0 2vmin var(--hq-bg)}.lobby .quiz-info[data-v-7fe37d38]{flex:none;gap:2vmin;width:100%;padding:3vmin}.quiz-info[data-v-7fe37d38] .qip__title{font-size:clamp(1.75rem,5vmin,3.5rem)}.quiz-info[data-v-7fe37d38] .qip__description{font-size:clamp(1rem,2.4vmin,1.5rem)}.quiz-info[data-v-7fe37d38] .qip__metric strong{font-size:clamp(1.25rem,3.4vmin,2.2rem)}.lobby__link[data-v-7fe37d38]{color:var(--hq-accent);word-break:break-all;text-align:center;font-size:clamp(1rem,2.6vmin,1.8rem)}.lobby__link[data-v-7fe37d38]:hover{text-decoration:underline}.lobby__code-box[data-v-7fe37d38]{text-align:center}.lobby__code-label[data-v-7fe37d38]{color:var(--hq-text-muted);margin:0;font-size:clamp(.75rem,1.8vmin,1.1rem)}.lobby__code[data-v-7fe37d38]{letter-spacing:.16em;color:var(--hq-figure);margin:.6vmin 0 0;font-size:clamp(2.5rem,8vmin,5.5rem);line-height:1.1}.lobby__qr[data-v-7fe37d38]{justify-content:center;width:100%;display:flex}.lobby__qr[data-v-7fe37d38] .hq-qr{aspect-ratio:1;image-rendering:pixelated;width:min(100%,34vh)!important;height:auto!important}.lobby__count[data-v-7fe37d38]{transform-origin:50% 70%;flex-direction:column;align-items:center;gap:.6vmin;transition:transform .45s cubic-bezier(.2,.9,.3,1);display:flex}.lobby__count--pop[data-v-7fe37d38]{transition-duration:.12s;transform:scale(1.25)}.lobby__count-num[data-v-7fe37d38]{font-family:var(--hq-font-pixel);font-variant-numeric:tabular-nums;color:var(--hq-text);text-shadow:0 0 1.5vmin var(--hq-bg), 0 0 3vmin var(--hq-bg);font-size:clamp(3rem,10vmin,7rem);font-weight:500;line-height:1}.lobby__count-label[data-v-7fe37d38]{color:var(--hq-text-muted);font-size:clamp(.75rem,1.8vmin,1.2rem)}@media (prefers-reduced-motion:reduce){.lobby__count[data-v-7fe37d38],.lobby__count--pop[data-v-7fe37d38]{transition:none;transform:none}.lobby__col[data-v-7fe37d38]{scroll-behavior:auto}}.hq-btn-primary[data-v-7fe37d38]{background:var(--hq-accent);width:min(100%,28rem);color:var(--hq-text);border-radius:var(--hq-radius);cursor:pointer;font-size:clamp(1rem,2.4vmin,1.6rem);font-family:var(--hq-font-pixel);border:none;padding:1.6vmin 2vmin;font-weight:700}.hq-btn-primary[data-v-7fe37d38]:hover:not(:disabled){background:color-mix(in srgb, var(--hq-accent) 80%, var(--hq-bg))}.hq-btn-primary[data-v-7fe37d38]:disabled{opacity:.4;cursor:not-allowed}.hq-btn-primary[data-v-7fe37d38]:focus-visible{outline:2px solid var(--hq-text);outline-offset:3px}.question-view[data-v-a18eb71b]{grid-template-rows:auto minmax(0,1fr) auto;gap:2.5vmin;height:100%;padding:3vmin 4vmin;display:grid;overflow:hidden}.hq-progress[data-v-a18eb71b]{align-items:center;gap:.6rem;padding-right:12rem;display:flex}.hq-progress__label[data-v-a18eb71b]{color:var(--hq-text-muted);min-width:2rem;font-size:clamp(.8rem,1.6vmin,1.1rem)}.hq-progress__label[data-v-a18eb71b]:last-child{text-align:right}.hq-progress__track[data-v-a18eb71b]{background:var(--hq-border);border-radius:var(--hq-radius-sm);flex:1;height:6px;overflow:hidden}.hq-progress__fill[data-v-a18eb71b]{background:var(--hq-progress);height:100%;transition:width .3s}.hq-main[data-v-a18eb71b]{grid-template-columns:auto minmax(0,1fr);align-items:center;gap:5vmin;min-height:0;display:grid}.hq-header[data-v-a18eb71b]{justify-content:center;align-items:center;display:flex}.hq-body[data-v-a18eb71b]{flex-direction:column;min-height:0;max-height:100%;display:flex}.hq-q-meta[data-v-a18eb71b]{justify-content:space-between;align-items:center;margin-bottom:1.5vmin;display:flex}.hq-q-meta__tags[data-v-a18eb71b]{flex-wrap:wrap;gap:.4rem;display:flex}.hq-q-meta__tag[data-v-a18eb71b]{background:var(--hq-bg);border:1px solid var(--hq-border);border-radius:var(--hq-radius-sm);color:var(--hq-text-muted);padding:.15rem .5rem;font-size:clamp(.75rem,1.5vmin,1rem)}.hq-difficulty[data-v-a18eb71b]{flex-shrink:0;align-items:center;gap:3px;display:flex}.hq-difficulty__dot[data-v-a18eb71b]{border-radius:var(--hq-radius-sm);background:0 0;border:1.5px solid;width:8px;height:8px}.hq-difficulty--easy[data-v-a18eb71b]{color:var(--hq-correct)}.hq-difficulty--medium[data-v-a18eb71b]{color:var(--hq-warn)}.hq-difficulty--hard[data-v-a18eb71b]{color:var(--hq-wrong)}.hq-difficulty--easy .hq-difficulty__dot--1[data-v-a18eb71b],.hq-difficulty--medium .hq-difficulty__dot--1[data-v-a18eb71b],.hq-difficulty--medium .hq-difficulty__dot--2[data-v-a18eb71b],.hq-difficulty--hard .hq-difficulty__dot[data-v-a18eb71b]{background:currentColor}.hq-question-text[data-v-a18eb71b]{margin:0 0 3vmin;font-size:clamp(1.4rem,4.6vmin,3.4rem);line-height:1.25}.hq-choices-grid[data-v-a18eb71b]{grid-template-columns:1fr 1fr;gap:2vmin;font-size:clamp(1rem,3vmin,2.2rem);display:grid}.hq-choice-card[data-v-a18eb71b]{border-radius:var(--hq-radius);background:var(--hq-surface-2);align-items:center;gap:.75em;padding:2vmin 2.4vmin;line-height:1.25;display:flex}.hq-choice-card--a[data-v-a18eb71b]{border-left:6px solid var(--hq-choice-a)}.hq-choice-card--b[data-v-a18eb71b]{border-left:6px solid var(--hq-choice-b)}.hq-choice-card--c[data-v-a18eb71b]{border-left:6px solid var(--hq-choice-c)}.hq-choice-card--d[data-v-a18eb71b]{border-left:6px solid var(--hq-choice-d)}.hq-choice-card__id[data-v-a18eb71b]{font-family:var(--hq-font-pixel);min-width:1.5em;font-weight:700}.hq-controls[data-v-a18eb71b]{justify-content:center;align-items:center;gap:3vmin;display:flex}.hq-controls__answered[data-v-a18eb71b]{color:var(--hq-text-muted);margin:0;font-size:clamp(.9rem,2.2vmin,1.5rem)}.hq-btn-action[data-v-a18eb71b]{background:var(--hq-surface-2);color:var(--hq-text);border:1px solid var(--hq-border);border-radius:var(--hq-radius);cursor:pointer;font-size:clamp(1rem,2.2vmin,1.5rem);font-family:var(--hq-font-pixel);padding:1.4vmin 2.6vmin;font-weight:700}.hq-btn-action[data-v-a18eb71b]:hover{background:var(--hq-surface)}.reveal-view[data-v-91f02780]{grid-template-rows:auto auto minmax(0,1fr) auto;gap:2.5vmin;height:100%;padding:3vmin 4vmin;display:grid;overflow:hidden}.rv-main[data-v-91f02780]{grid-template-rows:auto minmax(0,1fr);grid-template-columns:minmax(0,1.6fr) minmax(0,1fr);gap:2.5vmin 4vmin;min-height:0;display:grid}.rv-left[data-v-91f02780]{display:contents}.rv-fx[data-v-91f02780]{grid-area:2/1/auto/-1;min-height:0}.rv-progress[data-v-91f02780]{align-items:center;gap:.6rem;padding-right:12rem;display:flex}.rv-progress__label[data-v-91f02780]{color:var(--hq-text-muted);min-width:2rem;font-size:clamp(.8rem,1.6vmin,1.1rem)}.rv-progress__label[data-v-91f02780]:last-child{text-align:right}.rv-progress__track[data-v-91f02780]{background:var(--hq-border);border-radius:var(--hq-radius-sm);flex:1;height:6px;overflow:hidden}.rv-progress__fill[data-v-91f02780]{background:var(--hq-progress);height:100%}.rv-question[data-v-91f02780]{margin:0;font-size:clamp(1.3rem,3.6vmin,2.6rem);line-height:1.25}.rv-explanation[data-v-91f02780]{background:var(--hq-surface-2);border-left:6px solid var(--hq-correct);border-radius:var(--hq-radius-sm);flex-direction:column;gap:.8vmin;padding:2vmin 2.4vmin;font-size:clamp(.95rem,2.1vmin,1.5rem);display:flex}.rv-correct__label[data-v-91f02780]{color:var(--hq-correct);font-size:.8em;font-weight:700}.rv-correct__choices[data-v-91f02780]{flex-direction:column;gap:.25rem;margin:0 0 .25rem;padding:0;list-style:none;display:flex}.rv-correct__choice[data-v-91f02780]{color:var(--hq-correct);font-weight:600}.rv-explanation__label[data-v-91f02780]{color:var(--hq-text-muted);margin:0;font-size:.75em}.rv-explanation__body[data-v-91f02780]{line-height:1.5}.rv-explanation__body[data-v-91f02780] p{margin:0 0 .5rem}.rv-explanation__body[data-v-91f02780] p:last-child{margin:0}.rv-explanation__body[data-v-91f02780] code{background:var(--hq-surface);border:1px solid var(--hq-border);border-radius:var(--hq-radius-sm);padding:.1rem .35rem;font-size:.9em}.rv-explanation__body[data-v-91f02780] strong{color:var(--hq-text)}.rv-explanation__body[data-v-91f02780] ul,.rv-explanation__body[data-v-91f02780] ol{margin:.25rem 0;padding-left:1.25rem}.rv-scores[data-v-91f02780]{grid-area:1/2;min-height:0;font-size:clamp(.95rem,2.2vmin,1.5rem);overflow:auto}.rv-scores h3[data-v-91f02780]{color:var(--hq-text-muted);margin:0 0 1.2vmin;font-size:1em}.rv-score-row[data-v-91f02780]{border-bottom:1px solid var(--hq-border);align-items:center;gap:.75rem;padding:1vmin 0;display:flex}.rv-score-row span[data-v-91f02780]:first-child{flex:1}.rv-score-delta[data-v-91f02780]{color:var(--hq-correct);font-weight:600}.rv-score-delta--zero[data-v-91f02780]{color:var(--hq-text-muted)}.rv-score-total[data-v-91f02780]{color:var(--hq-text-muted);text-align:right;min-width:4rem;font-size:.85em}.rv-answer-block[data-v-91f02780]{flex:0 auto;grid-area:1/1;min-height:0;max-height:40vh;overflow:auto}.rv-controls[data-v-91f02780]{justify-content:center;display:flex}.hq-btn-action[data-v-91f02780]{background:var(--hq-accent);color:var(--hq-text);border-radius:var(--hq-radius);cursor:pointer;font-size:clamp(1rem,2.2vmin,1.5rem);font-family:var(--hq-font-pixel);border:none;padding:1.4vmin 2.6vmin;font-weight:700}.hq-btn-action[data-v-91f02780]:hover{background:color-mix(in srgb, var(--hq-accent) 80%, var(--hq-bg))}.podium-view[data-v-7252999f]{grid-template-columns:minmax(0,1fr) minmax(18rem,30vw);height:100%;display:grid;overflow:hidden}.podium-view__scene[data-v-7252999f]{min-height:0;position:relative}h1[data-v-7252999f]{z-index:1;text-align:center;margin:0;font-size:clamp(2rem,7vmin,5rem);position:absolute;top:3vmin;left:0;right:0}.podium-view__ranking[data-v-7252999f]{flex-direction:column;justify-content:center;align-items:center;gap:2.4vmin;min-height:0;padding:4vmin 3vmin;display:flex}.podium-view[data-v-7252999f] .hq-podium{flex:0 auto;gap:1.2vmin;width:100%;min-height:0;max-height:100%;font-size:clamp(1rem,2.6vmin,1.8rem);overflow:auto}.podium-view[data-v-7252999f] .hq-podium__row{padding:1.6vmin 2vmin}.podium-view[data-v-7252999f] .hq-podium__rank{min-width:2.2em;font-size:1.3em}.podium-view__actions[data-v-7252999f]{flex:none;gap:2vmin;width:min(100%,28rem);display:flex}.hq-btn-primary[data-v-7252999f]{background:var(--hq-accent);color:var(--hq-text);border:2px solid var(--hq-accent);border-radius:var(--hq-radius);cursor:pointer;font-size:clamp(1rem,2.4vmin,1.6rem);font-family:var(--hq-font-pixel);flex:1 1 0;padding:1.6vmin 2vmin;font-weight:700}.hq-btn-primary[data-v-7252999f]:hover{background:color-mix(in srgb, var(--hq-accent) 80%, var(--hq-bg))}.hq-btn-primary--ghost[data-v-7252999f]{color:var(--hq-accent);background:0 0}.hq-btn-primary--ghost[data-v-7252999f]:hover{background:var(--hq-accent);color:var(--hq-text)}.hq-btn-primary[data-v-7252999f]:focus-visible{outline:2px solid var(--hq-text);outline-offset:3px}.fs-btn[data-v-c2c16456]{z-index:50;color:var(--hq-text-muted);border:1px solid var(--hq-border);border-radius:var(--hq-radius-sm);cursor:pointer;opacity:.7;background:0 0;padding:.6vmin 1.2vmin;font-size:clamp(.65rem,1.1vmin,.9rem);transition:opacity .2s,color .2s;position:fixed;top:1.5vmin;right:1.5vmin}.fs-btn[data-v-c2c16456]:hover,.fs-btn[data-v-c2c16456]:focus-visible{opacity:1;color:var(--hq-text)}.fs-btn[data-v-c2c16456]:focus-visible{outline:2px solid var(--hq-accent);outline-offset:2px}.app{z-index:1;height:100dvh;padding:0;position:relative;overflow:hidden}.connecting{height:100dvh;color:var(--hq-text-muted);justify-content:center;align-items:center;display:flex}*,:before,:after,::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 #0000;--un-ring-shadow:0 0 #0000;--un-shadow-inset: ;--un-shadow:0 0 #0000;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:#93c5fd80;--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.container{width:100%}@media (width>=640px){.container{max-width:640px}}@media (width>=768px){.container{max-width:768px}}@media (width>=1024px){.container{max-width:1024px}}@media (width>=1280px){.container{max-width:1280px}}@media (width>=1536px){.container{max-width:1536px}}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.grid{display:grid}.inline{display:inline}.block{display:block}.inline-block{display:inline-block}.contents{display:contents}.hidden{display:none}.h1{height:.25rem}.h2{height:.5rem}.h3{height:.75rem}.flex{display:flex}.inline-flex{display:inline-flex}.flex-shrink{flex-shrink:1}.flex-wrap{flex-wrap:wrap}.transform{transform:translateX(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotateZ(var(--un-rotate-z)) skewX(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.break-all{word-break:break-all}.b,.border{border-width:1px}.uppercase{text-transform:uppercase}.tabular-nums{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)}.underline{text-decoration-line:underline}.text-shadow{--un-text-shadow:0 0 1px var(--un-text-shadow-color,#0003),0 0 1px var(--un-text-shadow-color,#0100051a);text-shadow:var(--un-text-shadow)}.outline{outline-style:solid}.backdrop-filter{-webkit-backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia);backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease{transition-timing-function:cubic-bezier(.4,0,.2,1)}:root{--hq-bg:#06060a;--hq-surface:#0c0c12;--hq-surface-2:#14141c;--hq-border:#22222e;--hq-accent:#a833f5;--hq-accent-2:#6523ee;--hq-brand-violet:#6523ee;--hq-brand-purple:#a833f5;--hq-correct:#4ade80;--hq-wrong:#ff4d6d;--hq-warn:#ffb020;--hq-text:#f9f8f8;--hq-text-muted:#8a8a9a;--hq-progress:#6b6b7a;--hq-font-display:"Space Grotesk", system-ui, sans-serif;--hq-font-pixel:"Jersey 10", "Space Grotesk", system-ui, sans-serif;--hq-font-mono:"JetBrains Mono", monospace;--hq-radius:0;--hq-radius-sm:0;--hq-figure:var(--hq-text);--hq-pixel:4px;--hq-step-gap:2px;--hq-font-label:"JetBrains Mono", monospace;--hq-label-spacing:.3em;--hq-choice-a:#b65cff;--hq-choice-b:#38bdf8;--hq-choice-c:#ffb020;--hq-choice-d:#2dd4bf;--hq-on-choice:#06060a;--hq-qr-dark:#f9f8f8;--hq-qr-light:#0c0c12;--hq-fx-dot:#fff;--hq-fx-line-opacity:.2;--hq-fx-glow:.35;--hq-fx-dust-density:1;--hq-fx-dust-alpha:1.8;--hq-fx-speed:1;--hq-fx-pixel:1}*,:before,:after{box-sizing:border-box}html,body{background:var(--hq-bg);color:var(--hq-text);font-family:var(--hq-font-display);font-synthesis:none;font-size-adjust:cap-height .7;min-height:100vh;margin:0}button,input,select,textarea{font-size-adjust:inherit}a{color:var(--hq-accent)}.hq-label{font-family:var(--hq-font-label);letter-spacing:var(--hq-label-spacing);text-transform:uppercase;font-weight:500}.hq-sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.hq-pixel{font-family:var(--hq-font-pixel);letter-spacing:.03em}.hq-press{box-shadow:var(--hq-pixel) var(--hq-pixel) 0 var(--hq-accent-2);transition:transform 80ms steps(2,end),box-shadow 80ms steps(2,end),background .15s,border-color .15s}.hq-press:active:not(:disabled){transform:translate(calc(var(--hq-pixel) / 2), calc(var(--hq-pixel) / 2));box-shadow:calc(var(--hq-pixel) / 2) calc(var(--hq-pixel) / 2) 0 var(--hq-accent-2)}.hq-press:disabled{box-shadow:none}.hq-steps{-webkit-mask:repeating-linear-gradient(90deg, black 0 8px, transparent 8px calc(8px + var(--hq-step-gap)));-webkit-mask:repeating-linear-gradient(90deg, black 0 8px, transparent 8px calc(8px + var(--hq-step-gap)));mask:repeating-linear-gradient(90deg, black 0 8px, transparent 8px calc(8px + var(--hq-step-gap)))}@media (prefers-reduced-motion:reduce){.hq-press,.hq-press:active:not(:disabled){transition:none;transform:none}}
|
package/web/host/index.html
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
<meta name="theme-color" content="#130A42">
|
|
12
12
|
<!-- The host dashboard is a tool, never a search result -->
|
|
13
13
|
<meta name="robots" content="noindex, nofollow">
|
|
14
|
-
<script type="module" crossorigin src="/host/assets/index-
|
|
15
|
-
<link rel="stylesheet" crossorigin href="/host/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/host/assets/index-B_dXXjPe.js"></script>
|
|
15
|
+
<link rel="stylesheet" crossorigin href="/host/assets/index-DlgQjMRR.css">
|
|
16
16
|
</head>
|
|
17
17
|
<body>
|
|
18
18
|
<div id="app"></div>
|