/*! pour report screen | MIT | https://pour.dev */ // scripts/report/serve.mjs import fs from "node:fs"; import http from "node:http"; import path2 from "node:path"; // src/engine/lib/dom.js var NEVER_RENDERED = /* @__PURE__ */ new Set(["SCRIPT", "TEMPLATE", "STYLE", "LINK", "META"]); function collectRoots(context) { const roots = context.shadowRoot ? [context, context.shadowRoot] : [context]; for (let i = 0; i < roots.length; i++) { if (!roots[i].querySelectorAll) continue; for (const el of roots[i].querySelectorAll("*")) { if (el.shadowRoot) roots.push(el.shadowRoot); } } return roots; } function flatTreeParent(node) { return node.assignedSlot ?? node.parentElement ?? node.getRootNode()?.host ?? null; } function flatDescendants(element) { const found = []; const seen2 = /* @__PURE__ */ new Set(); const visit = (scope) => { for (const el of scope.querySelectorAll("*")) { if (seen2.has(el)) continue; seen2.add(el); found.push(el); if (el.shadowRoot) visit(el.shadowRoot); if (el.tagName === "SLOT") { for (const assigned of el.assignedElements({ flatten: true })) { if (!seen2.has(assigned)) { seen2.add(assigned); found.push(assigned); } visit(assigned); } } } }; if (element.shadowRoot) visit(element.shadowRoot); visit(element); return found; } function outOfSequentialFocus(element, within = null) { const negative = (el) => el.hasAttribute("tabindex") && el.tabIndex < 0; if (negative(element)) return true; for (let node = flatTreeParent(element); node && node !== within; node = flatTreeParent(node)) { if (node.shadowRoot && negative(node)) return true; } return false; } function isRendered(element) { if (typeof element.checkVisibility === "function") { return element.checkVisibility({ visibilityProperty: true }); } const style = getComputedStyle(element); return style.display !== "none" && style.visibility !== "hidden"; } var attributesGetter = typeof Element !== "undefined" ? Object.getOwnPropertyDescriptor(Element.prototype, "attributes")?.get : null; function attributesOf(element) { const own = element.attributes; if (own && typeof own.length === "number" && typeof own.item === "function") return own; return attributesGetter ? attributesGetter.call(element) : []; } var childrenGetter = typeof Element !== "undefined" ? Object.getOwnPropertyDescriptor(Element.prototype, "children")?.get : null; function childrenOf(element) { return childrenGetter ? childrenGetter.call(element) : element.children; } var nodeContains = typeof Node !== "undefined" ? Node.prototype.contains : null; function containsNode(ancestor, node) { return nodeContains ? nodeContains.call(ancestor, node) : ancestor.contains(node); } function isEmbeddedDocument(doc) { const win = doc?.defaultView; return !!(win && win.top && win !== win.top); } function isInert(element) { for (let node = element; node; node = flatTreeParent(node)) { if (node.nodeType === 1 && node.hasAttribute("inert")) return true; } return false; } // src/engine/rules/wcag/2.4.2-document-title.js var PLACEHOLDER = /* @__PURE__ */ new Set([ "untitled document", "untitled page", "untitled-1", "untitled 1", "no title", "insert title here", "title here", "page title", "document title", "web page", "webpage" ]); var UNDESCRIPTIVE = /* @__PURE__ */ new Set([ "untitled", "document", "page", "title", "default", "index", "new document", "new page", "new tab", "react app", "create react app", "vite app", "vite + react", "vite + vue", "vite + svelte", "next app", "create next app", "vue app", "nuxt app", "svelte app", "angular app", "my app", "my site", "my website", "site title", "your site title", "example domain", "hello world" ]); var document_title_default = { id: "document-title", name: "Page title", impact: "serious", tags: ["wcag2a", "wcag242"], help: "The page must have a title that describes its topic or purpose", helpUrl: "https://www.w3.org/WAI/WCAG22/Understanding/page-titled.html", selector: "html", visibleOnly: false, evaluate(element) { if (isEmbeddedDocument(element.ownerDocument)) return { status: "pass" }; const title = element.ownerDocument.title.trim(); if (!title) { return { status: "fail", message: "The page has no title, so users of screen readers and browser tabs cannot tell what it is.", fix: "Add